VS:PointAlongPolyN

From Vectorworks Developer
Revision as of 14:35, 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

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.

This is similar to the function VS:PointAlongPoly but it allows for specifying epsilon value to handle curved cases better.

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

Parameters

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

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 PointAlongPolyN(h, dist, 0.1, 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 Vectorworks 2012

This is drop-in function.

See Also

VS:PointAlongPoly

[[VS:PointAlongPoly]]