发布于:2013-04-14 01:37:14
来自:建筑设计/CAD下载及教程
[复制转发]
本帖最后由 abc3446002 于 2013-4-14 01:37 编辑
要求:1.无论是1,2,3级板筋都指定改成8里的钢筋,如%%1306@100(2),%%13110@100(2)%%13212@100(2)都能直接改成%%1308@100(2),%%1318@100(2)%%1328@100(2)。
2.改线宽lsp,要求一步到位。比如我需要的是100宽的线。无论是直线,PL线,圆弧(可能的话,还有圆,样条曲线,椭圆等(应该难实现))都能直接改成100.不需要再去选择和输入线宽等。
希望热爱lsp的帮帮忙!!!
全部回复(13 )
只看楼主 我来说两句(defun C:pn (/ p l n e q w a m b layer0 color0 linetype0 layer1 color1 linetype1 rad-out rad-in)
(setq oldblp (getvar "blipmode")
oldech (getvar "cmdecho")
olderr *error*
linetype1 (getvar "celtype")
layer1 (getvar "clayer")
color1 (getvar "cecolor")
)
(setvar "blipmode" 0)
(setvar "cmdecho" 0)
(defun *error* (msg)
(princ "\n")
(princ msg)
(setvar "blipmode" oldblp)
(setvar "cmdecho" oldech)
(setq *error* olderr)
(princ)
)
(prompt "\n请选择要改变宽度的线,弧,圆及多义线.")
(setq p (ssget))
(setq w (getreal "\n请输入宽度<50>:"))
(if (not w) (setq w 50))
(setq l 0 m 0 n (sslength p))
(while (< l n)
(setq q (ssname p l))
(setq ent (entget q))
(setq b (cdr (assoc 0 ent)))
(if (member b '("LINE" "ARC"))
(progn
(command "PEDIT" q "y" "w" w "x")
(setq m (+ 1 m))
)
)
(if (= "LWPOLYLINE" b)
(progn
(command "PEDIT" q "w" w "x")
(setq m (+ 1 m))
)
)
(if (= "CIRCLE" b)
(progn
(if (assoc 6 ent) (setq linetype0 (cdr (assoc 6 ent))) (setq linetype0 "bylayer"))
(setq layer0 (cdr (assoc 8 ent)))
(if (assoc 62 ent) (setq color0 (cdr (assoc 62 ent))) (setq color0 "bylayer"))
(setq center0 (cdr (assoc 10 ent)))
(setq radius0 (cdr (assoc 40 ent)))
(setq diameter0 (* 2 radius0))
(entdel q)
(command "color" color0)
(command "layer" "s" layer0 "")
(command "linetype" "s" linetype0 "")
(if (> w diameter0)
(progn
(princ "\n\t 因线宽大于圆的直径,故将该圆填充")
(princ)
(setq rad-out (* 2 radius0)
rad-in 0
)
)
)
(if (<= w diameter0)
(progn
(setq rad-out (+ (* 2 radius0) w)
rad-in (- (* 2 radius0) w)
)
)
)
(command "donut" rad-in rad-out center0 "")
(setq m (+ 1 m))
)
)
(setq l (+ 1 l))
)
(if (= 0 m)
(progn
(princ "\n\t 没有任何线,弧,圆及多义线被选中")
(princ)
)
)
(setvar "blipmode" oldblp)
(setvar "cmdecho" oldech)
(setq *error* olderr)
(command "color" color1)
(command "layer" "s" layer1 "")
(command "linetype" "s" linetype1 "")
(princ)
)
(princ)
回复 举报
快捷键:ss
回复 举报