Files

180 lines
5.7 KiB
Common Lisp

;------------------------------------------------------------------------;
; ST- zeichnen ;
; - Block \prog\acad\layout\ST.DWG setzen und den Gegebenheiten ;
; anpassen. ;
; - Anschlieáend mssen die Atribute ge„ndert werden ;
; -----------------------------------------------------------------------;
; AW 02.4.93 ;
;------------------------------------------------------------------------;
(defun datain ()
;-------------------------------------------------------
;>>>> Eingabeteil <<<<<<<
;-------------------------------------------------------
(setq ALTFANG (getvar "osmode"))
(initget (+ 1 2 4))
(setq P1 (getpoint "\n1. Punkt antippen: "))
(setq P2 (getpoint P1 "\n2. Punkt antippen: "))
(setvar "osmode" 0)
(initget "O M")
(setq AUSFUEHRUNG (getkword "\n(O)hne oder (M)it Leitblech (O/M) <O> ?: "))
(if (not AUSFUEHRUNG)
(setq AUSFUEHRUNG "O")
)
(setq AUSFUEHRUNG (strcase AUSFUEHRUNG))
(if (= AUSFUEHRUNG "O")
(setq NEV "ST ")
(setq NEV "STL ")
)
(initget "J N")
(setq ANTWORT (getkword "\nMuffe am 2.Endpunkt anschweiáen ? (J/N) <N>?: "))
(if (not ANTWORT)
(setq ANTWORT "N")
)
(setq ANTWORT (strcase ANTWORT))
)
(defun berechne()
;------------------------------------------------------
;<<<<< Berechnungen durchfhren >>>>>>>
;------------------------------------------------------
(setq LAENGE (* (fix (/ (distance P1 P2) 5)) 5))
(setq WINKEL (/ (* (angle P1 P2) 180) PI))
(if (> LAENGE 6000)
(exit)
)
;--------------------
; Endstcke berechnen
;--------------------
(setq ENDST (- LAENGE (* (fix (/ LAENGE 500)) 500)))
(if (and (>= ENDST 0) (< ENDST 160))
(progn
(setq M_END1 250)
(setq M_END2 (- (+ ENDST 500) M_END1))
)
)
(if (and (>= ENDST 160) (< ENDST 330))
(progn
(setq M_END1 (/ ENDST 2))
(setq M_END2 M_END1)
)
)
(if (and (>= ENDST 330) (<= ENDST 500))
(progn
(setq M_END1 250)
(setq M_END2 (- ENDST M_END1))
)
)
)
(defun geometrie()
;----------------------------------------------------------
;<<<<<< Bl”cke einfgen >>>>>>
;----------------------------------------------------------
(if (= AUSFUEHRUNG "O")
(command "_layer" "_m" "L-2" "_c" "2" "" "")
(command "_layer" "_m" "L-7" "_c" "7" "" "")
)
(command "_insert" (strcat lw "/acadsst/layout/st") P1 LAENGE "1" WINKEL)
(if (= AUSFUEHRUNG "O")
(progn
;--------------------------------------
;Artikel-Nr. abh„ngig von der L„nge ST
;--------------------------------------
(if (and (> LAENGE 0) (<= LAENGE 1000))
(setq M_ARTINR "821084001")
)
(if (and (> LAENGE 1000) (<= LAENGE 2000))
(setq M_ARTINR "821084002")
)
(if (and (> LAENGE 2000) (<= LAENGE 3000))
(setq M_ARTINR "821084003")
)
(if (and (> LAENGE 3000) (<= LAENGE 4000))
(setq M_ARTINR "821084004")
)
(if (and (> LAENGE 4000) (<= LAENGE 5000))
(setq M_ARTINR "821084005")
)
(if (and (> LAENGE 5000) (<= LAENGE 6000))
(setq M_ARTINR "821084006")
)
)
(progn
;----------------------------------------
;Artikel-Nr. abh„ngig von der L„nge STL
;----------------------------------------
(if (and (> LAENGE 0) (<= LAENGE 1000))
(setq M_ARTINR "821084051")
)
(if (and (> LAENGE 1000) (<= LAENGE 2000))
(setq M_ARTINR "821084052")
)
(if (and (> LAENGE 2000) (<= LAENGE 3000))
(setq M_ARTINR "821084053")
)
(if (and (> LAENGE 3000) (<= LAENGE 4000))
(setq M_ARTINR "821084054")
)
(if (and (> LAENGE 4000) (<= LAENGE 5000))
(setq M_ARTINR "821084055")
)
(if (and (> LAENGE 5000) (<= LAENGE 6000))
(setq M_ARTINR "821084056")
)
)
)
)
(defun BEMASSUNG ()
;---------
; Bemaáung
;---------
(command "_layer" "_m" "L-10" "_c" "10" "" "")
(command "_dim")
(command "_dimtad" "0")
(command "_dimtxt" "125")
(command "_dimasz" "40")
(command "_align" P1 P2 (polar P1 (- (angle P1 P2) (/ pi 2)) 200) (itoa LAENGE))
(command "_exit")
(command "_layer" "_m" "L-2" "_c" "2" "" "")
)
;-----------------------------------------------------------------
(defun c:stol ( / P1 P2 LAENGE WINKEL M_ARTINR ENDST M_END1 M_END2)
(setvar "limcheck" 0)
(prompt "******* ST / STL (Schraubtr„ger OHNE oder MIT Leitblech) *******")
(prompt "")
(datain)
(berechne)
(geometrie)
(if (= ANTWORT "J")
(attribute-aendern "0" "2" "1" (itoa LAENGE) (itoa M_END1) (itoa M_END2)
M_ARTINR (strcat NEV "L= " (itoa LAENGE) " + 1 MUFFE ANGESCHW."))
(attribute-aendern "0" "2" "1" (itoa LAENGE) (itoa M_END1) (itoa M_END2)
M_ARTINR (strcat NEV "L= " (itoa LAENGE)))
)
(setq P3 (polar P1 (+ (angle P1 P2) (/ pi 6)) 100))
(command "_text" P3 "100" WINKEL (strcat NEV "L=" (itoa LAENGE)))
(bemassung)
(if (= ANTWORT "J")
(progn
(command "_layer" "_m" "L-1" "_c" "1" "" "")
(command "_insert" (strcat lw "/acadsst/layout/muffe")
P2 "" "" (rtos WINKEL))
(attribute-aendern "0" "0" "" "" "" "" "825002017"
"MUFFE ANGESCHWEISST (ST)")
(if (= AUSFUEHRUNG "O")
(command "_layer" "_m" "L-2" "_c" "2" "" "")
(command "_layer" "_m" "L-7" "_c" "7" "" "")
)
)
)
(setvar "osmode" ALTFANG)
)
;------------------------------------------------------------------