[Gmsh] Issue regarding OCC Topods shape import from gmsh-api (python)
Christophe Geuzaine
cgeuzaine at uliege.be
Wed Jul 3 07:23:03 CEST 2019
> On 3 Jul 2019, at 05:51, VARSHA GOEL <varshagoel94 at gmail.com> wrote:
>
> 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.
Actually gmsh::model::occ::importShapeNativePointer() was originally only designed to work with the C++ and C APIs, and has been removed from the Python and Julia APIs in Gmsh 4.4.
If a Python specialist can help in making a new version of the function that actually works in Python, we would be happy to re-add it (even if of course such a function is intrinsically "unsafe").
Christophe
> 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
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
—
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine
More information about the gmsh
mailing list