Curve division optimisation

Hello all,
It is required to divide a spline curve into sections with intervals of approximately 2 meters for fabrication.I t is desired to optimize the division so that the angles formed by tangent curves at the endpoints of the divided parts are minimized. Ideally, each part should be between approximately 1.5 to 2 meters in length, and through optimization, we aim for divisions that are closer to linear shapes rather than curved ones. Could you please advise on a suitable workflow for this? I assume Galapagos can be deployed?

The attached image showing equal division by length, approx 2m.

1 Like

Need geometry

I think you can use Discontinuity component with Level set to Analytics to get a base list of starting points along the curve

then I would pick one, and start moving along a given direction
keep moving until in the [1.5-2] length domain

at that point I would take the portion of curve that lies in the [1.5-2] meters distance from the starting point, find some sampling points along it, measure the angle between you start tangent and the tangent at those points, and pick the point that gives the minimum angle

that end point would become the starting point for your next iteration, moving along the very same direction

I was thinking about that.

What @inno suggests is better.

Does the linear appearance refer to the curve segments between points or some sort of alignment of the placement of points along a squiggly curve?

What does one ideal fabrication-ready part look like?

Thanks Rene
My intention is to find the optimised segemeted part with the minimum material loose. The curve on the above screen shot is the guidecurve, it is meant to having approx 45mm width along the curve and nested on the 1200x2400 either plywood or metal sheet. Thanks

1 Like

Hi Inno
Thanks for the suggested logic, sounds all make sense. Your suggesion is meant to be applied with Galapagos or equivalent, right? I’m not much familar with the plug-ins with evolutionary/recurring features, so just checking. Thanks for your supportive advice.

Thanks for the info. It all matters. Maybe post your guide curve so it’s easier for us to make attempts - obviously we can draw a squiggly curve but it’s best to work with the actual case :slight_smile:

Attached the curve geometry, thanks Quan for your time in advance!

Curve Segement Test.3dm (147.5 KB)

Sure, here it is, thanks!!
Curve Segement Test.3dm (147.5 KB)

1 Like

Thanks, @inno, @Quan_Li you go first :stuck_out_tongue:

1 Like

Color me interested!

I think this (adaptively breaking down the curve to shorter segments in ‘high curvature’–I don’t know how to say it accurately–so that each segment is as ‘straight’ as possible, if I understand correctly) could be super useful if generalized to surfaces–e.g. breaking down patches further in high-curvature areas, so that there is less distortion when morphing onto it

You might also consider approximating the curve by arcs and lines:

1 Like

Hi Gears
I aim to set a curve division first, than generate a surface with a certain width later.
Your description is pretty close to what I intend to achive. The length can be 2.2m for the part with low curvature and this fugure down to less than 0.5m for relative high curvature part. Do you have any suggested workflow? Thanks for your time,

Hi
Anders, thanks for sharing your great work, it should be greatly useful at some point. I currently looking for way to optimise the division with collection of relatively linear parts for efficiency of plasma cutting with minimum material lose. Maybe I can tweak your line and arc converting script, but don’t have much knowledge on Python I’m afraid, use Grasshopper only.
Thanks for your suggestion.

hey @lee9, just to better understand what kind of final result you expect, would you prioritize smaller parts which would be easier to nest together into a 2400x1200 sheet (of course with 45 units offset ecc etc) using the least amount of sheets, or would you prioritize having the longest possible portion of curve contained in each sheet?

I’m asking this because I’m thinking to the general approach, and I sort of understood the 1.5 to 2 meters range is something you decided ahead with “common sense” but actually might not produce an effective benefit?

I did this walker thing that is more a “just for fun” definition, let’s say that by using a max span of 1.5 to 2 meters of length you end up with like 35 different parts:
does that quantity of 35 parts really mean anything until you really give those an offset and try to nest them together, to see how many sheets does it really take to produce those? I don’t think so :slight_smile:

generally speaking, if you are dealing with parts that are “as big as the sheet they are going to be nested” (which means everything and nothing at the same time
 but let’s just say they are occupying a big portion of the sheet) straight parts nest better with other straight parts, while round parts nest better with other round parts

so I’m thinking more of the following:
a) would you be happier to use the least amount of sheets, running the risk that each sheet might contain even just one single part that has the longest possible length for that sheet?
or
b) would you be happier to get the best possible nesting using the minimum amount of sheets, which means that you will have more hand labor to stitch all the parts together afterwards?

