VS:GetLocPt

From Vectorworks Developer
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.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