[Gmsh] Issue regarding OCC Topods shape import from gmsh-api (python)

VARSHA GOEL varshagoel94 at gmail.com
Wed Jul 3 05:51:55 CEST 2019


Hello,
I am currently using pythonocc and gmsh-api for import and mesh genration
of a step file model.
I imported .step file using pythonocc 's step_control module, and used
gmsh.model.occ.importShapeNativePointer to import the model in gmsh for
mesh generation.After going through the C++ Gmsh Api , i understood that a
pointer is to be passed to this function. For executing the same in python,
i retreived the memory address of the variable having topods shape object
and passed that to gmsh.model.occ.importShapeNativePointer.However i am
getting the below mentioned error.Kindly help me with the current
implementation of this method.
Code Snippet & error encountered

repr = SwigPyIterator.__repr__(shape)
print('repr', repr)
address = str(repr)
addr = address.split()[-2]
dr = addr[2:-1]
mem_id = int(dr, 16)
print('mem_id', mem_id, 'addr', addr, 'dr', dr)
tag = gmsh.model.occ.importShapesNativePointer(mem_id, 3)
print(tag1, 'tag1')

shape class<'TopoDS_Shape'; Type:Solid; id:1798257137>
repr <OCC.TopoDS.TopoDS_Shape; proxy of <Swig Object of type
'TopoDS_Shape *' at 0x000001D2E96F3180> >
mem_id 2005371138432 addr 0x000001D2E96F3180> dr 000001D2E96F3180
c_long(0) ierr
Traceback (most recent call last):
  File "C:/Automation_MDK_MSI/MSI/TETRA_TOOL/Gmsh_mesh/gmsh_occ_mesh.py",
line 179, in <module>
    tags = mesh_occ_model(shape)
  File "C:/Automation_MDK_MSI/MSI/TETRA_TOOL/Gmsh_mesh/gmsh_occ_mesh.py",
line 117, in mesh_occ_model
    tag = gmsh.model.occ.importShapesNativePointer(mem_id, 3)
  File "C:\Users\varsha\AppData\Local\Continuum\anaconda3\envs\py3_occ\lib\site-packages\gmsh_api\gmsh.py",
line 4410, in importShapesNativePointer
    byref(ierr))
OSError: exception: access violation writing 0x0000000000000009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190703/d697d754/attachment-0001.html>


More information about the gmsh mailing list