Move 3d object

Move 3d object

Langephd
Participant Participant
1,180 Views
2 Replies
Message 1 of 3

Move 3d object

Langephd
Participant
Participant

Is it possible to move 3D objects with vl-cmdf "._move"?

I draw a box and run this code:

 

(setq
ssobj (ssget)
pt1 '(0 0 0)
pt2 (getpoint pt1 "Move box to: ")
obj_0 (vlax-ename->vla-object (ssname ssobj 0))
obj_1 (vla-copy obj_0)
)
(vl-cmdf "._move" obj_1 pt1 pt2)

 

The result was an error:

; error: invalid data type or data overflow: #<VLA-OBJECT IAcad3DSolid 0000019752665f58>

 

Is it possible to 'move' a 3d solid with the move command?

Thanks for your advise.

JoJo

 

 

0 Likes
Accepted solutions (1)
1,181 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

@Langephd wrote:

Is it possible to move 3D objects with vl-cmdf "._move"?

….

(setq
   ….

  obj_0 (vlax-ename->vla-object (ssname ssobj 0))
  obj_1 (vla-copy obj_0)
)
(vl-cmdf "._move" obj_1 pt1 pt2)

The result was an error:  ….  Is it possible to 'move' a 3d solid with the move command?....


The trouble is not that it's a 3D solid, but that you're using it as a VLA-object conversion rather than as an entity.  You should be able to do it, but giving it the entity name, not the VLA object.  Try using a Copy command [whether with (vl-cmdf) or (command)] rather than (vla-copy) to make the copy, and do it to the entity (ssname ssobj 0) [whether saved to a variable or directly] rather than on the VLA-object conversion of it, so the result is another entity version, and then Move that [which will be (entlast)].

Kent Cooper, AIA
0 Likes
Message 3 of 3

Langephd
Participant
Participant

Thank you Kent.

The not conversion of the entity does it.

Even not need of "move", just "copy",  something like this:

(setq
ssobj (ssget)
pt1 '(0 0 0)
pt2 (getpoint pt1 "Move box to: ")
obj_0 (ssname ssobj 0)
obj_1 (vl-cmdf "._copy" obj_0 "" pt1 pt2)
)

Thanks again.

JoJo

0 Likes