VS:GetSymLoc

From Vectorworks Developer
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure GetSymLoc returns the insertion point of the referenced symbol or plug-in object.

PROCEDURE GetSymLoc(
symHd :HANDLE;
VAR pX,pY :REAL);
def vs.GetSymLoc(symHd):
    return p

Parameters

symHd HANDLE Handle to placed symbol.
p REAL Returns insertion point of symbol

Remarks

You can use this function to retrieve the position of a PlugIn Object, from within the PlugIn Object itself. However, it will only display its position relative to the internal origin.

Gerard Jonkers, 2007/01/08: See also my Absolute_Origin article about origins on the VectorLab.

Example

Example, code for the PIO:

Procedure HereAmI;
VAR
hParm, hParmRecord, hWall : HANDLE;
PIOName, txtStr: STRING;
x, y : REAL;
BEGIN
IF GetCustomObjectInfo(PIOName, hParm, hParmRecord, hWall) THEN
BEGIN
GetSymLoc(hParm, x, y);
txtStr:= Concat(x, ' / ', y);
Locus(0, 0);
TextOrigin(0, 0);
BeginText;
txtStr
EndText;
END;
END;
Run (HereAmI); 

Python

def HereAmI():
	hasObj, PIOName, hParm, hParmRecord, hWall = vs.GetCustomObjectInfo()
	if hasObj:
		ptXY = vs.GetSymLoc(hParm)
		txtStr = vs.Concat(ptXY[0], ' / ', ptXY[1])
		vs.Locus(0, 0)
		vs.TextOrigin(0, 0)
		vs.BeginText()
		txtStr
		vs.EndText()
HereAmI()

Version

Availability: from All Versions