Jump to content
Developer Wiki and Function Reference Links ×

Points Coordinates along a Polyline


Luca

Recommended Posts

Hallo, is there a way to read point coordinates along a polylines? This mean: I draw a polyline, then I need to read the x,y values at given intervals along the polyline (i.e. every 5 cm), (therefore it is not useful to read the vertex coordinates because I need more points than those I used to actually draw the polyline).

Thank you very much for ypur help

Link to comment

Hi Luca,

You can use the "PointAlongPoly" from the VWPluginLibraryRoutines.p file.

The function is declared like this because the mechanism that generated the file can't handle Vector types:

PointAlongPoly(h: HANDLE; dist: REAL; VAR ptX, ptY, ptZ: REAL; VAR tangentX, tangentY, tangentZ: REAL) : BOOLEAN;

So you need to use the function as though it was declared like this:

PointAlongPoly(h: HANDLE; dist: REAL; VAR pt: vector; VAR tangent: vector): BOOLEAN;

Here is a simple script that shows how you would use this function.

procedure MyPoly;

const

PointSpacing = 5cm;

var

PolyHand: handle;

pt: vector;

tangent: vector;

pointDist, PerimeterLength: real;

ptresult: boolean;

begin

{create a polyline and get its handle}

CallTool(-204);

PolyHand:= LSActLayer;

{ get the perimeter length of the polyline }

PerimeterLength:= HPerim(PolyHand);

pointDist:= 0.0;

{draw points 5cm apart }

while pointDist<PerimeterLength do

begin

ptresult:= PointAlongPoly(PolyHand, pointDist, pt, tangent);

Locus(pt.X, pt.Y);

pointDist:= pointDist + PointSpacing;

end;

end;

run(MyPoly);

Good luck,

Link to comment

Islandmon,

Thanks. I use a variation of that to place other custom objects along a path polyline, where the objects have to be aligned with the curve of the path. It's a very useful way to place repeating elements.

I did observe the same behavior you are seeing, and it happens whether the polyline is closed or open. Still trying to figure out a fix for it...not much documentation available.

Link to comment
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...