10410024 发表于 2011-12-15 10:41:13

平行的多段线顶点相连

哪位高手能否编一个程序解决两条平行的多段线顶点相连问题啊。。如图所示。求助!

水仙的错 发表于 2019-9-6 19:07:27

能框选就完美了,哪位大师弥补下

tianbeiyuan 发表于 2019-11-23 20:25:39

很实用的程序啊正需要

水仙的错 发表于 2019-9-9 17:48:18

源码用不了

yan19851204 发表于 2011-12-15 11:40:00

求助版主!

yjr111 发表于 2011-12-15 12:03:30

(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))
)
)

yan19851204 发表于 2011-12-16 10:50:29

yjr111 发表于 2011-12-15 12:03 static/image/common/back.gif


高手,谢谢!

yoyoho 发表于 2011-12-16 11:06:51

程序实用学习了!

daidong013 发表于 2011-12-16 15:03:44

yjr111 发表于 2011-12-15 12:03 static/image/common/back.gif


朋友:改成框选的吧!更快捷!~~呵呵!~~

T_T 发表于 2012-1-13 20:51:39

很实用的程序谢谢

xingyun300 发表于 2012-3-10 11:15:04

本帖最后由 xingyun300 于 2012-3-10 11:18 编辑

是,能框选就好了!大侠,再改改呗!还有,能不能选择直线呢?不是平行的直线能完成这样的操作吗?

xingyun300 发表于 2012-3-10 21:03:27

顶上去,请高手改为框选!

vlisp2012 发表于 2012-3-11 10:00:56

在论坛收集后整理的3p线对应顶点连线程序。
页: [1] 2
查看完整版本: 平行的多段线顶点相连