Mesh Offset, Boolean Operation, Splitting Mesh
#1
Good day,

We're considering using AB3d for our project, but I'm having trouble finding all the features that we need.  We are trying to make 2-part molds for 3D objects to print.  We need to:
  • import a STL file
  • mesh offset (inflate the mesh, not scale it)
  • flatten the offset mesh at the top and bottom
  • add the original mesh with inverted normals to the mesh offset
  • add air channels (boolean-subtract some cylinders) to create the mold
  • calculate a split line and break the mold into two parts

Could AB3d handle these? Which functions cover which?
#2
Some of the required functionality is available with the Ab3d.PowerToys library, but some will need to be implemented by yourself by changing the posiitons of the mesh:

1) 
You can import stl files by using Assimp importer - see the Ab3d.PowerToys samples the "Assimp imporer / exporter" - "Assimp model viewer" sample. You can also start the sample and drag and drop stl file to the sample to see how the file is imported.

2) 
The is no functionality to inflate the mesh. I am also not familiar with that alogorithm. But after importing the stl file you get a GemetryModel3D or Model3DGroup (the Model3DGroup can contain multiple GeometryModel3D objecst). Each GeometryModel3D object has a Geometry property that is set to a MeshGeometry3D object. This object defines Positions, Normals, TextureCoordinates and TriangleIndices. You can change that data to inflate the mesh. If you want to just apply a transformation to a mesh (update mesh positions, then you can use the Ab3d.Utilities.MeshUtils.TransformMeshGeometry3D method.

3)
To flatten to mesh at the top and bottom you will also need to manually update the positions of the mesh. I do not know details about how you want to do that, but one way is to go through all the Positions and if the positions's y value (in WPF 3d coordinate system y is up direction) is bigger then some value, then this position is considered to be top positions and in this case its value is changed to some fixed y value (so all positions bigger then some value will get the same y value). The same is done for bottom values.

4)
You can easily invert normals by multiplying them by -1. You can also use the Ab3d.Utilities.MeshUtils.FlipNormals method to do that. To add one mesh to another you can use the Ab3d.Utilities.MeshUtils.CombineMeshes method.

5)
See two Boolean operations samples in the "Advanced 3D objects" section of the Ab3d.PowerToys samples. Note that the Boolena opertion can significantly increase the number of positions on the generated mesh - so try to keep the number of segments for the cylinders as low as possible. To get a mesh for cylinder you can use: Ab3d.Meshes.CylinderMesh3D class.

6)
With Ab3d.PowerToys you can split the mesh by a 3D plane and get the split line. See the "Advanced 3D objects" / "Slice 3D model with a plane" sample for more info.


When manually changing the mesh positions it may be useful to visually see the numbers of positions and number of triangles. To do that you can use the MeshInspectorOverlay - see the "Utilities" / "MeshInspectorOverlay" sample for more info.
Andrej Benedik
#3
Thanks!

Here's a link that explains Mesh Offset it in MATLAB:
http://www.alecjacobson.com/weblog/?p=4708

It can be used to hollow-out 3D prints. I want to us it to generate a contour over the mesh as a mold. I've been using geometry3sharp and signed distance offsets to accomplish it so far, but I'd have to turn MeshGeometry3D into DMesh3 objects to do this and return them. I think another method is to generate a normal for each vertex, modify the magnitude of the normal, and then add the normal to the vertex's position.

How I've been flattening meshes using geometry3sharp is by creating a signed distance bitmap, modifying it, and then using marching cubes to create the final mesh.  This method doesn't generate nice meshes though. Can this library do something similar?

For splitting the model, a planar cut won't work.  I was thinking of generating a curve or line through the middle of the mesh every 1 mm to 5 mm, meshing them together (row meshes or triangle lines? meshing two lists of edges or points), then making a solid object. Use that solid object to boolean subtract one part, and use the result to boolean subtract the mold to get the second part. Could this library do that?
#4
(03-14-2022, 01:41 PM)abenedik Wrote: Some of the required functionality is available with the Ab3d.PowerToys library, but some will need to be implemented by yourself by changing the posiitons of the mesh:

1) 
You can import stl files by using Assimp importer - see the Ab3d.PowerToys samples the "Assimp imporer / exporter" - "Assimp model viewer" sample. You can also start the sample and drag and drop stl file to the sample to see how the file is imported.

2) 
The is no functionality to inflate the mesh. I am also not familiar with that alogorithm. But after importing the stl file you get a GemetryModel3D or Model3DGroup (the Model3DGroup can contain multiple GeometryModel3D objecst). Each GeometryModel3D object has a Geometry property that is set to a MeshGeometry3D object. This object defines Positions, Normals, TextureCoordinates and TriangleIndices. You can change that data to inflate the mesh. If you want to just apply a transformation to a mesh (update mesh positions, then you can use the Ab3d.Utilities.MeshUtils.TransformMeshGeometry3D method.

3)
To flatten to mesh at the top and bottom you will also need to manually update the positions of the mesh. I do not know details about how you want to do that, but one way is to go through all the Positions and if the positions's y value (in WPF 3d coordinate system y is up direction) is bigger then some value, then this position is considered to be top positions and in this case its value is changed to some fixed y value (so all positions bigger then some value will get the same y value). The same is done for bottom values.

4)
You can easily invert normals by multiplying them by -1. You can also use the Ab3d.Utilities.MeshUtils.FlipNormals method to do that. To add one mesh to another you can use the Ab3d.Utilities.MeshUtils.CombineMeshes method.

5)
See two Boolean operations samples in the "Advanced 3D objects" section of the Ab3d.PowerToys samples. Note that the Boolena opertion can significantly increase the number of positions on the generated mesh - so try to keep the number of segments for the cylinders as low as possible. To get a mesh for cylinder you can use: Ab3d.Meshes.CylinderMesh3D class.

6)
With Ab3d.PowerToys you can split the mesh by a 3D plane and get the split line. See the "Advanced 3D objects" / "Slice 3D model with a plane" sample for more info.


When manually changing the mesh positions it may be useful to visually see the numbers of positions and number of triangles. To do that you can use the MeshInspectorOverlay - see the "Utilities" / "MeshInspectorOverlay" sample for more info.


1) Great, thanks.

2) Any plans to implement more advanced mesh functions like Winding Number, Marching cubes, etc? Those could do this. I'm using g3Sharp now.

3) I saw something about a planar shadow, could that do it? project the shadow of the mesh, scale it slightly and extrude it to cover the whole mesh?

4) Worked well, thank you.

5) I've done this and see what you mean about mesh sizes. I also have a multitude of mesh errors (+1000) when the model is imported into a 3d slicer. To correct this, I'm using g3Sharp to try fixing the errors and to reduce the mesh's size.  It's doing a decent job. Is there a 3rd party library you'd recommend? I'm not a fan of converting the MeshGeometry3D to DMesh3 and back.

6) I'm looking to split the mesh along a curved surface. I'd have that surface match the middle section of a model.  Is there a way to generate a curved plane and then do that planar cut? If not, is there a way to create a curved surface, extrude it in one direction to create a mesh, and then use that to boolean intersect/subtract?
  


Forum Jump:


Users browsing this thread:
1 Guest(s)