(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)) ;; 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 " (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) (+ Breite aufmass) 0.000000001) (* (+ Laenge aufmass) (+ Hoehe aufmass) 0.000000001) (* (+ Hoehe aufmass) (+ Breite aufmass) 0.000000001))) (display (format nil " Materialbedarf mit ~Amm Aufmass:" (sd-num-to-string aufmass 2))) (display (format nil " ~Aqm " (sd-num-to-string zuschnitt 6))) ) ;; end let / ok-action ) ;; end dialog