# Find subcurves with normals between certain angles

I would like to use grasshopper to shatter curves into pieces, based on the relationship of the normals of the curve the unit X vector.

In my application, I want to separate out four different types of curve:

1. Normals from 45-135 degrees of unit x
2. from 135-225
3. from 225-315
4. greater than 315 and less than 45

Input curve with manually drawn normals and points on the left,
Manual representation of desired outcome on the right:

I have no idea where to start when it comes to achieving this. Could I use this definition, plus Galapagos? Or would that be painfully slow? Is there a simple mathy solution?

(definition: Find 15 135 225 315 Normals.gh (8.4 KB) )

Why do I need this? Itâ€™s for CNC routing hardwoods. When routing along the grain, you get less tearout by doing a climb cut, when routing across the grain, you get less tearout by doing a conventional cut. (climb vs. conventional is about the direction of rotation of the bit relative to itâ€™s path of movement). Being able to automatically separate a curve into portions that get one type of cut vs. the other would save a lot of time when programing cuts in hardwood. I currently do it by eyeballing the angle in Rhino and using the perpendicular curve tool. Tedious.

Thank you.

I donâ€™t know c# and have never used scripting components myself.

No problem-
curve_extremes.gh (10.1 KB)
The script is just that one line shown in the screenshot.

I just realised as well that it looks like there is a built in Gh component for this - the â€śX-tremezâ€ť component under curve analysis

It looks like the built in component only gives the outer tangent points though:
curve_extremes2.gh (4.9 KB)

1 Like

Yup. Thatâ€™s why it didnâ€™t occur to me to use it.

Havenâ€™t had a chance to open your definition with the script yet because Iâ€™m doing child care, but it looks like plugging in all the combinations of .5 and -.5 x and y values will get me where I want to go.

OK. It works. Almost*.

Definition:Find 45 135 225 315 Normals.gh (13.8 KB)

*Dividing up closed curves works. Not quite ready to use for CNC toolpaths yet, because concave polyline vertices will need some special treatment.

Do you actually machine the profiles as 2 sets of curves? One set for climb and another conventional?
Do you get marks on the wood where the curves meet?
Have you tried using spiral cutters with a down spiral?

So far Iâ€™ve only done this when cutting circles.

I do a roughing pass all the way around, leaving 1/16", and then climb cut the side grain and conventional cut the end grain. Upcut rougher, compression spiral for finishing. The rougher has a larger diameter than the finisher, so I just plunge the finisher into the void left by the rougher and do a radial entry to the cut. I overlap the spots where the curves meet by a little.

Wouldnâ€™t a downcut give me tearout on the bottom of the workpiece?

Hereâ€™s an updated definition, still not complete. It has some Human plugin components in clusters for baking. Other than that I think itâ€™s all native.

It bakes to two different layers, but I think Iâ€™m going to change it to bake to one layer with two different colors.

It also has a setting for overlapping the curves. And thereâ€™s setting for a minimum cut length so that situations where the output includes tiny cuts on pointy objects can be tamed if you want. (look close at the pic labeled â€śalmost worksâ€ť above. Thereâ€™s a teeny spot of yellow in one place. I didnâ€™t like it so I created an option to extend it to a given length, say 1 inch minimum.

The overlaps are hard to see with basic custom preview, but theyâ€™re there.

It works perfectly with closed curves that have no convex vertices.

Convex vertices are a problem because splitting up a profile will give you curves that create toolpaths that cut into the part. That will take some headscratchy geometry to fix. It also has a relatively easy bug to fix with open curves: the overlap setting shouldnâ€™t affect the outer ends of the original curve, only the interior ends of the new curve.

Lastly, I would like to figure out how to vary the angle at which the curves are split up. Iâ€™m pretty sure spitting them at 45-135-225-315 will work in most cases, but itâ€™d be nice to have options. Thereâ€™s a group in the definition Iâ€™m posting below that is my failed attempt to create a variable division point. @DanielPiker do you have suggestions on this one?

Hereâ€™s the definition. The cluster at the beginning just places the output in a bounding box at zero. If you draw input to the left of the y axis you can see input and result at the same time.

Find 45 135 225 315 Normals.gh (47.5 KB)

1 Like

You can set any angles you like in the v input of the script

I use up/down spiral cutters sometimes where the bottom few millimeters have an up spiral and the rest is down spiral. Theyâ€™re good for finishing pass on hardwood plywood.
I need to cut 4 oak staircase stringers with 42 degree steps so might experiment with conventional vs climb. Probably make no difference at 42 degrees tho.