FEM: console messages line break improvements
This commit is contained in:
@@ -554,7 +554,7 @@ class GeometryElementsSelection(QtGui.QWidget):
|
||||
)
|
||||
continue
|
||||
FreeCAD.Console.PrintLog(
|
||||
" ReferenceShape : {}, {}, {} --> {}"
|
||||
" ReferenceShape : {}, {}, {} --> {}\n"
|
||||
.format(r.ShapeType, ref[0].Name, ref[0].Label, ref[1])
|
||||
)
|
||||
if not ref_shty:
|
||||
|
||||
@@ -105,7 +105,9 @@ class _ViewProviderFemMeshGmsh:
|
||||
"mesh object belongs too!\n"
|
||||
)
|
||||
else:
|
||||
print("Gmsh FEM mesh object does not belong to the active analysis.")
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Gmsh FEM mesh object does not belong to the active analysis.\n"
|
||||
)
|
||||
found_mesh_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
if o.isDerivedFrom("Fem::FemAnalysisPython"):
|
||||
@@ -113,26 +115,26 @@ class _ViewProviderFemMeshGmsh:
|
||||
if m == self.Object:
|
||||
found_mesh_analysis = True
|
||||
FemGui.setActiveAnalysis(o)
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"The analysis the Gmsh FEM mesh object "
|
||||
"belongs to was found and activated: {}"
|
||||
"belongs to was found and activated: {}\n"
|
||||
.format(o.Name)
|
||||
)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
break
|
||||
if not found_mesh_analysis:
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Gmsh FEM mesh object does not belong to an analysis. "
|
||||
"Analysis group meshing will be deactivated."
|
||||
"Analysis group meshing will be deactivated.\n"
|
||||
)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError("Active analysis is not in active document.")
|
||||
FreeCAD.Console.PrintError("Active analysis is not in active document.\n")
|
||||
else:
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"No active analysis in active document, "
|
||||
"we are going to have a look if the Gmsh FEM mesh object "
|
||||
"belongs to a non active analysis."
|
||||
"belongs to a non active analysis.\n"
|
||||
)
|
||||
found_mesh_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
@@ -141,20 +143,21 @@ class _ViewProviderFemMeshGmsh:
|
||||
if m == self.Object:
|
||||
found_mesh_analysis = True
|
||||
FemGui.setActiveAnalysis(o)
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"The analysis the Gmsh FEM mesh object "
|
||||
"belongs to was found and activated: {}".format(o.Name)
|
||||
"belongs to was found and activated: {}\n"
|
||||
.format(o.Name)
|
||||
)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
break
|
||||
if not found_mesh_analysis:
|
||||
print(
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Gmsh FEM mesh object does not belong to an analysis. "
|
||||
"Analysis group meshing will be deactivated."
|
||||
"Analysis group meshing will be deactivated.\n"
|
||||
)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
print("No analysis in the active document.")
|
||||
FreeCAD.Console.PrintMessage("No analysis in the active document.\n")
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
@@ -338,10 +341,10 @@ class _TaskPanelFemMeshGmsh:
|
||||
self.form.te_output.moveCursor(QtGui.QTextCursor.End)
|
||||
|
||||
def update_timer_text(self):
|
||||
# print("timer1")
|
||||
# FreeCAD.Console.PrintMessage("timer1\n")
|
||||
if self.gmsh_runs:
|
||||
print("timer2")
|
||||
# print("Time: {0:4.1f}: ".format(time.time() - self.Start))
|
||||
FreeCAD.Console.PrintMessage("timer2\n")
|
||||
# FreeCAD.Console.PrintMessage("Time: {0:4.1f}: \n".format(time.time() - self.Start))
|
||||
self.form.l_time.setText("Time: {0:4.1f}: ".format(time.time() - self.Start))
|
||||
|
||||
def max_changed(self, base_quantity_value):
|
||||
@@ -395,9 +398,12 @@ class _TaskPanelFemMeshGmsh:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except:
|
||||
import sys
|
||||
print("Unexpected error when creating mesh: ", sys.exc_info()[0])
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(sys.exc_info()[0])
|
||||
)
|
||||
if error:
|
||||
print(error)
|
||||
FreeCAD.Console.PrintMessage("{}\n".format(error))
|
||||
self.console_log("Gmsh had warnings ...")
|
||||
self.console_log(error, "#FF0000")
|
||||
else:
|
||||
@@ -414,11 +420,16 @@ class _TaskPanelFemMeshGmsh:
|
||||
if self.analysis:
|
||||
for m in FemGui.getActiveAnalysis().Group:
|
||||
if m.Name == self.mesh_obj.Name:
|
||||
print("Active analysis found: " + self.analysis.Name)
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Active analysis found: {}\n"
|
||||
.format(self.analysis.Name)
|
||||
)
|
||||
return
|
||||
else:
|
||||
# print("Mesh is not member of active analysis, means no group meshing")
|
||||
FreeCAD.Console.PrintLog(
|
||||
"Mesh is not member of active analysis, means no group meshing.\n"
|
||||
)
|
||||
self.analysis = None # no group meshing
|
||||
else:
|
||||
# print("No active analysis, means no group meshing")
|
||||
FreeCAD.Console.PrintLog("No active analysis, means no group meshing.\n")
|
||||
self.analysis = None # no group meshing
|
||||
|
||||
@@ -214,7 +214,7 @@ def make_femmesh(
|
||||
e = elms_seg3[i]
|
||||
mesh.addEdge([e[0], e[1], e[2]], i)
|
||||
Console.PrintLog(
|
||||
"imported mesh: {} nodes, {} HEXA8, {} PENTA6, {} TETRA4, {} TETRA10, {} PENTA15"
|
||||
"imported mesh: {} nodes, {} HEXA8, {} PENTA6, {} TETRA4, {} TETRA10, {} PENTA15\n"
|
||||
.format(
|
||||
len(nds),
|
||||
len(elms_hexa8),
|
||||
@@ -225,7 +225,8 @@ def make_femmesh(
|
||||
)
|
||||
)
|
||||
Console.PrintLog(
|
||||
"imported mesh: {} HEXA20, {} TRIA3, {} TRIA6, {} QUAD4, {} QUAD8, {} SEG2, {} SEG3"
|
||||
"imported mesh: {} "
|
||||
"HEXA20, {} TRIA3, {} TRIA6, {} QUAD4, {} QUAD8, {} SEG2, {} SEG3\n"
|
||||
.format(
|
||||
len(elms_hexa20),
|
||||
len(elms_tria3),
|
||||
|
||||
@@ -188,15 +188,11 @@ def read_z88_mesh(
|
||||
elemts_first_line = nodes_last_line + 1
|
||||
elements_last_line = elemts_first_line - 1 + elements_count * 2
|
||||
|
||||
Console.PrintLog(nodes_count)
|
||||
Console.PrintLog("\n")
|
||||
Console.PrintLog(elements_count)
|
||||
FreeCAD.Console.PrintLog("\n")
|
||||
Console.PrintLog(nodes_last_line)
|
||||
Console.PrintLog("\n")
|
||||
Console.PrintLog(elemts_first_line)
|
||||
Console.PrintLog("\n")
|
||||
Console.PrintLog(elements_last_line)
|
||||
Console.PrintLog("{}\n".format(nodes_count))
|
||||
Console.PrintLog("{}\n".format(elements_count))
|
||||
Console.PrintLog("{}\n".format(nodes_last_line))
|
||||
Console.PrintLog("{}\n".format(elemts_first_line))
|
||||
Console.PrintLog("{}\n".format(elements_last_line))
|
||||
|
||||
z88_mesh_file.seek(0) # go back to the beginning of the file
|
||||
for no, line in enumerate(z88_mesh_file):
|
||||
@@ -559,14 +555,14 @@ def get_z88_element_type(
|
||||
):
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
if not femmesh:
|
||||
Console.PrintError("Error: No femmesh!")
|
||||
Console.PrintError("Error: No femmesh.\n")
|
||||
if not femelement_table:
|
||||
Console.PrintError("We need to get the femelement_table first!")
|
||||
Console.PrintError("The femelement_table need to be calculated.\n")
|
||||
femelement_table = FemMeshTools.get_femelement_table(femmesh)
|
||||
# in some cases lowest key in femelement_table is not [1]
|
||||
for elem in sorted(femelement_table):
|
||||
elem_length = len(femelement_table[elem])
|
||||
Console.PrintLog("node count of first element: " + str(elem_length) + "\n")
|
||||
Console.PrintLog("Node count of first element: {}\n".format(elem_length))
|
||||
break # break after the first elem
|
||||
if FemMeshTools.is_solid_femmesh(femmesh):
|
||||
if femmesh.TetraCount == femmesh.VolumeCount:
|
||||
|
||||
@@ -100,7 +100,7 @@ def import_z88_disp(
|
||||
)
|
||||
result_mesh_object.FemMesh = femmesh
|
||||
else:
|
||||
Console.PrintError("Z88 mesh file z88i1.txt not found!")
|
||||
Console.PrintError("Z88 mesh file z88i1.txt not found.\n")
|
||||
|
||||
# create result obj
|
||||
for result_set in disp_read["Results"]:
|
||||
|
||||
@@ -239,13 +239,13 @@ def read_fenics_mesh_xml(xmlfilename):
|
||||
Console.PrintMessage("Mesh found\n")
|
||||
(nodes, cells_dict, cell_type, dim) = read_mesh_block(find_mesh)
|
||||
element_dict = generate_lower_dimensional_structures(nodes, cells_dict, cell_type, dim)
|
||||
Console.PrintMessage("Show min max element dict")
|
||||
Console.PrintMessage("Show min max element dict\n")
|
||||
for (elm, numbers) in list(element_dict.items()):
|
||||
lst = sorted(list(numbers.items()), key=lambda x: x[0])
|
||||
if lst != []:
|
||||
Console.PrintWarning(elm, " min: ", lst[0], " max: ", lst[-1], "\n")
|
||||
else:
|
||||
Console.PrintError("No mesh found")
|
||||
Console.PrintError("No mesh found\n")
|
||||
|
||||
if root.find("data") is not None:
|
||||
Console.PrintLog("Internal mesh data found\n")
|
||||
|
||||
@@ -201,7 +201,7 @@ class GmshTools():
|
||||
else:
|
||||
self.dimension = "0"
|
||||
Console.PrintError(
|
||||
"Could not retrieve Dimension from shape type. Please choose dimension."
|
||||
"Could not retrieve Dimension from shape type. Please choose dimension.\n"
|
||||
)
|
||||
elif self.dimension == "3D":
|
||||
self.dimension = "3"
|
||||
@@ -552,7 +552,7 @@ class GmshTools():
|
||||
setting["FacesList"] = belem_list
|
||||
else:
|
||||
Console.PrintError(
|
||||
"boundary layer is only supported for 2D and 3D mesh"
|
||||
"boundary layer is only supported for 2D and 3D mesh.\n"
|
||||
)
|
||||
self.bl_setting_list.append(setting)
|
||||
else:
|
||||
|
||||
@@ -70,7 +70,7 @@ class Prepare(run.Prepare):
|
||||
|
||||
def run(self):
|
||||
self.pushStatus("Preparing input files...\n")
|
||||
FreeCAD.Console.PrintMessage("Machine testmode: {}".format(self.testmode))
|
||||
FreeCAD.Console.PrintMessage("Machine testmode: {}\n".format(self.testmode))
|
||||
if self.testmode:
|
||||
w = writer.Writer(self.solver, self.directory, True) # test mode
|
||||
else:
|
||||
|
||||
@@ -852,7 +852,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
|
||||
# If user doesn't give a file but a path without a file or
|
||||
# a file which is not a binary no exception at all is raised.
|
||||
except OSError as e:
|
||||
FreeCAD.Console.PrintError(str(e))
|
||||
FreeCAD.Console.PrintError("{}\n".format(e))
|
||||
if e.errno == 2:
|
||||
error_message = (
|
||||
"FEM: CalculiX binary ccx \'{}\' not found. "
|
||||
@@ -864,7 +864,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
|
||||
QtGui.QMessageBox.critical(None, error_title, error_message)
|
||||
raise Exception(error_message)
|
||||
except Exception as e:
|
||||
FreeCAD.Console.PrintError(str(e))
|
||||
FreeCAD.Console.PrintError("{}\n".format(e))
|
||||
error_message = (
|
||||
"FEM: CalculiX ccx \'{}\' output \'{}\' doesn't "
|
||||
"contain expected phrase \'{}\'. "
|
||||
|
||||
@@ -419,17 +419,17 @@ def getSelectedFace(selectionex):
|
||||
aFace = None
|
||||
# print(selectionex)
|
||||
if len(selectionex) != 1:
|
||||
FreeCAD.Console.PrintMessage("none OR more than one object selected")
|
||||
FreeCAD.Console.PrintMessage("No or more than one object selected.\n")
|
||||
else:
|
||||
sel = selectionex[0]
|
||||
if len(sel.SubObjects) != 1:
|
||||
FreeCAD.Console.PrintMessage("more than one element selected")
|
||||
FreeCAD.Console.PrintMessage("More than one element selected.\n")
|
||||
else:
|
||||
aFace = sel.SubObjects[0]
|
||||
if aFace.ShapeType != "Face":
|
||||
FreeCAD.Console.PrintMessage("not a Face selected")
|
||||
FreeCAD.Console.PrintMessage("Not a Face selected.\n")
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(":-)")
|
||||
FreeCAD.Console.PrintMessage(":-)\n")
|
||||
return aFace
|
||||
return aFace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user