VS:PointAlongPoly

From Vectorworks Developer
Revision as of 13:20, 19 January 2012 by Root (talk | contribs)
(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

Returns a point at the specified distance along the poly, and a vector tangent to the poly at that point. Returns FALSE if it fails for any reason.

FUNCTION PointAlongPoly(
h :HANDLE;
dist :REAL;
VAR ptX, ptY, ptZ :REAL;
VAR tangentX, tangentY, tangentZ :REAL) :BOOLEAN;
def vs.PointAlongPoly(h, dist):
    return (BOOLEAN, pt, tangent)

Parameters

h HANDLE
dist REAL
ptX, ptY, ptZ REAL Output parameter.
tangentX, tangentY, tangentZ REAL Output parameter.

Remarks

This appears to be annotated wrong? Shouldn't pt and tangent be POINT or VECTOR variables?

Example

PROCEDURE Example;
VAR
   h    :HANDLE;
   p, t :VECTOR;
   dist :REAL;
BEGIN
   h := FSActLayer;
   IF h = NIL THEN
      AlrtDialog('Select a poly before running this script.')
   ELSE BEGIN
      dist := RealDialog('Enter distance:', '1');
      DSelectAll;
      IF PointAlongPoly(h, dist, p, t) THEN BEGIN
         Locus(p.x, p.y);
         MoveTo(p.x, p.y);
         LineTo(p.x + (t.x * 10), p.y + (t.y * 10));
      END ELSE AlrtDialog('Error!');
   END;
END;
RUN(Example);

Version

Availability: from All Versions

This is drop-in function.

See Also

VS:PointAlongPolyN

[[VS:PointAlongPolyN]]