I want to input 3Euler angles to rotate a 3D model around model center.
Having trouble with Orientation3 function.
RotateAboutCenter works but is limited only on 2 axis.
I would suggest to create a rotational transformation (example: #CODE|Rotation Transform) and set it to IModelView::Orientation3 proeprty.
Thanks Artem, I will give it a try and let U know.
More suggestions are welcome. The one who provides the solution for the problem will get a small reward over Paypal for your time. Thank you.
I do not think that there is a direct function to rotate a view about the 3 angles. But the results can be achieved by splitting the process.
You can use RotateByAxis() function to rotate about each of the axes 3 times. The only consideration is that the angle needs to be computed about each axes after each transformation. This is simplified if rotation occurs about the modelview center.
Hope it helps!!!
You meant RotateAboutAxis? 2016 SOLIDWORKS API Help - RotateAboutAxis Method (IModelView)
I tried that but it didnt work quite well.
I was looking at: 2016 SOLIDWORKS API Help - IMathTransform Interface
But I cant figure out how to use matrix data:
2016 SOLIDWORKS API Help - Orientation3 Property (IModelView)
I am not sure why it does not work. I have used Transformation in many projects including cases where we rotate bodies about multiple axes. We have achieved accurate results.
If there is something specific which you are looking for the please share the specific case and I shall look into it.
As for the ArrayData, MathTransform Arraydata is a 4x4 matrix. The matrix is defined as follows: -
Array = Xcoordinate of XAxis, Ycoordinate of XAxis, ZCoordinate of XAxis, ScaleX
Array = Xcoordinate of YAxis, Ycoordinate of YAxis, ZCoordinate of YAxis, ScaleY
Array = Xcoordinate of ZAxis, Ycoordinate of ZAxis, ZCoordinate of ZAxis, ScaleZ
Array = Xcoordinate of Origin, Ycoordinate of Origin, ZCoordinate of Origin, 1
This is the general structure of arraydata of any transformation matrix.
Thank you for the reply.
I tryed something like this:
I input the angles, the points x,y,z are set to 0, and Im not sure if I selected the vector right with just writing 1.0#.
Dim Ptx As Double = 0
Dim Pty As Double = 0
Dim Ptz As Double = 0
'instance.RotateAboutAxis(Angle, Ptx, Pty, Ptz, AxisVecX, AxisVecY, AxisVecZ)
'Rotation about X axis
marioview.RotateAboutAxis(Anglex, Ptx, Pty, Ptz, 1.0#, 0.0#, 0.0#)
'Rotation about Y axis
marioview.RotateAboutAxis(Angley, Ptx, Pty, Ptz, 0.0#, 1.0#, 0.0#)
'Rotation about Z axis
marioview.RotateAboutAxis(Anglez, Ptx, Pty, Ptz, 0.0#, 0.0#, 1.0#)
Can you share the piece of code that worked for you?
Do you have some example on how to use transformation matrix?
Thank you in advance.
I shall make it simple with this attached example.
Open the attached testBlock.sldprt model. This is just a rectangular block. Select Isometric View.
Now run the attached macro. The macro first rotates the view to Front View and then to Top View.
The macro has separate functions (actually procedures) for each rotation.
Hi Rajat, I managed to get it to work somehow with your help. Still have some things to figure out. Can you share your paypal adress so I can send you a small reward for your time.
Has anyone some experience with:
Rotate a component about an axis using ArrayData
Rotate a component about an axis using IDragOperator
Rotate a component using ArrayDataRotate component using SetData
I found that website CADsharp has examples on their website but its for premium users.
I'm a bit confused. Are you trying to rotate a component or rotate the view? I have used the transforms (array data) to rotate views and components. The IDragOperator allows physical movements (say you have a component with mates in place - you can use this method to emulate the user's drag operation).
Cool, do you have some sample code that you used for transforms (array data) to rotate views and components? So you can rotate the views and the components too? Thank you.
Retrieving data ...