Incremental Move Multiple Selected Objects

Incremental Move Multiple Selected Objects

rvtquestions
Advocate Advocate
917 Views
1 Reply
Message 1 of 2

Incremental Move Multiple Selected Objects

rvtquestions
Advocate
Advocate

A simple request to know if there are any existing lisps or addins that include a function to incrementally move multiple select objects? To clarify, say there are multiple objects in the same spot, could be a bunch of lines, devices, hatches, etc., I would like to move all those objects by a factor of X.

 

| to | | | | | | | |

 

In pseudo code,

- Select Objects

- Define X

- For each object in Objects, move by X * I for which (I=1, I+=1)

so first object moves X, second moves X*2, third moves X*3. Essentially like an array but instead of creating new instances, there already is an existing group of objects that need to be arranged.

0 Likes
918 Views
1 Reply
Reply (1)
Message 2 of 2

ВeekeeCZ
Consultant
Consultant

I would think that you might want to keep the first one on place... but here you go...

 

(vl-load-com)

(defun c:MoveX (/ s x i)
  
  (if (and (setq s (ssget "_:L"))
	   (setq x (getdist "\nDelta X: "))
	   (setq i -1)
	   )
    (progn
      (vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
      (repeat (sslength s)
	(command "_.move" (ssname s (setq i (1+ i))) "" "_non" '(0 0) "_non" (list (* (1+ i) x) 0)))
      (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))))
  (princ)
  )
0 Likes