FEM: some modules, better document handling

This commit is contained in:
Bernd Hahnebach
2020-03-14 21:43:37 +01:00
parent 9d76f458a8
commit 5214c81ed4
3 changed files with 10 additions and 10 deletions

View File

@@ -70,7 +70,7 @@ class _ViewProviderFemMeshGmsh:
def setEdit(self, vobj, mode):
# hide all meshes
for o in FreeCAD.ActiveDocument.Objects:
for o in vobj.Object.Document.Objects:
if o.isDerivedFrom("Fem::FemMeshObject"):
o.ViewObject.hide()
# show the mesh we like to edit
@@ -253,7 +253,7 @@ class _ViewProviderFemMeshGmsh:
objs = self.Object.MeshRegionList
objs.append(incoming_object)
self.Object.MeshRegionList = objs
FreeCAD.ActiveDocument.recompute()
incoming_object.Document.recompute()
class _TaskPanel:
@@ -313,13 +313,13 @@ class _TaskPanel:
def accept(self):
self.set_mesh_params()
FreeCADGui.ActiveDocument.resetEdit()
FreeCAD.ActiveDocument.recompute()
self.mesh_obj.ViewObject.Document.resetEdit()
self.mesh_obj.Document.recompute()
return True
def reject(self):
FreeCADGui.ActiveDocument.resetEdit()
FreeCAD.ActiveDocument.recompute()
self.mesh_obj.ViewObject.Document.resetEdit()
self.mesh_obj.Document.recompute()
return True
def clicked(self, button):

View File

@@ -909,7 +909,7 @@ def get_force_obj_edge_nodeload_table(
FreeCAD.Console.PrintMessage("{}\n".format(len(bad_refedge_nodes)))
FreeCAD.Console.PrintMessage("{}\n".format(bad_refedge_nodes))
# import FreeCADGui
# FreeCADGui.ActiveDocument.Compound_Mesh.HighlightedNodes = bad_refedge_nodes
# frc_obj.Document.Compound_Mesh.HighlightedNodes = bad_refedge_nodes
FreeCAD.Console.PrintMessage("bad_edge_table\n")
# bad_edge_table:
@@ -926,7 +926,7 @@ def get_force_obj_edge_nodeload_table(
# should be == bad_refedge_nodes
FreeCAD.Console.PrintMessage("{}\n".format(sorted(bad_edge_table_nodes)))
# import FreeCADGui
# FreeCADGui.ActiveDocument.Compound_Mesh.HighlightedNodes = bad_edge_table_nodes
# frc_obj.Document.Compound_Mesh.HighlightedNodes = bad_edge_table_nodes
# bad_node_length_table:
# [ (nodeID, length), ... , (nodeID, length) ]
# some nodes will have more than one entry

View File

@@ -48,7 +48,7 @@ def purge_results(analysis):
if m.Mesh and is_of_type(m.Mesh, "Fem::FemMeshResult"):
analysis.Document.removeObject(m.Mesh.Name)
analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()
analysis.Document.recompute()
# if analysis typ check is used result mesh
# without result obj is created in the analysis
# we could run into trouble in one loop because
@@ -56,7 +56,7 @@ def purge_results(analysis):
for m in analysis.Group:
if is_of_type(m, "Fem::FemMeshResult"):
analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()
analysis.Document.recompute()
def reset_mesh_deformation(resultobj):