;;--------------------------------------------------------------------------* ;; Modulbeschreibung: ;; Erstellt und ändern Fasen nach Geometrieregeln ;;--------------------------------------------------------------------------* ;; Dateiname: Kanten_zu_Fase.lsp ;; Version : 1.1 ;; Datum : 26.04.2017 ;; Author : MiBr ;;--------------------------------------------------------------------------* ;; Als Grundlage diente das Tool Kanten.lsp von der Seite OSD.CAD.de ;;--------------------------------------------------------------------------* ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 65280 Grün ; 16776960 Gelb ; 16777215 Weiss ; 16711680 Rot ; 255 Blau ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :custom) (use-package :oli) (sd-defdialog 'Kanten_zu_Fasen :dialog-title "Fase nach Geometrieregel" :toolbox-button nil :start-variable 'MLAENGE :variables '( (Erstell_FA :title "Erstellen" :value-type :boolean :toggle-type :grouped-toggle :persistent-data-storage t :initial-value t :after-input (progn (sd-set-variable-status 'MLAENGE :visible t) (sd-set-variable-status 'MFlaeche :visible nil) (sd-set-variable-status 'UeberErs :visible t) (sd-set-variable-status 'Uebercol :visible nil) (sd-set-variable-status 'Ueberloe :visible nil) (sd-set-variable-status 'UeberAen :visible nil) (sd-set-variable-status 'FBoegen :visible t) (sd-set-variable-status 'FFasen :visible nil) (sd-set-variable-status 'Tol_mm :visible t) (sd-set-variable-status 'Tol_qmm :visible nil) ) ) (Loesch_FA :title "Ändern" :value-type :boolean :toggle-type :grouped-toggle :persistent-data-storage t :initial-value t :after-input (progn (sd-set-variable-status 'MLAENGE :visible nil) (sd-set-variable-status 'MFlaeche :visible t) (sd-set-variable-status 'UeberErs :visible nil) (sd-set-variable-status 'Uebercol :visible t) (sd-set-variable-status 'Ueberloe :visible t) (sd-set-variable-status 'UeberAen :visible t) (sd-set-variable-status 'FBoegen :visible nil) (sd-set-variable-status 'FFasen :visible t) (sd-set-variable-status 'Tol_mm :visible nil) (sd-set-variable-status 'Tol_qmm :visible t) ) ) ("Fasenfestlegung") (FArt :range ((0 :label "Abstand") (1 :label "Abst/Winkel")) :title "Art" :after-input (progn (if (equal FArt 0) (progn (sd-set-variable-status 'FWINKEL :enable nil) (sd-set-variable-status 'FWECHSEL :enable nil) ) (progn (sd-set-variable-status 'FWINKEL :enable t) (sd-set-variable-status 'FWECHSEL :enable t) ) ) ;end if ) ) (FAbstand :value-type :number :title "Abstand" :initial-value 1 :prompt-text "Abstand eingeben" :proposals (1 2 3 4 5 10 15 20) ) (FWINKEL :value-type :number :title "Winkel" :initial-value 30 :prompt-text "Winkel eingeben" :proposals (15 30 45 60) :initial-enable nil ) (FWECHSEL :value-type :boolean :toggle-type :wide-toggle :title "Fläche wechseln" :initial-enable nil :initial-value nil ) ("Auswahl") (MLAENGE :selection (*sd-arc-3d-seltype* *sd-circle-3d-seltype*) :title "Referenz Bogen" :prompt-text "Referenz Bogen auswählen" :after-input (progn (setf KLAENGE (sd-call-cmds (measure_dist :edge_length MLAENGE)))) :initial-visible t :next-variable 'FBoegen ) (MFlaeche :selection *sd-chamfer-3d-seltype* :title "Referenz Fase" :prompt-text "Referenz Fase auswählen" :after-input (progn (setf KFlaeche (sd-call-cmds (get_vol_prop :for_face MFlaeche :area)))) :initial-visible nil :next-variable 'FFasen ) (FBoegen :selection (*sd-arc-3d-seltype* *sd-circle-3d-seltype*) :prompt-text "Bögen wählen" :title "Bögen wählen" :multiple-items t :initial-value nil :initial-visible t ) (FFasen :selection *sd-chamfer-3d-seltype* :prompt-text "Fasen wählen" :title "Fasen wählen" :multiple-items t :initial-value nil :initial-visible nil ) (Tol_mm :value-type :number :title "Toleranz [±mm]" :initial-value 0.0001 :prompt-text "± Toleranz der Kantenabweichtung angeben" :initial-visible t ) (Tol_qmm :value-type :number :title "Toleranz [±mm²]" :initial-value 0.001 :prompt-text "± Toleranz der Flächenabweichtung angeben" :initial-visible nil ) ("-") (Uebercol :title "Farbe ändern" :push-action (do_col) :toggle-type :grouped-toggle :initial-visible nil ) (UeberLoe :title "Fasen löschen" :push-action (do_loe) :toggle-type :grouped-toggle :initial-visible nil ) (UeberAen :title "Fasen ändern" :push-action (do_aen) :toggle-type :wide-toggle :initial-visible nil ) (UeberErs :title "Fasen erstellen" :push-action (do_ers) :toggle-type :wide-toggle :initial-visible t ) ) ;end var :mutual-exclusion '(Loesch_FA Erstell_FA) :Ok-Action `() :help-action '(sd-display-message " Fase nach Geometrieregel erstellen/löschen - Erstellt Fasen nach Referenzbögen mit gleicher Bogenlänge (± Toleranz mm) - Ändert und löscht Fasen nach Referenzfase mit gleicher Flächengröße (± Toleranz mm²) Viel Spaß beim Fasen setzen !!! Michael " :title "Kanten_zu_Fase.lsp" :push "Weiter") :local-functions '( (do_ers () (if (equal FArt 0) ;Art Abstand (progn (let (i kanten istlang) (setf kanten FBoegen) (dolist (i kanten) (setf istlang (sd-call-cmds (measure_dist :edge_length i))) (if (and (< (- istlang Tol_mm) KLAENGE ) (> (+ istlang Tol_mm) KLAENGE)) (progn (sd-call-cmds (chamfer i :distance FAbstand :check))) ) ) ;end dolist KANTEN_FASEN ) ;end let ) ;end progn ;Art Abstand/Winkel (progn (let (i kanten istlang) (setf kanten FBoegen) (dolist (i kanten) (setf istlang (sd-call-cmds (measure_dist :edge_length i))) (if (and (< (- istlang Tol_mm) KLAENGE ) (> (+ istlang Tol_mm) KLAENGE)) (progn (if (equal FWECHSEL nil) (progn (sd-call-cmds (chamfer i :DIST_ANGLE :new_angle_dist FAbstand (* FWINKEL (/ pi 180)) :check))) (progn (sd-call-cmds (chamfer i :DIST_ANGLE :new_angle_dist FAbstand (* FWINKEL (/ pi 180)) :da_reverse :check)))) ) ;end progn ) ) ;end dolist ) ;end let ) ;end progn ) ;end if (setf FBoegen nil) (setf MLAENGE nil) ) ;end do_ers (do_aen () (if (equal FArt 0) ;Art Abstand (progn (let (i flaeche istgross) (setf flaeche FFasen) (dolist (i flaeche) (setf istgross (sd-call-cmds (get_vol_prop :for_face i :area ))) (if (and (< (- istgross Tol_qmm) KFlaeche ) (> (+ istgross Tol_qmm) KFlaeche)) (progn (sd-call-cmds (modify_chamfers i :DISTANCE :NEW_DISTANCE FAbstand :nocheck))) ) ) ;end dolist ) ;end let ) ;end progn ;Art Abstand/Winkel (progn (let (i flaeche istgross) (setf flaeche FFasen) (dolist (i flaeche) (setf istgross (sd-call-cmds (get_vol_prop :for_face i :area ))) (if (and (< (- istgross Tol_qmm) KFlaeche ) (> (+ istgross Tol_qmm) KFlaeche)) (progn (if (equal FWECHSEL nil) (sd-call-cmds (modify_chamfers i :DIST_ANGLE :new_angle_dist FAbstand (* FWINKEL (/ pi 180)) :nocheck)) (sd-call-cmds (modify_chamfers i :DIST_ANGLE :new_angle_dist FAbstand (* FWINKEL (/ pi 180)) :reverse :nocheck))) ) ;end progn ) ) ;end dolist ) ;end let ) ;end progn ) ;end if (setf FFasen nil) (setf MFlaeche nil) ) ;end do_aen (do_loe () (progn (let (i flaeche istgross) (setf flaeche FFasen) (dolist (i flaeche) (setf istgross (sd-call-cmds (get_vol_prop :for_face i :area ))) (if (and (< (- istgross Tol_qmm) KFlaeche ) (> (+ istgross Tol_qmm) KFlaeche)) (progn (sd-call-cmds (remove_chamfers i :nocheck))) ;;; (modify_chamfers i :reverse :nocheck) ) ) ;end dolist ) ;end let ) ;end progn (setf FFasen nil) (setf MFlaeche nil) ) ;end do_loe (do_col () (progn (let (i flaeche istgross) (setf flaeche FFasen) (dolist (i flaeche) (setf istgross (sd-call-cmds (get_vol_prop :for_face i :area ))) (if (and (< (- istgross Tol_qmm) KFlaeche ) (> (+ istgross Tol_qmm) KFlaeche)) (progn (sd-call-cmds (set_face_Color i 10066329))) ) ) ;end dolist ) ;end let ) ;end progn (setf FFasen nil) (setf MFlaeche nil) ) ;end do_col ) ;end local ) ;end sd-def