(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" ) ) :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) (display "Nr.;Typ;X;Y;Nennd") (when bohr_position_liste (dolist (i bohr_position_liste) (display (format nil "~A;~A;~,3F;~,3F;~,1F" (nth 0 i) (nth 1 i) (nth 2 i) (nth 3 i)(nth 4 i))) ) ) );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 '("aaaa" "bbbb" "cccc" )) (setq bohr_pos_liste nil) (setq n 0) ;;; 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) d) bohr_pos_liste) );Ende when );Ende when );Ende let );Ende dolist (values bohr_pos_liste) );Ende scan_bohr_im_teil