Jump to content
Developer Wiki and Function Reference Links ×

Polygon vs. Polyline


Recommended Posts

If all the points between BeginPoly and EndPoly are created with LineTo, then the object type will default to Polygon (but you already know this).

Try adding a dummy CurveTo point as your second point and then delete it immediately after you issue the EndPoly. The type will stay as a PolyLine. I tried adding a Dummy Point as the last point, but deleting it closed the Poly, which may, or may not affect your routine. Also, if you add it as the second point, you always know where it is and can delete it without having to calculate the size of the Poly.

Here's a simple example that leaves the type as PolyLine. I tried it as a stand alone script in 8.5.2, but not as a PIO, and it worked. It should still work in 9.5.

BeginPoly;MoveTo(-1.2, 1.9);CurveTo(0, 0); { Dummy point }LineTo(1.9, 1);LineTo(0.1, -0.8);LineTo(0.8, -1);LineTo(3.6, 1.4);EndPoly;DelVertex(LObject, 2);

HTH,Raymond

Link to comment

Here's a snippet:

this_path_handle:=GetCustomObjectPath(this_object_handle); if( (this_path_handle<>NIL) AND (GetVertNum(this_path_handle)>1) ) then begin

{ ------------------------------------------------------- } { -----------begin the core drawing section-------------- } { ------------------------------------------------------- } NumberOfVertices:=GetVertNum(this_path_handle); GetPolyPt(this_path_handle,1,x_prev,y_prev); GetPolyPt(this_path_handle,2,x2,y2); x1:=x_prev; y1:=y_prev; FillPat(0); { blank } PenSize(15); PenPat(-8); { standard: dash with two dots } PenBack(line_colourval,line_colourval,line_colourval); {penfore} OpenPoly; { sets poly mode to 'open' } BeginPoly; for VertexNow := 1 to NumberOfVertices DO begin {GetPolylineVertex(this_path_handle, VertexNow, x_current, y_current,Vtype,Vradius);} GetPolyPt(this_path_handle,VertexNow,x_current,y_current); AddPoint(x_current,y_current); end; { of vertex loop } EndPoly; { finish the polyline and draw it }

----------------------------------

I can draw a 3-point poly manually while creating the PIO, but cannot delete the extraneous 3rd point using the reshape tool.I could try adding code to add segments to the poly, then delete them, as has been suggested. Better yet, I should make the two automatically-drawn end 'legs' part of the poly; they are currently just separate lines.

Link to comment

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