Hi everyone,
I’m working on editing a Neper-generated .obj file in Rhino before exporting it to 3DEC, a numerical modeling software. The .obj contains about 6000 closed meshes, each representing a grain in a polycrystalline structure. My goal is to modify problematic geometries while ensuring that the grains form a perfectly fitting, tight puzzle with:
- Flat surfaces, so each grain remains a closed, convex polyhedron
- No overlap or voids, completely filling a rectangular domain
I need to remove or modify grains that do not meet these numerical constraints:
- Edges are smaller than 0.0002 m
- Faces smaller than 4E-08 m2
- Aspect ratio (max edge length / cube root of volume) greater than 10
- Grains with volumes smaller than 8E-04 m3
- Any concave grain
Most problematic grains appear along the rectangular domain boundaries because I trimmed a larger domain to avoid boundary effects of the tessellation.
I have tried to:
- Import .obj → Unify mesh normals → Join all meshes → Collapse small mesh faces/edges → Explode. Issue: This might unintentionally alter grain convexity.
- Python script to identify & isolate bad grains, colorizing them for manual inspection. The only thing I haven’t figured out is how to reliably detect concavity.
- Python script to merge vertices within a tolerance on domain boundaries. Works well but again compromises convexity.
- Manual adjustments using Gumball. Time consuming.
After all of these steps, I convert the meshes to polyhedrons and export the geometries to a .3dgrid file, compatible with 3DEC using a python script. In the 3DGrid file, I list all the vertices (3 or more) in clockwise order as seen from outside the grain, that define each flat face of a grain, and then I list all the faces that make up the entire grain. I have imported what I thought was a successfully edited geometry into 3DEC but there seems to be some overlap between grains. Solid edges or vertices intersect, breaking the watertight fit but I don’t know where or how many overlaps there are.
Does anyone have any ideas or advice on how I could:
- Check for overlapping meshes or gaps between them in Rhino.
- Ensure the grains remain convex during editing?
- Better automate the cleanup process.
I don’t necessarily need a mesh representation—what I really need is a convex polyhedral representation for each grain. I tried using ConvexHull, but it over-simplifies the grain shapes, losing too much geometric detail.
I’m new to geometry handling, Rhino, and mesh editing, so I might be approaching this the wrong way. Any guidance, resources, or alternative workflows would be greatly appreciated!
Photo of the polycrystalline: Colored grains are problematic. Yellow: Bad Volume, Red: Bad Face, Green: Bad Edge, Purple: Bad Aspect Ratio.