Hello, I got several geometry files that are used for 3D printing.
For statistics I’d like to calculate an accurate volume of the parts, but my models consist of several closed meshes which due to intersections lead to a surplus volume.
The first picture shows a small section of such a file. For this one I can use the MeshUnion grasshopper component, but this doesn’t work with more complicated geometries.
One possibility is using Netfabb or Magics for the mesh union and the volume calculation.
Could this be done in grasshopper with more complex geometries too ?
mesh_merge.stl (11.8 KB)
Mesh Boolean Union is the component that would do what you want. In cases where the mesh is very shattered, as you noticed, Rhino’s current algorithm might not give good results. Improving this type of operation is something incremental, as there are almost infinite possibilities of combinations of faces.
There’s a plan for improving the algorithm, but it’s not ready yet. Here the current schedule: Mesh Intersection Milestones in Rhino 7
If you have cases that you feel should work and want to submit them, they can be added to future tests and can be checked while writing the algorithm. Please submit them if you can. You can simply attach a sample here.
Also, to get a more-easily working Boolean union (the principle is different, more robust but slightly less precise), a way is to use implicit surfaces/metaballs/marching cubes. These names are essentially pointing to the same concept. You could check out this Grasshopper discussion or JellyFish.
for Robert McNeel & Associates
It would be nice that for future Mesh Boolean Rhino could track intersection pairs similar to CGAL I use within Cockroach:
What type of tracking do you mean? Do you mean something visual/UI, like keeping the face colors? Or some sort of origin array for each face index? Neither is very complex to add, but I’d like to focus on minimal usability.
Just to show a few screenshots from Rhino.
I use mesh boolean to cut out timber joints. The first Mesh faces are colored in grey. And the rest meshes (i+1, i+2 … i+n ) I give arbitrary color. From CGAL I see that mesh face tracking comes directly from algorithm, so there is no need to do cp search. I know that this is just a display option I use for unwelded meshes, but it gives good info for me.
Internally I have a face list property that is indexed according to cutting volumes i.e [0, 0, 0, 1, 2, 0]
where 0 is the first mesh and 1 is the first cutter, 2 is the second cutter.
It looks like something that can be added. I wrote the note at RH-63307.
@martinborst1 can I use the STL above for mesh intersection testing? This means that the file will be transformed into a .3dm and various intersection operators be applied to it.
I’m curious to know you you do such testing. Is it automated/ unit testing? And which framework do you use? My approach when implementing my own libraries is often to make a big hardcoded list of ‘truths’ from rhino results, then test my algorithms against that with NUnit.
I’ve recently made the mx_testing project public on GitHub.
I attached a grasshopper file that shows another problem I am facing with Mesh booleans right now that could be valuable for testing:
What I am trying to do is performing a boolean difference with labels and letters. It sometimes works and sometimes does not, depending on some minor differences that are sometimes not even noticable.
For details check the attached grasshopper file.
Do you know a workaround?
Thanks for your effort.
int_Mesh_difference_problem.gh (926.2 KB)
Yes sure, sorry for not answering your question earlier.
Sorry, presently I can only suggest to use MeshSplit for such cases. MeshBooleanX is the same as Rhino 6. You could try a plug-in, as mentioned above?
One possible solution is to use Cockroach.
I have implemented CGAL mesh boolean methods, that are quite robust:
This component is running following methods:
I also have a feeling that for your specific case BRep booleans could also work very well.
Thanks, I’ll give it a try
As far as I can tell right now, it works.