Hi all, I’m hoping that someone can help me with this little problem!
I am contouring solid shapes so that I can manufacture them from stacked layers.
Each contoured layer is then cut into 4 pieces to make nesting more tightly spaced when laid out.
My problem is how I can automate the sequential numbering system ( using a single line engraving text) as some of my objects will have 1000’s of unique shapes.
I am sure this is possible in Grasshopper, but am really struggling to sort this one out.
Using Rhino 7 on Mac. I cannot seem to find a tutorial anywhere on this specific requirement.
Your help much appreciated.
sliced shape.3dm (3.2 MB)
Hi all, I’m hoping that someone can help me with this little problem!
Hi Sebastian - right GH or a script can help here - for example, it could find all the pieces at each level and number them - if the splitting is orderly and predictable as in your example, it could find the right number sequence at each level. If the real life situation is more complicated than this - say multiple vertiacl groups in arbitrary locations that all have slices at the same Z - something like that, then it gets more complicated…
Here’s a solution using grasshopper and the OpenNest plug-in.
sliced_shape_re.gh (345.9 KB)
geometry internalized (no need for .3dm file)
Nested your surfaces (with text labels) to four 200 X 200 sheets with spacing set to 1 in ~376 iterations (~5 minutes on my old iMac).
@seb1 in the .3dm file you posted, the lowest level of surfaces is duplicated (4 extra surfaces).
Thank you so much for helping me with that!
I shall test it over the next few days. I’m determined to learn a lot more about Grasshopper, but with 15 years using Rhino, GH still seems very difficult to get my head round, but the benefits are amazing.
Much appreciated, Sebastien
Hi Kevin, finally got a chance to test this out - thank you very much…seems like magic!
However, when I first dragged the gh file into the canvas area, it asked for various opennest plugins, which downloaded and installed no problem, I think.
Now, I can see the curves are in the first container, so I guess I need to toggle ’true’ for it to run?
When I do this, the Opennest container turns red and nothing appears to be happening…sure this is an error on my part, but grateful for a pointer in the right direction in order for this to work.
Many thanks, Sebastien
Did you exit and re-start Rhino after installing the OpenNest plug-in?
The white square shown in your screenshot should be one of the components from OpenNest.
If you re-started Rhino and it still doesn’t work, I’d suggest un-installing OpenNest (from the menu in grasshopper go to File → Special Folders → Components and delete OpenNest from there) then re-install it using the _PackageManager command from Rhino.
Edit: Update to info. posted abve
I un-installed the OpenNest plug-in from my mac then opened this definition. I allowed it to install OpenNest version 1.5.0 and I got exactly the same behavior you showed. Looked for OpenNest in the components folder and it wasn’t there. Ran the _PackageManager command from Rhino and got this:
After updating from version 1.5.0 to 1.5.1 and re-starting Rhino it works as expected.
Tryed this on Windows also. After it automatically installed version 1.5.0 of the OpenNest plug-in, it would nest the shapes but the InscribeCircle component was missing. Same fix - update to V1.5.1 of OpenNest by running the _PackageManager command from Rhino.
Hi Kevin - latest update!
Ok, the OpenNest plugin seems to be installed, and when I toggle ’true’ to start nesting….nothing seems to happen!
Am I missing a stage here?
I can see on the OpenNest container that it is ‘counting’. I have left it for 20 minutes and no result appears anywhere.
Grateful for your continued support here.
Screenshot of latest GH canvas.
I am using a Mac as shown. Rhino 7
Hi Kevin - further update…
Now, in my grasshopper canvas, when I select multiple surfaces as per the original stacked shape I sent you, it works fine and creates a layout on sheets in Rhino. So far so good.
I pulled in another stack of contoured shapes and reset the multiple Surfaces selected in GH….and get this strange result. Some of the surfaces appear to be inverted (the text) and stay at different Z levels.
When I toggle True to start Nesting - nothing happens.
I attach both the Rhino file and the GH file …this is so close to what I need, so I can’t tell you how much difference this will make to the automated system I need for preparing 1000’s of shapes for laser cutting - the Holy grail!
slice test2.3dm (2.98 MB)
slice test2.gh (22.3 KB)
Try this file:
slice test2_re.gh (423.2 KB) - Geometry is internalized (no need for .3dm file)
Changes I made:
- Some of the smaller surfaces were overlapping:
- Now uses the length of the curve to determine the segment length when converting to polylines.
- Text tag orientation inconsistent (some upside-down):
- Added code to compare normal directions and selectively flip.
- Reduced font size for text tags so they fit on the smaller surfaces.
Changes circled in red:
This is the result after letting it run 145 iterations:
Not sure what’s going on here - when I opened the files you posted, it worked ok except for the things I noted above.
Noticed that some of the nested surfaces were still very close together.
Curves have to be converted to polylines to use OpenNest. More segments gives more precision to the nested result but take more time - need to find the best balance between speed and precision.
Small change to code - added Simplify Curve component after Curve to Polyline component to reduce segment count of polylines.
slice test2_re2.gh (423.3 KB)
Hi Kevin - that is fantastic…really appreciated.
I think I have made an error in describing my workflow though - thinking about it…hopefully this is a simple solution/amendment.
Basically, it is;
Create organic mesh outside of Rhino (Zbrush) Mostly figurative sculptures.
Export as Obj/stl mesh, import into Rhino.
I then Contour slice the mesh in Rhino so that I end up with lots of polyline closed shapes.
(So actually I don’t need them to be Surfaces - just outline closed shapes - this is the change I need - which is what the laser cutting facility needs)
I then need to lay them out on cutting sheets that are 2500 x 1250mm.
I tried altering the container for the Sheet size but don’t think I got it right…the shapes would not nest correctly.
I have attached a file that shows a typical application.
If you could advise how to change sheet size, and possibly font size, that would be excellent.
I apologise for this taking up so much of your time, but what you are doing is completely changing how I can use rhino for fabrication, and I’m hoping there are many users out there who will find this invaluable as a tool/solution.
Again, thank you.
Slice test4.3dm (3.32 MB)
The workflow you describe is pretty much the understanding I had. A couple of things I don’t know is what spacing is needed for the parts and what level of precision is required.
OpenNest will work with either closed polylines or surfaces. If you’re working with surfaces they can easily be converted to curves in grasshopper for later processing.
The last file you posted has 14 very short open curves (0.000077 To 0.001523
mm. long). OpenNest will not work with open curves so I’ve culled them.
There are also 2 self-intersecting curves in your file. This doesn’t seem to affect the nesting, but it may cause problems with your laser cutting. If you run the command _SelSelfIntersectingCrv from Rhino it will select them. Then running the _IntersectSelf command while they are selected will place points in the Rhino document where the self-intersections occur. (both of these commands are only available in Rhino V7 or above)
Using the last file you posted, the text tag directions were inconsistent again. I changed the gh file to use the world XY-plane for orientation. This should work fine with all the files you’ve posted so far.
Referencing the curve you created for the sheet size worked ok when I tried it. I think it probably wasn’t nesting when you tried because of the open curves in your file. I’ve added some components to the gh file to set the sheet location and size.
The s (Size) input to the Text component will change the font size of the text tags.
I changed the code to reduce the point count of the polylines using the Reduce component. This shows the effect that the T (Tolerance) input to the Reduce component has on the segment count of the curves in the last file you posted (the first line shows the segment count of the curves in your file):
As you can see, using a tolerance of 0.01 reduces the segment count of the curves in your file from 33,105 to 13,862. This should give plenty of precision and reduce nesting time. Higher tolerance values further reduce the segment count and nesting time required but at the cost of precision. Simplifying the polylines makes the curved areas more segmented, therefore they could be nested closer together. As an example, using the Reduce component with a tolerance of 0.5 and nesting your shapes with spacing set to 5.0 - some of the shapes could be as close as 4mm to each other.
The gh file in this post running on my computer with the Tolerance input of the Reduce component set to 0.01 takes ~10 minutes for the first iteration. More iterations of nesting can produce a better nesting result, possibly fitting the parts on fewer sheets. I guess all of this is less critical if you have the time to just set the Tolerance setting low and let the nesting iterations run for a long time.
You can run the OpenNest plug-in in 2 modes.
- Iterative Mode:
- Iterations input set to 0
- Continually runs nesting iterations while Run input is set to True
- Display in Rhino viewport updates after each iteration
- Press Reset button before toggling Run input to True if any input parameters have been changed (otherwise it just resumes nesting where it left off previously)
- Static Mode:
- Iterations input set to the number of desired iterations
- Nesting will start as soon as you change any input parameter
- Display in Rhino viewport does not update until all iterations are finished
It seems that if you’re running multiple nesting iterations, the first iteration takes about twice as long as the rest.
There are 3 good tutorials for OpenNest here:
Don’t worry about asking questions here, that’s what this forum is for. It gives us all an opportunity to help each other and learn.
Here’s the updated gh file with internalized geometry from the last file you posted:
slice_test4_re.gh (601.0 KB)
Here’s the iteration times nesting with the geometry and settings in this file on my computer:
Result after 4 iterations:
Hi Kevin, sorry to report that this latest GH file is just causing my computer to crash. It simply hangs with the spinning wheel forever (hours)!
All I do is load the GH file onto the canvas and double click ‘False’ on the run container.
Running a Mac as shown with Rhino 7 (undated)
Any ideas? Regards Sebastien
@seb1 Are you sure it isn’t running nesting iterations?
When you double-click the Boolean Toggle connected to the Run input to set it to True there is no apparent change except the Rhino and Grasshopper windows become unresponsive and you get the spinning wheel. Even the text on the Boolean Toggle component still says False.
You won’t see any changes until the first nesting iteration is finished. The text on the Boolean Toggle changes to True, the message area at the bottom of the OpenNest component says Run 1, and you can see nesting results in the Rhino viewport.
After the following iterations, the only apparent change is the message area at the bottom of the OpenNest component changes to Run 2, Run 3, … (You may also see changes in the nesting results).
When you want to stop doing “Iterative Solving” and you double-click the Boolean Toggle component connected to the Run input, there will be no immediate change. It will complete running the current iteration before stopping.
Also, there are times it takes more than one attempt to get it to stop nesting. When this happens, it will run another iteration before stopping. Not exactly sure why this happens but I guess the Boolean Toggle component isn’t getting the double-click event. Maybe because the Grasshopper window doesn’t have the focus when you double-click? Or the mouse pointer isn’t positioned exactly correctly (difficult to tell if the grasshopper canvas is zoomed out)? There have been times when it took me 2 or 3 attempts to get it to stop. Kind of frustrating if the iterations are taking a long time to complete.
- A few things I try to do before I start running nesting:
- Save any changes before starting (in case I need to force-quit Rhino).
- Position the Grasshopper canvas where I can see the Boolean Toggle connected to the Run input and the message area at the bottom of the OpenNest component.
- Make sure the Grasshopper canvas isn’t zoomed out too much.
- Make sure the Rhino viewport is set up so I can see the nesting results when they are available. Should be able to see the curve that is connected to the Sheets input of the OpenNest component and perhaps the area to the right of it if nesting will need more than 1 sheet.
If your doing “Static Solving” things will seem unresponsive until it finishes running the number of iterations matching what the Iterations input of the OpenNest component is set to (in this example, 1).
@seb1 to verify that this file is a problem for you, try changing the slider connected to the Iterations input to 1. One iteration takes ~2.5 to 3 minutes to run on my computer, I think yours should be close to that.
If you still have problems, perhaps try downloading the file again. I downloaded the file from here instead of running the one on my computer to make sure the upload wasn’t corrupted and it worked fine.
Hi Kevin, my bad, I think as you suggest that it was actually running iteratively. When I reduce the Iteration to 1 I get a result within a minute or two…which is excellent news.
I shall continue testing over the weekend and let you know how it goes.
Many, many thanks - have a good one.
Hi Kevin - happy to report some success, but still struggling. With simple curves I managed to get an expected result.
When I import model as shown in attached - mesh head that is split - I can contour it easily enough, then I manually try and sort out any self intersecting and open curves, which is a nightmare.
There doesn’t appear to be a consistent response.
I end up trying to rebuild curves, boolean them, simplify , but sometimes they just do not work and stop the GH file from running. I even identify a particular shape that is causing the problem, and just cannot figure out what the issue is.
Sometimes if I marquee select it stops GH from running, whereas individually selecting sometimes works.
I’m feeling that the answer is out there somewhere, and maybe it’s to do with prepping the curves after contouring, or there are hidden micro shapes and points.
Once again, I would appreciate your input…I cannot leave it now!
Regards, Sebastien - this must be the longest thread in Rhino GH history!
slice test5_re.3dm (4.29 MB)
Here’s some ideas to use grasshopper to clean up your curves:
clean_up.gh (873.2 KB)
In the last part of this definition, I culled curves that have an area less than 1. One small curve in your file (a tiny sliver at the bottom of the chin) was causing the nesting to fail.
You might be able to avoid the need for some of this clean-up on the curves if you simplify your mesh in ZBrush before you export it.
After running your curves through this definition, they nest without errors:
The only changes I made to the nesting file were referencing the new cleaned up curves, changed Placement parameter of OPenNest component to 1, and changed Size parameter of Text component to 4.
slice_test5_re.gh (847.8 KB)
Hi Kevin - that’s fantastic…working much better now after the clean up. I think it’s mostly about the preparation of the curves extracted as contours.
The process works much better on simpler shapes, so I’m trying every way to optimise the process, starting with the mesh output.
There are still problems when it won’t run, but bizarrely, by changing the selection method it seems to work….must be leaving out some glitch shape?
One final thing is that because of the sheer number of shapes in one sculpture, I have to divide the extracted contours into manageable sections and process a few hundred at a time and then bake them out.
The problem is that I end up with lots of numbers that are the same.
Is there any way of adding a prefix (like A,B,C etc) to the numbers, so that I can identify each section that has been processed at any one time?
I cannot thank you guys enough for helping me endlessly with this method, it is genuinely appreciated.
I looked at so many different nesting and numbering processes and nothing seemed to work for this specific need.
Amazing…many thanks, Sebastien