(in-package :test) (use-package :oli) (sd-defdialog 'gh2_bohr_pos :dialog-title "Bohr POS" :toolbox-button t :variables '( (ae_bohr_null) (ae :initial-value (sd-inq-curr-wp)) (teil :value-type :part :initial-value nil :title "Teil" :prompt-text "Bauteil an dem die Bohrungspos. ermittelt werden sollen, angeben" ) (TXT_1 :value-type :number :title "Prog_Nr" :initial-value 1000 :prompt-text "Programmnummer eingeben") (TXT_2 :value-type :number :initial-value 1.5 :title "Zent. Tiefe" :prompt-text "Zentriertiefe eingeben") (TXT_3 :value-type :number :initial-value 0 :title "Bes. Rueckz." :prompt-text "Besonderer Rueckzug eingeben") (TXT_4 :value-type :number :initial-value 1200 :title "Drehzahl" :prompt-text "Drehzahl eingeben") (TXT_5 :value-type :number :initial-value 200 :title "Vorschub" :prompt-text "Vorschub eingeben") (Lochtype :range ("Gew_Dg_Loch" "Gew_Sa_Loch" "DG_Loch" "Alle") :title "Lochtype" :prompt-text "Lochtype" ) ) :local-functions '( (do_it () (setq bohr_position_liste nil) (setq ae_bohr_null (sd-inq-curr-wp)) ;(display ae_bohr_null) ;;;Bohrungs -Nr, -Typ, -Lagetoleranz, -XPosition, -YPosition, -Nennd., -Durchmessertol. listen (setq bohr_position_liste (scan_bohr_im_teil teil ae_bohr_null)) (display :clear) (SETQ Teilename (OLI::sd-inq-obj-basename (OLI::SD-INQ-CURR-PART))) (DISPLAY (format nil "N1000 (Bohrprog. fuer ~S )" Teilename)) (DISPLAY "N2 G90") (DISPLAY "N3 G17") (DISPLAY "N4 G54") (DISPLAY "N5 M6 T1") (DISPLAY "N6 G0 X0 Y0") (DISPLAY (format nil "N7 G83 Y5 B~S Z-~S S~S F~S M3 "TXT_3 TXT_2 TXT_4 TXT_5)) (when bohr_position_liste (dolist (i bohr_position_liste) (display (format nil "N~A X~3F Y~3F Z~3F (DM ~1F ~A)" (nth 0 i) (nth 2 i) (nth 3 i)(nth 4 i)(nth 5 i)(nth 1 i))) ) ) (DISPLAY "N200 M6 T0") (DISPLAY "N201 M30") );Ende do_it );Ende local-functions :ok-action '(do_it) ) (defun scan_bohr_im_teil (teil WP) ;;; ##### In folgender Liste die ersten 4 Zeichen der zulaessigen Featurenamen eintragen ##### (setq bohr_typ_liste '(Lochtype)) ;; (setq bohr_typ_liste '("aaaa" ;; "bbbb" ;; "cccc" ;; )) (setq bohr_pos_liste nil) (setq n 7) ;;; MA-Bohrpositionen und Parameter im teil bestimmen (setq feat (sd-inq-part-named-features teil)) (dolist (i feat) (let ( (feat_si nil) (feat_var nil) (typ nil) (pos nil) (d nil) (b nil) (achs_vec nil) (achs_vec_norm_ae nil) ) ;;; Hier werden die zul. Faetures ausgefiltert ;;; Wenn i die ersten 4 Zeichen in bohr_typ_liste enthalten sind (when (and (>= (length i) 4) (member (subseq i 0 4) bohr_typ_liste :test 'string=) ) (setq n (+ n 1)) (display (format nil "feat i: ~a" i)) (setq feat_si (sd-call-cmds (get_selection :focus_type *sd-feature-seltype* :single_selection :select :full_name :start_name (sd-inq-obj-pathname teil) :feature i :end_name))) ;(display (format nil "feat_si: ~a" i)) (setq typ (subseq i 0 4)) (setq b (sd-call-cmds (get_selection :focus_type *sd-cylinder-seltype* :select :by_feature :full_name :start_name (sd-inq-obj-pathname teil) :feature i :end_name))) (setq achs_vec (sd-vec-xform (sd-cylinder-axis-dir (sd-inq-geo-props (first b) :dest-space :global)) :source-space :global :dest-space WP)) ;;; Falls die Achsrichtung der Zyl.-flaeche wesentlich von der AE-Normalen abweicht ;;; wird sie später nicht gelistet (setq achs_vec_norm_ae (let ( (ae_z_vec (sd-inq-wp-w-dir WP)) (winkel nil) (achs_vec (sd-cylinder-axis-dir (sd-inq-geo-props (first b) :dest-space :global))) ) (setq winkel (sd-vec-angle-between achs_vec ae_z_vec)) (if (or (sd-num-equal-p winkel 0.0 :resolution 0.00001) (sd-num-equal-p winkel pi :resolution 0.00001) );Ende or t nil );Ende if );Ende let );Ende setq (setq pos (sd-vec-xform (sd-cylinder-center (sd-inq-geo-props (first b) :dest-space :global)) :source-space :global :dest-space WP)) (cond ( (setq feat_var (sd-cust-feat-inq-vars feat_si :variables ':thread_dia)) (setq d (getf feat_var :thread_dia)) ) ( (setq feat_var (sd-cust-feat-inq-vars feat_si :variables ':hole_dia_prop)) ;Falls feat_var <> nil (setq d (getf (getf feat_var :hole_dia_prop) :value)) ) ( (setq feat_var (sd-cust-feat-inq-vars feat_si :variables ':drill_dia_prop)) ;Falls feat_var <> nil (setq d (getf (getf feat_var :drill_dia_prop) :value)) ) ( t nil) ) ;;; Nur wenn die Achsrichtung der Zyl.-flaeche parallel der AE-Normalen ist ;;; wird sie gelistet (when achs_vec_norm_ae (push (list (format nil "~,0F" n) typ (gpnt3d_x pos) (gpnt3d_y pos)(gpnt3d_z pos) d) bohr_pos_liste) );Ende when );Ende when );Ende let );Ende dolist (values bohr_pos_liste) );Ende scan_bohr_im_teil