I wrote a lisp program which creates a selection set using ssget. Then I use the bounding box commands to get the lowest point of that selection set. Now I want to move that selection set as a whole using the vla-move command. I am having trouble doing this. Is this possible? Can we vla-move a selection set? Is there a workaround? Thanks.
It should I just tried this and it worked.
(vla-move myCircle maxpoint minpoint)
You just need to adjust the variables to what you are using.
If you show your codes that would be much better , anyway here is one way of using vla-move function .
(vla-move (vla-object) (vlax-3d-point p1) (vlax-3d-point p2))
I guess according to what you have said , your codes did not work maybe because you did not converted them to vla .
Tharwat
@mike wrote:I wrote a lisp program which creates a selection set using ssget. .... Now I want to move that selection set as a whole using the vla-move command. I am having trouble doing this. Is this possible? Can we vla-move a selection set? Is there a workaround? ....
It seems (vla-move) wants a single VLA object. Selection sets can apparently only contain entity names [at least, (ssadd) won't add a VLA object to a selection set]. So it looks to me like it isn't possible, directly.
The workaround that comes to mind, if you must use (vla-move), is to make the selection set into a list of VLA objects, and (vla-move) them all individually from the list. [For a lark, I tried (vla-move) on a whole list of VLA objects all together, and that didn't work, either.]
Or, use Move in a (command) or (vl-cmdf) function, which can move a selection set all together.
The (vla-Move...) function is different from the "MOVE" command. Its actually a method of an Entity-type object, therefore you need to call it for each entity in turn (after you convert it to a vla-type object, of course). You could accomplish this by looping over the contents of the selection set, in turn converting each entity and then calling the Move method. If you are doing other things with the entities in the selection set, it might make more sense to convert that selection set to a list of vla-type objects first then work the list for each set of operations needed to save the overhead of converting entities each time.
(if
(and (setq p1 (getpoint "\n Specify Base point :")) (setq p2 (getpoint "\n Specify Next point :")) (setq ss (ssget "_:L")) ) (repeat (setq i (sslength ss)) (vla-move (vlax-ename->vla-object (ssname ss (setq i (1- i)))) (vlax-3d-point p1) (vlax-3d-point p2)) ) (princ) )
Tharwat
This may be a little more efficient:
(defun c:test ( / p1 p2 sel ) (if (and (ssget "_:L") (setq p1 (getpoint "\nBase Point: ")) (setq p2 (getpoint p1 "\nDisplacement: ")) ) (progn (setq p1 (vlax-3D-point (trans p1 1 0)) p2 (vlax-3D-point (trans p2 1 0)) ) (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (vla-move obj p1 p2) ) (vla-delete sel) ) ) (princ) )
(vl-load-com)
Really very clever and efficient your codes below Lee ....
(vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (vla-move obj p1 p2) ) (vla-delete sel)