hi, i would like to import geometry to gmsh from cq
import cadquery as cq
import gmsh
import math
import os
import sys
#create cadquery geometry
geometry = cq.Workplane("front").box(2.0, 2.0, 0.5)
shape = geometry.toOCC()
#import geometry to gmsh
gmsh.initialize()
gmsh.model.add("box")
gmsh.model.occ.importShapesNativePointer(shape, highestDimOnly=True)
gmsh.model.occ.synchronize()
#generate mesh
gmsh.model.mesh.generate(3)
#export mesh
gmsh.write("box.msh")
# Launch the GUI to see the results:
if '-nopopup' not in sys.argv:
gmsh.fltk.run()
gmsh.finalize()
my problem is that
geometry.toOCC() gives back OCP.TopoDS.TopoDS_Solid type and as per gmsh doc
def importShapesNativePointer(shape, highestDimOnly=True):
"""
gmsh.model.occ.importShapesNativePointer(shape, highestDimOnly=True)
Imports an OpenCASCADE `shape' by providing a pointer to a native
OpenCASCADE `TopoDS_Shape' object (passed as a pointer to void). The
imported entities are returned in `outDimTags'. If the optional argument
`highestDimOnly' is set, only import the highest dimensional entities in
`shape'. In Python, this function can be used for integration with
PythonOCC, in which the SwigPyObject pointer of `TopoDS_Shape' must be
passed as an int to `shape', i.e., `shape = int(pythonocc_shape.this)'.
Warning: this function is unsafe, as providing an invalid pointer will lead
to undefined behavior.
Return `outDimTags'.
"""
I need a TopoDS_Shape . Do anyone has an idea, how could i bypass this problem?