(in-package :custom) (use-package :oli) (sd-defdialog 'tp_bauteile_ausmessen_dia :dialog-title "Bauteile ausmessen" :dialog-type :terminate :taskBarPage nil :embedded-ui nil ;; default = t :toolbox-button t :after-initialization '(progn (setq tp_box_feedback nil) );;ende progn :variables '( (tp_bauteile :selection (*sd-part-seltype*) :multiple-items t :edge-part-allowed nil :title "Bauteile" :after-input (progn (if (and tp_bauteile tp_richtung1 tp_richtung2) (progn (if (sd-vec-dir-equal-p (first tp_richtung1) (first tp_richtung2)) (progn (display "Länge und Breite müßen sich unterscheiden") (setq tp_richtung1 nil) (setq tp_richtung2 nil) ) (progn (tp-die-box) ));;ende if ));;ende if );;ende progn ) (tp_richtung1 :initial-visible t :initial-enable t :value-type :measure-direction :title "Länge" :prompt-text "Richtung" :after-input (progn (if (and tp_bauteile tp_richtung1 tp_richtung2) (progn (if (sd-vec-dir-equal-p (first tp_richtung1) (first tp_richtung2)) (progn (display "Länge muß eine Andere sein wie die Länge") (setq tp_richtung1 nil) ) (progn (tp-die-box) ));;ende if ));;ende if );;ende progn ) (tp_richtung2 :initial-visible t :initial-enable t :value-type :measure-direction :title "Breite" :prompt-text "Richtung" :after-input (progn (if (and tp_bauteile tp_richtung1 tp_richtung2) (progn (if (sd-vec-dir-equal-p (first tp_richtung1) (first tp_richtung2)) (progn (display "Breite muß eine Andere sein wie die Länge") (setq tp_richtung2 nil) ) (progn (tp-die-box) ));;ende if ));;ende if );;ende progn ) ("Abmessungen") (tp_laenge :title "Länge" :initial-visible t :value-type :length :initial-value 0 ) (tp_breite :title "Breite" :initial-visible t :value-type :length :initial-value 0 ) (tp_hoehe :title "Höhe" :initial-visible t :value-type :length :initial-value 0 ) (tp_gewicht :title "Gewicht (kg)" :initial-visible t :value-type :string :initial-value "0" ) );;ende variablen :cleanup-action '(progn (if tp_box_feedback (sd-end-feedback tp_box_feedback)) );;ende progn :local-functions '( ;;============================================================================================================================================================================================================================== (tp-die-box () (sd-call-cmds (units 1.0 :G)) (setq tp_gewicht (sd-num-to-string (/ (sd-call-cmds(get_vol_prop :for_part :part tp_bauteile :select_done :mass)) 1000) 2)) (if tp_box_feedback (sd-end-feedback tp_box_feedback)) (setq tp_dir1 (first tp_richtung1)) (setq tp_dir2 (first tp_richtung2)) (setq tp_point_x_list1 '()) (setq tp_point_x_list2 '()) (setq tp_point_y_list1 '()) (setq tp_point_y_list2 '()) (setq tp_point_z_list1 '()) (setq tp_point_z_list2 '()) (loop for x from 0 to (- (length tp_bauteile) 1) do (progn (setq the-box (sd-inq-exact-box (nth x tp_bauteile) tp_dir1 tp_dir2 :source-space :global :dest-space :global)) (setq tp_pnt0_1x (gpnt3d_x (nth 0 the-box))) (setq tp_pnt0_1y (gpnt3d_y (nth 0 the-box))) (setq tp_pnt0_1z (gpnt3d_z (nth 0 the-box))) (setq tp_pnt1_1x (gpnt3d_x (nth 1 the-box))) (setq tp_pnt1_1y (gpnt3d_y (nth 1 the-box))) (setq tp_pnt1_1z (gpnt3d_z (nth 1 the-box))) (push tp_pnt0_1x tp_point_x_list1) (push tp_pnt1_1x tp_point_x_list1) (push tp_pnt0_1y tp_point_y_list1) (push tp_pnt1_1y tp_point_y_list1) (push tp_pnt0_1z tp_point_z_list1) (push tp_pnt1_1z tp_point_z_list1) ));;ende loop (setq tp_point_x_list1 (stable-sort tp_point_x_list1 #'<)) (setq tp_point_y_list1 (stable-sort tp_point_y_list1 #'<)) (setq tp_point_z_list1 (stable-sort tp_point_z_list1 #'<)) (setq tp_point1 (make-gpnt3d :x (nth 0 tp_point_x_list1) :y (nth 0 tp_point_y_list1) :z (nth 0 tp_point_z_list1) )) (setq tp_point2 (make-gpnt3d :x (nth (-(length tp_point_x_list1)1) tp_point_x_list1) :y (nth (-(length tp_point_y_list1)1) tp_point_y_list1) :z (nth (-(length tp_point_z_list1)1) tp_point_z_list1) )) (setq the-box '()) (push tp_point2 the-box) (push tp_point1 the-box) (setq tp_hoehe (round(sd-call-cmds (measure_dist :between_points (nth 3 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)) (nth 0 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)))))) (setq tp_breite (round(sd-call-cmds (measure_dist :between_points (nth 1 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)) (nth 0 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)))))) (setq tp_laenge (round(sd-call-cmds (measure_dist :between_points (nth 4 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)) (nth 0 (sd-box-points (nth 1 the-box) (nth 0 the-box) tp_dir1 tp_dir2)))))) (setq tp_box_feedback (sd-start-box-feedback (sd-box-points (first the-box) (second the-box) tp_dir1 tp_dir2) :color 1.0,1.0,0.5)) );ende tp_bauteil ;;============================================================================================================================================================================================================================== );;ende local-funtions );;ende dialog