# Slicer to convert linear interpolation to Arch and G02

A Basic Grashopper slicer breaks the curve into points and moves along those points in a straight line, even if its an arch, creating a ridiculous number of points . How can grashopper recognize the arch along the curve in order to reduce the number of points ant utilize G02?

If your curve is not a polyline there is a command curve to arc and line
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_ToArcsAndLines.htm

If it is a polyline, it seems rhinocommon is not working. I made my own tool for that. There are some tools available also, see my post.

@laurent_delrieu Thank you … I could really use some guidance … I’m very new to python and custom components, how does that script become come a component?

Hello
if you want some guidance from the forum it could be good you give more informations on your problems

If you are new to Grasshopper, you will find online many many informations, tutorial …

@laurent_delrieu …Much appreciated! My problem is rather than generate g-code through linear interpolation (see attached) where G01 is only going to work … how can grashopper convert this segmented polyline to Arcs in order to utilize G02? … Similar to This GCode Post-Processor Squeezes Lines Into Arcs | Hackaday and/or how can the code shown on the hackaday website work in grashopper?

Slicer.gh (14.0 KB)

hello
you must learn to program. It is a one line code !!

Slicer.gh (18.1 KB)

@laurent_delrieu I can’t thank you enough … I’m learning as fast as I can… Ok…that identifies each “Arc-like curve” now how does grasshopper identify the radius of each arch-like curve?

Not on my pc but you could plug an arc component filter the null and surely something like arc deconstruct.

There lot of automatic conversion in grasshopper. Try to be curious. Double click on canvas type arc …test components. Sometimes it is not easy to find but most of problems were already solved by the developper or some people.

I am extremely curious, and I search far and wide for an answer before asking the question on this forum.

1 Like

I am happy you are. I just find that many people asking don’t use or badly use all the tools online (search engine).

Here is a way using one approach, as I don’t use enough DataTree in Grasshopper I think there could be a more nice approach but whatever It seems to work.
Explode the curve
Plug an arc component
I then make an index of each geometry and on top of picture I split geometries depending if they are a line or an arc.

Then you’ll have to make your Gcode in the group,

merge all commands and sort by index in order to have the correct order of commands.

SlicerLD2.gh (26 KB)