;********************************************************************************************* ; Dateiname : SD_EngraveText.lsp ; Autor : Stephan Wörz ; Erstellt : 11.11.2013 ; geÌndert : mbk 2014.01.17 ;********************************************************************************************* ; Beschreibung : Aufbringen der Artikelnummer/Text auf Bauteil ;Änderung: Extrudieren und Fräsen ; Optionen: - ; Bemerkungen: - ; Beachten: -Bearbeitung Fräsen/Extrudieren muss immer gewählt werden, Anzeige stimmt nicht mit dem Verfahren überein, es wird immer das letzte Verfahren ausgeführt!!!!!! ; -kann den Fehler nicht finden ;********************************************************************************************* ; ä Ì Ì Ø ö Î Ö Ú ü Ï Ï Û ß Þ ° ³ (in-package :Teo) (use-package :OLI) (sd-hide-console-window) ;(sd-show-console-window) (setf si::*enter-break-handler* t) ;;mode T = fräsen (setf mode t) ;;Artikelnummer aus Attributen holen (setf GetArticle t) (sd-defdialog 'SD_EngraveText :dialog-title "Text auf FlÌche" :toolbox-button nil :variables '( (Textflaeche :value-type :face :after-input (progn ;;zur Fläche geörendes Teil (setf Part (sd-inq-parent-obj Textflaeche)) (if GetArticle ;;then: Artikelnummer aus den Attributen holen (progn (setf Beschriftungstext (GetAttribute_LESA_HLZ_Artikel Part)) ;; Artikelnummer prüfen (when (not Beschriftungstext) (progn (setf Beschriftungstext "123 456") :next-variable 'Textflaeche );;progn );;when );;progn ;;else () );;if ;; Flächennormale ermitteln und Struktur (structure) in Variable schreiben (Setf FaceProbs (sd-inq-geo-props Textflaeche :dest-space :global)) ;;Zugriff auf den Slot "normal" (die Flächennormale auslesen) (setf Normale (sd-plane-normal FaceProbs)) ;; Variable aktivieren (sd-set-variable-status 'Nullpunkt :enable t) );;progn );;Textflaeche (Nullpunkt :value-type :point-3d :initial-enable nil :built-in-feedback t :preselection-definition-time :suppress ;:modifies NIL :prompt-text "Textursprung angeben (unten links vom Text)" :title "Textursprung" :initial-value nil :next-variable 'Textrichtung :after-input (progn (sd-set-variable-status 'Textrichtung :enable t) );;progn );;Nullpunkt (Textrichtung :value-type :measure-direction :initial-enable nil :prompt-text "Textrichtung angeben" :built-in-feedback t :title "Textrichtung" :after-input (progn ;; Wenn Normale und Textrichtung gleiche oder entgegengesetzte Richtung haben (if (sd-vec-colinear-p (first Textrichtung) Normale) ;;Then... (progn (sd-display-message "Richtung nicht zulÌssig - Textrichtung neu wÌhlen") (setf Textrichtung nil) :next-variable 'Textrichtung );;progn ;;Else... (progn (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) (sd-set-variable-status 'Klein :enable t) (sd-set-variable-status 'Mittel :enable t) (sd-set-variable-status 'Gross :enable t) (sd-set-variable-status 'Fontsize :enable t) );;progn );;if );;progn );;Textrichtung ("SchriftgrÎÞe") (Klein :value-type :grouped-boolean :initial-enable nil :initial-value t :size :third :title "4.0 mm" :after-input (progn (if Klein ;;then... (progn (setf Fontsize 5) ;;AE löschen (sd-call-cmds (delete_3d (sd-inq-curr-wp))) ;;AE neu (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) );;progn ;;else... () );;if );;progn );;Klein (Mittel :value-type :grouped-boolean :initial-enable nil :size :third :title "6.5 mm" :after-input (progn (if Mittel ;;then... (progn (setf Fontsize 8) ;;AE löschen (sd-call-cmds (delete_3d (sd-inq-curr-wp))) ;;AE neu (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) );;progn ;;else... () );;if );;progn );;Mittel (Gross :value-type :grouped-boolean :initial-enable nil :size :third :title "9.0 mm" :after-input (progn (if Gross ;;then... (progn (setf Fontsize 11) ;;AE löschen (sd-call-cmds (delete_3d (sd-inq-curr-wp))) ;;AE neu (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) );;progn ;;else... () );;if );;progn );;Gross (Fontsize :value-type :number ;:number oder display-only :initial-value 5 :initial-enable nil :after-input (progn ;;AE löschen (sd-call-cmds (delete_3d (sd-inq-curr-wp))) ;;AE neu (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) );;progn :title "SchriftgrÎÞe" );; ("Verfahren") (Mill :value-type :grouped-boolean :initial-enable t :size :half :title "FrÌsen" :after-input (progn (if Mill (progn (setf mode t) (sd-set-variable-status 'Fontdepth :enable t) ) (setf mode nil) ) );;progn :initial-value t );;Mill (Extrude :value-type :grouped-boolean :initial-enable t :size :half :title "Extrudieren" :after-input (progn (if Extrude (progn (setf mode nil) (sd-set-variable-status 'Fontdepth :enable t) ) (setf mode t) ) );;progn :initial-value nil );;Extrude ("Beschriftungstext") (Beschriftungstext :value-type :string ;:display-only :initial-value "123 456" :after-input (progn ;;AE löschen (sd-call-cmds (delete_3d (sd-inq-curr-wp))) ;;AE neu (CreateUserdefinedWorkplane Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) );;progn :title "Text" );; ("INFO") (Fonttype :value-type :display-only :initial-value "arial" :title "Schriftart" );; (Fontdepth :value-type :number ;display-only :initial-value 0.5 :title "Gravurtiefe" );; );;Variables :mutual-exclusion '((Klein Mittel Gross)(Mill Extrude)) :ok-action '(progn (PutTextToPart Part Fontdepth mode) );;progn );;sd-defdialog ;;;Funktion zum Auslesen der Artikelnummer (defun GetAttribute_LESA_HLZ_Artikel (selitem) (let ((attr (sd-inq-item-attribute selitem "LESATECH_BOM_ATTR" :values :attachment :contents))) (if attr (getf attr :Lesa_HLZ_Artikel) nil) );;let );;defun ;;; Funktion zum Erstellen der Arbeitsebene (Defun CreateUserdefinedWorkplane (Nullpunkt Normale Textrichtung Beschriftungstext Fontsize Fonttype) (progn (sd-call-cmds (create_workplane :new :pt_dir :origin Nullpunkt :normal Normale :u_dir Textrichtung ) ) ;; Geo-Text erstellen (sd-call-cmds (create_geo_text :text Beschriftungstext :pos 0,0 :angle 0 :size Fontsize :font Fonttype ) );; );;progn );;defun (Defun PutTextToPart (Part Fontdepth mode) ;; Text auf AE (if mode ;;Then >> fräsen (progn (sd-call-cmds (mill :linear_pull :selection_focus_profiles :keep_wp :no :sel_part Part :distance Fontdepth :direction :-W ));;sd-call-cmds );;progn ;else ;;>> extrudieren (progn (sd-call-cmds (extrude :auto_direction :yes :distance Fontdepth :keep_wp :no ));;sd-call-cmds );;progn );;if );;defun