VS:GetPolyPt: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
m (fix name)
Line 41: Line 41:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
([[User:Orso.b.schmid|Orso]], 2010 Dec. 22) Since the introduction of rotated rectangles, it doesn't turn them into polygons any longer. The routine fails with warning, as expected.  
([[User:CBM-c-|_c_]], 2010 Dec. 22) Since the introduction of rotated rectangles, it doesn't turn them into polygons any longer. The routine fails with warning, as expected.  


(Charles Chandler, 2001 Jan. 25): Doesn't work on rectangles, unless you rotate them, which turns them into polygons.
(Charles Chandler, 2001 Jan. 25): Doesn't work on rectangles, unless you rotate them, which turns them into polygons.

Revision as of 10:11, 2 March 2021

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

Description

Procedure GetPolyPt returns the coordinates of a specified vertex of the referenced object.

PROCEDURE GetPolyPt(
objectHd :HANDLE;
index :INTEGER;
VAR pX,pY :REAL);
def vs.GetPolyPt(objectHd, index):
    return p

Parameters

objectHd HANDLE Handle to polygon.
index INTEGER Index of vertex (range of 1 to n).
p REAL Returns coordinates of vertex.

Remarks

(_c_, 2010 Dec. 22) Since the introduction of rotated rectangles, it doesn't turn them into polygons any longer. The routine fails with warning, as expected.

(Charles Chandler, 2001 Jan. 25): Doesn't work on rectangles, unless you rotate them, which turns them into polygons.

(Gerard Jonker, 2007 Jan. 8) Please have a look at my comments on the VectorLab regarding this function, concerning index and origin.

Example

VectorScript

for i := 1 to GetVertNum(thePoly) do
begin		
GetPolyPt(thePoly, i, vertX, vertY);
end;	

Python

def Example():
	obj = vs.FSActLayer()
	for vertexNum in range(1, vs.GetVertNum(obj)):
		ptVt = vs.GetPolyPt(obj, vertexNum)
		vs.TextOrigin(ptVt[0], ptVt[1])
		vs.CreateText(vs.Concat('vNum: ', vertexNum))

Example()

Version

Availability: from All Versions

See Also

For polygons:

For polylines:

For polygons:
  • [[VS:SetPolyPt| SetPolyPt]]

For polylines:

  • [[VS:GetPolylineVertex| GetPolylineVertex]]
  • [[VS:SetPolylineVertex| SetPolylineVertex]]