kwok
发表于 2014-9-14 11:57:54
杜阳 发表于 2014-9-14 11:09 static/image/common/back.gif
程序很实用但是里面存着一个问题就是,能不能换方向啊,假设一条直线利用程序继续画线的那个端点不是我 ...
用楼主的码弄一下,从点线的那端开始接着画线,希望楼主不要介意
有个问题不能输入c就闭合,一闭合就跟之前选中的en不能连接一体了,
高手再改进一下.
(defun c:tt ( / en ent en1 pt lw)
(command "undo" "be");;命令编组开始
(setq en(entsel "\n请点取要继续的多段线:"))
(setq pt (osnap (cadr en) "end"))
(setq ent (entget (car en)))
(if (= (cdr (assoc 0 ent)) "LWPOLYLINE")
(progn
(setq lw (cdr (assoc 43 ent)));实体全局线宽
(if (= lw nil) (setq lw (cdr (assoc 40 ent))));如果无实体全局线宽 则取起始线宽
(command ".pline"pt "w" lw lw)
(while(/=(getvar"cmdactive")0)(command pause))
(setq en1 (entlast))
(command "_matchprop"en en1 "")
(command "_join"en1 en "")
)
(alert "选择的不是多线段!")
)
(command "undo" "e")
(princ)
)
wzg356
发表于 2014-9-14 12:15:09
杜阳 发表于 2014-9-14 11:09 static/image/common/back.gif
程序很实用但是里面存着一个问题就是,能不能换方向啊,假设一条直线利用程序继续画线的那个端点不是我 ...
对线段反向的源码论坛资料里很多的呀,
杜阳
发表于 2014-9-14 15:55:09
kwok 发表于 2014-9-14 11:57 static/image/common/back.gif
用楼主的码弄一下,从点线的那端开始接着画线,希望楼主不要介意
有个问题不能输入c就闭合,一闭合就跟之 ...
你好,把你的这句(command "_join"en1 en "")改为
(Vl-Cmdf ".Pedit" en1 en "Yes" "J" "C" Pt1 Pt2 "" "" )
就连接在一起了但是处理还是不那么顺畅但是 是一条直线了我是刚学的 再深了 也解答不了
kwok
发表于 2014-9-15 11:35:16
wzg356 发表于 2014-9-14 12:15 static/image/common/back.gif
对线段反向的源码论坛资料里很多的呀,
输入c闭合的意思,如下图
wzg356
发表于 2014-9-15 11:41:24
本帖最后由 wzg356 于 2014-9-15 11:48 编辑
kwok 发表于 2014-9-15 11:35 static/image/common/back.gif
输入c闭合的意思,如下图
(command "pline"pt "w" lw lw);
(while(/=(getvar"cmdactive")0)(command pause))
该成下面的(假闭合)
(command "pline"pt "w" lw lw)
(while(/=(getvar"cmdactive")0)
(cond
((or(equal (grread t 8) '(2 67))(equal (grread t 8) '(2 99)))(command (car lst) ""));按下c/C键闭合
((= (car (grread t 8)) 11) (command ""));按下鼠标右键结束
(t (command pause))
)
)
kwok
发表于 2014-9-15 12:47:19
wzg356 发表于 2014-9-15 11:41 static/image/common/back.gif
(command "pline"pt "w" lw lw);
(while(/=(getvar"cmdactive")0)(command pause))
这个加不加都一样,不起作用,输入c后还是如14楼图片右边的图那样.
kwok
发表于 2014-9-15 12:48:22
wzg356 发表于 2014-9-15 11:41 static/image/common/back.gif
(command "pline"pt "w" lw lw);
(while(/=(getvar"cmdactive")0)(command pause))
这个加不加都一样,不起作用,输入c后还是如14楼图片右边的图那样.测试环境cad2008
wzg356
发表于 2014-9-15 13:35:55
kwok 发表于 2014-9-15 12:48 static/image/common/back.gif
这个加不加都一样,不起作用,输入c后还是如14楼图片右边的图那样.测试环境cad2008
我用的2006
USER2128
发表于 2014-9-15 15:55:23
kwok 发表于 2014-9-15 12:48 static/image/common/back.gif
这个加不加都一样,不起作用,输入c后还是如14楼图片右边的图那样.测试环境cad2008
;;;修改BY HLCAD.
(defun c:tt ( / en ent en1 pt lw)
(command "_.undo" "_be");;命令编组开始
(setq en(entsel "\n请点取要继续的多段线:"))
(setq pt (osnap (cadr en) "end"))
(setq ent (entget (car en)))
(if (= (cdr (assoc 0 ent)) "LWPOLYLINE")
(progn
(or (setq lw (cdr (assoc 43 ent)));实体全局线宽
(setq lw (cdr (assoc 40 ent)));如果无实体全局线宽 则取起始线宽
)
(command "_.pline"pt "w" lw lw)
(while (/= (getvar"cmdactive") 0) (command pause))
(setq en1 (entlast))
(command "_.matchprop"en en1 "")
(if (= (cdr (assoc 70 (entget (entlast)))) 0)
(command "_.join" en1 en "")
(progn
(command ".pedit" (list en1 (cadr en)) "_open" "")
(command ".pedit" en "_j" en1 "" "_cl" "")
)
)
)
(alert "选择的不是多线段!")
)
(command "_.undo" "_e")
(princ)
)
liuhaixin88
发表于 2014-9-16 17:42:26
(defun c:tt ( / en ent en1 pt lw)
(command "undo" "be");;命令编组开始
(setq en(entsel "\n请点取要继续的多段线:")
closep nil)
(setq pt (osnap (cadr en) "end"))
(setq ent (entget (car en)))
(if (= (cdr (assoc 0 ent)) "LWPOLYLINE")
(progn
(setq lw (cdr (assoc 43 ent)))
(if (= lw nil) (setq lw (cdr (assoc 40 ent))))
(command ".pline"pt "w" lw lw)
(while (and (/= (getvar"cmdactive") 0) (not closep))
(setq pnt (grread t))
(cond ((and (= 2 (car pnt)) (or (= (last pnt) 99) (= (last pnt) 67)))
(setq closep t) (command ""))
((and (= 2 (car pnt)) (or (= (last pnt) 32) (= (last pnt) 13)))
(command ""))
((= 3 (car pnt)) (command (last pnt))))
)
(setq en1 (entlast))
(command "_matchprop"en en1 "")
(command "_join"en1 en "")
(if closep (command "pedit" (entlast) "C" ""))
)
(alert "选择的不是多线段!")
)
(command "undo" "e")
(princ)
)