VS:Centroid: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (fix example) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<desc> | <desc> | ||
Returns the centroid of the object. Returns false if an unsupported object type is supplied. | Returns the centroid of the object. Returns false if an unsupported object type is supplied.</desc> | ||
</desc> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<def> | <def> | ||
<funcDef lang="vs"> | <funcDef lang="vs"> | ||
FUNCTION Centroid(h :HANDLE; VAR x :REAL; VAR y :REAL) :BOOLEAN; | FUNCTION Centroid(h:HANDLE; VAR x:REAL; VAR y:REAL) : BOOLEAN; | ||
</funcDef> | </funcDef> | ||
<funcDef lang="py"> | <funcDef lang="py"> | ||
Line 30: | Line 29: | ||
x | x | ||
REAL | REAL | ||
</line> | </line> | ||
<line> | <line> | ||
y | y | ||
REAL | REAL | ||
</line> | </line> | ||
</lineList> | </lineList> | ||
</params> | </params> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<remark> | <remark> | ||
([[User:Orso.b.schmid|Orso]] 2016.04.18): This returns mm, so convert the values into current units: | |||
<code lang="vss"> | |||
IF Centroid(h, c.x, c.y) THEN BEGIN | |||
{ centroid returns mm } | |||
c.x := c.x * GetPrefReal(152) / 25.4; | |||
c.y := c.y * GetPrefReal(152) / 25.4; | |||
END; | |||
</remark> | </remark> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<sample> | <sample></sample> | ||
< | |||
</ | ----------------------------------------------------------------------------------------------------------- | ||
<seeAlso></seeAlso> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<version> | <version> | ||
Availability: from | Availability: from Vectorworks 2014 | ||
</version> | </version> | ||
</vwDoc> | </vwDoc> |
Revision as of 06:57, 18 April 2016
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Returns the centroid of the object. Returns false if an unsupported object type is supplied.
FUNCTION Centroid(
h :HANDLE;
VAR x :REAL;
VAR y :REAL) : BOOLEAN;
def vs.Centroid(h): return (BOOLEAN, x, y)
Parameters
h HANDLE x REAL y REAL
Remarks
(Orso 2016.04.18): This returns mm, so convert the values into current units:
IF Centroid(h, c.x, c.y) THEN BEGIN
{ centroid returns mm }
c.x := c.x * GetPrefReal(152) / 25.4;
c.y := c.y * GetPrefReal(152) / 25.4;
END;
Version
Availability: from Vectorworks 2014