VS:PointAlongPoly: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
(No difference)

Revision as of 14:35, 12 August 2013

.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]]