FEM: material editor, add it to materials menue

This commit is contained in:
Bernd Hahnebach
2018-05-28 06:00:57 +02:00
parent 24a21ce83f
commit fbf96728b8
3 changed files with 20 additions and 1 deletions

View File

@@ -164,7 +164,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
material->setCommand("Materials");
*material << "FEM_MaterialSolid"
<< "FEM_MaterialFluid"
<< "FEM_MaterialMechanicalNonlinear";
<< "FEM_MaterialMechanicalNonlinear"
<< "FEM_MaterialEditor";
Gui::MenuItem* elec = new Gui::MenuItem;
elec->setCommand("&Electrostatic Constraints");

View File

@@ -303,6 +303,21 @@ class _CommandFemEquationHeat(CommandManager):
FreeCAD.ActiveDocument.recompute()
class _CommandFemMaterialEditor(CommandManager):
"The FEM_MaterialEditor command definition"
def __init__(self):
super(_CommandFemMaterialEditor, self).__init__()
self.resources = {'Pixmap': 'fem-femmesh-clear-mesh',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Material Editor", "opens the FreeCAD material editor"),
# 'Accel': "Z, Z",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Material Editor", "opens the FreeCAD material editor")}
self.is_active = 'allways'
def Activated(self):
FreeCADGui.addModule("MaterialEditor")
FreeCADGui.doCommand("MaterialEditor.openEditor()")
class _CommandFemMaterialFluid(CommandManager):
"The FEM_MaterialFluid command definition"
def __init__(self):
@@ -750,6 +765,7 @@ FreeCADGui.addCommand('FEM_EquationElasticity', _CommandFemEquationElasticity())
FreeCADGui.addCommand('FEM_EquationFlow', _CommandFemEquationFlow())
FreeCADGui.addCommand('FEM_EquationFluxsolver', _CommandFemEquationFluxsolver())
FreeCADGui.addCommand('FEM_EquationHeat', _CommandFemEquationHeat())
FreeCADGui.addCommand('FEM_MaterialEditor', _CommandFemMaterialEditor())
FreeCADGui.addCommand('FEM_MaterialFluid', _CommandFemMaterialFluid())
FreeCADGui.addCommand('FEM_MaterialMechanicalNonlinear', _CommandFemMaterialMechanicalNonlinear())
FreeCADGui.addCommand('FEM_MaterialSolid', _CommandFemMaterialSolid())

View File

@@ -53,6 +53,8 @@ class CommandManager(object):
def IsActive(self):
if not self.is_active:
active = False
elif self.is_active == 'allways':
active = True
elif self.is_active == 'with_document':
active = FreeCADGui.ActiveDocument is not None
elif self.is_active == 'with_analysis':