API Panel.Position.Get

From Flowcode Help
Jump to navigationJump to search

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

Class hierarchy





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

Return value


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.


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 FC6 Icon.png SIMAPI_Panel_Position_Get 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