looking to optimize nesting on complex closed 2d shapes to do that i’d like to reduce the number of control points so opennest would work quicker
the problem is currently the tool offered in rhino 5 and the one i checked in pufferfish doesn’t allow to optimize the control points by tolerance but asks for the number and degree, which is hard to supply for numeral models that consist of different shapes and control points.
I’m aware that rhino 7 and artCAM does the operation and would like to find an option to do so in rhino 5.
on the same note does the opennest tool for nesting complexity to calculate the nesting increase with the degree of the rebuild?
is it possible to look at the functions added by models in food4rhino without downloading and installing them?
There are a couple of calls you can use. There is Curve.Fit() which reapproximates a curve to a given tolerance. But of course you need to specify a desired degree. An alternative solution is lowering the degree or rebuilding, or you re-interpolate, but then you need to measure the deviation for yourself. There is just not one single solution to your problem. And this is because your problem is not really solvable.
No algorithm on earth can reapproximate a curve without making assumption on what to value more. It’s not only about deviation, but also about holding continuity to other curves, and many other properties.
And frankly speaking,
you should not create the garbage in the first place. It’s always important to work as light-weight as possible.
thank you for your response ill try all the options suggested and choose whats optimal for my cases.
Curve.Fit() , Lowering the degree or rebuilding(which is the one I initially wanted to use but rhino 5 doesn’t allow rebuilding by tolerance) , re-interpolate
Don’t understand though why would I reduce the degree when rebuilding, does lower degree on polygons compute faster with OpenNest nesting tool?
Another option I’d like to have is when running the Rebuild tool from ironpython env to extract the value of the Maximum Deviation printed in the rhino output so that I could re-adjust the numbers to fulfill my requirements, that with the offset tool should be enough.
The degree of a curve indirectly influences the amount of controlpoints. Lowering the degree is an alternative to “Rebuild”, because it keeps the curve as it is, trying just to remove a point. Of course, this does not always work out, because any controlpoint (within a span) influences the flow of a curve.
Again, this is also why you almost always get a deviation if you remove something.
Increasing the degree, however, always holds the shape by adding more points. You might ask why this would be useful, but there are many modelling workflows where you start with a lower degree curve, adding more control on one part of the curve by demand. Rebuilding would break this sort of modelling, because it affects the flow curve as a whole. So working with “degree elevation” is a common technique used in class-A modelling, more common than just “rebuilding”.
Almost any operation, involving parametric polynomial equations, will run faster if the degree of the polynomials is lower. If this is your bottleneck, is another question. I don’t know much about OpenNest. I wonder why it would do more than transforming a shape? Probably it’s more about the whole amount of elements, since they all affect each other, when nesting.
As a consequence, you rather divide your definition into multiple nesting operations, instead of having just one. Probably the impact of the shape itself is rather minimal. It’s always difficult to optimize something, if it’s unclear on what the bottleneck is.
Where do your “complex closed 2D shapes” come from? Why are they so complex? If I designed those curves I would not at all approve of them being messed around with just to speed up nesting. Trying to just arbitrarily “rebuild” or “refit” curves with some script is just…not great, as Tom says there are a lot of other parameters than just some “tolerance.” If these curves are just full of needless detail that can be safely tossed, tell the people up the chain to do their jobs properly and stop giving you junk.
Very informative thank you and was pretty much what I expected to be.
To elaborate, OpenNest as I understand it to be is a statistical algorithm,
which calculates optimal nesting based on geometry sent which shouldn’t
necessary be the enclosing geometry itself, therefore using a bounding for
that geometry that is less control points expensive should bring faster(which will allow multiple tries)
and better results. The current algorithm does not optimally introduce the frame
that’s why I’ll probably move forward with your suggestion to re-interpolate the
points and will be glad to be given some guidelines on how to proceed with that,
having minimal acquaintance with interpolation.
In my opinion the number of points shouldn’t be higher than the number of inflection points
the complex shapes are font generated merged letters, I’ll look into that.
After some looking around, I’ve came to an understanding that I don’t want to go in that deep. Does anyone know about a third party software or something that takes a dxf and finds most effiecent outer contour?
I can only repeat myself. I think you want something almost impossible. Control-point reduction is changing the shape almost always. This can be ok, but it’s you to decide if it still represents what you want. In automotive a quite expensive CAD called ICEM Surf is used. This software is great for re-approximation, because this simplification is key for creating quality shapes. Similar functionality is also in CATIA and the ISD module (which is even more expensive).
But before ending up here, wouldn’t it be possible for you to share some data? Also, the issue you are facing is bad performance with OpenNest right?! Don’t you think we can have a look into a more efficient way of achieving the nesting?
ok, I look into it later. But one thing. Could it also be that you have choosen a wrong dxf export? This sometimes can also lead to higher cp count. Furthermore, if this is all the data. It would be fastest and
easiest to simply remodel the shape.
Yes later today I’ll check about the export settings, don’t understand though what you mean by remodel. For now a better example to analyze is Aletter.dxf (166.0 KB)
that the outline exported in a fair way.
Okay that file looks fine, and the other one looks like it was just exported using different settings that made it come out as polylines. Even so, the point count on that bigger file is not something that should really be a problem, so…there’s something else going on here, you should not be butchering this just for the sake of OpenNest.
OpenNest deals with very difficult problems, meaning as the number of shapes grows so does the time the nesting operation takes grows, imagine having to nest 100 of those high count control points objects. To amplify the result given by OpenNest I’ll need to increase also the number of rotations done, and optimizing that would be dependant on how long one such operation takes.
therefore I’m trying to minimize the bottlenecks in this procedure and thats why im looking for a tool/solution to minimize the number of cp in the model without sacrificing to much space and preferably not creating a new shape that intersects with the original so the nesting would be invalid.
The one file looks quite alright. I do also think that there is rather a problem with OpenNest here?!
Are you sure you need that tool? Before messing around with reapproximating curves… (which I’m not sure is the reason why OpenNest is badly performing, we don’t know this either)… I think you would have been already done with the job, when orienting your shapes manually, or partially manually.
And something more regarding OpenNest. It has a great name, but if you look at the source code on GitHub, I’m not so sure if this really a masterpiece. There are more things here, creating good outcomes, writing clean and understandable code, and doing it effective at places required. The majority of all plugin developers in the domain of Rhino are rather junior architects and do not necessarily understand much about advanced programming. Just because you partially write an application in C++, it doesn’t mean it’s fast. So do not assume, that OpenNest is performing exceptional well, I would rather assume the opposite. I don’t want to lower the achievement with that statement, but you have to be aware of the fact, the most tools are rather written inefficient.
So I would assume that you are not optimizing something here at all. And last but not least transformation operations are not very costly, but computing collisions with complex convex hulls are probably more likely the bottleneck here. So if this is the case, lowering the amount of CPs doesn’t do much here.
Okay so why are you getting those (not really) high-point objects? Is that what you’re given? It seems it’s possible to get clean curves, so…get those? But as Tom said…does it actually even help? And…yeah is the problem here not actually OpenNest, that it can’t actually handle actual industrial-scale real-world objects that aren’t just variations on rectangles?
I didn’t look much into other programs for this process, my impression from the developer of OpenNest is that he is a quite capable in the field and is a long way ahead of knowing some C++ code.
The appealing feature in his algorithm is the possible answer within reasonable time, There may be other programs that do it better but because I’m currently Invested in Rhino and Grasshopper I’ll try to optimize it that way. I’ve yet to see the source for OpenNest code that you mentioned is in GitHub but deducing from all the manuals and explanations given the bottleneck is located in the number of control points.
I don’t quite understand how convex hulls can be complex and have more cp than the models created, even if the creation is clean there is always room for improvement in the construction of the outer layer which would be the input for the calculation.
I’m very grateful for your input I’ve attained a lot of insights from this conversation and for now I’ll look closer into the nesting algorithms to find out which one would be most efficient for me.