TiTaNiuM sAMuRai Posted September 18, 2002 Share Posted September 18, 2002 Is there a way to force a PIO to draw a polyLINE instead of a polyGON? Quote Link to comment
Alexandre Villares Posted September 18, 2002 Share Posted September 18, 2002 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. Quote Link to comment
MullinRJ Posted September 19, 2002 Share Posted September 19, 2002 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 Quote Link to comment
Alexandre Villares Posted September 19, 2002 Share Posted September 19, 2002 Samurai & Raymond, Are you doing this to get rid of the midpoint snaps? just curious... Quote Link to comment
TiTaNiuM sAMuRai Posted September 19, 2002 Author Share Posted September 19, 2002 I need the ability to create single-segment polylines (new feature to v9, AFAIK) within a path-type PIO. Quote Link to comment
TiTaNiuM sAMuRai Posted September 19, 2002 Author Share Posted September 19, 2002 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. Quote Link to comment
MullinRJ Posted September 20, 2002 Share Posted September 20, 2002 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 Quote Link to comment
Recommended Posts
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.