PythonOCC and Gmsh API integration
I am developing a project that uses PythonOCC together with GMSH Python API. In this project, I use PythonOCC to find the parameters of each geometry of the input model and I use GMSH to adapt a mesh on the surface of the same model. As both libraries are C++ warpings and both have OCCT input kernel, an integration seemed easy. In the beginning of the project, I was opening the input STEP file two times, one on PythonOCC and the other on GMSH. However, this became a trouble as the project works with large files in the input.
The solution that we found to solve the problem was to recover to GMSH 4.8.4 the OCC ImportShapesNativePointer method changing the gen.py file, what worked really well after some researches about SWIG and CTypes file types conversions. The procedure to use this GMSH API method in that case is:
- Read file in PythonOCC:
shape = read_step_file(input_name)
- Pass the warped C++ object pointer to integer:
shape_pnt = int(shape.this)
- Use the pointer to import model on GMSH:
gmsh.model.occ.importShapesNativePointer(shape_pnt)
If you agree with this way to import shapes, I can make a pull request with this modification on gen.py or maybe you do the change. The purpose of this issue is to keep our project using the official GMSH repository on the most updated releases and to help other users that are facing the same problem.
Thank you!!