this is the most I have been able to do, don't know if I'm far away from a result or not, or if I'm thinking in the best way (probably not)
but here is what I got
(defun _ListDuplicateCounter (lst / c new)
;; Alan J. Thompson, 06.26.10
(foreach x lst
(if (setq c (assoc x new))
(setq new (subst (cons x (1+ (cdr c))) c new))
(setq new (append new (list (cons x 1))))
)
)
)
(defun c:pltest ()
(prompt "\nSelect Polyline to be changed:")
(setq pl1 (ssget))
(prompt "\nSelect Polyline to base from:")
(setq pl2 (ssget))
(setq lst1 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget (ssname pl1 0))))
lst2 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget (ssname pl2 0))))
num 0
num1 0
clpt nil
);setq
(repeat (length lst2)
(setq pt1 (nth num lst2)
ptdst (mapcar '(lambda (x) (list (distance pt1 x) pt1 x)) lst1)
ptdst (car (vl-sort ptdst '(lambda (x1 x2)(< (car x1)(car x2)))));first closest point
clpt (cons ptdst clpt)
num (+ 1 num)
);setq
);repeat
(setq clpt (vl-sort clpt '(lambda (x1 x2)(< (car x1)(car x2))));group of closest points
clpt2 (mapcar '(lambda (x) (last x)) clpt)
clpt2 (_ListDuplicateCounter clpt2);group of vertices which closest point is the same between them
);setq
);defun
it only outputs a list of the number of vertices which have a common repeated closest point to the polyline to be changed.
from here I don't know what to do but to guess which ones are the least distance to a certain tolerance and replace them in the polyline to be changed.
I'm far from being an expert.