Files

278 lines
10 KiB
Common Lisp

;------------------------------------------------------------------------;
; Baugruppe aus KW+STB ;
;------------------------------------------------------------------------;
; AW 10.05.93 ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
(setq Dat (load_dialog (strcat lw "/acadsst/layout/l_bg_kw.DCL")))
(if (not (new_dialog "l_bg_kw" Dat)) (exit))
(set_tile "ANZ" m_ANZ)
(set_tile "BEMASSEN" m_BEMASSEN)
(SetDia)
(ACTION_TILE "ANZ" "(zeig_dia)")
(ACTION_TILE "BEMASSEN" "(zeig_dia)")
(action_tile "accept" "(SetPara) (done_dialog)")
(action_tile "cancel" "(exit) (done_dialog)")
(start_dialog)
(unload_dialog Dat)
)
(defun SetDia()
(setq breite (dimx_tile "anzeige"))
(setq hoehe (dimy_tile "anzeige"))
(start_image "anzeige")
(FILL_IMAGE 0 0 breite hoehe -18)
(if (= m_BEMASSEN "1") ; mit Bemassung
(progn
(if (= m_ANZ "ANZ_1")
(slide_image 0 0 breite hoehe "layout(kw1d)")
)
(if (= m_ANZ "ANZ_2")
(slide_image 0 0 breite hoehe "layout(kw2d)")
)
(if (= m_ANZ "ANZ_3")
(slide_image 0 0 breite hoehe "layout(kw3d)")
)
(if (= m_ANZ "ANZ_4")
(slide_image 0 0 breite hoehe "layout(kw4d)")
)
)
)
(if (= m_BEMASSEN "0") ; mit Bemassung
(progn
(if (= m_ANZ "ANZ_1")
(slide_image 0 0 breite hoehe "layout(kw1)")
)
(if (= m_ANZ "ANZ_2")
(slide_image 0 0 breite hoehe "layout(kw2)")
)
(if (= m_ANZ "ANZ_3")
(slide_image 0 0 breite hoehe "layout(kw3)")
)
(if (= m_ANZ "ANZ_4")
(slide_image 0 0 breite hoehe "layout(kw4)")
)
)
)
(end_image)
)
(defun zeig_dia()
(setq m_ANZ (get_tile "ANZ"))
(setq m_BEMASSEN (get_tile "BEMASSEN"))
(SetDia)
)
(defun SetPara ()
(setq m_ANZ (get_tile "ANZ")
m_BEMASSEN (get_tile "BEMASSEN")
)
(if (= m_ANZ "ANZ_1")
(setq ANZAHL 1)
)
(if (= m_ANZ "ANZ_2")
(setq ANZAHL 2)
)
(if (= m_ANZ "ANZ_3")
(setq ANZAHL 3)
)
(if (= m_ANZ "ANZ_4")
(setq ANZAHL 4)
)
)
(defun datain ()
(setq auswahl-satz nil)
(setq MUFFE-ZAEHLER 0)
(setq ALTFANG (getvar "osmode"))
(initget (+ 1 2 4))
(setq PT0 (getpoint "\nPick centre of omni switch (1st point): "))
(bl-name PT0) ;--> Block-Name definieren -> Rckgabe: element-name
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(command "_insert" (strcat lw "/acadsst/layout/kw800_8x") PT0 "" "" "")
(attribute-aendern "0" "0" "" "" "" "" "" " (BG)" "" "")
(setq auswahl-satz (ssget "_L"))
)
(defun geometrie()
(setq zaehler 0)
(repeat ANZAHL
(setvar "osmode" ALTFANG)
(setq zaehler (+ zaehler 1))
(setq PT01 (getpoint PT0 "\nPick direction (intersection): "))
(setq PT02 (getpoint PT0 "\nPlace the curve (intersection): "))
(setvar "osmode" 0)
;-----------------
; Winkel berechnen
;-----------------
(setq WINK_RAD1 (angle PT0 PT01))
(setq WINK_GRA1 (/ (* WINK_RAD1 180) pi))
(setq WINK_RAD2 (angle PT0 PT02))
(setq WINK_GRA2 (/ (* WINK_RAD2 180) pi))
(setq WINK_RAD3 (angle PT01 PT02))
(setq WINK_GRA3 (/ (* WINK_RAD3 180) pi))
;------------------------
; Punkte fr die Bemaáung
;------------------------
(setq PT1 (polar PT01 WINK_RAD3 1000))
(setq PT2 (polar PT0 WINK_RAD3 1000))
;-----------------
;Abstand berechnen
;-----------------
(setq L1 (* (fix (/ (+ (distance PT0 PT01) 1) 2)) 2))
(if (or (< L1 350) (> L1 1800))
(progn
(alert "Abstand zu groá oder zu klein ...")
(setvar "osmode" ALTFANG)
(exit)
)
)
(setq L2 (* (fix (/ (+ (distance PT0 PT02) 1) 2)) 2))
;--------------------------------------------------------
;<<<<< RICHTUNG ermitteln >>>>>>>
;--------------------------------------------------------
(initget "L R")
(setq RICHTUNG (getkword "\n(L)eft or (R)ight ? <L>: "))
(if (not RICHTUNG)
(setq RICHTUNG "L")
)
(setq RICHTUNG (strcase RICHTUNG))
(setq BEZ (strcat BEZ "/" RICHTUNG " " (rtos L1)))
(princ (strcat "\nL1= " (rtos L1) " | L2= " (rtos L2) " | DIRECTION= "
RICHTUNG " | W1= " (rtos WINK_RAD1 3 3) " | W2= "
(rtos WINK_RAD2 3 3) " | W3= " (rtos WINK_RAD3 3 3)
" | Z = " (rtos zaehler) "\n"))
;--------------------------------------------------------
;<<<<< Konstruktionspunkte definieren >>>>>>>
;--------------------------------------------------------
(setq PT01 (polar PT0 WINK_RAD1 L1)
PT02 (polar PT0 WINK_RAD2 L2)
PT10 (polar PT0 WINK_RAD2 400)
)
(if (and (>= L1 350) (<= L1 530)) ; R400 + LINIE
(progn
(setq PT11 (polar PT01 WINK_RAD3 800)
PT12 (polar PT02 WINK_RAD3 270)
)
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45400l4") PT02 "" "" (rtos (+ WINK_GRA1 90)))
(command "_insert" (strcat lw "/acadsst/layout/s45400r4") PT02 "" "" (rtos (- WINK_GRA1 90)))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (< L1 530)
(progn
(command "_line" PT11 PT12 "")
(ssadd (entlast) auswahl-satz)
)
)
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT10 "0.5" "0.5" "0")
(ssadd (entlast) auswahl-satz)
(command "_layer" "_m" "L-6" "_c" "6" "" "")
(command "_insert" (strcat lw "/acadsst/layout/muffe") PT11 "" "" "0")
(attribute-aendern "0" "0" "" "" "" block-kennung "825002016" "MUFFE ANGESCHWEISST (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(setq MUFFE-ZAEHLER (+ MUFFE-ZAEHLER 1))
)
)
(if (and (> L1 530) (<= L1 683)) ; R650
(progn
(setq PT11 (polar PT02 WINK_RAD3 425)
)
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45650l4") PT02 "" "" (rtos (+ WINK_GRA1 90)))
(command "_insert" (strcat lw "/acadsst/layout/s45650r4") PT02 "" "" (rtos (- WINK_GRA1 90)))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT10 "0.5" "0.5" "0")
(ssadd (entlast) auswahl-satz)
(command "_layer" "_m" "L-6" "_c" "6" "" "")
(command "_insert" (strcat lw "/acadsst/layout/muffe") PT11 "" "" "0")
(attribute-aendern "0" "0" "" "" "" block-kennung "825002016" "MUFFE ANGESCHWEISST (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(setq MUFFE-ZAEHLER (+ MUFFE-ZAEHLER 1))
)
)
(if (and (> L1 683) (<= L1 1800)) ; R650
(progn
(setq PT11 (polar PT02 WINK_RAD3 425)
PT13 (polar PT10 WINK_RAD2 (- L2 400 565))
)
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45650l4") PT02 "" "" (rtos (+ WINK_GRA1 90)))
(command "_insert" (strcat lw "/acadsst/layout/s45650r4") PT02 "" "" (rtos (- WINK_GRA1 90)))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT10 "0.5" "0.5" "0")
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT13 "0.5" "0.5" "0")
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT10 (- L2 400 565) "1" (rtos WINK_GRA2))
(attribute-aendern "0" "0" "" (rtos (- L2 400 565)) "" block-kennung ""
(strcat " L=" (rtos (- L2 400 565))) "" "")
(ssadd (entlast) auswahl-satz)
(command "_layer" "_m" "L-6" "_c" "6" "" "")
(command "_insert" (strcat lw "/acadsst/layout/muffe") PT11 "" "" "0")
(attribute-aendern "0" "0" "" "" "" block-kennung "825002016" "MUFFE ANGESCHWEISST (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(setq MUFFE-ZAEHLER (+ MUFFE-ZAEHLER 1))
)
)
(if (= m_BEMASSEN "1")
(bemassung)
)
) ;---- Ende repeat
) ;---- Ende geometrie
(defun BEMASSUNG ()
;----------
; Bemaáung
;----------
(command "_layer" "_m" "L-10" "_c" "10" "" "")
(command "_dim")
(command "_dimtad" "0")
(command "_dimtxt" "125")
(command "_dimasz" "40")
(if (= RICHTUNG "L")
(setq WINK_BEM (- WINK_RAD3 (/ pi 2)))
(setq WINK_BEM (+ WINK_RAD3 (/ pi 2)))
)
(command "_align" PT1 PT2 (polar PT1 WINK_BEM 200) "")
(command "_exit")
(command "_layer" "_m" "L-3" "_c" "3" "" "")
)
;------------------------------------------------------------------------------
(defun c:l_bg_kw ( / PT0 PT01 PT02 PT1 PT2 PT3 PT4 PT5 PT6 PT7
PT8 PT9 PT10 PT11 PT12 PT13 WINK_RAD1 WINK_RAD2
WINK_RAD3 WINK_GRA1 WINK_GRA2 WINK_GRA3 ZAEHLER
ANZAHL)
(setvar "limcheck" 0)
(prompt "**** Group of omni switch+curves *******")
(prompt "")
(setq BEZ "** BG 1KW+STBL ")
(if (null m_ANZ) (setq m_ANZ "ANZ_2")) ; mit 2 KW vordefinieren
(if (null m_BEMASSEN) (setq m_BEMASSEN "1")) ; mit Bemaáung
(dbox)
(datain)
(geometrie)
(mach-block PT0 "0" auswahl-satz)
(setq auswahl-satz nil)
(setq BEZ (strcat BEZ " + " (rtos MUFFE-ZAEHLER) " MUFFE(N)"))
(attribute-aendern "0" "2" "1" "" "" block-kennung "111111111" (strcat BEZ " [BG1]") "" "") ; in SSTBASE.LSP
(setvar "osmode" ALTFANG)
)
;------------------------------------------------------------------------------