;;----------------------------------------------------------------------------- ;; for PTC Creo Elements/Direct Modeling ;; better known as CoCreate SolidDesigner ;; Description: ;; Demonstrations beispiel fuer sd-set-model-checkpoint ;; ;;----------------------------------------------------------------------------- ;; ;; Filename : checkpoint.lsp ;; Version : 1.01 ;; Datum : 18.06.2019 ;; Author : MiBr ;; Download : https://ww3.cad.de/foren/ubb/Forum92/HTML/000945.shtml ;; ;;----------------------------------------------------------------------------- (in-package :custom) (use-package :oli) (sd-defdialog 'bezugstexte_erstellen :dialog-title "Text mit Bezugslinie" :after-initialization '(setf recover_b (list (sd-set-model-checkpoint))) :toolbox-button t :variables '( (ausw_besit :selection (*sd-anno-view-seltype*) :title "Besitzer" :prompt-text "Besitzer/Ansicht auswählen" :initial-value nil :toggle-type :invisible :gui-value (if ausw_besit (format nil "~a" (sd-am-inq-name ausw_besit))) ;;Ansichtsname im Display anzeigen ) (text_set :value-type :string :prompt-text "Text" :title "Text" :proposals ("A" "B" "C" "D" "E" "F" "G" "H" "I" "J") :initial-value "A" ) ("-") (end_pun :value-type :docupntcnp :title "Kante" :prompt-text "Kante auswählen" :toggle-type :invisible :before-input (progn (setf end_pun nil) (setf start_pun nil) (setf ausw_besit nil)) :next-variable 'Start_pun :after-input (setf ausw_besit (first (sd-call-cmds (get_selection :focus_type *sd-anno-view-seltype* :select End_pun)))) ;Besitzer ermitteln ) (start_pun :value-type :docupntcnp :title "Position" :prompt-text "Linke untere Position für das Symbol auswählen" :toggle-type :invisible :after-input (if ausw_besit (progn (sd-call-cmds (text_eintragen)) (set_recover)) (sd-display-message (format nil "Keine Kante gefunden!") :title "Fehler" :push "Weiter") ) ) (recover_b :push-action (recover_back) :title "<<<" :title-alignment :center :toggle-type :grouped-toggle :initial-enable nil ) (recover_f :push-action (recover_forw) :title ">>>" :title-alignment :center :toggle-type :grouped-toggle :initial-enable nil ) );end-variables :prompt-variable 'End_pun :ok-action '() :cancel-action '() :help-action '(oli:sd-display-url "\\\\mmfserver02\\cadconfig\\modeling\\Kordel\\Hilfe\\Kantenzustände.pdf") :local-functions '( (set_recover () (push (sd-set-model-checkpoint) recover_b) (sd-set-variable-status 'recover_b :enable t) (sd-set-variable-status 'recover_f :enable nil) (setf recover_f nil) ) (recover_back () (when (nth 1 recover_b) (push (nth 0 recover_b) recover_f) (pop recover_b) (sd-return-to-model-checkpoint (nth 0 recover_b)) (sd-set-variable-status 'recover_f :enable t) (unless (nth 1 recover_b) (sd-set-variable-status 'recover_b :enable nil)) ) ) (recover_forw () (when recover_f (push (nth 0 recover_f) recover_b) (pop recover_f) (sd-return-to-model-checkpoint (nth 0 recover_b)) (sd-set-variable-status 'recover_b :enable t) (unless recover_f (sd-set-variable-status 'recover_f :enable nil)) ) ) (text_eintragen () (let* (sketch start_pun_x start_pun_y end_pun_x end_pun_y txt_punkt catch_range (view-scale (sd-am-view-struct-scale (sd-am-inq-view ausw_besit))) (view-scale-1 (/ 1 view-scale )) (start_pun_x (gpnt2d_x Start_pun)) (start_pun_y (gpnt2d_y Start_pun)) (end_pun_x (gpnt2d_x end_pun)) (end_pun_y (gpnt2d_y end_pun)) ) (setf docu::*docu-hide-wrong-owner-warning* t) (setf catch_range (sd-am-inq-curr-catch-range)) ;Fangbereich ermitteln und auf Größe 1 ändern (am_set_catch_parameters :cursor_range 1) ;;; Skizze erstellen ;;; (setq sketch (format nil "/~a/~a/Textsymbol" (sd-am-inq-curr-sheet-name) ;;Aktive Blatt (sd-am-inq-name ausw_besit) ;;Besitzer Ansicht )) ;Skizze Pfad (am_sketch_create :sketch_name (format nil "Textsymbol") :owner ausw_besit :ref_point (sd-vec-scale (make-gpnt2d :X start_pun_x :y start_pun_y) view-scale-1) ) ;am_sketch ;;; Text erstellen ;;; (defparameter *annotation-view-port* "Annotation" ) (setq txt_punkt (frame2::make-GPNTDOCU :x (+ start_pun_x 1.0) :y (+ start_pun_y 1.0) :gport *annotation-view-port*)) (AM_CREATE_TEXT :docu-text text_set :owner :sketch sketch :size 2.2 :linesp 1.65 :color 255 :done :abs_angle 0 :ratio 0.8 :adjust 1 txt_punkt );end AM_CREATE_TEXT :docu-text ;;; Referenzpunkt der Skizze löschen ;;; (am_delete :docu_point start_pun) ;;; Bezugslinien einzeichnen ;;; (if (and (< start_pun_x end_pun_x) (< start_pun_y end_pun_y)) (am_create_refline :ref_arrow_type 1 :ref_arrow_size 3.5 :source txt_punkt :horiz_to_src (sd-vec-scale (make-gpnt2d :X (+ start_pun_x 4) :Y (- start_pun_y 1)) view-scale-1) (sd-vec-scale (make-gpnt2d :X (- start_pun_x 1) :Y (- start_pun_y 1)) view-scale-1) (sd-vec-scale (make-gpnt2d :X (- start_pun_x 1) :Y (+ start_pun_y 4)) view-scale-1) (sd-vec-scale (make-gpnt2d :X end_pun_x :Y end_pun_y ) view-scale-1) ) ;end then (am_create_refline :ref_arrow_type 1 :ref_arrow_size 3.5 :source txt_punkt :horiz_to_src (sd-vec-scale (make-gpnt2d :X (+ start_pun_x 4) :Y (- start_pun_y 1)) view-scale-1) (sd-vec-scale (make-gpnt2d :X (- start_pun_x 1) :Y (- start_pun_y 1)) view-scale-1) (sd-vec-scale (make-gpnt2d :X end_pun_x :Y end_pun_y ) view-scale-1) ) ;end else ) (setf docu::*docu-hide-wrong-owner-warning* nil) (am_set_catch_parameters :cursor_range catch_range) ;Fangbereich zurück setzen (sd-am-set-default-owner :text :2dview ausw_besit) ;Besitzer behalten ) ;end let );text_eintragen );end Local-Functions );end sd-defdialog