Jump to content
Sign in to follow this  
carpenter1234

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!

Share this post


Link to post

If I had an existing script ?close enough? I might, but I don't and I can't really make custom tools for free. Sorry.

Maybe someone else will help ? it is certainly doable.

Share this post


Link to post

Are all the poly-arcs the same diameter?

What is the grid spacing of the 4000 groups ?

4000x x 50 = 200,000 , when you select all is that how many objects are shown ?

Share this post


Link to post

the polylines represent a b/w image in dotted raster.

so almost any polyline has different diameters.

i attached two images (german localization) with parts of the drawing.

Share this post


Link to post

Have you tried re-export >DWG / DXF.

In 2004-2008 the polygons convert to polylines and the polylines to polygon.

Will closed Polygons be sufficient for the cnc tool ?

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

Carpenter1234,

Have you solved your problem yet? If not, email me offline and I'll tell you what I've got.

Raymond (mullinrj @ aol . com)

Share this post


Link to post

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;

Begin

GetBBox(H1,X1,Y1,X2,Y2);

X3:=(X2-X1)/2;

Y3:=(Y1-Y2)/2;

X4:=X1+X3;

Y4:=Y2+Y3;

ArcByCenter(X4,Y4,Y3,0,360);

End;

Begin

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

End;

Run(PLtoCircles);

Share this post


Link to post

Cool. 1 click vs. 8000

I am always amazed at how short and "simple" some scripts can be.

I am glad there are script writers out there like you who are willing and able to help.

Share this post


Link to post

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.

Raymond

Share this post


Link to post

@Pat Stanford: you made my day, your script works nice!

thsank you so much.

would love to send you a bottle of wine or thelike, but CA is a bit far away from germany.

once again, thanks a thousand times!

Share this post


Link to post

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

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