Using Gmsh as triangulator for CAM

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
JulianTodd
Posts: 74
Joined: Tue Oct 23, 2018 3:35 pm

Using Gmsh as triangulator for CAM

Post by JulianTodd »

I'm experimenting with Gmsh, which I learnt about at FOSDEM2020. It's for creating the even triangulations (2D and 3D) needed for FEA.

Gmsh tightly bound to OpenCascade, so using it as a triangulator should be possible.

While the long skinny badly distributed triangles that we get from the standard tessellator are no problem for the graphics cards (they've been optimized to handle it), it's not ideal for CAM algorithms.

Also, if the triangulations are of this quality, it may be possible to use them as a basis for rest machining -- something which I've never attempted. I've only ever worked out rest milling within the tool surface (the locus of tool centres when in contact with the surface), which does not generalize to 5-axis.

Unless I can find the right settings somewhere, these triangulations are not good enough to machine against, because, as you can see, you get a lot of folds in the singly curved surfaces like cylinders, because the edges are not aligned with the parametrization. If it is possible to set the tolerances, it may still be good for finding uncut surface material from one cutter to the next.

Does anyone have much experience with using Gmsh? Could it be run against OCC bodies easily to generate the triangulations?
Attachments
gmsh1.png
gmsh1.png (52.94 KiB) Viewed 727 times
gmsh2.png
gmsh2.png (91.05 KiB) Viewed 727 times
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Using Gmsh as triangulator for CAM

Post by ickby »

Does anyone have much experience with using Gmsh? Could it be run against OCC bodies easily to generate the triangulations?
GMSH is one of the two meshers used in FEM workbench, there you can easily access and use it (also for 2d triangulation). Have a look at FEM_MeshGmshFromShape. If you want to generate 2D tesselations do the following:

1. Crete a FEM analysis
2. Select your shape
3. Hit the gmesh mesher button
4. Select "2D" in Mesh element dimensions
5. Hit "Execute" button (don't know the english wording of that one, but not "ok" button as ok does not execute the mesher)
6. Make the mesh visible in the tree view

With this you can now play around with the mesher settings. I also highly recomend playing around with the mesh regions, as this allows to add more details around individual edges or faces where needed. This gives quite nice control over the result mesh.
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Using Gmsh as triangulator for CAM

Post by sliptonic »

JulianTodd wrote: Mon Feb 03, 2020 6:29 pm
While the long skinny badly distributed triangles that we get from the standard tessellator are no problem for the graphics cards (they've been optimized to handle it), it's not ideal for CAM algorithms.

Also, if the triangulations are of this quality, it may be possible to use them as a basis for rest machining -- something which I've never attempted. I've only ever worked out rest milling within the tool surface (the locus of tool centres when in contact with the surface), which does not generalize to 5-axis.
Can you explain in layman's terms what you have in mind for using the mesh for rest milling? I have nothing to offer when it comes to gmsh but this sounds fascinating.
Post Reply