Jump to content

Convert many polylines to circle

Recommended Posts

i have to get the following done:

i have a vw-drawing with about 4000 circle-like formed polylines, but each of them is a polyline consisting in about 50 single dots.

these circles shall be countersank later on, so i have to export them as dxf for the cnc-program.

the machine won't accept those polylines, so i need a way to convert them automatically into real circles (see the difference? the polylines have a x and y position and consist of lots of dots, a real circle has a middle and a radius).

does anyne know a way to do this?

either in vw or in any 3rd-party-program?

help urgently appreciated!

Link to comment

thanks for the hints, but both don't work.

exporting and reimporting changes nothing, and converting to polygon leaves me with several hundreds single dots for each circle. ->absolutely uncountersinkable.

closed polygons are also not ok, i really need circles.

now i am trying to do it with vectorscript, but as a beginner it'S quite hard.

any hints highly appreciated!

Edited by carpenter1234
Link to comment

Say it took 2 seconds to manually trace each polyline with a new circle.

That grueling, but doable, task would take about 2 hours 15 minutes.

Based on what has already been discussed on the topic, sounds like

writing a vectorscript to do this would take a matter of days.

Link to comment

Based on the screen shots, it looks like the bounding box for your polylines is coinicdent with the edges of the polyline/circle. If this is so, then the following script may work for you. Copy a few of your polys to a new drawing and try it there first.

And GMM18, this took about 30 minutes to come up with, including a lot of playing with bad test polylines. I tried Ovals first, but Arcs are much better if you want to make circles.

Procedure PLtoCircles;

{Draws a new circle at the center of the bounding box of each}

{selected polyline on the active layer}

{I recommend creating a new class and making it active to make}

{it easy to select the created circles.}

{February 8, 2009}

{? 2009, Coviana, Inc - Pat Stanford pat@coviana.com}

{Licensed under the GNU Lesser General Public License}

Procedure DoIt(H1:Handle);

Var X1,Y1,X2,Y2,X3,Y3,X4,Y4 : Real;










ForEachObject(DoIt,(((T=POLYLINE) & (SEL=TRUE))));



Link to comment

One small thing to consider, and I mean very small; if the accuracy of the circle's placement is critical, then the above script is only exact if there are an even number of points on the polyline, and they are equally spaced around the perimeter of the circle.

If there are an odd number of points, or the spacing in non-uniform, then the accuracy of the center placement and the radius goes down as the point count goes down. For a large number of points the error is quite small.

If the accuracy of the radius is critical, then the above script is only exact when there are polyline points on the 0?, 90?, 180??and 270? points of the circle. With an odd number of evenly spaced poly points, these criteria can never be met exactly.

For what you are doing, this is most likely not a consideration, but I state it for others who may want use the script in the future.


Link to comment

Indeed. I might have checked the distance from the centre of every vertex and procrastinated about what to do if all distances are not equal but some are more equal than others. Move centre? Change radius? Raise the river? Lower the bridge? Mix, match & be confused about inches & millimetres? (Oh yes, that caused some problems in one engineering project a few years ago.)

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.

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