VS:PointAlongPoly
Jump to navigation
Jump to search
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Returns a point at the specified distance along the poly, and a vector tangent to the poly at that point.
FUNCTION PointAlongPoly(
h :HANDLE;
dist :REAL;
VAR pt :VECTOR;
VAR tangent :VECTOR) : BOOLEAN;
def vs.PointAlongPoly(h, dist): return (BOOLEAN, pt, tangent)
Parameters
h HANDLE dist REAL pt VECTOR tangent VECTOR
Remarks
( _c_, 2022.01.18) In Vectorscript Python this returns a tuple with 3 items ( 0, 0, 0 ). This is relevant for usage in routines such as Vec2Ang, returning wrong values if the tuple is only bidimensional.
Example
Pascal
PROCEDURE Test; VAR polyObj : HANDLE; dist : REAL; p, tangentVec : VECTOR; BEGIN polyObj := FSActLayer; IF polyObj = NIL THEN AlrtDialog( 'Select a polygon' ) ELSE BEGIN dist := 1m; IF PointAlongPoly( polyObj, dist, p, tangentVec ) THEN Locus( p.x, p.y ); END; END; Run(Test);
Python
def Str2Num( inStr ): ok, num = vs.ValidNumStr( inStr ) if ok: return num else: return 0 polyObj = vs.FSActLayer() if polyObj == vs.Handle(): vs.AlrtDialog( 'Select a polygon' ) else: dist = Str2Num( '1m' ) # convert string to dim ok, p, tangentVec = vs.PointAlongPoly( polyObj, dist ) if ok: vs.Locus( p ) vs.AlrtDialog( str( len(p)) ) # return a tuple with 3 items
Version
Availability: from Vectorworks 2014
See Also
VS Functions:
VS Functions:
- [[VS:PointAlongPolyN]]