;;--------------------------------------------------------------------------* ;; Modulbeschreibung: ;; Hilfsbolzen ;;--------------------------------------------------------------------------* ;; Dateiname: Hilfsbolzen.lsp ;; Version : 1.0 ;; Datum : 05.2008 ;; Author : Highway - osd.cad.defdialog ;; Beschreibung: Erstellt einen Hilfsbols zur Positionierung ;;--------------------------------------------------------------------------* ;; Version : 1.1 ;; Datum : 22.11.2017 ;; Author : MiBr ;; Erweitert: Achsrichtung für Nullpunkt, Einstellung der Größe ;; Teile/AE bleiben aktiv , Ursprungsfläche Rot ;;--------------------------------------------------------------------------* (in-package :custom) (use-package :oli) (sd-defdialog 'hilfsbolzen_erzeugen :dialog-title "3D Hilfsbolzen" :after-initialization '(progn (setq derBolzen nil) (setq Vorschau_WP nil) (setq Erster_nullp 0)) :help-action '(sd-display-message "Der Hilfsbolzen dient als Hilfe bei der Positionierung") :variables '( ; (PICTURE :value-type ; :image :image-file "\\\\xxx\\hilfsbolzen.bmp" ; :image-width 170 ; :image-height 100 ; :image-alignment :center ; ) ; (parameters :title "Einstellung der Größe" ; :expand-shrink (Bolzen_durch Bolzen_laenge Bolzen_dreh)) (Bolzen_durch :value-type :number :prompt-text "Durchmesser des Bolzen wählen" :title "ø [mm]" :initial-value 20 :after-input (hilfsbolzen) ) (Bolzen_laenge :value-type :number :prompt-text "Gesamtlänge des Bolzen wählen" :title "Länge [mm]" :initial-value 50 :after-input (hilfsbolzen) ) (Bolzen_dreh :value-type :number :prompt-text "Drehwinkel des Hilfsbolzen wählen" :title "α [°]" :initial-value 0 :after-input (hilfsbolzen) ) ("-") (KEEP_WP :value-type :boolean :toggle-type :grouped-toggle :title "AE behalten" :initial-value nil :after-input (hilfsbolzen) ) (NULLP_X :toggle-type :wide-toggle :value-type :boolean :indicator-type :none :title "Im Nullpunkt auf X-Achse" :initial-value nil :initial-visible nil :after-input (progn (Nullpunkt_Y) (hilfsbolzen)) ) (NULLP_Y :toggle-type :wide-toggle :value-type :boolean :indicator-type :none :title "Im Nullpunkt auf Y-Achse" :initial-value nil :initial-visible nil :after-input (progn (Nullpunkt_Z) (hilfsbolzen)) ) (NULLP_Z :toggle-type :wide-toggle :value-type :boolean :indicator-type :none :title "Im Nullpunkt auf Z-Achse" :initial-value nil :initial-visible t :after-input (progn (Nullpunkt_X) (hilfsbolzen)) ) ("-") (URSPRUNG :value-type :point-3d :title "Ursprung" :after-input (progn (setq NULLP_X nil) (setq NULLP_Y nil) (setq NULLP_Z nil) (hilfsbolzen)) ) (RICHTUNG :value-type :measure-direction :title "Richtung" :after-input (progn (setq NULLP_X nil) (setq NULLP_Y nil) (setq NULLP_Z nil) (hilfsbolzen)) ) ) :ok-action '() :cancel-action ' (progn (if derBolzen (sd-call-cmds (delete_3d derBolzen))) ;Vorschau löschen (if Vorschau_WP (sd-call-cmds (delete_3d Vorschau_WP))) ;Vorschau löschen) ) :local-functions '( (hilfsbolzen () (if derBolzen (sd-call-cmds (delete_3d derBolzen))) ;Vorschau löschen (if Vorschau_WP (sd-call-cmds (delete_3d Vorschau_WP))) ;Vorschau löschen (when (not (or (equal URSPRUNG nil) (equal RICHTUNG nil))) (let ((Default_Part (sd-inq-curr-part)) ;Aktives Teil sichern (Default_WP (sd-inq-curr-wp)) ;Aktive Arbeitsebene sichern ) (sd-call-cmds (create_workplane :new :pt_dir :origin URSPRUNG :normal RICHTUNG)) (setq Vorschau_WP (sd-inq-curr-wp)) (sd-call-cmds (position_wp :current :rotate :axis :w :rotation_angle (- 0 (* Bolzen_dreh (/ pi 180))))) ; Arbeitsebene drehen (sd-call-cmds (uic_c_line_cross 0,0)) (sd-call-cmds (c_circle :cen_dia 0,0 Bolzen_durch)) (sd-call-cmds (geometry_mode :real)) (sd-call-cmds (polygon (oli:make-gpnt2d :x (/ Bolzen_durch 2) :y 0) ;1,0 (oli:make-gpnt2d :x 0 :y 0) ;0,0 (oli:make-gpnt2d :x 0 :y (/ Bolzen_durch 2)))) ;0,1 (sd-call-cmds (arc :3_pos (oli:make-gpnt2d :x 0 :y (/ Bolzen_durch 2)) ;0,1 (oli:make-gpnt2d :x (/ Bolzen_durch 2) :y 0) ;1,0 (oli:make-gpnt2d :x (- 0 (/ Bolzen_durch 2)) :y 0))) ;-1,0 (setq nameBolzen (sd-gen-obj-basename :Part :Parent "/" :Prefix "Hilfsbolzen")) (sd-call-cmds (create_part :name nameBolzen :Owner "/")) (setq derBolzen (sd-inq-curr-part)) ;; a sel-item (sd-call-cmds (extrude :part derBolzen :distance Bolzen_laenge :keep_profile :no :KEEP_WP (if KEEP_WP :yes :no))) (sd-call-cmds (part_prop derBolzen :base_density 0.0001 :base_color 10276015 :done :base_trans :semi)) (sd-call-cmds (set_face_Color (sd-call-cmds (get_selection :focus_type *sd-face-seltype* :curr_part_only :select URSPRUNG)) 16733011)) (sd-call-cmds (current_part Default_Part)) ;Gesichertes aktives Teil wieder aktivieren (if KEEP_WP () (sd-call-cmds (current_WP Default_WP))) ;Gesicherte Arbeitsebene aktivieren ) ;end let ) ;when ) ;end Hilfsbolzen (Nullpunkt_X () (if (equal Erster_nullp 0) (progn (setq URSPRUNG 0,0,0) (setq RICHTUNG (list 0,0,1)) (sd-set-variable-status 'NULLP_X :visible nil) (sd-set-variable-status 'NULLP_Y :visible nil) (sd-set-variable-status 'NULLP_Z :visible t) (setq Erster_nullp 1)) (progn (setq URSPRUNG 0,0,0) (setq RICHTUNG (list 1,0,0)) (sd-set-variable-status 'NULLP_X :visible t) (sd-set-variable-status 'NULLP_Y :visible nil) (sd-set-variable-status 'NULLP_Z :visible nil)) ) ) ;end Nullpunkt (Nullpunkt_Y () (setq URSPRUNG 0,0,0) (setq RICHTUNG (list 0,1,0)) (sd-set-variable-status 'NULLP_X :visible nil) (sd-set-variable-status 'NULLP_Y :visible t) (sd-set-variable-status 'NULLP_Z :visible nil) ) ;end Nullpunkt (Nullpunkt_Z () (setq URSPRUNG 0,0,0) (setq RICHTUNG (list 0,0,1)) (sd-set-variable-status 'NULLP_X :visible nil) (sd-set-variable-status 'NULLP_Y :visible nil) (sd-set-variable-status 'NULLP_Z :visible t) ) ;end Nullpunkt ) ; end local-functions ) ; end dialog