Difference between revisions of "API Panel.Position.RotateZ"

From Flowcode Help
Jump to navigationJump to search
Line 49: Line 49:
 
* Add to a calculation icon: <pre class="brush:[cpp]">::Panel.Position.RotateZ(handle, pivothandle, degrees)</pre>
 
* Add to a calculation icon: <pre class="brush:[cpp]">::Panel.Position.RotateZ(handle, pivothandle, degrees)</pre>
  
''<span style="color:red;">No additional information</span>''
+
Download [[File:SIMAPI_Panel_Position_RotateZ_v1.fcf]] and open it in Flowcode v6.

Revision as of 21:20, 21 May 2013

<sidebar>API contents</sidebar> Rotates the object around the Z axis

Class hierarchy

Panel

Position
RotateZ

Parameters

HANDLE Handle

The position or component to update
The default value for this parameter is: this

HANDLE PivotHandle

An optional position to treat as the origin to rotate around

FLOAT Degrees

Number of degrees to rotate by


Return value

This call does not return a value


Detailed description

There are several api calls that deal with rotation of an object and the effects can be quite complex. Here we are going to deal exlusively with the RotateX() api call. An object can rotate around it's own axis(x,y,z), or around the axis of another object's axis(x,y,x) if a different object is named as the pivothandle in the api call. When dealing with rotation in Flowcode it is important therefore to understand the following points

  1. Rotation of an object occurs from the centre of an object or group.
  2. The axis orientation of the object or group may well be different from the axis on the system panel(world axis)
  3. The axis orientation of another object if used as a pivothandle could be different from the object to rotate.


SIMAPI Panel Position RotateZ Pic1.png

Rotating around an object's own axis

This technique is the simplest way of rotating an object or group when the type of rotation required is not relative to any other object or component. The image to the right shows a cube with it's axis positions identified. Note in this context the x,y,z axis is illustrated just to highlight the explanation of technique, it is not representative of the axis position in Flowcode v6.

Calling the simulation api Panel.Position.RotateZ(MyCube,MyCube,1) will rotate the object in one-degree steps along it's Z-axis as shown by the blue rotation arc. To rotate the cube in a counter direction simply specify a negative number for the degrees parameter.

The screenshot from Flowcode v6 below shows a cubiod with it's internal axis shown (blue is the Z-axis line), and also a blue circle that cuts right through the cuboid's Z-axis (see example section below for links to the file) When the program runs the cuboid rotates along it's Z axis. Note also incidentally the cuboids axis is also the same as the world axis but this might not always be the case.SIMAPI Panel Position RotateZ Pic2.png


Examples

Calling in a calculation

  • Add to a calculation icon:
    ::Panel.Position.RotateZ(handle, pivothandle, degrees)

Download File:SIMAPI Panel Position RotateZ v1.fcf and open it in Flowcode v6.