(defun c:Test (/ s sn l i d lst p a b j k ss) ;; Tharwat 15. may. 2014 ;; (princ "\n Select a 2Dpolyline ...") (if (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE")))) (progn (setq l (vlax-curve-getdistatparam (setq sn (ssname s 0)) (fix (vlax-curve-getendparam sn))) i (/ l 1000.) d i ) (repeat 1000 (setq lst (cons (vlax-curve-getpointatdist sn i) lst) i (+ i d) ) ) (setq p (mapcar 'cdr (vl-remove-if-not '(lambda (x) (eq (car x) 10)) (entget sn))) a (mapcar 'car p) b (mapcar 'cadr p) j (/ (apply '+ a) (length a)) k (/ (apply '+ b) (length b)) ) (if (setq ss (ssget "_CP" lst '((0 . "CIRCLE")))) ((lambda (x / n e) (while (setq n (ssname ss (setq x (1+ x)))) (if (vlax-write-enabled-p (vlax-ename->vla-object n)) (entmod (subst (cons 10 (list j k 0.)) (assoc 10 (setq e (entget n))) e)) ) ) ) -1 ) ) ) ) (princ))(vl-load-com)
First we select a polyline then write the codes to make a list of point along the selected polyline so after that we can a selection set with the help with these point to select only circle as shown in the feed code for the ssget function , so if circles found we get the centeriod point of the polyline then update the center of each circle to that point .