FEM: proxy type, use for all classes the notation Fem:: same as C++ classes

This commit is contained in:
Bernd Hahnebach
2018-01-09 07:29:59 +01:00
parent 8f91010ba6
commit c34bbb007a
20 changed files with 37 additions and 37 deletions

View File

@@ -38,7 +38,7 @@ class _FemConstraintSelfWeight:
obj.Gravity_y = 0.0
obj.Gravity_z = -1.0
obj.Proxy = self
self.Type = "FemConstraintSelfWeight"
self.Type = "Fem::ConstraintSelfWeight"
def execute(self, obj):
return

View File

@@ -116,7 +116,7 @@ class _FemElementFluid1D:
obj.InletFlowRateActive = False
obj.OutletFlowRateActive = False
obj.Proxy = self
self.Type = "FemElementFluid1D"
self.Type = "Fem::FemElementFluid1D"
def execute(self, obj):
return

View File

@@ -44,7 +44,7 @@ class _FemElementGeometry1D:
obj.SectionType = _FemElementGeometry1D.known_beam_types
obj.SectionType = 'Rectangular'
obj.Proxy = self
self.Type = "FemElementGeometry1D"
self.Type = "Fem::FemElementGeometry1D"
def execute(self, obj):
return

View File

@@ -34,7 +34,7 @@ class _FemElementGeometry2D:
obj.addProperty("App::PropertyLength", "Thickness", "ShellThickness", "set thickness of the shell elements")
obj.addProperty("App::PropertyLinkSubList", "References", "ShellThickness", "List of shell thickness shapes")
obj.Proxy = self
self.Type = "FemElementGeometry2D"
self.Type = "Fem::FemElementGeometry2D"
def execute(self, obj):
return

View File

@@ -35,7 +35,7 @@ class _FemMaterial:
obj.addProperty("App::PropertyEnumeration", "Category", "Material", "Material type: fluid or solid")
obj.Category = ['Solid', 'Fluid'] # used in TaskPanel
obj.Proxy = self
self.Type = "FemMaterial"
self.Type = "Fem::Material"
def execute(self, obj):
return

View File

@@ -32,7 +32,7 @@ class _FemMaterialMechanicalNonlinear:
"The FemMaterialMechanicalNonlinear object"
def __init__(self, obj):
obj.Proxy = self
self.Type = "FemMaterialMechanicalNonlinear"
self.Type = "Fem::MaterialMechanicalNonlinear"
obj.addProperty("App::PropertyLink", "LinearBaseMaterial", "Base", "Set the linear material the nonlinear builds upon.")

View File

@@ -31,7 +31,7 @@ __url__ = "http://www.freecadweb.org"
class _FemMeshBoundaryLayer:
"The FemMeshBoundaryLayer object"
def __init__(self, obj):
self.Type = "FemMeshBoundaryLayer"
self.Type = "Fem::FemMeshBoundaryLayer"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object

View File

@@ -39,7 +39,7 @@ class _FemMeshGmsh():
known_mesh_algorithm_3D = ['Automatic', 'Delaunay', 'New Delaunay', 'Frontal', 'Frontal Delaunay', 'Frontal Hex', 'MMG3D', 'R-tree']
def __init__(self, obj):
self.Type = "FemMeshGmsh"
self.Type = "Fem::FemMeshGmsh"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object

View File

@@ -34,7 +34,7 @@ class _FemMeshGroup:
obj.addProperty("App::PropertyBool", "UseLabel", "MeshGroupProperties", "The identifier used for export (True: Label, False: Name)")
obj.addProperty("App::PropertyLinkSubList", "References", "MeshGroupShapes", "List of FEM mesh group shapes")
obj.Proxy = self
self.Type = "FemMeshGroup"
self.Type = "Fem::FemMeshGroup"
def execute(self, obj):
return

View File

@@ -34,7 +34,7 @@ class _FemMeshRegion:
obj.addProperty("App::PropertyLength", "CharacteristicLength", "MeshRegionProperties", "set characteristic length of FEM elements for this region")
obj.addProperty("App::PropertyLinkSubList", "References", "MeshRegionShapes", "List of FEM mesh region shapes")
obj.Proxy = self
self.Type = "FemMeshRegion"
self.Type = "Fem::FemMeshRegion"
def execute(self, obj):
return

View File

