Jump to content
Sign in to follow this  
TiTaNiuM sAMuRai

Polygon vs. Polyline

Recommended Posts

Do you mean to make the script code draw a polyline inside the PIO? What difference does it make on your context-problem?

If you use the ArcTo( CurveTo( or CurveThrough( procedures you'll get a PolyLine.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

How many points are in your single segment polylines? 2? I tried creating a 3 point Polyline and deleting the middle point. It worked, and it still stayed a Polyline with 2 points. How goes it in your PIO?

Raymond

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...