Boolean difference for graph-like objects

I’m a Computer Sciences student in my final year and for my project, I want to print a graph “out” of a box.
Let me explain a bit:
Assuming I have a valid STL file for printing a graph (nodes as spheres and edges as cylinders), I’d like to 3D-print a box (big enough to contain said graph) in which the graph is “carved out”, empty spaces inside the box where the graph should be.
Another attempt to intuition: if I was to pour melted chocolate inside the box and put the box in the freezer for a couple hours, then cracking the box open, I would find a chocolate graph matching the one in the STL file (that’s not the goal of my project though).

I read that this kind of process is called Boolean Difference and that Rhino can do it. I managed to create the surrounding box but I failed “boolean-differencing” the graph out of it.

If any Rhino-pro would be willing to help, I’d send him an valid STL file (and my full gratitude).

Thanks.

Couple of roadblocks here…

  1. Although Rhino does allow disjoint meshes, it does not allow disjoint solid meshes - that is to say where one volume is entirely inside another (they do not touch) and the inner volume is supposed to represent a void. So, your graph stl would need to intersect the outer surface of the box at at least one spot. This is advisable in any case if you are 3D printing as you will need to get unused material/support material out of the void area, something you can’t do if it’s completely closed.

  2. If the above condition is met, you may be able to difference out the the graph .stl from the box to leave a void. However, Rhino’s mesh tools are somewhat weak, so this might also fail if the intersection is complex. In that case some other mesh software might do the job better. If you have an .stl and you would like someone to look at it and test in Rhino, post it here or send it via PM…

–Mitch

First off, thanks for the quick answer.
About the intersection, isn’t it possible to make the box “full” (filled with material, not hollow) and then the graph stl would intersect with said filling ?
The intersection might be complex, I can’t really say with my rhino-untrained eye.
I joined a few possible graph .stl files to this reply.

Thank you.
7_complate.stl (646.0 KB)
10_complete.stl (1.8 MB)
20_Mod_3.stl (1.8 MB)

Nope. This is a common misconception about most 3d representation systems. In reality, with the most used systems - meshes, breps, and subdivision surfaces - “solids” are only hollow “shells”, and the user is made to believe they are solid by various visual and computational effects… Only a voxel-based system is actually “solid” in the sense that it is made up of tiny “grains” of material, like 3D pixels. Rhino does not work with voxels.

But again this is all mostly moot when it comes to the world of 3D printing, where most current physical systems make it quite difficult to print an arbitrary shape that is a closed shell with wall thickness. Although it is possible in some cases with FDM and the correct geometry, most of the time there is the problem that the support material gets trapped inside the object, so it’s as good as solid anyway. So usually you need to have a hole somewhere anyway to let this material out.

I will look at your files and get back to you in a bit.

–Mitch

So, as I suspected, this is going to be difficult in Rhino. First, your graph objects are all separate - they do not form a complete continuous shell. The need to be merged into one object. Rhino has the function to do this (MeshBooleanUnion), but is unable to do so because of weakness in the actual algorithm. Second, even once they are all merged, subtracting from a box in Rhino has the same problem.

Attached is a sample I made with Magics - mega-expensive mesh repair software. I first fused the graph objects (84) into one, then I created a bounding box, offset it inwards by about the radius of one of the spheres (to create an intersection) and subtracted the graph from the box. The original stl was very small, I suspect either in inches or no units - so I did convert it to mm. If you are working in inches, it will be 25.4 times too big, you will need to scale it.

HTH, --Mitch

Graph-Void.stl (1.6 MB)

Wow, that was fast and full of great info.
Thank you.

I’ll look into Magics too.

Thanks again !!

Probably want to look at something less expensive, like NetFabb or maybe MeshLab (open source)

–Mitch

By the way, I guess I would be amiss if I didn’t mention that this should be able to be done with Rhino using Breps (NURBS surfaces) instead of meshes. Rhino’s Brep tools are much stronger than its mesh tools.

If you are programming this based on some data, you can use Python inside of Rhino to create cylinders/spheres and then unite them. It should also be possible (and maybe more fun) with the Grasshopper visual programming plug-in for Rhino.

–Mitch