平行的多段线顶点相连
哪位高手能否编一个程序解决两条平行的多段线顶点相连问题啊。。如图所示。求助!能框选就完美了,哪位大师弥补下 很实用的程序啊正需要
源码用不了 求助版主! (defun c:pxlj(/ e1 e2 vla_e1 vla_e2 pts1 pts2 fglst lst_dist&p)
(setq e1(car(entsel"\n 选择第一条曲线:"))
e2(car(entsel"\n 选择第二条曲线:"))
vla_e1(vlax-ename->vla-object e1)
vla_e2(vlax-ename->vla-object e2)
pts1(vlax-safearray->list(vlax-variant-value(vla-get-coordinates vla_e1)))
pts2(vlax-safearray->list(vlax-variant-value(vla-get-coordinates vla_e2)))
)
(fgb pts1)
(setq pts1 fglst fglst nil)
(fgb pts2)
(setq pts2 fglst fglst nil)
(setq i 0 m 0)
(while(< i(lengthpts1))
(setq x (nth i pts1))
(while (< m(lengthpts2))
(setq y (nth m pts2))
(setq lst_dist&p (append lst_dist&p (list(list x y (distance x y)))))
(setq m(1+ m))
)
(setq lst_dist&p(vl-sort lst_dist&p(function(lambda(x1 x2)(< (caddr x1)(caddr x2))))))
(command "line" (caar lst_dist&p)(cadar lst_dist&p) "")
(setq pts1(vl-remove (caar lst_dist&p) pts1)
pts2(vl-remove (cadar lst_dist&p) pts2)
)
(setq lst_dist&p nil)
(if(notpts1)(setq i (1+ i)))
(if(notpts2)(setq m (1+ m))(setq m 0))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;将表内元素每2个进行分割重新组表;;;;;;;;;;;;;;;;;;;;;;;;;
(defun fgb(lst1 / fglst1 dxf10 n)
(setq n 0 i 0)
(repeat (/(length lst1)2)
(repeat 2
(setqdxf10 (nth n lst1))
(setq fglst1 (append fglst1 (list dxf10 )))
(setq n (1+ n))
)
(setq fglst (appendfglst (list fglst1 )))
(setq fglst1 nil)
(setq i(1+ i))
)
)
yjr111 发表于 2011-12-15 12:03 static/image/common/back.gif
高手,谢谢! 程序实用学习了! yjr111 发表于 2011-12-15 12:03 static/image/common/back.gif
朋友:改成框选的吧!更快捷!~~呵呵!~~ 很实用的程序谢谢 本帖最后由 xingyun300 于 2012-3-10 11:18 编辑
是,能框选就好了!大侠,再改改呗!还有,能不能选择直线呢?不是平行的直线能完成这样的操作吗? 顶上去,请高手改为框选! 在论坛收集后整理的3p线对应顶点连线程序。
页:
[1]
2