Converting Line Segments To Arcs

Hi,

I’m working with some .dwg files that were prepared by a client and was sent curves that consist of many line segments. These are used to represent all the radius corners and curves as well.

Is there any way to approximate these curves into arc segments instead using a Rhino command similar to Convert?

If anyone is aware of a way please let me know as it could be a great time saver!!

Thanks

Sean Prokopec

Hi Sean - the best way I know of to get the arcs is to use Arc > 3Point snapping to the polyline vertices, but there is no ‘convert’. Circle > FitPoints can also help, but you need to turn on control points on the polyline and select the ones you want.

@seanprokopec - in case it helps, I had a few Python scripts that attempt to reverse engineer arcs from points and polylines - I bundled them into a plugin fo convenience, you may be able to save a bit of time. If you download and unblock:

the plug-in and then drag it onto Rhino, you’ll get these commands:

Arc3Pt -the same as the Rhino command Arc > Start, End, PointOnArc only it reads out the radius and copies the radius to the clipboard - this is handy for checking the radius on an arc like polyline and then adding a fillet between two lines that has that same radius - this way the arc is sure to be tangent to the lines.

Arc3PointFromPoints - you give the tool points or control points (e.g. selected control points in an arc-like area of a polyline) and it makes a 3 point arc there. (the start and end of the arc should be the first and last points selected)

ArcFitToPoints - as above for the input, but makes a best-fit arc, that is the start and and points may not actually be - probably won’t - the ends of the point sequence, but it may be a better approximation of the arc, I’d use the 3point version if you are pretty sure that the points selected fall on an arc.

Arc3PointFromPolyline as above for points but asks for a polyline as input - if you already have the arc-like polyline as its own joined polyline.

ArcFitToPolyline - as above for points only uses a polyline as input.

Arc3Pt.rhp (19.5 KB)

Not heavily tested but I think it works OK.

-Pascal

2 Likes

i have used the end points of the lines, or some of the end points to make a spline, then break into arcs.

Thanks,
great plug in.
Is it possible to delete the input because now I have to explode the contour and delete the little line segments and after, join the contour again.
For me, that wil makes the plug in “almost” perfect.
thanks already

if no, please tell me, sorry

Hello - the commands that accept objects as input can be made to delete the inputs, yes.

-Pascal

lucky me, how do I achieve this.
Is that in the script already?

multi line to arcs.3dm (28.7 KB)

Hi Edward - - You don’t… I have to type it… hold on a bit.

@E.O.Stam -I updated the plug-in again - This version of ArcFitToPolyline and Arc3PtFromPolyline have been goosed to optionally delete inputs. See how it works. They work with multiple input polylines.
In your example, I would use `Arc3PtFromPolyline’:

  1. ExtractSubCrv to separate all the straights from the arc shapes,
  2. Arc3PtFromPolyline DeleteInout=Yes, and select everything as input, even the lines, they will be ignored, Enter, then select everything again, and Join. Done.

CurveAndArcUtilities.rhp (52 KB)

There are a few other commands in this plug-in as well.

3PtArcFromPointsFro
3PtArcFromPolyline
ArcFitToCurve
ArcFitToPoints
ArcFitToPolyline
RadiusFrom3Pts
SetArcDegrees
SetArcRadians
SetCurveLength
SubCrvFromMid

Don’t forget to un-block.

-Pascal

Deleteinput=Yes I did see it once and default was no, I did’t change it an now I don’t see the option anymore.
Do I have to remove the privious plug-in (Arc3Pt.rhp)?

this is what I do now:
select contour, explode, turn control points on, select control points where you want the arc, run the command and after delete

Yeah, I guess I would remove the older plug-in and restart Rhino.

-Pascal

Works really great.
the only problem till now is, if you don’t extract first (forget) but run the command
Arc3ptfrompolyline, rhino will crash.

OK - thanks, let me check that.
Hmm - I do not get a crash - there is a check in the code for the arc being valid, and on the polylines you sent earlier, if I feed it the whole polyline, the arc it makes is not valid and the command ignores it and moves on, as it should - if you have a specific file that crashes, please send it to me.

-Pascal

ok, I delete the previous end new rhp and download it again an drag it into rhino but still get a crash with my example, sorry.
next week I will check it on my desktop.
hope its oke.