FEM: gmsh tools, get rid of useless unv related warning

This commit is contained in:
Bernd Hahnebach
2020-02-13 13:11:01 +01:00
parent 162617d54c
commit 8ecbf811b0
2 changed files with 16 additions and 2 deletions

View File

@@ -403,10 +403,12 @@ class _TaskPanelFemMeshGmsh:
.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))

View File

@@ -828,13 +828,25 @@ class GmshTools():
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")
else:
Console.PrintError("No mesh was created.\n")