gmsh meshing code

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Oli772
Posts: 26
Joined: Wed Apr 27, 2022 2:35 pm

gmsh meshing code

Post by Oli772 »

Hello,

how to make a script which executes the gmsh mesher which is available in freeCAD ?
Would the meshing parameters, visible in the interface, be accessible ?

thank you

oli
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: gmsh meshing code

Post by heda »

afaik, fc uses gmsh as an external exe, so only subprocessing and file reading as interface as it is today (nicely masked through the gui)...

you can always browse through the fem source to get traces of how it is done today...

however, today one can pip-install the gmsh-lib, including the binary, so at least there is now a lesser hurdle to make gmsh reachable in fc-process out of the box.

since you can pip install it, you could always do that today in your fc installation (you just need to make sure that you pip it in the fc python and not any other random python on your system)

have never tried it myself, but it looks like the whole api is there through a pip-install.
you can then do you deeds completely in the gmsh world from fc-python, and when done in the gmsh world - write the mesh to disk (or maybe it works with bytesio) and import it as a fem-mesh and you have bypassed the current (external) fc interfacing with gmsh.
Post Reply