<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font size="+1">Hi I am trying to remesh an STL file to create a
        Tetrahderon.</font></p>
    <p><font size="+1">My code looks like based on info on the web</font></p>
    <p><font size="+1">SaimaSafdar commented on 2 Sep 2019 • <br>
        edited by nschloe <br>
        I used the gmsh-api for python
        <a class="moz-txt-link-freetext" href="https://gitlab.onelab.info/gmsh/gmsh/blob/master/README.txt">https://gitlab.onelab.info/gmsh/gmsh/blob/master/README.txt</a><br>
        The code I used is below for the gmsh-api<br>
        <br>
        import math<br>
        import gmsh_api<br>
        import gmsh_api.gmsh as gmsh<br>
        <br>
        gmsh.initialize()<br>
        gmsh.option.setNumber("General.Terminal", 1)<br>
        gmsh.option.setNumber("Mesh.Algorithm", 8);<br>
        gmsh.option.setNumber("Mesh.CharacteristicLengthMin", 1);<br>
        gmsh.option.setNumber("Mesh.CharacteristicLengthMax", 2);<br>
        gmsh.option.setNumber("Mesh.Optimize",1)<br>
        gmsh.option.setNumber("Mesh.QualityType",2);<br>
        <br>
gmsh.merge("C:/2_FuzzyClassification/brainmodel/brainModelscriptacvd.stl")<br>
        n = gmsh.model.getDimension()<br>
        s = gmsh.model.getEntities(n)<br>
        l = gmsh.model.geo.addSurfaceLoop([s[i][1] for i in
        range(len(s))])<br>
        gmsh.model.geo.addVolume([l])<br>
        print("Volume added")<br>
        gmsh.model.geo.synchronize()<br>
        <br>
        gmsh.model.mesh.generate(3)<br>
        gmsh.write("C:/2_FuzzyClassification/brainmodel/example.msh")<br>
        gmsh.finalize()</font></p>
    <p><font size="+1"><br>
      </font></p>
    <p><font size="+1">My Code<br>
      </font></p>
    <p>def meshObjSTL(obj, dim) :<br>
          obj.Mesh.write('/tmp/transfer.stl')<br>
          bbox = obj.Mesh.BoundBox<br>
          ml = maxCord(bbox) / 10<br>
          print('Mesh length : '+str(ml))<br>
          gmsh.option.setNumber("Mesh.Algorithm",8)<br>
          gmsh.option.setNumber("Mesh.CharacteristicLengthMax", ml)<br>
         
      gmsh.option.setNumber("Mesh.CharacteristicLengthFromCurvature",
      ml)<br>
          gmsh.option.setNumber("Mesh.CharacteristicLengthFromPoints",
      ml)<br>
          gmsh.option.setNumber("Mesh.Optimize",1)<br>
          gmsh.option.setNumber("Mesh.QualityType",2)<br>
          gmsh.merge('/tmp/transfer.stl')<br>
          n = gmsh.model.getDimension()<br>
          s = gmsh.model.getEntities(n)<br>
          l = gmsh.model.geo.addSurfaceLoop([s[i][1] for i in
      range(len(s))])<br>
          gmsh.model.geo.addVolume([l])<br>
          print("Volume added")<br>
          gmsh.model.geo.synchronize()<br>
          gmsh.model.mesh.generate(dim)<br>
          print('Mesh Generated '+str(dim))<br>
          gmsh.model.mesh.renumberNodes()</p>
    <p>But crashes with no output ( Code is part of a FreeCAD workbench
      )<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>