(in-package :examples) (use-package :oli) (sd-defdialog 'Teilemasse-anzeigen :toolbox-button T ; oder nil.. das ist geschmacksache. ;-) :dialog-control :sequential :variables '( (the-part :value-type :part :prompt-text (sd-multi-lang-string "Specify the part to get the measurement of." :german "Teil selektieren um die Fertigmasse anzuzeigen") :modifies nil ) ) ;; end variables :ok-action '(let (the-box z-dir x-dir ausgangs-punkt end-punkt fertig-masse Laenge Breite Hoehe ) (setf z-dir 0,0,1) (setf x-dir 1,0,0) (setf the-box (sd-inq-exact-box the-part z-dir x-dir :source-space :local :dest-space :local)) (setf ausgangs-punkt (nth 0 the-box)) (setf end-punkt (nth 1 the-box)) (setf fertig-masse (sd-vec-subtract end-punkt ausgangs-punkt)) ;; fertig masse ist ein 3D vector, den zerlegt man wie folgt: (setf Laenge (gpnt3d_x fertig-masse)) (setf Breite (gpnt3d_y fertig-masse)) (setf Hoehe (gpnt3d_z fertig-masse)) (setq VOLUMEN (sd-call-cmds (get_vol_prop :for_part :part_asmb (sd-inq-obj-pathname the-part) :volume) :failure nil );sd-call-cmds );;setq volume ;; nun gibt es mehrere alternativen (display (format nil " ~%~%Aussenabmasse: ~A" (sd-inq-obj-pathname the-part))) #| (display (format nil "Version A Fertigmass: ~ax~ax~a" Laenge Breite Hoehe)) (display (format nil "Version B Fertigmass: ~Fx~Fx~F" Laenge Breite Hoehe)) (display (format nil "Version C Fertigmass: ~8,3Fx~8,3Fx~8,3F" Laenge Breite Hoehe)) (display (format nil "Version D Fertigmass: ~Ax~Ax~A mm^3" (sd-num-to-string Laenge 2) (sd-num-to-string Breite 2) (sd-num-to-string Hoehe 2))) (display (format nil "Fertigmass: ~Ax~Ax~A ~A^3" (sd-num-to-string (sd-sys-to-user-units :length Laenge)) (sd-num-to-string (sd-sys-to-user-units :length Breite)) (sd-num-to-string (sd-sys-to-user-units :length Hoehe )) (sd-inq-length-units))) |# (display (format nil " ~A x ~A x ~A in mm" (sd-num-to-string Laenge 2) (sd-num-to-string Breite 2) (sd-num-to-string Hoehe 2))) (setq aufmass 5) (setq zuschnitt (max (* (+ Laenge aufmass aufmass) (+ Breite aufmass aufmass) 0.000001) (* (+ Laenge aufmass aufmass) (+ Hoehe aufmass aufmass) 0.000001) (* (+ Hoehe aufmass aufmass) (+ Breite aufmass aufmass) 0.000001))) (display (format nil " Materialbedarf mit ~Amm Aufmass:" (sd-num-to-string aufmass 2))) (display (format nil " ~,6Fm^2 " zuschnitt)) (display (format nil " Volumen = ~,3Fmm^3 " VOLUMEN)) (display (format nil " Dichte = ~,3Fkg/dm^3 bzw. t/m^3" (* (sd-inq-part-density the-part) 1000))) (setq masse (* Volumen (sd-inq-part-density the-part) 0.001)) (display (format nil " Masse = ~,3Fkg" masse)) ) ;; end let / ok-action ) ;; end dialog