home *** CD-ROM | disk | FTP | other *** search
- ;*******LP\LPMC.LSP****** 11-3-89 BJ
- (if (null ls1) (setq ls1 "ls1"))
- ;----------
- (defun C:LPMC ( )
- (if (listp ls1) (princ ls1) (mls1))
- (setq wcy 1)
- (while wcy
- (setq wxr (getint "\n 0.!ls1/1.mls1/2.CMC/3.Ldim/4.Lcopy
- <or RETURN for none>:"))
- (if (= wxr nil) (setq wcy nil))
- (if (= wxr 0) (print ls1))
- (if (= wxr 1) (mls1))
- (if (= wxr 2) (progn (p0af) (cmc)))
- (if (= wxr 3) (progn (p0af) (ldim)))
- (if (= wxr 4) (lcopy))
- )
- )
- ;**********
- (defun p0af ( )
- (if (null p0) (setq p0 (getpoint "enter point P0:"))
- (setq new (getpoint "enter point P0 <old P0>:")))
- (if new (setq p0 new))
- (if (null af) (setq af (* 0.5 pi) ra 90.0))
- (setq new (getangle (strcat "enter angle <" (rtos ra 2 1) ">:")))
- (if new (setq af new))
- ; (setq af (getangle "\n enter angle <90>:"))
- ; (if (null af) (setq af 90))
- (setq ra (* (/ af pi) 180.0))
- )
- ;----------
- (defun mls1 ( )
- (setq wxr 1 ls1 (list "ls1"))
- (if (= mmm "M") (prompt "\n *** !mmm=M *** ")
- (prompt "\n *** !mmm=MM *** "))
- (while wxr
- (setq ll (getreal "\n enter ll <or RETURN for none>:"))
- (if (null ll) (setq wxr nil) (setq ls1 (cons ll ls1)))
- )
- (setq ls1 (reverse ls1))
- )
- ;----------
- (defun ldim ( )
- (if (/= (getvar "clayer") "cc") (command "layer" "m" "cc" ""))
- (setvar "dimse1" 0) (setvar "dimse2" 0)
- (setq pcc (getpoint "enter point Pcc:"))
- (setq n 1 pt1 p0)
- (while n
- (setq dl (nth n ls1))
- (if (= dl nil) (setq n nil) (ldim0))
- )
- )
- (defun ldim0 ( )
- (setq pt2 (polar pt1 af dl))
- (if (> dl 0.0) (command "DIM1" "ALI" pt1 pt2 pcc "")
- (command "DIM1" "ALI" pt2 pt1 pcc ""))
- (setvar "dimse1" 1)
- (setq pt1 pt2)
- (setq n (+ n 1))
- )
- ;----------
- (defun hcopy ( )
- (setq ppp (ssget))
- (setq wxr 1 adl 0.0 n 1)
- (while wxr
- (setq dl (nth n ls1))
- (if (= dl nil) (setq wxr nil) (progn
- (setq adl (+ adl dl))
- (command "copy" ppp "" '(0.0 0 0) (list 0 0 adl))
- (setq n (1+ n)))
- )
- )
- )
- ;---------
- (defun lcopy ( )
- (setq ppp (ssget))
- (setq pb (getpoint "Base point:"))
- (setq wxr 1 adl 0.0 n 1)
- (command "copy" ppp "" pb p0)
- (while wxr
- (setq dl (nth n ls1))
- (if (= dl nil) (setq wxr nil) (progn
- (setq adl (+ adl dl))
- (command "copy" ppp "" pb (polar p0 af adl))
- (setq n (1+ n)))
- )
- )
- )
- ;-------------------------
- (defun cmc ( )
- ; (if (null ldmbg) (setq ldmbg (getvar "elevation")))
- ; (setq new (getreal (strcat "LDMBG <" (rtos ldmbg 2 2) ">:")))
- ; (if new (setq ldmbg new))
- ; (setvar "elevation" ldmbg)
- (setvar "thickness" 0.0)
- (if (= mmm "M") (prompt "\n *** !mmm=M ***")
- (prompt "\n *** !mmm=MM *** "))
- (setq d1 (getreal "enter real d1 <120>:"))
- (if (null d1) (setq d1 120.0))
- (setq d2 (getreal "enter real d2 <120>:"))
- (if (null d2) (setq d2 120.0))
- (setq ql (nth 1 ls1))
- (setq p1 (polar p0 af ql))
- (setq wxr 1 n 2)
- (while wxr
- (setq mcl (nth n ls1))
- (if (= mcl nil) (setq wxr nil) (progn (cmc0)
- (setq ql (nth (+ n 1) ls1))
- (if (/= ql nil) (setq p1 (polar p1 af (+ ql mcl))))
- (setq n (+ 2 n))))
- )
- )
- ;------
- (defun cmc0 (/ p)
- (setq bmcl (* 0.5 mcl))
- (setq p11 (polar p1 (+ af (* 0.5 pi)) d1))
- (setq p12 (polar p11 af mcl))
- (if (> (distance (getvar "viewctr") p12)
- (* 0.5 (getvar "viewsize")))
- (command "zoom" "c" (polar p1 af bmcl) ""))
- (setq p21 (polar p1 (+ af (* -0.5 pi)) d2))
- (setq p22 (polar p21 af mcl))
- (if (/= (getvar "clayer") "qc") (command "layer" "m" "qc" ""))
- (command "pline" p11 p21 "")
- (command "pline" p12 p22 "")
- (command "trim" "l" p1 "" (polar p11 af bmcl)
- (polar p21 af bmcl) "")
- (command "pedit" p1 "j" (polar p11 af (* -0.5 d1))
- (polar p21 af (* -0.5 d2)) "" "")
- (command "pedit" (polar p1 af mcl) "j" (polar p12 af (* 1.1 d1))
- (polar p22 af (* 1.1 d2)) "" "")
- (command "layer" "m" "mc" "")
- (setq p (polar p21 (+ af (* 0.5 pi)) (* 0.5 (+ d1 d2))))
- ; (if (= mmm "MM")
- ; (setq mcl0 (* mcl 0.001)) (setq mcl0 mcl))
- ; (setq mcdh (substr (getstring "Men/Cuang? <c>:") 1 1))
- ; (if (or (= mcdh "m") (= mcdh "M"))
- ; (setq mcdh "M") (setq mcdh "C"))
- ; (if (= mcdh "M") (pm-m) (pm-c))
- ; (pm-mc0)
- (pm-c)
- )
- ;------
- (defun pm-m ( )
- (if (null mdg) (setq mdg 2700.0))
- (setq new (getreal (strcat "enter MDG <" (rtos mdg 2 1) ">:")))
- (if new (setq mdg new)) (setq mch mdg)
- (if (< mcl0 1.1999) (cdm0))
- (if (and (> mcl0 1.1999) (< mcl0 2.3999)) (csm0))
- (if (> mcl0 2.3999) (c4sm0))
- )
- ;------
- (defun pm-c ( )
- ; (if (null ctg) (setq ctg 900.0))
- ; (setq new (getreal (strcat "enter CTG <" (rtos ctg 2 1) ">:")))
- ; (if new (setq ctg new))
- ; (if (null cdg) (setq cdg 1800.0))
- ; (setq new (getreal (strcat "enter CDG <" (rtos cdg 2 1) ">:")))
- ; (if new (setq cdg new)) (setq mch cdg)
- (command "line" p11 p12 "")
- (command "line" p21 p22 "")
- (command "line" p (polar p af mcl) "")
- )
- ;------
- (defun pm-mc0 ( )
- (setq mcl0s (rtos (* mcl0 10) 2 0))
- (if (= (strlen mcl0s) 1) (setq mcl0s (strcat "0" mcl0s)))
- (if (= mmm "MM")
- (setq mch0 (* mch 0.001)) (setq mch0 mch))
- (setq mch0s (rtos (* mch0 10) 2 0))
- (if (= (strlen mch0s) 1) (setq mch0s (strcat "0" mch0s)))
- (command "line" p (polar p af mcl) "")
- (if (= mcdh "M")
- (command "change" "l" "" "p" "elev" ldmbg "th" mch "lay" "3d" "")
- (command "change" "l" "" "p" "elev" (+ ldmbg ctg) "th" mch "lay" "3d" ""))
- (setq p (polar p21 af (* 0.5 mcl)))
- (setq p (polar p (+ af (* -0.5 pi)) (* 600 tb)))
- (setq mcdh0 (strcat mcdh mcl0s mch0s))
- (setq mcdh (getstring (strcat "enter MCDH <" mcdh0 ">:")))
- (if (= mcdh "") (setq mcdh mcdh0))
- (command "text" "c" p (* 250 tb) ra mcdh)
- (command "change" "l" "" "lay" "cc")
- (setq mcdh0 nil)
- )
- ;**********
- (defun C:CLEAN2 ( )
- (setq atomlist (member 'C:CLEAN2 atomlist))
- 'DONE2
- )
- (princ)