试试
- (defun c:test ( )
- (defun xty-get-plptlist (en /)
- (mapcar 'cdr
- (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget en))
- )
- )
- (setq en1 (vlax-ename->vla-object (car (entsel "\n原状:")))
- en2 (car (entsel "\n匹配:"))
- lst (xty-get-plptlist en2)
- n (fix (vlax-curve-getendparam en1))
- i 0
- )
- (repeat n
- (setq pt (vlax-curve-getpointatparam en1 i)
- pt (car
- (vl-sort lst
- '(lambda (x y) (< (distance pt x) (distance pt y)))
- )
- )
- )
- (vla-put-coordinate
- en1
- i
- (vlax-safearray-fill
- (vlax-make-safearray vlax-vbDouble '(0 . 1))
- (list (car pt) (cadr pt))
- )
- )
- (setq i (1+ i))
- )
- )
|