[Gmsh] Python API volume adding + mesh creation problem

Christophe Geuzaine cgeuzaine at uliege.be
Thu Sep 19 19:45:08 CEST 2019



> On 23 Aug 2019, at 04:35, Saima Safdar <saima.safdar at research.uwa.edu.au> wrote:
> 
> Hi All,
> I am using gmsh-api. Installed it into anconda enviornment using pip install gmsh-api. 
> I have an .ply file. When I create a 3D mesh usign GMSH manually it creates the mesh. The steps I am using are: merge>add volume from elementry entities>mesh 3D
> 
> But when I am using python api. its not giving me the results. The program haults for long time. I am attaching the script here with. please help. 
> 

Did you solve your problem? If not, try reproduce it on the smallest possible dataset and send us the files.

Christophe


> import math
> import gmsh_api
> import gmsh_api.gmsh as gmsh
> 
> gmsh.initialize()
> gmsh.option.setNumber("General.Terminal", 1)
> gmsh.option.setNumber("Mesh.Algorithm3D", 1);
> gmsh.option.setNumber("Mesh.CharacteristicLengthMin", 1);
> gmsh.option.setNumber("Mesh.CharacteristicLengthMax", 1);
> 
> 
> gmsh.merge("C:/2_FuzzyClassification/brainmodel/newBrainModelS.ply")
> 
> n = gmsh.model.getDimension()
> s = gmsh.model.getEntities(n)
> 
> l = gmsh.model.geo.addSurfaceLoop([s[i][1] for i in range(len(s))])
> gmsh.model.geo.addVolume([l])
> 
> print("Volume added")
> gmsh.model.geo.synchronize()
> 
> gmsh.model.mesh.generate(3)
> 
> gmsh.write("C:/2_FuzzyClassification/brainmodel/simplification_2.msh")
> 
> gmsh.finalize()
> 
> regards,
> Saima Safdar
> 
> _______________________________________________
> 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