- 积分
- 7669
- 明经币
- 个
- 注册时间
- 2017-2-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2021-12-31 17:57:00
|
显示全部楼层
(defun c:gp (/ *error* s2 n e ty wd index pt rad r1 r2 old_lay date1 ffg oos)
(setvar "cmdecho" 0)
(defun *error* (msg)
(if oos
(setvar "osmode" oos)
)
(if old_lay
(setvar "clayer" old_lay)
)
)
(setq oos (getvar "osmode"))
(setvar "osmode" 0)
(setq old_lay (getvar "clayer"))
(prompt "\n请选择要连接成多义线的线(line,arc,circle,lwpolyline)<退出>:")
(setq s2 (ssget '((-4 . "<AND") (0 . "LINE,LWPOLYLINE,ARC,CIRCLE")
(-4 . "AND>")
)
)
)
(if (/= s2 nil)
(progn
(setq date1 (getvar "CDATE"))
(setq wd (getdist "多义线宽度<0>:")
wd (if wd
wd
0
)
)
(setq n (sslength s2))
(setq index 0)
(repeat n
(setq e (ssname s2 index)
ent (entget e)
index (+ 1 index)
ty (assoc 0 ent)
)
(if (= "LWPOLYLINE" (cdr ty))
(progn
(command ".change" s2 "" "P" "C" "bylayer" "")
(setq ffg (cdr (assoc 70 ent)))
(if (= ffg 0)
(command ".pedit" e "j" s2 "" "w" wd "")
(command ".pedit" e "w" wd "")
)
)
)
(if (= "LINE" (cdr ty))
(progn
(command ".change" s2 "" "P" "C" "bylayer" "")
(command ".pedit" e "y" "j" s2 "" "w" wd "")
)
)
(if (= "CIRCLE" (cdr ty))
(progn
(setq pt (cdr (assoc 10 ent)))
(setq rad (cdr (assoc 40 ent)))
(setq r1 (- (* rad 2) wd))
(setq r2 (+ (* rad 2) wd))
(if (> wd (* 2 rad))
(progn
(setq r1 0)
(setq r2 (* rad 2))
)
)
(command ".change" s2 "" "P" "C" "bylayer" "")
(command "_donut" r1 r2 pt "")
(entdel e)
)
)
(if (= "ARC" (cdr ty))
(progn
(setq r1 (cdr (assoc 10 ent)))
(setq r2 (cdr (assoc 40 ent)))
(setq pt (cdr (assoc 50 ent)))
(setq rad (cdr (assoc 51 ent)))
(setq p1 (polar r1 pt r2))
(setq p2 (polar r1 rad r2))
(command ".change" s2 "" "P" "C" "bylayer" "")
(command "_pline" p1 "_w" wd wd "_a" "_ce" r1 p2 "")
(entdel e)
)
)
)
(setq n (itoa n)
wd (rtos wd 2 0)
)
(prompt (strcat "\n共有\"" n "\"条线宽度变为\"" wd "\"的多义线。耗时\"" (rtos (* (- (getvar "CDATE") date1) 86400) 2 3)
"\"秒。"
)
)
)
)
(command "_clayer" old_lay)
(setvar "osmode" oos)
(setvar "cmdecho" 1)
(princ)
)
这个线宽不支持40 |
|