Skip to content

Commit

Permalink
FEM: gmsh tools, get rid of useless unv related warning
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Feb 13, 2020
1 parent a199adc commit 9960b67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py
Expand Up @@ -403,10 +403,12 @@ def run_gmsh(self):
.format(sys.exc_info()[0])
)
if error:
FreeCAD.Console.PrintMessage("Gmsh had warnings ...\n")
FreeCAD.Console.PrintMessage("{}\n".format(error))
self.console_log("Gmsh had warnings ...")
self.console_log(error, "#FF0000")
else:
FreeCAD.Console.PrintMessage("Clean run of Gmsh\n")
self.console_log("Clean run of Gmsh")
self.console_log("Gmsh done!")
self.form.l_time.setText("Time: {0:4.1f}: ".format(time.time() - self.Start))
Expand Down
16 changes: 14 additions & 2 deletions src/Mod/Fem/femmesh/gmshtools.py
Expand Up @@ -828,13 +828,25 @@ def run_gmsh_with_geo(self):
error = "Error executing: {}\n".format(" ".join(comandlist))
Console.PrintError(error)
self.error = True
return error

# workaround
# filter useless gmsh warning in the regard of unknown element MSH type 15
# https://forum.freecadweb.org/viewtopic.php?f=18&t=33946
useless_warning = (
"Warning : Unknown element type for UNV export "
"(MSH type 15) - output file might be invalid"
)
new_err = error.replace(useless_warning, "")
# remove empty lines, https://stackoverflow.com/a/1140967
new_err = "".join([s for s in new_err.splitlines(True) if s.strip("\r\n")])

return new_err

def read_and_set_new_mesh(self):
if not self.error:
fem_mesh = Fem.read(self.temp_file_mesh)
self.mesh_obj.FemMesh = fem_mesh
Console.PrintMessage(" The Part should have a pretty new FEM mesh!\n")
Console.PrintMessage(" New mesh was added to to the mesh object.\n")

This comment has been minimized.

Copy link
@vocx-fc

vocx-fc Feb 13, 2020

Contributor

@berndhahnebach there is an extra "to" in this sentence

This comment has been minimized.

Copy link
@berndhahnebach

berndhahnebach Feb 23, 2020

Author Contributor
else:
Console.PrintError("No mesh was created.\n")

Expand Down

0 comments on commit 9960b67

Please sign in to comment.