FEM: nonlinear material command, only allow to add nonlinear material to solid material
This commit is contained in:
@@ -68,6 +68,8 @@ class FemCommands(object):
|
||||
active = FreeCADGui.ActiveDocument is not None and self.with_femmesh_andor_res_selected()
|
||||
elif self.is_active == 'with_material':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.material_selected()
|
||||
elif self.is_active == 'with_material_solid':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.material_solid_selected()
|
||||
elif self.is_active == 'with_solver':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.solver_selected()
|
||||
elif self.is_active == 'with_analysis_without_solver':
|
||||
@@ -123,6 +125,13 @@ class FemCommands(object):
|
||||
else:
|
||||
return False
|
||||
|
||||
def material_solid_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("App::MaterialObjectPython") and hasattr(sel[0], "Category") and sel[0].Category == "Solid":
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def with_femmesh_andor_res_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemMeshObject"):
|
||||
|
||||
@@ -42,7 +42,7 @@ class _CommandFemMaterialMechanicalNonlinear(FemCommands):
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("FEM_MaterialMechanicalNonlinear", "Nonlinear mechanical material"),
|
||||
'Accel': "C, W",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("FEM_MaterialMechanicalNonlinear", "Creates a nonlinear mechanical material")}
|
||||
self.is_active = 'with_material'
|
||||
self.is_active = 'with_material_solid'
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
|
||||
Reference in New Issue
Block a user