Difference between revisions of "API Panel.Position.Get"
(XML import of new API docs) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Get''' | |
− | + | |- | |
− | + | | colspan="2" | Gets a handle to an object representing the components current position | |
− | === | + | |- |
− | [[ | + | |- |
− | : | + | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE |
− | :: | + | | width="90%" | Handle |
− | + | |- | |
− | + | | colspan="2" | The position or component to read from | |
− | + | |- | |
− | == | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE |
− | [[ | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
− | + | |} | |
− | |||
− | |||
− | |||
− | == | ||
− | [[ | ||
− | |||
− | |||
Line 33: | Line 26: | ||
===Flowcode example file=== | ===Flowcode example file=== | ||
− | Download | + | Download {{Fcfile|SIMAPI_Panel_Position_Get.fcfx|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) | 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) |
Latest revision as of 11:41, 16 January 2023
![]() |
Get |
Gets a handle to an object representing the components current position | |
![]() |
Handle |
The position or component to read from | |
![]() |
Return |
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
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.