VS:GetLocPt: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
(expand) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 33: | Line 33: | ||
</lineList> | </lineList> | ||
</params> | </params> | ||
----------------------------------------------------------------------------------------------------------- | |||
<remark> | |||
([[User:CBM-c-|_c_]], 2022.01.19) In Python the tuple returned is always bidimensional in the form (0, 0). | |||
Remember to add a third item (0, 0, 0) for usage in the Vector Routines such as [[VS:Vec2Ang]] or they will return gibberish. | |||
</remark> | |||
----------------------------------------------------------------------------------------------------------- | |||
<sample> | |||
==== VectorScript ==== | |||
<code lang=pas> | |||
PROCEDURE TEST; | |||
VAR | |||
pt : VECTOR; | |||
BEGIN | |||
Message( 'Set begin point' ); | |||
CallTool( -221 ); { activates the locus tool } | |||
GetLocPt( FSActLayer, pt.x, pt.y ); | |||
Message( pt ); | |||
END; | |||
Run(TEST); | |||
</code> | |||
==== Python ==== | |||
<code lang="py"> | |||
locObj = vs.FSActLayer() | |||
# make sure a locus is selected or there will be an error. | |||
# Due to the nature of Python, CallTool from the example above | |||
# is not usable for fetching LSActLayer in the same running script. | |||
if locObj!= vs.Handle() and vs.GetTypeN( locObj ) == 17: | |||
pt = vs.GetLocPt( locObj ) | |||
vs.AlrtDialog( str(pt) ) | |||
else: | |||
vs.AlrtDialog( 'Select a locus' ) | |||
</code> | |||
</sample> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
Latest revision as of 08:09, 19 January 2022
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Procedure GetLocPt returns the coordinate location of the referenced locus.
PROCEDURE GetLocPt(
h :HANDLE;
VAR pX,pY :REAL);
def vs.GetLocPt(h): return p
Parameters
h HANDLE Handle to locus. p REAL Coordinates of locus point.
Remarks
(_c_, 2022.01.19) In Python the tuple returned is always bidimensional in the form (0, 0).
Remember to add a third item (0, 0, 0) for usage in the Vector Routines such as VS:Vec2Ang or they will return gibberish.
Example
VectorScript
PROCEDURE TEST; VAR pt : VECTOR; BEGIN Message( 'Set begin point' ); CallTool( -221 ); { activates the locus tool } GetLocPt( FSActLayer, pt.x, pt.y ); Message( pt ); END; Run(TEST);
Python
locObj = vs.FSActLayer() # make sure a locus is selected or there will be an error. # Due to the nature of Python, CallTool from the example above # is not usable for fetching LSActLayer in the same running script. if locObj!= vs.Handle() and vs.GetTypeN( locObj ) == 17: pt = vs.GetLocPt( locObj ) vs.AlrtDialog( str(pt) ) else: vs.AlrtDialog( 'Select a locus' )
Version
Availability: from All Versions