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

From Flowcode Help
Jump to navigationJump to search
(XML import of API documentation)
Line 33: Line 33:
  
 
===Flowcode example file===
 
===Flowcode example file===
Download [[File:SIMAPI_Panel_Position_Get.fcf]] and open it in Flowcode v6. In this example, a purple sphere is placed at coordinates x0,y0,z0. the sphere is moved into 4 different positions on the system panel. Each time the sphere is moved, the get() api command is called, returning a handle to the objects position into 4 previously defined variables of type handle. Once the sphere returns to the centre of the system panel, the clone() api command is called 4 times to create clones of the original sphere but placing them at the coordinates that were stored in each of the variables respectively.
+
Download [[File:SIMAPI_Panel_Position_Get.fcfx]] and open it in Flowcode v6. In this example, a purple sphere is placed at coordinates x0,y0,z0. the sphere is moved into 4 different positions on the system panel. Each time the sphere is moved, the get() api command is called, returning a handle to the objects position into 4 previously defined variables of type handle. Once the sphere returns to the centre of the system panel, the clone() api command is called 4 times to create clones of the original sphere but placing them at the coordinates that were stored in each of the variables respectively.
  
 
Note once you have executed the flowcode program manually you will need to delete each of the 4 cloned spheres in order to run the program again (alternatively with the system panel window in focus, press Ctrl-Z to undo)
 
Note once you have executed the flowcode program manually you will need to delete each of the 4 cloned spheres in order to run the program again (alternatively with the system panel window in focus, press Ctrl-Z to undo)

Revision as of 13:22, 20 September 2013


<sidebar>API Contents</sidebar> Gets a handle to an object representing the components current position

Class hierarchy

Panel

Position
Get

Parameters

HANDLE Handle

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


Return value

HANDLE

Returns the handle to an object representing the components current position


Detailed description

Obtaining a handle to a component provides the ability to hold information about the position and coordinates of that component at the time the api is called. This has several uses for example tracking a position of an object prior to any changes to it's parameters. A good example how this is used can be seen by looking at the source code for the example provided in the API Panel.Position.Set wiki page.

Examples

Calling in a calculation

  • Declare a variable 'result' of type HANDLE
  • Add to a calculation icon:
    result = ::Panel.Position.Get(handle)

Flowcode example file

Download File:SIMAPI Panel Position Get.fcfx and open it in Flowcode v6. In this example, a purple sphere is placed at coordinates x0,y0,z0. the sphere is moved into 4 different positions on the system panel. Each time the sphere is moved, the get() api command is called, returning a handle to the objects position into 4 previously defined variables of type handle. Once the sphere returns to the centre of the system panel, the clone() api command is called 4 times to create clones of the original sphere but placing them at the coordinates that were stored in each of the variables respectively.

Note once you have executed the flowcode program manually you will need to delete each of the 4 cloned spheres in order to run the program again (alternatively with the system panel window in focus, press Ctrl-Z to undo)

The screenshots below show the effect and also highlight the code used by the example.

SIMAPI Panel Position Get Pic0.png SIMAPI Panel Position Get Pic1.png