在楼主的要求下做了点修改,没能把生成的线变成pline线。对pline的命令不是很了解,有相关文章希望推荐一下下~ 多多指教
 - (defun c:bs (/ oldlayer o)
- (prompt "***单线变双线***")
- (command "undo" "be")
- (setq oldlayer (getvar "CLAYER"))
- (setvar "cmdecho" 0)
- (if (not (tblobjname "ltype" "Dashed"))
- (command "linetype" "l" "dashed" "" "")
- )
- (if (not (tblsearch "layer" "图层1"))
- (command "layer" "n" "图层1" "c" "2" "图层1" "")
- )
- (command "layer" "l" "dashed" "图层1" "")
- (if (not (tblsearch "layer" "管径"))
- (command "layer" "n" "管径" "c" "2" "管径" "")
- )
- (command "layer" "l" "Continuous" "管径" "")
- (command "layer" "lw" "30" "管径" "")
- (if dis
- (setq dis dis)
- (setq dis 1)
- )
- (prompt "\n请输入双线间的距离<") (princ dis) (prompt ">:") (terpri)
- (setq num (getreal ""))
- (if num
- (setq dis num)
- )
- (setq Lines (ssget '((0 . "LINE"))))
- (setq LineNum (sslength Lines))
- (setq i 0)
- (repeat LineNum
- (setq o (ssname Lines i))
- (command "change" o "" "p" "la" "图层1" "")
- (command "offset" (/ dis 2) o '(-9999999 -9999999) "")
- (setq l1 (entlast))
- (command "change" l1 "" "p" "la" "管径" "")
-
- (command "offset" (/ dis 2) o '(9999999 9999999) "")
- (setq l2 (entlast))
- (command "change" l2 "" "p" "la" "管径" "")
- (command "change" l2 "" "p" "LW" "30" "")
- (setq Line (entget o))
- (setq p10 (cdr (assoc 10 Line)))
- (setq p11 (cdr (assoc 11 Line)))
- (setq center (mapcar '* '(0.5 0.5 0.5) (mapcar '+ p10 p11)))
- (setq ss (ssadd))
- (ssadd o ss)
- (command "scale" ss "" center 1.5)
- (setq i (+ i 1))
- )
- (setvar "CLAYER" oldlayer)
- (command "undo" "e")
- )
|