Emulate 3Drotate command

Emulate 3Drotate command

Anonymous
Not applicable
879 Views
4 Replies
Message 1 of 5

Emulate 3Drotate command

Anonymous
Not applicable

Hey there, quick question.

 

What I am trying to do is emulate the 3d rotate command to "stand up" an object, by rotating it 90 degrees.


Basically, I want the user to be able to select the object, and it will automatically rotate it 90 degreese about the right axis to stand it up. Eventually, I will make it so the user can select lots of objects and it will stand them all up.

 

I have looked at this example, http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a919382... but I don't know if thats what I am trying to do. That looks like it's for more objects that are 3D already...

 

Any suggestions?

0 Likes
880 Views
4 Replies
Replies (4)
Message 2 of 5

_gile
Consultant
Consultant

Hi,

 

Look at the Entity.TransformBy() method.

This method requires a matrix 3d as argument.

The Matrix3d structure provides a Matrix3d.Rotation() static (Shared in VB) method which requires 3 arguments: the angle, the rotation axis and the center point.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 5

Anonymous
Not applicable

Alright, looking at that now, everything seems ok except for I do not know what the last paramter does

 

object.TransformBy(Matrix3d.Rotation(0.7854,
                                           curUCS.Zaxis,
                                           new Point3d(4, 4.25, 0)));

 Apparently it is the center point? Is that just the center of the object? How would I get that...

0 Likes
Message 4 of 5

_gile
Consultant
Consultant

As with the 3DROTATE (or ROTATE3D) command, the user or the program have to specify the rotation base point.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 5

Anonymous
Not applicable

Could I somehow make the point be the same on all of the objects selected, like I could detect the bottom right corner or something?

0 Likes