@@ -33,7 +33,7 @@ class _FemMeshResult():
"""
def __init__(self, obj):
self.Type = "FemMeshResult"
self.Type = "Fem::FemMeshResult"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object

View File

@@ -33,7 +33,7 @@ class _FemResultMechanical():
"""The Fem::_FemResultMechanical's Proxy python type, add result specific properties
"""
def __init__(self, obj):
self.Type = "FemResultMechanical"
self.Type = "Fem::FemResultMechanical"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object

View File

@@ -35,7 +35,7 @@ class _FemSolverCalculix():
"""The Fem::FemSolver's Proxy python type, add solver specific properties
"""
def __init__(self, obj):
self.Type = "FemSolverCalculix"
self.Type = "Fem::FemSolverCalculix"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object

View File

@@ -559,7 +559,7 @@ class _CommandFemSolverCalculix(CommandManager):
if use_old_solver_frame_work and not use_new_solver_frame_work:
has_nonlinear_material_obj = False
for m in self.active_analysis.Group:
if hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
if hasattr(m, "Proxy") and m.Proxy.Type == "Fem::MaterialMechanicalNonlinear":
has_nonlinear_material_obj = True
FreeCAD.ActiveDocument.openTransaction("Create SolverCalculix")
FreeCADGui.addModule("ObjectsFem")

View File

@@ -116,7 +116,7 @@ class CommandManager(object):
def gmsh_femmesh_selected(self):
sel = FreeCADGui.Selection.getSelection()
if len(sel) == 1 and hasattr(sel[0], "Proxy") and sel[0].Proxy.Type == "FemMeshGmsh":
if len(sel) == 1 and hasattr(sel[0], "Proxy") and sel[0].Proxy.Type == "Fem::FemMeshGmsh":
self.selobj = sel[0]
return True
else:
@@ -140,7 +140,7 @@ class CommandManager(object):
def has_no_nonlinear_material(self):
"check if an nonlinear material exists which is already based on the selected material"
for o in FreeCAD.ActiveDocument.Objects:
if hasattr(o, "Proxy") and o.Proxy is not None and o.Proxy.Type == "FemMaterialMechanicalNonlinear" and o.LinearBaseMaterial == self.selobj:
if hasattr(o, "Proxy") and o.Proxy is not None and o.Proxy.Type == "Fem::MaterialMechanicalNonlinear" and o.LinearBaseMaterial == self.selobj:
# FreeCAD.Console.PrintError(o.Name + ' is based on the selected material: ' + self.selobj + '. Only one nonlinear object for each material allowed.\n')
return False
return True

View File

@@ -400,13 +400,13 @@ def get_femelement_sets_from_group_data(femmesh, fem_objects):
def get_elset_short_name(obj, i):
if hasattr(obj, "Proxy") and obj.Proxy.Type == 'FemMaterial':
if hasattr(obj, "Proxy") and obj.Proxy.Type == 'Fem::Material':
return 'Mat' + str(i)
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'FemElementGeometry1D':
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'Fem::FemElementGeometry1D':
return 'Beam' + str(i)
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'FemElementFluid1D':
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'Fem::FemElementFluid1D':
return 'Fluid' + str(i)
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'FemElementGeometry2D':
elif hasattr(obj, "Proxy") and obj.Proxy.Type == 'Fem::FemElementGeometry2D':
return 'Shell' + str(i)
else:
print('Error: ', obj.Name, ' --> ', obj.Proxy.Type)

View File

@@ -35,7 +35,7 @@ import FreeCAD
def purge_results(analysis):
for m in analysis.Group:
if (m.isDerivedFrom('Fem::FemResultObject')):
if m.Mesh and hasattr(m.Mesh, "Proxy") and m.Mesh.Proxy.Type == "FemMeshResult":
if m.Mesh and hasattr(m.Mesh, "Proxy") and m.Mesh.Proxy.Type == "Fem::FemMeshResult":
analysis.Document.removeObject(m.Mesh.Name)
analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()

View File

@@ -184,7 +184,7 @@ class _Container(object):
material_linear_dict = {}
material_linear_dict['Object'] = m
self.materials_linear.append(material_linear_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::MaterialMechanicalNonlinear":
material_nonlinear_dict = {}
material_nonlinear_dict['Object'] = m
self.materials_nonlinear.append(material_nonlinear_dict)
@@ -192,7 +192,7 @@ class _Container(object):
fixed_constraint_dict = {}
fixed_constraint_dict['Object'] = m
self.fixed_constraints.append(fixed_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemConstraintSelfWeight":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::ConstraintSelfWeight":
selfweight_dict = {}
selfweight_dict['Object'] = m
self.selfweight_constraints.append(selfweight_dict)
@@ -234,15 +234,15 @@ class _Container(object):
transform_constraint_dict = {}
transform_constraint_dict['Object'] = m
self.transform_constraints.append(transform_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry1D":
beam_section_dict = {}
beam_section_dict['Object'] = m
self.beam_sections.append(beam_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementFluid1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementFluid1D":
fluid_section_dict = {}
fluid_section_dict['Object'] = m
self.fluid_sections.append(fluid_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry2D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry2D":
shell_thickness_dict = {}
shell_thickness_dict['Object'] = m
self.shell_thicknesses.append(shell_thickness_dict)

View File

@@ -182,7 +182,7 @@ class _Container(object):
material_linear_dict = {}
material_linear_dict['Object'] = m
self.materials_linear.append(material_linear_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::MaterialMechanicalNonlinear":
material_nonlinear_dict = {}
material_nonlinear_dict['Object'] = m
self.materials_nonlinear.append(material_nonlinear_dict)
@@ -190,7 +190,7 @@ class _Container(object):
fixed_constraint_dict = {}
fixed_constraint_dict['Object'] = m
self.fixed_constraints.append(fixed_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemConstraintSelfWeight":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::ConstraintSelfWeight":
selfweight_dict = {}
selfweight_dict['Object'] = m
self.selfweight_constraints.append(selfweight_dict)
@@ -232,15 +232,15 @@ class _Container(object):
transform_constraint_dict = {}
transform_constraint_dict['Object'] = m
self.transform_constraints.append(transform_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry1D":
beam_section_dict = {}
beam_section_dict['Object'] = m
self.beam_sections.append(beam_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementFluid1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementFluid1D":
fluid_section_dict = {}
fluid_section_dict['Object'] = m
self.fluid_sections.append(fluid_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry2D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry2D":
shell_thickness_dict = {}
shell_thickness_dict['Object'] = m
self.shell_thicknesses.append(shell_thickness_dict)

View File

@@ -89,7 +89,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
def purge_results(self):
for m in self.analysis.Group:
if (m.isDerivedFrom('Fem::FemResultObject')):
if m.Mesh and hasattr(m.Mesh, "Proxy") and m.Mesh.Proxy.Type == "FemMeshResult":
if m.Mesh and hasattr(m.Mesh, "Proxy") and m.Mesh.Proxy.Type == "Fem::FemMeshResult":
self.analysis.Document.removeObject(m.Mesh.Name)
self.analysis.Document.removeObject(m.Name)
FreeCAD.ActiveDocument.recompute()
@@ -224,7 +224,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
material_linear_dict = {}
material_linear_dict['Object'] = m
self.materials_linear.append(material_linear_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::MaterialMechanicalNonlinear":
material_nonlinear_dict = {}
material_nonlinear_dict['Object'] = m
self.materials_nonlinear.append(material_nonlinear_dict)
@@ -232,7 +232,7 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
fixed_constraint_dict = {}
fixed_constraint_dict['Object'] = m
self.fixed_constraints.append(fixed_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemConstraintSelfWeight":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::ConstraintSelfWeight":
selfweight_dict = {}
selfweight_dict['Object'] = m
self.selfweight_constraints.append(selfweight_dict)
@@ -273,15 +273,15 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
transform_constraint_dict = {}
transform_constraint_dict['Object'] = m
self.transform_constraints.append(transform_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry1D":
beam_section_dict = {}
beam_section_dict['Object'] = m
self.beam_sections.append(beam_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementFluid1D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementFluid1D":
fluid_section_dict = {}
fluid_section_dict['Object'] = m
self.fluid_sections.append(fluid_section_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemElementGeometry2D":
elif hasattr(m, "Proxy") and m.Proxy.Type == "Fem::FemElementGeometry2D":
shell_thickness_dict = {}
shell_thickness_dict['Object'] = m
self.shell_thicknesses.append(shell_thickness_dict)