home *** CD-ROM | disk | FTP | other *** search
- (setq dat "CCC=1800*1800" whight "900")
-
- (defun iswinerr(s)
- (if (/= s "Function cancelled")
- (princ (strcat "\nError:" s))
- )
- (setvar "osmode" 0)
- (command "layer" "s" "0" "")
- (setvar "cmdecho" 1)
- (setq *error* oer)
- (princ)
- )
-
- (defun instr(st s0 s00 / l n loop x n0 l0)
- (setq l (+ (- (strlen s0) st) 1) l0 0 n0 st n 1 loop t)
- (while (and (<= n l) loop)
- (setq x (substr s0 n0 1))
- (if (eq x s00) (setq loop nil l0 n0) (setq n0 (1+ n0) n (1+ n)))
- )
- (eval l0)
- )
-
- (defun strdv(rn / loop l x)
- (setq wlist nil loop t)
- (while loop
- (setq l (instr 1 rn " "))
- (if (= l 0) (setq wlist (cons rn wlist) loop nil)
- (progn ;else
- (setq x (substr rn 1 (1- l)))
- (setq wlist (cons x wlist))
- (setq rn (substr rn (1+ l) (- (strlen rn) l)))
- (setq loop t)
- )
- )
- )
- (setq wlist (reverse wlist))
- )
-
- (defun chkmc(c / l0 l1 l2 xh wd hgt ch)
- (setq wlt nil)
- (if (and (> (setq l0 (instr 1 c "=")) 0) (> (setq l1 (instr 1 c "*")) 0) (> l1 l0) (= (instr 1 c "@") 0)) (progn
- (setq xh (substr c 1 (- l0 1)) wd (substr c (+ l0 1) (- l1 l0 1)) hgt (substr c (+ l1 1)))
- (if (and (findfile (strcat xh ".dwg"))(> (atoi wd) 0) (> (atoi hgt) 0) (> (strlen c) l1))(setq lop nil wlt (list xh wd hgt)) (princ "*├┼┤░╩²╛▌╙╨┤φ*"))) (princ "*├┼┤░╩²╛▌│÷┤φ*"))
- )
-
- (defun c:iswin(/ oer thns lop x x1 wh bn sx sy sz sz0 whigh wwidth loop ssn entl ent1 entp ss en ename elay p1 ths bulge
- wth ent2 ent p2 sp ep ang1 ang2 angm pi2 ssbl ssal sp1 ep1 sp2 ep2 sp3 ep3 sp4 ep4 att att1 insp1 insp2 bln1 bln2 bln p3 p4
- p5 p6 ip ang cen r bln bnn sz0 entnx ennx)
- (setvar "cmdecho" 0)
- (setq oer *error* *error* iswinerr)
- (setq thns (getvar "thickness"))
- (setq lop t)
- (while lop
- (initget "Hight")
- (princ "\n┤░╠¿╕▀H/├┼┤░╩²╛▌ <")
- (princ dat)
- (setq x (getstring ">: "))
- (cond ((= (strcase x) "H") (princ "\n┤░╠¿╕▀ <")
- (princ whight)
- (setq x1 (getstring ">: "))
- (if (/= x1 "") (setq whight x1))
- )
- (t (if (/= x "") (setq dat x))
- (chkmc dat)
- ))
- ) ;endwhile
- (setq wh (atoi whight) bn (nth 0 wlt) sx (/ (setq wwidth (atoi (nth 1 wlt))) 100.0) sz (/ (setq whigh (atoi (nth 2 wlt))) 100.0))
- (setq loop t)
- (while loop
- (setq ssn (nentsel "\nSelect wall: "))
- (if ssn (progn
- (if (= (length ssn) 2)(setq ent1 (car ssn) entp (cadr ssn) ss (entget (ssname (ssget entp) 0))) (setq ent1 (car (last ssn))))
- (setq en (entget ent1) ename (cdr (assoc 0 en)) elay (cdr (assoc 8 en)))
- (cond ((= ename "VERTEX")
- (setq p1 (cdr (assoc 10 (entget ent1))) ths (cdr (assoc 39 (entget ent1))))
- (setq bulge (cdr (assoc 42 (entget ent1))))
- (setq wth (fix (+ 0.5 (cdr (assoc 40 (entget ent1)))))) (if (or (= (strcase bn) "MMH")(= (strcase (substr bn 1 2)) "CC")) (setq sy (/ wth 10.0)) (setq sy sx))
- (if (= ths nil) (setq ths 0) (setq ths (fix (+ ths 0.5))))
- (setq ent2 (entnext ent1))
- (setq ename (cdr (assoc 0 (entget ent2))))
- (if (= "SEQEND" ename) (progn
- (setq ent (entget (entnext (cdr (assoc -2 (entget ent2))))))
- (setq p2 (cdr (assoc 10 ent))) )
- (setq p2 (cdr (assoc 10 (entget ent2))))
- )
- (while (/= "SEQEND" (cdr (assoc 0 (entget ent2))))
- (setq ent2 (entnext ent2))
- )
- (setq ent1 (cdr (assoc -2 (entget ent2))))
- (cond ((equal entp p1)
- (setq sp (getpoint entp "\nLast point:"))
- (setq ep (getpoint entp "\nNext point:"))
- (setq ang1 (angle sp p1) ang2 (angle p1 ep))
- (setq angm (- ang2 ang1))
- (if (< angm 0) (setq angm (+ ang2 (/ (+ (* 2 pi) angm) 2.0))) (setq angm (+ ang2 (/ angm 2.0))))
- (setq pi2 (/ pi 2.0) ssbl nil ssbl (ssadd) ssal nil ssal (ssadd))
- (setq sp1 (polar sp (+ ang1 pi2) (+ (/ wth 2.0) 1)))
- (setq ep1 (polar p1 (+ ang1 pi2) (+ (/ wth 2.0) 1)))
- (setq sp3 (polar p1 (+ ang2 pi2) (+ (/ wth 2.0) 1)))
- (setq ep3 (polar ep (+ ang2 pi2) (+ (/ wth 2.0) 1)))
- (setq ep1 (inters sp1 ep1 sp3 ep3 nil) sp3 ep1)
- (setq sp2 (polar sp (- ang1 pi2) (+ (/ wth 2.0) 1)))
- (setq ep2 (polar p1 (- ang1 pi2) (+ (/ wth 2.0) 1)))
- (setq sp4 (polar p1 (- ang2 pi2) (+ (/ wth 2.0) 1)))
- (setq ep4 (polar ep (- ang2 pi2) (+ (/ wth 2.0) 1)))
- (setq ep2 (inters sp2 ep2 sp4 ep4 nil) sp4 ep2)
- (setvar "elevation" 0)
- (setvar "thickness" 100.0)
- (command "color" 2)
- (command "pline" ep1 "w" 0 0 sp1 sp2 ep2 "")
- (ssadd (entlast) ssal)
- (setq att1 (strcat (rtos (car sp1) 2 2) " " (rtos (cadr sp1) 2 2) " " (rtos (car sp2) 2 2) " " (rtos (cadr sp2) 2 2) " " (rtos (car ep2) 2 2) " " (rtos (cadr ep2) 2 2) " " (rtos (car ep1) 2 2) " " (rtos (cadr ep1) 2 2) " " (rtos ang1 2 4)))
- (command "pline" sp4 "w" 0 0 ep4 ep3 sp3 "")
- (ssadd (entlast) ssbl)
- (setq att2 (strcat (rtos (car sp3) 2 2) " " (rtos (cadr sp3) 2 2) " " (rtos (car sp4) 2 2) " " (rtos (cadr sp4) 2 2) " " (rtos (car ep4) 2 2) " " (rtos (cadr ep4) 2 2) " " (rtos (car ep3) 2 2) " " (rtos (cadr ep3) 2 2) " " (rtos ang2 2 4)))
- (setq sp1 (polar sp (+ ang1 pi2) (/ wth 6.0)))
- (setq ep1 (polar p1 (+ ang1 pi2) (/ wth 6.0)))
- (setq sp3 (polar p1 (+ ang2 pi2) (/ wth 6.0)))
- (setq ep3 (polar ep (+ ang2 pi2) (/ wth 6.0)))
- (setq ep1 (inters sp1 ep1 sp3 ep3 nil) sp3 ep1)
- (setq sp2 (polar sp (- ang1 pi2) (/ wth 6.0)))
- (setq ep2 (polar p1 (- ang1 pi2) (/ wth 6.0)))
- (setq sp4 (polar p1 (- ang2 pi2) (/ wth 6.0)))
- (setq ep4 (polar ep (- ang2 pi2) (/ wth 6.0)))
- (setq ep2 (inters sp2 ep2 sp4 ep4 nil) sp4 ep2)
- (setq insp1 (inters sp1 ep2 sp2 ep1) insp2 (inters sp4 ep3 sp3 ep4))
- (setvar "thickness" 0)
- (command "pline" sp1 ep1 "")(ssadd (entlast) ssal)
- (command "pline" sp2 ep2 "")(ssadd (entlast) ssal)
- (command "pline" sp3 ep3 "")(ssadd (entlast) ssbl)
- (command "pline" sp4 ep4 "")(ssadd (entlast) ssbl)
- (setvar "aflags" 1)
- (command "attdef" "" "h" "" "" p1 (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssal)
- (command "attdef" "" "h1" "" "" p1 (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssal)
- (command "attdef" "" "h" "" "" p1 (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssbl)
- (command "attdef" "" "h1" "" "" p1 (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssbl)
- (setq bln1 (strcat "CCZ" (rtos (car sp) 2 0) (rtos (cadr sp) 2 0)))
- (setq bln2 (strcat "CCZ" (rtos (car ep) 2 0) (rtos (cadr ep) 2 0)))
- (setvar "expert" 2)
- (command "block" bln1 insp1 ssal "")
- (command "block" bln2 insp2 ssbl "")
- (setvar "expert" 0)
- (command "layer" "m" "pwindow" "")
- (setq att (strcat (itoa ths) " " (itoa wth)))
- (command "insert" bln1 (list (car insp1) (cadr insp1) wh) "xyz" 1 1 sz 0 att att1)
- (command "insert" bln2 (list (car insp2) (cadr insp2) wh) "xyz" 1 1 sz 0 att att2)
- (command "color" "bylayer")
- ) ;cz
- (T (if (= bulge 0) (progn
- (setq ang (angle p1 p2))
- (command "insert" bn "x" sx "y" sy "z" sz "r" (/ (* 180 ang) pi) pause 0)
- (setq entl (entlast))
- (setq ip (cdr (assoc 10 (entget entl))))
- (entdel entl)
- (setq ip (inters ip (polar ip (+ ang 1.57079) 50) p1 p2 nil))
- (setq p3 (polar ip (+ ang pi) (/ wwidth 2.0)) p4 (polar ip ang (/ wwidth 2.0)))
- (setq pi2 (/ pi 2.0))
- (if (= (substr (strcase bn) 1 2) "MM")(command "break" ent1 p3 p4))
- (setq p5 (polar p3 (+ ang pi2) (/ wth 2.0)) p7 (polar p4 (+ ang pi2) (/ wth 2.0)))
- (setq p6 (polar p3 (- ang pi2) (/ wth 2.0)) p8 (polar p4 (- ang pi2) (/ wth 2.0)))
- (if (= (substr (strcase bn) 1 2) "CC") (setq ip (list (car ip) (cadr ip) wh)))
- ; (command "layer" "m" "pwall" "")
- ; (setvar "thickness" 0)
- ; (command "line" p5 p6 "")
- ; (command "line" p7 p8 "")
- (command "layer" "m" "pwindow" "")
- (setq att (strcat (itoa ths) " " (itoa wth)))(command "insert" bn "x" sx "y" sy "z" sz "r" (/ (* 180 ang) pi) ip att)
- ) ;endprogn bugle
- (progn ;<>0
- (setq ang (* 4 (atan bulge)) ang1 (angle p1 p2))
- (if (>= ang pi)
- (setq ang (- (angle p1 p2) (- (/ pi 2.0) (/ (- (* 2 pi) ang) 2.0))))
- (setq ang (+ (angle p1 p2) (- (/ pi 2.0) (/ ang 2.0))))
- )
- (if (equal (- (angle p1 p2) ang) 0) (setq r (/ (distance p1 p2) 2.0)) (setq r (/ (/ (distance p1 p2) 2.0) (cos (abs (- (angle p1 p2) ang))))))
- (setq cen (polar p1 ang r) r (abs r))
- (setq sp (getpoint cen "\nStart point: "))
- (setq ep (getpoint cen "\nEnd point: "))
- (setq ang1 (angle cen sp) ang2 (angle cen ep) angm (- ang2 ang1))
- (if (< angm 0) (setq angm (+ ang1 (/ (+ (* 2 pi) angm) 2.0))) (setq angm (+ ang1 (/ angm 2.0))))
- (setq ip (polar cen angm r))
- (if (= (strcase (substr bn 1 2)) "MM") (progn
- (setq sp (polar cen (setq ang1 (angle cen sp)) r))
- (setq ep (polar cen (setq ang2 (angle cen ep)) r))
- (setq sx (/ (distance sp ep) 100.0) sy sx)
- (command "break" ent1 sp ep)
- (command "layer" "m" "pwindow" "")
- (setq bln (strcat "CCAM" (rtos (car ip) 2 0) (rtos (cadr ip) 2 0)))
- (setq att (strcat (itoa ths) " " (itoa wth)))
- (setq att1 (strcat (rtos (car sp) 2 2) " " (rtos (cadr sp) 2 2) " " (rtos (car cen) 2 2) " " (rtos (cadr cen) 2 2) " " (rtos (car ep) 2 2) " " (rtos (cadr ep) 2 2)))
- (setq entl (entlast) ssbl nil ssbl (ssadd))
- (command "insert" bn ip "xyz" 1 1 1 0 att)
- (command "explode" (entlast))
- (while (/= (setq entl (entnext entl)) nil) (ssadd entl ssbl))
- (setvar "aflags" 1)
- (command "attdef" "" "h1" "" "" ip (* 3 (getvar "userr1")) 0)
- (ssadd (entlast) ssbl)
- (command "block" bln ip ssbl "")
- (command "insert" bln ip "xyz" sx sy sz (/ (* 180 (angle sp ep)) pi) att att1)
- )(progn
- (setq sp1 (polar cen ang1 (- r (/ wth 2.0) 2)))
- (setq ep1 (polar cen ang2 (- r (/ wth 2.0) 2)))
- (setq sp2 (polar cen ang1 (+ r (/ wth 2.0) 2)))
- (setq ep2 (polar cen ang2 (+ r (/ wth 2.0) 2)))
- (setvar "elevation" 0)
- (setvar "thickness" 100.0)
- (setq ssbl nil ssbl (ssadd) oldc (getvar "CECOLOR"))
- (command "color" 2)
- (command "arc" sp1 "c" cen ep1)
- (ssadd (entlast) ssbl)
- (command "arc" sp2 "c" cen ep2)
- (ssadd (entlast) ssbl)
- (command "line" sp1 sp2 "")
- (ssadd (entlast) ssbl)
- (command "line" ep1 ep2 "")
- (ssadd (entlast) ssbl)
- (setq sp3 (polar cen ang1 (- r (/ wth 6.0))))
- (setq ep3 (polar cen ang2 (- r (/ wth 6.0))))
- (setq sp4 (polar cen ang1 (+ r (/ wth 6.0))))
- (setq ep4 (polar cen ang2 (+ r (/ wth 6.0))))
- (setvar "thickness" 0)
- (command "arc" sp3 "c" cen ep3)
- (ssadd (entlast) ssbl)
- (command "arc" sp4 "c" cen ep4)
- (ssadd (entlast) ssbl)
- (setvar "aflags" 1)
- (command "attdef" "" "h" "" "" ip (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssbl)
- (command "attdef" "" "h1" "" "" ip (* (getvar "userr1") 3) 0)
- (ssadd (entlast) ssbl)
- (setq bln (strcat "CCA" (rtos (car ip) 2 0) (rtos (cadr ip) 2 0)))
- (command "block" bln ip ssbl "")
- (command "layer" "m" "pwindow" "")
- (setq att (strcat (itoa ths) " " (itoa wth)))
- (setq att1 (strcat (rtos (car sp) 2 2) " " (rtos (cadr sp) 2 2) " " (rtos (car cen) 2 2) " " (rtos (cadr cen) 2 2) " " (rtos (car ep) 2 2) " " (rtos (cadr ep) 2 2)))
- (command "insert" bln (list (car ip) (cadr ip) wh) "xyz" 1 1 sz 0 att att1)
- (command "color" "bylayer")
- )) ;if MMM
- )) ;if bulge
- )) ;end cond
- )
- ((and (= ename "INSERT") (= elay "PWINDOW"))
- (setq bnn (cdr (assoc 2 en)) ip (cdr (assoc 10 en)) sz0 (cdr (assoc 43 en)))
- (if (or (= (substr bnn 1 3) "CCA") (= (substr bnn 1 3) "CCZ")) (progn
- (setq entnx (entnext ent1) att (cdr (assoc 1 (setq ennx (entget entnx)))))
- (setq ths (atoi (substr att 1 (- (instr 1 att " ") 1))))
- (setq att (strcat (itoa wh) "$ " (substr att (+ (instr 1 att " ") 1))))
- (setq ennx (subst (cons 1 att) (assoc 1 ennx) ennx))
- (entmod ennx)
- (command "copy" ent1 "" ip (list (car ip) (cadr ip) wh))
- (setq entl (entlast) entnx (entnext entl))
- (setq en (entget entl) ennx (entget entnx) att (cdr (assoc 1 ennx)))
- (setq att (substr att (+ (instr 1 att " ") 1)))
- (setq att (strcat (itoa (- ths (+ whigh wh))) " " att " " (rtos (+ (last ip) (* sz0 100.0)) 2 0) "@"))
- (setq en (subst (cons 43 sz) (assoc 43 en) en))
- (entmod en)
- (setq ennx (subst (cons 1 att) (assoc 1 ennx) ennx))
- (entmod ennx)
- )(progn
- (setq sx (cdr (assoc 41 en)) ang (/ (* 180 (cdr (assoc 50 en))) pi))
- (setq entnx (entnext ent1) att (cdr (assoc 1 (setq ennx (entget entnx)))))
- (strdv att) (setq ths (atof (nth 0 wlist)) sy (/ (atof (nth 1 wlist)) 10.0))
- (setq ennx (subst (cons 1 (strcat (itoa wh) "$ " (nth 1 wlist))) (assoc 1 ennx) ennx))
- (entmod ennx)
- (setq att (strcat (rtos (- ths (+ whigh wh)) 2 0) " " (nth 1 wlist) " " (rtos (+ (last ip) (* sz0 100.0)) 2 0) "@"))
- (command "layer" "m" "pwindow" "")
- (command "insert" bn "x" sx "y" sy "z" sz "r" ang (list (car ip) (cadr ip) wh) att)
- ))
- )) ;end cond
- ) (setq loop nil))
- )
- (setq *error* oer)
- (command "layer" "s" "0" "")
- (setvar "cmdecho" 1)
- (setvar "thickness" thns)
- (princ)
- )
-
- (defun fixp(p)
- (setq p (list (fix (+ (car p) 0.5)) (fix (+ (cadr p) 0.5)) (fix (+ (caddr p) 0.5))))
- )