the above a) means less labor to stitch all the parts together, in exchange of more wasted material, while the above b) means a reduced waste in exchange of more stitching labor

don’t know if this makes sense

1 Like

Hi Inno
Thanks for your attempt and comments on this.
The 1.5 to 2m was my initial assumtion, but also realised right after my first post that it is not the right figure for the roundy portion.
a) is more appropirate from your description. The relaively straight part will take division with the length nerly close to 2m, but the roundy part should be smaller segment(but larger than a certain figure at least, lets say 500mm). I assume this will help nest with the smaller number of sheets with reasonable labor cost for stitching. Thanks

1 Like

understood :+1:
what I had in mind is something like the greediest algorithm ever

given a curve and a start point, it starts walking along the curve calculating the bounding boxes (flat boxes: rectangles) of the portion of curves it’s walking along on multiple planes

at a certain point the portion of curve will become too big to be contained on the bounding box (which means the bounding box becomes bigger than the cutting sheet), so it will stop the walk, put a cutting point there, and restart from there as a new sheet

it looks like this, but the definition is a sketch so messed up that I don’t dare to post it right now:

I’ll try to make the GH file a little more comprehensible (and functional) then I’ll post it


[edit]
here is a cleaner version .________. which is a hell of a mess anyway
 I’m sorry

I don’t know if you are familiar with Anemone Plugin (which is needed for the file to run)
because this is a sketch-test, I didn’t take care of some things that might be considered “not secondary” if you had to use this on a daily basis
 but the main concept is shown

for instance, the loop does not know when the curve ends, it’s implementable, but I think it’s just better to rewrite it completely instead of adding a patch to the mess you see on the GH canvas at the moment

so, for instance, the best way is to low the iterations, for this shape let’s try 10, then if you see the curve didn’t complete, then add one (or more) more iteration until you see the last portion is “reasonably small”

for instance this:

in this case with 13 iterations we get to this point, and still have the red portion of curve to take care of:

when you move to right side of the definition, if you press the Data Dam (4) you will see that that end-reminder-portion can indeed fit in a sheet, so it’s ok to not go to 14 iterations because that will be nested anyway in a sheet

but, for instance, if we stop at iteration 12, you will see that the remaining part is too big to fit a single sheet, like this:

and if at iteration 12 you trigger the Data Dam (4), it will show you the reminder of the curve nested in the final sheet, which is too big:

so you know you have to add one more and go to 13 :slight_smile:

this “so you know you have to add one more” is the truly wrong way to do things
 but I meant this just as a sketch, with all its limitations
 it will be improved :slight_smile:

depending on the start point you will end up with different numbers of sheets required, for instance if we start on this random location:

it looks like we end up with “one more sheet”
 but that small end-part can be easily included in another sheet (but I would just try another start point)

the main issue is that by using this greedy way, you are almost 99.9% sure you’ll never be able to nest two complete different shapes in the very same sheet


one last important thing: as Data Dam remebers the last data that went through it, if you change the start point after pressing the data dam (4) it’s better to right click on the GH canvas and Recompute the solution
 to get rid of the crazy nesting that would be generated (another thing to take care of
 :smiley: )

[edit] reuploaded GH file with old Area component for R7
curve_division_optimization_inno.gh (51.3 KB)

3 Likes

Thanks Inno, this is brillant, it looks like a ‘mega frame’ approach. Let me digest your work as I’m not much familar with the Anemone yet.

Do you mind sharing your first attempt as well so I can liase with a steel contractor to compare cost implication in 2 directions. When I rudimentely attempted with the 500mm equal lengh devision, around total 5 sheets(1200x2400) were needed to nest all the pieces in there. Your mega frame approach looks far efficient, but the material & cutting cost will go up. This is pretty much labor vs material cost comparison and might need to find the desired balance.

As per my previous note, the 1.5m to 2m was’t the fixed number, but I can play with different numbers for desired optimisation.

I mean the attempt shown in the screenshot below. Best,

of course, here it is:

button to start, (A) determines min/max length of each portion, then B is the “resolution” like the number of points the portion defined in A is divided into to evaluate each tangent vector

curve_division_optimization.gh (22.2 KB)

note that it has the same “feature” (lol) than the other one: you need to manually pick the amount of iterations in (C) ,so if in doubt start lower and increase one by one :+1:

1 Like

Brillant, thanks a lot, let me test it out.

Best