Rotation around all axis

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
ptis
Posts: 28
Joined: Wednesday 16 May, 2012 - 10:18

Rotation around all axis

Post by ptis »

Hello,

in the spatial tab I can rotate an atom around the Z-axis (aka in XY-plane). How can I rotate atoms around the X- or Y-axis?

Background: I want to create a 6-axis-robot with 6 nested atoms, each can be rotated so I can go the a specific point.

Thanks.
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Rotation around all axis

Post by marlies »

Hi,

You can make any rotation when you write some code in the On3DDraw event handler. You will find it in the tab Events of the atom Editor and then 3dDraw.

The following code would draw a simple box with a rotation of 15 degrees over the y-axis.

Code: Select all

do( 
 PushCoords,
  
 RotateCoords(15,0,1,0),
 
 di3DBox(0, 0, 0, xSize, ySize, zSize, ColorRed),
  
 PopCoords
) 
You can replace the di3Dbox command by a drawing command for any other shape or a 3d drawing model (using the command drawmodel3D).

If you are using 3D models, you could also specify a rotation in the resources manager. To do that you should go to Window > Resources manager. In the tab 3D models you may select the right 3D model, click edit and specify the required rotation.

Good luck,

Marlies
ptis
Posts: 28
Joined: Wednesday 16 May, 2012 - 10:18

Re: Rotation around all axis

Post by ptis »

RotateCoords() with all 7 parameters and the nested atoms (without di3DBoxes) were exactly what I need. Thanks.

(Curious that I don't find this operation with the ED-help...)
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: Rotation around all axis

Post by marlies »

Hi,

Maybe you didn't check the topics about visualization? When modelling in 3D the following help topics could be useful:

1. Help > Quickstart > Quickstart guido to 3D Animation.
2. Help > Help Overview > 4D Script Reference Guide > 4D Script Categories > Category Visualization

Regards, Marlies
Post Reply