VS:GetOrigin

From Vectorworks Developer
Revision as of 14:32, 12 August 2013 by Root (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Description

Procedure GetOrigin returns the current origin location relative to the center of the page.

PROCEDURE GetOrigin(
VAR x :REAL;
VAR y :REAL);
def vs.GetOrigin():
    return (x, y)

Parameters

x REAL Returns X coordinate of origin.
y REAL Returns Y coordinate of origin.

Remarks

Inside plug-in objects, [{VS:GetOrigin]] always returns {0, 0} no matter what.

In 12.5.1, inside menu commands, VS:GetOrigin returns the correct coordinates of the user origin. I think this this is not true for earlier versions, where the origin would always be the absolute origin, not the user origin.

Inside document script, the user origin works correctly.

Other comments that I haven't verified:

VectorScript is using the page origin instead of the symbol origin when operating inside symbols. Plug-ins and symbols should use their insertion point as their origin.

VS:Set3DRot, VS:SetRot3D, VS:GetPolyPt3D, and other functions, may be using the wrong origin.

There are several complicating factors - 3D objects really have their own coordinate space (working plane/ground plane) - old scripts should continue to work when the above problems are fixed - some complicated internal details - etc.

Objects inside Symbols use the reverse of the User Origin. I added a table of the values related to VectorScript origin in the article Absolute Origin, by Gerard Jonker, on VectorLab.

Example

VectorScript

PROCEDURE Example;
VAR
originPt :VECTOR;
BEGIN
GetOrigin(originPt.x, originPt.y);
Message(originPt);
END;
RUN(Example);

Python

def Example():
	originPtX, originPtY = vs.GetOrigin()
	vs.Message(originPtX, originPtY);
Example()

Version

Availability: from All Versions