;********************************************************************************************* ; Dateiname : SD_Test_4.lsp ; Autor : Stephan Wörz ; Erstellt : 30.01.2019 ; geändert : ;********************************************************************************************* ; Beschreibung : - ; ; Optionen : - ; ; Bemerkungen : - Check-Funktion für die Höhe des DMC fehlt noch! ; - Runden der Schildlänge & Bohrungsabstand auf vollen mm fehlt noch ; - CheckOutFromPhoenix - Laufzeitproblem! ...keine Rückmeldung wenn fertig - ggf. Paket laden! ; ;Funktionen : - (CheckOutFromPhoenix [ObjID]) >> lädt Objekt aus dem PDM ; - (create-new-label) >> erzeugt neues Schild - ungünstig für Zeichnungserstellung ; - (modify-reference-label) >> modifiziert vorhandenes Schild ;********************************************************************************************* ; -------------------------------------------------------------------------------------------- ; ä Ì Ä Ø ö Î Ö Ú ü Ï Ü Û ß Þ ° ³ µ ó ; (Display (format nil "Name~20T: Stephan") ~20T >> Setzt Cursor in Spalte 20!! ; (Display (format nil "Name~%: Stephan") ~% >> Erzeugt Zeilenumbruch!!!!!! ; -------------------------------------------------------------------------------------------- ; BASIC FUNCTIONS: ; SD_CheckWorkplane Parameter: Keine - prüft ob Arbeitsebene vorhanden ; -------------------------------------------------------------------------------------------- (in-package :SCHILLER) (use-package :oli) (sd-hide-console-window) ;(sd-show-console-window) ;(setf si::*enter-break-handler* t) (defun CheckOutFromPhoenix(ObjID) (progn (SETQ obj (Phoenix::px-checkout-model-by-objid ObjID 1)) ;; Bildschirm neu aufbauen (UPDATE_SCREEN) ;; bei Multiload Dialog offenlassen (if (not (sd-togglebutton-set-p "Multiload")) (sd-hide-dialog-shell "Schiller-Befestigungsteile" :ignorePin t) );;if ;;Zwangspause ; (sleep 5) ;;Attribute aktualisieren ;;(phoenix::px-update-attributes (list obj)) );;progn );;defun (sd-defdialog 'SD_Test_4 :dialog-title "Erzeuge Barcode / DMC Schild" :toolbox-button nil :variables '( ;; local variables: (blank-zone :initial-value 4.5) ;Ruhezone links und rechts vom Barcode (border-zone :initial-value 3.0) ;Randabstand der Bohrungen (text-height :initial-value 3.0) ;Texthöhe der Textzeilen (text-char-width :initial-value 2.0) ;Breite je Textzeichen (label-thickness :initial-value 0.8) ;Dicke des Schildes (label-heigth :initial-value 9.0) ;Höhe des Schildes (Fontsize :initial-value 3.746) ;Schrifthöhe = 3mm (Fonttype :initial-value "arial");Schriftart (y-offset :initial-value 10) ;Verschiebewert - nur zur Entwicklung notwendig um die Varianten nich übereinander zu haben ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ;; dialog vaiables: ("Codetype") (code-39 :value-type :grouped-boolean :title "Code 39" :initial-value t :after-input (progn (setf Text-row-1 "Code39") (setf y-offset 10) (calculate-label-dimensions) );;progn );;code-39 (code-128 :value-type :grouped-boolean :title "Code 128" :initial-value nil :after-input (progn (setf Text-row-1 "Code128") (setf y-offset 20) (calculate-label-dimensions) );;progn );;code-128 ("inklusive DMC Code") (dmc-code-yes :value-type :grouped-boolean :title "Ja" :initial-value nil :after-input (progn (sd-set-variable-status 'dmc-code-lenght :visible t) (setf Text-row-2 "DMC-1") (setf y-offset (+ y-offset 20)) (calculate-label-dimensions) );;progn );;code-39 (dmc-code-no :value-type :grouped-boolean :title "Nein" :initial-value t :after-input (progn (sd-set-variable-status 'dmc-code-lenght :visible nil) (setf Text-row-2 "DMC-0") (setf y-offset (+ y-offset 20)) (calculate-label-dimensions) );;progn );;code-128 (dmc-code-lenght :value-type :length :title "DMC Code BxH" :initial-value 5 :initial-visible nil :after-input (calculate-label-dimensions) );;barcode-module ("Befestigung") (kerbnagel :value-type :grouped-boolean :title "KerbnÌgel" :initial-value t :after-input (setf hole-diameter 1.8) );;kerbnagel (schraube :value-type :grouped-boolean :title "Schrauben M3" :initial-value nil :after-input (setf hole-diameter 3.2) );;schraube ("Benutzereingaben") (barcode-length :value-type :length :title "Anzahl der Barcode-Zeichen" :initial-value 10 :after-input (calculate-label-dimensions) );;barcode-length (barcode-module :value-type :length :title "Modul" :initial-value 0.3 :after-input (calculate-label-dimensions) );;barcode-module (barcode-print-ratio :value-type :length :title "Druckverhaeltnis 1:" :initial-value 3 :after-input (calculate-label-dimensions) );;barcode-print-ratio (Text-row-1 :value-type :string :title "Mustertext obere Zeile" :initial-value "Code39" );;Text-row-1 (Text-row-2 :value-type :string :title "Mustertext untere Zeile" :initial-value "DMC-0" );;Text-row-2 ("Berechnete Werte") (barcode-width :value-type :length :title "LÌnge des Codes in mm" :initial-enable nil :initial-value (calculate-label-dimensions) );;barcode-length (barcode-label-width :value-type :length :title "LÌnge des Schildes in mm" :initial-enable nil :initial-value (calculate-label-dimensions) );;barcode-length ("feste Werte") (barcode-label-height :value-type :length :title "HÎhe des Schildes in mm" :initial-enable nil :initial-value 9 );;barcode-length (hole-diameter :value-type :length :title "Bohrungsdurchmesser" :initial-enable nil :initial-value 1.8 );;barcode-length );;end variables :ok-action '(modify-reference-label) ;(create-new-label) :cancel-action '() :help-action '(progn ); end progn :local-functions '( (calculate-label-dimensions () (if code-39 ;then (if dmc-code-yes ;then (progn (setf barcode-width (* barcode-module (+ (* (+ barcode-length 2)(+ 6 (* 3 barcode-print-ratio))) (+ 1 barcode-length)))) (setf barcode-label-width (+ 10 dmc-code-lenght blank-zone barcode-width blank-zone (* (length Text-row-1)text-char-width) 10)) );;progn ;else (progn (setf barcode-width (* barcode-module (+ (* (+ barcode-length 2)(+ 6 (* 3 barcode-print-ratio))) (+ 1 barcode-length)))) (setf barcode-label-width (+ 10 barcode-width blank-zone (* (length Text-row-1)text-char-width) 10)) );;progn );;if ;else (if dmc-code-yes ;then (progn (setf barcode-width (* barcode-module (+ 11 (* 11 barcode-length) 11 13))) (setf barcode-label-width (+ 10 dmc-code-lenght blank-zone barcode-width blank-zone (* (length Text-row-1)text-char-width) 10)) );;progn ;else (progn (setf barcode-width (* barcode-module (+ 11 (* 11 barcode-length) 11 13))) (setf barcode-label-width (+ 10 barcode-width blank-zone (* (length Text-row-1)text-char-width) 10)) );;progn );;if );;if );;calculate-label-dimensions ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (create-new-label () (progn ;Teilenamen zusammenbasteln (setq teil (format nil "/~A_~A" Text-row-1 Text-row-2)) ;1 Arbeitsebene erzeugen (sd-call-cmds (create_workplane :new :NAME "Dummy-AE")) ;2 Umriss malen und extrudieren (sd-call-cmds (rectangle 0,0 (make-gpnt2d :x barcode-label-width :y label-heigth))) (sd-call-cmds (extrude :part teil :distance -0.8 :keep_wp :yes :keep_profile :no)) ;3 Löcher buddeln (sd-call-cmds (circle :cen_rad (make-gpnt2d :x 3 :y (/ label-heigth 2)) (/ hole-diameter 2))) (sd-call-cmds (circle :cen_rad (make-gpnt2d :x (- barcode-label-width 3) :y (/ label-heigth 2)) (/ hole-diameter 2))) (sd-call-cmds (punch :part teil :keep_wp :yes :keep_profile :no)) ;3 Schraubenköpfe (sd-call-cmds (circle :cen_rad (make-gpnt2d :x 3 :y (/ label-heigth 2)) 2.85)) (sd-call-cmds (circle :cen_rad (make-gpnt2d :x (- barcode-label-width 3) :y (/ label-heigth 2)) 2.85)) (sd-call-cmds (imprint_linear :imprint_part teil :imprint_distance 0.1 :imprint_keep_wp :on :imprint_keep_profile :no)) ;4 ggf. DMC-Code-Bereich malen und aufprägen (if dmc-code-yes ;then (progn ;DMC-Code-Bereich (sd-call-cmds (rectangle (make-gpnt2d :x 11 :y (/ (- label-heigth dmc-code-lenght)2)) (make-gpnt2d :x (+ 11 dmc-code-lenght) :y (- label-heigth(/ (- label-heigth dmc-code-lenght)2)) ))) (sd-call-cmds (imprint_linear :imprint_part teil :imprint_distance 0.1 :imprint_keep_wp :on :imprint_keep_profile :no)) ;Barcode-Bereich ;; (sd-call-cmds (rectangle (make-gpnt2d :x (/ (- barcode-label-width barcode-width ) 2) :y 0.5) (sd-call-cmds (rectangle (make-gpnt2d :x (+ 11 dmc-code-lenght blank-zone) :y 0.5) (make-gpnt2d :x (+ 11 dmc-code-lenght blank-zone barcode-width) :y (- label-heigth 0.5) ))) (sd-call-cmds (imprint_linear :imprint_part teil :imprint_distance 0.1 :imprint_keep_wp :on :imprint_keep_profile :no)) ;;X-Startposition der Beschriftungstexte (setf text-x-pos (+ 11 dmc-code-lenght blank-zone barcode-width blank-zone)) );;progn ;else >> ohne DMC-Code-Bereich (progn ;aufprägen Barcode-Bereich malen und aufprägen (sd-call-cmds (rectangle (make-gpnt2d :x 11 :y 0.5) (make-gpnt2d :x (+ barcode-width 11) :y (- label-heigth 0.5)))) (sd-call-cmds (imprint_linear :imprint_part teil :imprint_distance 0.1 :imprint_keep_wp :on :imprint_keep_profile :no)) ;;X-Startposition der Beschriftungstexte (setf text-x-pos (+ 11 barcode-width blank-zone)) );;progn );if ;6 Texte aufbringen (sd-call-cmds (create_geo_text :text Text-row-1 :pos (make-gpnt2d :x text-x-pos :y 5) :angle 0 :size Fontsize :font Fonttype)) (sd-call-cmds (create_geo_text :text Text-row-2 :pos (make-gpnt2d :x text-x-pos :y 1) :angle 0 :size Fontsize :font Fonttype)) (sd-call-cmds (imprint_linear :auto_direction :yes :imprint_keep_wp :off :imprint_part teil :imprint_distance 0.1 :imprint_dir :+W)) ;Schild verschieben (sd-call-cmds (position_PA teil :translate :dir_len :neg_y y-offset)) );;progn );;create-new-label (modify-reference-label () ;; ;;1. Schild laden ;; (if dmc-code-yes ;; ;;then ;; (CheckOutFromPhoenix 1113104) ;; ;;else ;; (CheckOutFromPhoenix 1113531) ;; );;if ;;2. Flächen definieren ;;(setf faces-to-move ;; (sd-call-cmds(get_selection ;; :focus_type *sd-face-seltype* ;; :select :selected_part "/R_Barcode-DMC-Schild_Metall_080_HU__einfach_V0_KR000234" ;; :by_box_ ;; ((make-gpnt3d x: 45.268845 y: -1.354851 z: 2.259205 )"1") ;; ((make-gpnt3d x: 101.607725 y: 21.801981000000001 z: 2.2592050000000001 )"1") ;; ((make-gpnt3d x: 96.100917 y: 25.614387 z: 2.259205 )"1") ;; );;get_selection ;; );;sd-call-cmds ;;);;setf ;;(display (length faces-to-move)) ;;3. Move Faces ;;(sd-call-cmds(move ;; :faces ;; ;:check_fix :on ;; :keep_tangent :yes ;; :blend_auto :yes ;; ;:transform_objects :yes ;; ;:update_rels :no ;; :feat_select :FR-ANY-FEAT ;; :by_box_vp_2d_3d (make-gpnt3d x: 0 y: 0 z: 0) ;; (make-gpnt3d x: 100 y: 0 z: 20) ;; :dyn-pos-method :on ;; :current-direction :x 10 ;; );; ;;);; );;modify-reference-label );; end of local functions :mutual-exclusion '((code-39 code-128) (kerbnagel schraube) (dmc-code-yes dmc-code-no)) );;sd-defdialog