Files

602 lines
21 KiB
Common Lisp

;------------------------------------------------------------------------;
; Baugruppe oder Sonder aus 1 Weiche - links oder rechts (STAHL) ;
;------------------------------------------------------------------------;
; AW 12.05.93 ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
(setq Dat (load_dialog (strcat lw "/acadsst/layout/l_bg_w45.DCL")))
(if (not (new_dialog "l_bg_w45" Dat)) (exit))
(set_tile "RA" m_RA)
(set_tile "RI" m_RI)
(set_tile "WB" m_WB)
(set_tile "BEMASSEN" m_BEMASSEN)
(setq breite (dimx_tile "anzeige"))
(setq hoehe (dimy_tile "anzeige"))
(start_image "anzeige")
(slide_image 0 0 breite hoehe "layout(l_bg_w45)")
(end_image)
(action_tile "accept" "(SetPara) (done_dialog)")
(action_tile "cancel" "(exit) (done_dialog)")
(start_dialog)
(unload_dialog Dat)
)
(defun SetPara ()
(setq m_RA (get_tile "RA")
m_RI (get_tile "RI")
m_WB (get_tile "WB")
m_BEMASSEN (get_tile "BEMASSEN")
)
(if (= m_RA "RA_1")
(setq RADIUS 1)
)
(if (= m_RA "RA_2")
(setq RADIUS 2)
)
(if (= m_RA "RA_3")
(setq RADIUS 3)
)
(if (= m_RI "RI_L")
(setq RICHTUNG "L")
)
(if (= m_RI "RI_R")
(setq RICHTUNG "R")
)
(if (= m_WB "WB_W")
(setq ABSCHLUSS "W")
)
(if (= m_WB "WB_B")
(setq ABSCHLUSS "B")
)
)
(defun datain ()
(setq ALTFANG (getvar "osmode"))
(setq MUFFE-ZAEHLER 0)
(setq auswahl-satz nil)
(if (= RADIUS 2) ; bei R=400 gibt es keine 45-Grad Weiche
(setq ABSCHLUSS "B")
)
(setq ABSCHLUSS (strcase ABSCHLUSS))
(initget (+ 1 2 4))
(setq PT01 (getpoint "\nAnfangspunkt antippen: "))
(setq PT0 (getpoint PT01 "\nSchnittpunkt antippen: "))
(setq PT02 (getpoint PT0 "\nEndpunkt antippen: "))
(bl-name PT0) ;--> Block-Name definieren -> Rckgabe: element-name
(setvar "osmode" 0)
(setq WINK_RAD1 (angle PT01 PT0))
(setq WINK_GRA1 (/ (* WINK_RAD1 180) pi))
(if (= RICHTUNG "L")
(setq WINK_RAD2 (+ WINK_RAD1 (/ pi 4)))
(setq WINK_RAD2 (- WINK_RAD1 (/ pi 4)))
)
(setq WINK_GRA2 (/ (* WINK_RAD2 180) pi))
;------------------;
;Abst„nde berechnen;
;------------------;
; (setq L1 (* (fix (/ (+ (distance PT01 PT0) 1) 2)) 2))
; (setq L2 (* (fix (/ (+ (distance PT0 PT02) 1)2)) 2))
(setq L1 (distance PT01 PT0))
(setq L2 (distance PT0 PT02))
(if (= RADIUS 1) ; Radius 650
(progn
(if (or (< L1 325) (> L1 1800) (< L2 360) (> L2 1800))
(progn
(alert "Abstand zu groá oder zu klein ...")
(setvar "osmode" ALTFANG)
(exit)
)
)
)
)
(if (= RADIUS 2) ; Radius 400
(progn
(if (or (< L1 190) (> L1 1800) (< L2 268) (> L2 1800))
(progn
(alert "Abstand zu groá oder zu klein ...")
(setvar "osmode" ALTFANG)
(exit)
)
)
)
)
(if (= RADIUS 3) ; Radius 175
(progn
(if (or (< L1 170) (> L1 1800) (< L2 148) (> L2 1800))
(progn
(alert "Abstand zu groá oder zu klein ...")
(setvar "osmode" ALTFANG)
(exit)
)
)
)
)
;------------------------------------------------------------
(princ (strcat "\nL1= " (rtos L1) " | L2= " (rtos L2)
" W1= " (rtos WINK_RAD1 3 3) " | W2= " (rtos WINK_RAD2 3 3)
"\n"))
;--------
; Muffen
;--------
(command "_layer" "_m" "L-6" "_c" "6" "" "")
(command "_insert" (strcat lw "/acadsst/layout/muffe") PT01 "" "" "0")
(attribute-aendern "0" "0" "" "" "" block-kennung "825002016" "MUFFE ANGESCHWEISST (BG)" "" "")
(setq auswahl-satz (ssget "_L"))
(setq MUFFE-ZAEHLER (+ MUFFE-ZAEHLER 1))
(command "_insert" (strcat lw "/acadsst/layout/muffe") PT02 "" "" "0")
(attribute-aendern "0" "0" "" "" "" block-kennung "825002016" "MUFFE ANGESCHWEISST (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(setq MUFFE-ZAEHLER (+ MUFFE-ZAEHLER 1))
(if (= ABSCHLUSS "W")
(progn
(command "_layer" "_m" "L-7" "_c" "7" "" "")
(if (= RADIUS 3)
(command "_insert" (strcat lw "/acadsst/layout/muffe") (polar PT0 WINK_RAD1 550) "" "" "0")
(command "_insert" (strcat lw "/acadsst/layout/muffe") (polar PT0 WINK_RAD1 375) "" "" "0")
)
(attribute-aendern "0" "0" "" "" "" block-kennung "825004017" "DREIKANTLASCHE" "" "")
(ssadd (entlast) auswahl-satz)
)
)
(command "_layer" "_m" "L-3" "_c" "3" "" "")
)
(defun geometrie-650()
;-----------------------------------------
; Abst„nde analysieren und Elemente setzen
;-----------------------------------------
;***************
; L1 bearbeiten
;***************
(if (= ABSCHLUSS "W")
(progn
(cond
(
(< L1 425)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (= RICHTUNG "L")
(progn
(command "_insert" (strcat lw "/acadsst/layout/w45650l3") PT0 "" "" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "824052012" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
)
(progn
(command "_insert" (strcat lw "/acadsst/layout/w45650r3") PT0 "" "" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "824052011" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
)
)
(if (> L1 325)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 325)))
(command "_line" PT01 PT3 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L1 425) (<= L1 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/w45650l4") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/w45650r4") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 426) ; sonst wird auch bei 425,3 Verbindung gesetzt!
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 425)))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT3 "0.5" "0.5" (rtos WINK_GRA1))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT01 (- L1 425) "1" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos (- L1 425)) "" block-kennung ""
(strcat " L=" (rtos (- L1 425))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
) ;----end PROGN
) ;---- endif ABSCHLUSS="W"
(if (= ABSCHLUSS "B")
(progn
(cond
(
(< L1 425)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45650l3") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45650r3") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "" " SONDER IN (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 700)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 325)))
(command "_line" PT01 PT3 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L1 425) (<= L1 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45650l4") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45650r4") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 426)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 425)))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT3 "0.5" "0.5" (rtos WINK_GRA1))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT01 (- L1 425) "1" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos (- L1 425)) "" block-kennung ""
(strcat " L=" (rtos (- L1 425))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
) ;----end PROGN
) ;---- endif ABSCHLUSS="B"
;***************
; L2 bearbeiten
;***************
(cond
(
(< L2 565)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (> L2 360)
(progn
(setq PT4 (polar PT0 WINK_RAD2 360))
(command "_line" PT02 PT4 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L2 565) (<= L2 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (> L2 565)
(progn
(setq PT4 (polar PT0 WINK_RAD2 565))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT4 "0.5" "0.5" (rtos WINK_GRA2))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT4 (- L2 565) "1" (rtos WINK_GRA2))
(attribute-aendern "0" "0" "" (rtos (- L2 565)) "" block-kennung ""
(strcat " L=" (rtos (- L2 565))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
)
(defun geometrie-400()
;-----------------------------------------
; Abst„nde analysieren und Elemente setzen
;-----------------------------------------
;***************
; L1 bearbeiten
;***************
(if (= ABSCHLUSS "B")
(progn
(cond
(
(< L1 270)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45400l5") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45400r5") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "" " SONDER IN (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 190)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 190)))
(command "_line" PT01 PT3 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L1 270) (<= L1 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45400l5") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45400r5") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 270)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 270)))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT3 "0.5" "0.5" (rtos WINK_GRA1))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT01 (- L1 270) "1" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos (- L1 270)) "" block-kennung ""
(strcat " L=" (rtos (- L1 270))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
) ;----end PROGN
) ;---- endif ABSCHLUSS="B"
;***************
; L2 bearbeiten
;***************
(cond
(
(< L2 565)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (> L2 268)
(progn
(setq PT4 (polar PT0 WINK_RAD2 268))
(command "_line" PT02 PT4 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L2 565) (<= L2 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (> L2 565)
(progn
(setq PT4 (polar PT0 WINK_RAD2 565))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT4 "0.5" "0.5" (rtos WINK_GRA2))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT4 (- L2 565) "1" (rtos WINK_GRA2))
(attribute-aendern "0" "0" "" (rtos (- L2 565)) "" block-kennung ""
(strcat " L=" (rtos (- L2 565))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
)
(defun geometrie-175()
;-----------------------------------------
; Abst„nde analysieren und Elemente setzen
;-----------------------------------------
;***************
; L1 bearbeiten
;***************
(if (= ABSCHLUSS "W")
(progn
(cond
(
(< L1 250)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/w45175l3") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/w45175r3") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 170)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 170)))
(command "_line" PT01 PT3 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L1 250) (<= L1 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/w45175l4") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/w45175r4") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 250)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 250)))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT3 "0.5" "0.5" (rtos WINK_GRA1))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT01 (- L1 250) "1" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos (- L1 250)) "" block-kennung ""
(strcat " L=" (rtos (- L1 250))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
) ;----end PROGN
) ;---- endif ABSCHLUSS="W"
(if (= ABSCHLUSS "B")
(progn
(cond
(
(< L1 250)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45175l4") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45175r4") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" (rtos L1) "" block-kennung "" " SONDER IN (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 190)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 190)))
(command "_line" PT01 PT3 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L1 250) (<= L1 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (= RICHTUNG "L")
(command "_insert" (strcat lw "/acadsst/layout/s45175l4") PT0 "" "" (rtos WINK_GRA1))
(command "_insert" (strcat lw "/acadsst/layout/s45175r4") PT0 "" "" (rtos WINK_GRA1))
)
(attribute-aendern "0" "0" "" "" "" block-kennung "" " (BG)" "" "")
(ssadd (entlast) auswahl-satz)
(if (> L1 250)
(progn
(setq PT3 (polar PT01 WINK_RAD1 (- L1 250)))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT3 "0.5" "0.5" (rtos WINK_GRA1))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT01 (- L1 250) "1" (rtos WINK_GRA1))
(attribute-aendern "0" "0" "" (rtos (- L1 250)) "" block-kennung ""
(strcat " L=" (rtos (- L1 250))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
) ;----end PROGN
) ;---- endif ABSCHLUSS="B"
;***************
; L2 bearbeiten
;***************
(cond
(
(< L2 565)
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(if (> L2 148)
(progn
(setq PT4 (polar PT0 WINK_RAD2 148))
(command "_line" PT02 PT4 "")
(ssadd (entlast) auswahl-satz)
)
)
)
(
(and (>= L2 565) (<= L2 1800))
(command "_layer" "_m" "L-3" "_c" "3" "" "")
(if (> L2 565)
(progn
(setq PT4 (polar PT0 WINK_RAD2 565))
(command "_insert" (strcat lw "/acadsst/layout/verbind") PT4 "0.5" "0.5" (rtos WINK_GRA2))
(ssadd (entlast) auswahl-satz)
(command "_insert" (strcat lw "/acadsst/layout/stbg") PT4 (- L2 565) "1" (rtos WINK_GRA2))
(attribute-aendern "0" "0" "" (rtos (- L2 565)) "" block-kennung ""
(strcat " L=" (rtos (- L2 565))) "" "")
(ssadd (entlast) auswahl-satz)
)
)
)
) ; endcond
)
;-------------------
(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_BEM1 (- WINK_RAD1 (/ pi 2)))
(setq WINK_BEM1 (+ WINK_RAD1 (/ pi 2)))
)
(if (= RICHTUNG "L")
(setq WINK_BEM2 (- WINK_RAD2 (/ pi 2)))
(setq WINK_BEM2 (+ WINK_RAD2 (/ pi 2)))
)
(command "_align" PT01 PT0 (polar PT01 WINK_BEM1 200) "")
(command "_align" PT0 PT02 (polar PT0 WINK_BEM2 200) "")
(command "_exit")
(command "_layer" "_m" "L-3" "_c" "3" "" "")
)
;------------------------------------------------------------------------------
(defun c:l_bg_w45 ( / PT0 PT01 PT02 PT3 PT4 RADIUS RICHTUNG
ABSCHLUSS WINK_RAD1 WINK_RAD2 WINK_GRA1 WINK_GRA2)
(setvar "limcheck" 0)
(prompt "**** BG oder Sonder aus Weiche/STBL - links oder rechts *******")
(prompt "")
(if (null m_RA) (setq m_RA "RA_1")) ; Radius 650
(if (null m_RI) (setq m_RI "RI_L")) ; Links
(if (null m_WB) (setq m_WB "WB_W")) ; Weiche
(if (null m_BEMASSEN) (setq m_BEMASSEN "1")) ; mit Bemaáung
(dbox)
(datain)
(if (= ABSCHLUSS "W")
(setq ART "** BG W")
(setq ART "** MG STBL")
)
(if (= RADIUS 1)
(progn
(geometrie-650)
(setq RAD " R650")
(if (or (< L1 800) (< L2 800))
(setq BEZ (strcat ART " (SONDER)" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
(setq BEZ (strcat ART "+ST" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
)
)
)
(if (= RADIUS 2)
(progn
(geometrie-400)
(setq RAD " R400")
(if (or (< L1 500) (< L2 500))
(setq BEZ (strcat ART " (SONDER)" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
(setq BEZ (strcat ART "+ST" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
)
)
)
(if (= RADIUS 3)
(progn
(geometrie-175)
(setq RAD " R175")
(if (or (< L1 400) (< L2 400))
(setq BEZ (strcat ART " (SONDER)" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
(setq BEZ (strcat ART "+ST" RAD "/45-" RICHTUNG " L=" (rtos L1) "-" (rtos L2)))
)
)
)
(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
(if (= m_BEMASSEN "1")
(bemassung)
)
(setvar "osmode" ALTFANG)
)
;------------------------------------------------------------------------------