(use-package :OLI) ;; Logical Table (sd-create-logical-table "Gewindeauswahl" :columns '(:Gewinde :Kern_dm ) :columnNames '("Gewinde" "Kern_dm" ) :types '(:string :length ) :units '( nil :mm ) :contents '( (" M8x0,75 " (7.19 :mm) ) (" M10x1 " (8.92 :mm) ) (" M14x1,5 " (12.38 :mm) ) (" M16x1,5 " (14.38 :mm) ) (" M24x1,5 " (22.38 :mm) ) (" 1/8 Zoll " (8.57 :mm) ) (" 1/4 Zoll " (11.45 :mm) ) (" 3/8 Zoll " (14.95 :mm) ) (" 1/2 Zoll " (18.63 :mm) ) ) ; end contents ) ;end sd-create-logical-table ;; Display Table (sd-create-display-table "Gewindeauswahl" :tableTitle "Gewindeauswahl" :logicalTable "Gewindeauswahl" :columns '(:Gewinde :Kern_dm) :applyColumns '(:Kern_dm) :displayHeight 200 :filterStatusLine nil :selectionMode :single-row :applyAction :default-tokens ); end sd-create-display-table (defun zeige-gewindeauswahl () (sd-show-display-table "Gewindeauswahl" :position '("TOP-MENU-TOOLBOX-TB" :bottomleft 330 250) ) ) ;end defun (defun verstecke-gewindeauswahl () (sd-hide-display-table "Gewindeauswahl" :ignorePin t)) ;; Dialog (sd-defdialog 'Kuehlbohrungen :dialog-title "Kuehlbohrungen" :variables '( (AE :value-type :wp :title "AE" :prompt-text "AE angeben.") (Mittelpunkt :value-type :point-2d :title "Punkt" :prompt-text "Punkt auswaehlen") (Kern_dm :value-type :positive-number :title "Gewindedurchmesser" :prompt-text "Gewindedurchmesser auswählen" :show-input-tool (zeige-gewindeauswahl) :hide-input-tool (verstecke-gewindeauswahl) :after-input (setq tabellenwert (sd-read-logical-table-row "Gewindeauswahl" :pList `(:Kern_dm, Kern_dm) :units :internal ) Kern_dm (getf tabellenwert :Kern_dm) ) ; end after input ) (Gewindetiefe :value-type :length :title "Gewindetiefe" :prompt-text "Gewindetiefe des Gewindes angeben") (Bohrungstiefe :value-type :length :title "Bohrungstiefe" :prompt-text "Bohrungstiefe der Bohrung angeben (ohne Spitze)") (Bohrungsdurchmesser :value-type :length :title "Bohrungsdurchmesser" :prompt-text "Bohrungsdurchmesser der Bohrung angeben") (Spitzenwinkel :value-type :length :title "Spitzenwinkel" :initial-value 118 :prompt-text "Geben Sie den Spitzenwinkel ein. Defaultwert sind 118 Grad") (Fase ; Button für mit/ohne Fase :value-type :boolean :toggle-type :wide-toggle :title "Fase" :initial-value t ) (Naechste :push-action (los-gehts)) ) ; end variables :ok-action '(los-gehts) :local-functions '( (los-gehts () (sd-call-cmds (CREATE_WORKPLANE ; Vorhandene AE kopieren :copy :name "Test" :source AE) ) ;end call (sd-call-cmds (slide_wp_origin (Sd-Inq-Curr-Wp) Mittelpunkt) ;Ursprung der kopierten AE auf den angeklickten Punkt verschieben ) ; end call (cond ;Fallunterscheidung: Wenn negative Gewindetiefen-Werte eingegeben werden, ((> Gewindetiefe 0) (setq Drehwinkel (* 0.5 pi))) ;wird die kopierte AE in der anderen Richtung gedreht, um einen Bolzen ((< Gewindetiefe 0) (setq Drehwinkel (- (* 0.5 pi)))) ;in der entgegengesetzten Richtung zu erzeugen ) ;end cond (sd-call-cmds (position_wp (sd-inq-curr-wp) ;Drehen der kopierten AE :rotate :axis :v :rotation_angle Drehwinkel :done ) ; end position ) ;end call ((if Fase t (sd-call-cmds (GEOMETRY_MODE :REAL) ;ändert die Geometrieart auf "Geometrie" falls das nicht eingestellt ist ) ;end call (sd-call-cmds (polygon ;Polygon zeichnen, aus dem später der Bolzen gedeht wird (gpnt2d 0 0) ;Punkt 0/0 (gpnt2d 0 (* 1.05(/ Kern_dm 2.0))) ;Fase aussen (gpnt2d (- (* 1.05(/ Kern_dm 2.0)) (/ Kern_dm 2.0)) (/ Kern_dm 2.0)) ;1. Pkt. Gewindekerndrms (gpnt2d (ABS Gewindetiefe) (/ Kern_dm 2.0)) ;2. Pkt. ende Gewinde (gpnt2d (ABS Gewindetiefe) (/ Bohrungsdurchmesser 2.0)) (gpnt2d (ABS (+ Gewindetiefe Bohrungstiefe)) (/ Bohrungsdurchmesser 2.0)) (gpnt2d (+ (ABS (+ Gewindetiefe Bohrungstiefe)) (/ (* Bohrungsdurchmesser (tan (/ (* (- 90 (/ Spitzenwinkel 2)) pi) 180)))2)) 0) :close) ; Polygon schliessen ) ;end call ) (sd-call-cmds (GEOMETRY_MODE :REAL) ;ändert die Geometrieart auf "Geometrie" falls das nicht eingestellt ist ) ;end call (sd-call-cmds (polygon ;Polygon zeichnen, aus dem später der Bolzen gedeht wird (gpnt2d 0 0) ;Punkt 0/0 (gpnt2d 0 (/ Kern_dm 2.0)) ;1. Pkt. Gewindekerndrms (gpnt2d (ABS Gewindetiefe) (/ Kern_dm 2.0)) ;2. Pkt. ende Gewinde (gpnt2d (ABS Gewindetiefe) (/ Bohrungsdurchmesser 2.0)) (gpnt2d (ABS (+ Gewindetiefe Bohrungstiefe)) (/ Bohrungsdurchmesser 2.0)) (gpnt2d (+ (ABS (+ Gewindetiefe Bohrungstiefe)) (/ (* Bohrungsdurchmesser (tan (/ (* (- 90 (/ Spitzenwinkel 2)) pi) 180)))2)) 0) :close) ; Polygon schliessen ) ;end call ) (sd-call-cmds (turn :part "/Stift" ;Bolzen erzeugen :wp "/Test" :axis :u :rotation_angle (* 2 pi) :keep_profile :no :keep_wp :no) ) ;end call (sd-call-cmds (current_wp AE) ;Setzt als aktuelle AE wieder die ursprüngliche ) ;end call ) ;end los-gehts ) ;end local-functions ) ;end def dialog