- (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(length pts1))
- (setq x (nth i pts1))
- (while (< m(length pts2))
- (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(not pts1)(setq i (1+ i)))
- (if(not pts2)(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
- (setq dxf10 (nth n lst1))
- (setq fglst1 (append fglst1 (list dxf10 )))
- (setq n (1+ n))
- )
- (setq fglst (append fglst (list fglst1 )))
- (setq fglst1 nil)
- (setq i(1+ i))
- )
- )
|