; Autor : Adrian F ; Erstellt: 28.07.2008 ; Winkel ; Dateiname: pero_Winkel.lsp ; Version: 1.0 ; 1.0 erste Final (in-package :custom) (use-package :OLI) ; ------------ Wertetabellen -------------------------------- ; ------------ Pfade anpassen! ------------------------------ (setf WINKEL_GS_FILE "C:/test/DIN-EN-10056-1-Gleichschenklig.tab") (setf WINKEL_UGS_FILE "C:/test/DIN-EN-10056-1-Ungleichschenklig.tab") ; Read-ltab-from-file by Patrick Weber 12.11.2008 ; ---------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (sd-defdialog 'Winkel-DIN-EN-100562 :dialog-title "Winkel DIN EN 10056" :toolbox-button t :variables '( (A_PART :value-type :part-incl-new :modifies :contents :title "Teil" :prompt-text "Name für den Winkel eingeben") (A_ASSEM :value-type :assembly :modifies :contents :title "Baugruppe" :initial-value "/" :prompt-text "Baugruppe auswaehlen.") ("Position") (NULLPUNKT :toggle-type :boolean :title "im Nullpunkt" :push-action (nullpunkt)) (Startpunkt :value-type :point-3d) (Richtung :value-type :measure-direction :prompt-text "Richtung in Z") (Abstand :value-type :length :prompt-text "Abstand vom Startpunkt" :initial-value 0) (WINKEL :value-type :angle :title "Winkel" :initial-value 0 :prompt-text "Winkel angeben.") ("Geometrie") (querschnitt :expand-shrink ((A1 B1 S1 R1 R11 Laenge) (A2 S2 R2 R22 Laenge)) :expand-shrink-toggle-type :toggle-pair :expand-token :Ungleichschenklig :expand-title "Ungleichschenklig" :shrink-token :Gleichschenklig :shrink-title "Gleichschenklig" ) (A1 :value-type :distance :title "Schenkel A" :show-input-tool (sd-show-display-table "DIN-EN-10056-1-Ungleichschenklig" :position '("TOP-MENU-TOOLBOX-TB" :lefttop 570 50)) :hide-input-tool (sd-hide-display-table "DIN-EN-10056-1-Ungleichschenklig" :ignorePin t) :prompt-text "LĖnge angeben") (B1 :value-type :distance :title "Schenkel B" :prompt-text "LĖnge angeben") (S1 :value-type :distance :title "Dicke S" :prompt-text "LĖnge angeben") (R1 :value-type :distance :title "Radius 1" :prompt-text "LĖnge angeben") (R11 :value-type :distance :title "Radius 2" :prompt-text "LĖnge angeben") (A2 :value-type :distance :title "Schenkel A" :show-input-tool (sd-show-display-table "DIN-EN-10056-1-Gleichschenklig" :position '("TOP-MENU-TOOLBOX-TB" :lefttop 570 50)) :hide-input-tool (sd-hide-display-table "DIN-EN-10056-1-Gleichschenklig" :ignorePin t) :prompt-text "LĖnge angeben") (S2 :value-type :distance :title "Dicke S" :prompt-text "LĖnge angeben") (R2 :value-type :distance :title "Radius 1" :prompt-text "LĖnge angeben") (R22 :value-type :distance :title "Radius 2" :prompt-text "LĖnge angeben") (Laenge :value-type :distance :prompt-text "LĖnge angeben") ("-") (RICHT :range ( (:+W :label "+W") (:-W :label "-W") (:both_sides :label "beidseitig")) :title "Richtung" :prompt-text "Richtung angeben") ("Werkstoff angeben") (ABK :value-type :string :title "Werkstoff" :show-input-tool (sd-show-display-table "Werkstoff-Dichte-Liste" :position '("TOP-MENU-TOOLBOX-TB" :lefttop 70 50)) :hide-input-tool (sd-hide-display-table "Werkstoff-Dichte-Liste" :ignorePin t) :prompt-text "Werkstoff auswaehlen" );;ABK (DICHTE :value-type :positive-number :title "Dichte" :prompt-text "Dichte eingeben") (Farbe2 :value-type :string :toggle-type :invisible :after-input (progn (sd-set-variable-status "FARBE" :value (sd-rgb-to-color (read-from-string Farbe2))) (setq FARBE (sd-rgb-to-color (read-from-string Farbe2))))) (FARBE :value-type :rgb-color :title "Farbe") ("-") (NEXT :push-action (Winkel-erstellen) :after-input (setf Startpunkt nil A1 nil A2 nil B1 nil S1 nil S2 nil R1 nil R11 nil R2 nil R22 nil Laenge nil) :next-variable 'Startpunkt) ) :after-initialization '(progn (when (sd-logical-table-p "DIN-EN-10056-1-Ungleichschenklig") (sd-destroy-logical-table "DIN-EN-10056-1-Ungleichschenklig")) (when (sd-logical-table-p "DIN-EN-10056-1-Gleichschenklig") (sd-destroy-logical-table "DIN-EN-10056-1-Gleichschenklig")) (sd-create-logical-table "DIN-EN-10056-1-Ungleichschenklig" :columns '(:Benennung :a1 :b1 :s1 :r1 :r11) :columnNames '("Bezeichnung" "a" "b" "s" "R1" "R2") :types '(:string :length :length :length :length :length) :units '(nil :mm :mm :mm :mm :mm) :contents '() ) (let (V1 V2 V3 V4 V5 V6 ZEILE_STRING_IN ZEILE_STRING_LISTE FI NEW_LIST) (with-open-file (FI WINKEL_UGS_FILE :direction :input :if-does-not-exist nil) (setf ZEILE_STRING_IN (read-line FI nil)) ; Header überspringen (setf ZEILE_STRING_IN (read-line FI nil)) ; erste Zeile mit Werten lesen (setf ZEILE_STRING_LISTE (sd-string-split ZEILE_STRING_IN ",")) (loop while ZEILE_STRING_IN do (setf ZEILE_STRING_LISTE (sd-string-split ZEILE_STRING_IN ",")) (setf V1 (sd-string-trim (nth 0 ZEILE_STRING_LISTE)) V2 (read-from-string (sd-string-trim (nth 1 ZEILE_STRING_LISTE))) V3 (read-from-string (sd-string-trim (nth 2 ZEILE_STRING_LISTE))) V4 (read-from-string (sd-string-trim (nth 3 ZEILE_STRING_LISTE))) V5 (read-from-string (sd-string-trim (nth 4 ZEILE_STRING_LISTE))) V6 (read-from-string (sd-string-trim (nth 5 ZEILE_STRING_LISTE)))) (setf NEW_LIST (list V1 V2 V3 V4 V5 V6)) (sd-insert-logical-table-row "DIN-EN-10056-1-Ungleichschenklig" :position :bottom :overwriteIfExists nil :contents NEW_LIST ) (setf ZEILE_STRING_IN (read-line FI nil)) ; nächste Zeile ) ) ) (sd-create-display-table "DIN-EN-10056-1-Ungleichschenklig" :tableTitle "DIN-EN-10056-1-Ungleichschenklig" :logicalTable "DIN-EN-10056-1-Ungleichschenklig" :columns '(:Benennung :a1 :b1 :s1 :r1 :r11) :applyColumns '(:a1 :b1 :s1 :r1 :r11) :displayHeight 850 :filterStatusLine nil :selectionMode :single-row :applyAction :default-tokens ) (sd-create-logical-table "DIN-EN-10056-1-Gleichschenklig" :columns '(:Benennung :a2 :a22 :s2 :r2 :r22) :columnNames '("Bezeichnung" "a" "a" "s" "R1" "R2") :types '(:string :length :length :length :length :length) :units '(nil :mm :mm :mm :mm :mm) :contents '() ) (let (V1 V2 V3 V4 V5 V6 ZEILE_STRING_IN ZEILE_STRING_LISTE FI NEW_LIST) (with-open-file (FI WINKEL_GS_FILE :direction :input :if-does-not-exist nil) (setf ZEILE_STRING_IN (read-line FI nil)) ; Header überspringen (setf ZEILE_STRING_IN (read-line FI nil)) ; erste Zeile mit Werten lesen (setf ZEILE_STRING_LISTE (sd-string-split ZEILE_STRING_IN ",")) (loop while ZEILE_STRING_IN do (setf ZEILE_STRING_LISTE (sd-string-split ZEILE_STRING_IN ",")) (setf V1 (sd-string-trim (nth 0 ZEILE_STRING_LISTE)) V2 (read-from-string (sd-string-trim (nth 1 ZEILE_STRING_LISTE))) V3 (read-from-string (sd-string-trim (nth 2 ZEILE_STRING_LISTE))) V4 (read-from-string (sd-string-trim (nth 3 ZEILE_STRING_LISTE))) V5 (read-from-string (sd-string-trim (nth 4 ZEILE_STRING_LISTE))) V6 (read-from-string (sd-string-trim (nth 5 ZEILE_STRING_LISTE)))) (setf NEW_LIST (list V1 V2 V3 V4 V5 V6)) (sd-insert-logical-table-row "DIN-EN-10056-1-Gleichschenklig" :position :bottom :overwriteIfExists nil :contents NEW_LIST ) (setf ZEILE_STRING_IN (read-line FI nil)) ; nächste Zeile ) ) ) (sd-create-display-table "DIN-EN-10056-1-Gleichschenklig" :tableTitle "DIN-EN-10056-1-Gleichschenklig" :logicalTable "DIN-EN-10056-1-Gleichschenklig" :columns '(:Benennung :a2 :a22 :s2 :r2 :r22) :applyColumns '(:a2 :a2 :s2 :r2 :r22) :displayHeight 850 :filterStatusLine nil :selectionMode :single-row :applyAction :default-tokens ) ) ; end after-initialization :local-functions '( (Winkel-erstellen () (sd-call-cmds (progn (create_workplane :new :name "AEF" :pt_dir :origin Startpunkt :normal (first Richtung) :done) (position_wp "/AEF" :translate :dir_len :w Abstand) (when (and A1 B1) (setf p0 (make-gpnt2d :x 0 :y 0) ;; links unten p1 (make-gpnt2d :x B1 :y 0) ;; rechts unten p2 (make-gpnt2d :x B1 :y S1) ;; rechts mitte p3 (make-gpnt2d :x S1 :y S1) ;; innen mitte p4 (make-gpnt2d :x S1 :y A1) ;; rechts oben p5 (make-gpnt2d :x 0 :y A1)) ;; links oben (GEOMETRY_MODE :REAL) ;ändert die Geometrieart auf "Geometrie" falls das nicht eingestellt ist (polygon (gpnt2d 0 0) (gpnt2d B1 0) (gpnt2d B1 S1) (gpnt2d S1 S1) (gpnt2d S1 A1) (gpnt2d 0 A1) :close) (when (> R1 0) (fillet :create :fillet_radius R1 p3) ) (when (> R11 0) (fillet :create :fillet_radius R11 p2 p4) ) ) (when (and A2 S2) (setf p0 (make-gpnt2d :x 0 :y 0) ;; links unten p1 (make-gpnt2d :x A2 :y 0) ;; rechts unten p2 (make-gpnt2d :x A2 :y S2) ;; rechts mitte p3 (make-gpnt2d :x S2 :y S2) ;; innen mitte p4 (make-gpnt2d :x S2 :y A2) ;; rechts oben p5 (make-gpnt2d :x 0 :y A2)) ;; links oben (GEOMETRY_MODE :REAL) ;ändert die Geometrieart auf "Geometrie" falls das nicht eingestellt ist (polygon (gpnt2d 0 0) (gpnt2d A2 0) (gpnt2d A2 S2) (gpnt2d S2 S2) (gpnt2d S2 A2) (gpnt2d 0 A2) :close) (when (> R2 0) (fillet :create :fillet_radius R2 p3) ) (when (> R22 0) (fillet :create :fillet_radius R22 p2 p4) ) ) (if (/= WINKEL 0) (rotate_2d :select :edge_2d :all_2d :center_point P0 :angle WINKEL :repeat_factor 1 :keep :off) );;if (extrude :sel_part A_PART :direction RICHT :keep_profile :no :distance Laenge) (set_part_base_color :parts A_PART :color FARBE) (set_part_base_density :parts A_PART :dens DICHTE) (CHANGE_PA_OWNER :PARTS_ASSEMBLIES A_PART :NEW_OWNER A_ASSEM) (delete_3d "/AEF" ) );progn );sd-call-cmds );Winkel-erstellen (nullpunkt () (setq Startpunkt 0,0,0) (setq RICHTUNG (list 0,0,1)) );nullpunkt );;local-functions :ok-action '(Winkel-erstellen) :help-action '(progn (display :show) (display "Dieses Tool wurde von Adrian F entwickelt!") (display " ")) ) ; end sd-defdialog 'Winkel-DIN-EN-100562