SclViewport viewToWorld
Overview
You use this command to convert coordinates of the viewport to real world coordinates.
Synopsis
SclViewport viewToWorld <$viewportHandle> <$xv> <$yv> <xw> <yw> <zw>
Description
Converts viewport coordinates to real world coordinates.
Arguments
- <$viewportHandle>
Passed by value. The reference value to the viewport of interest. You can use SclGetActiveViewport command to get the viewport handle.
- <$xv>
Passed by value. The X coordinate of the point in the viewport. This value must be between -1.0 and 1.0.
- <$yv>
Passed by value. The Y coordinate of the point in the viewport. This value must be between -1.0 and 1.0.
- <xw>
Passed by reference. Returns the X coordinate of the point in the real world.
- <yw>
Passed by reference. Returns the Y coordinate of the point in the real world.
- <zw>
Passed by reference. Returns the Z coordinate of the point in the real world.
Returns
If successful, this command returns $SCL_OK. If the viewport or layer handles are not valid, there are an incorrect number of variables, or if xv or yv are outside of the range -1.0 to 1.0, an error message is returned.
Example
# Obtain and display the coordinates of the middle of the active viewport. SclGetActiveViewport ViewportHandle SclViewport viewToWorld $ViewportHandle 0.0 0.0 wx wy wz puts "The middle of the viewport coordinates: ($wx,$wy,$wz)" |