FEM: new commands, use same code system as it is used in the other commands
This commit is contained in:
@@ -25,35 +25,36 @@ __title__ = "AddConstraintBodyHeatSource"
|
||||
__author__ = "Markus Hovorka"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandFemConstraintBodyHeatSource
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from .FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from PyGui import FemCommands
|
||||
|
||||
|
||||
class Command(FemCommands.FemCommands):
|
||||
|
||||
class _CommandFemConstraintBodyHeatSource(FemCommands):
|
||||
"The FEM_ConstraintBodyHeatSource command definition"
|
||||
def __init__(self):
|
||||
super(Command, self).__init__()
|
||||
super(_CommandFemConstraintBodyHeatSource, self).__init__()
|
||||
self.resources = {
|
||||
'Pixmap': 'fem-constraint-heatflux',
|
||||
'Pixmap': 'fem-constraint-heatflux', # the heatflux icon is used
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintBodyHeatSource",
|
||||
"Constraint body heat source"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintBodyHeatFlux",
|
||||
"FEM_ConstraintBodyHeatSource",
|
||||
"Creates a FEM constraint body heat source")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
App.ActiveDocument.openTransaction(
|
||||
FreeCAD.ActiveDocument.openTransaction(
|
||||
"Create FemConstraintBodyHeatSource")
|
||||
Gui.addModule("ObjectsFem")
|
||||
Gui.doCommand(
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(
|
||||
"FemGui.getActiveAnalysis().Member += "
|
||||
"[ObjectsFem.makeConstraintBodyHeatSource()]")
|
||||
"[ObjectsFem.makeConstraintBodyHeatSource(FreeCAD.ActiveDocument)]")
|
||||
|
||||
|
||||
Gui.addCommand('FEM_ConstraintBodyHeatSource', Command())
|
||||
FreeCADGui.addCommand('FEM_ConstraintBodyHeatSource', _CommandFemConstraintBodyHeatSource())
|
||||
|
||||
@@ -25,35 +25,36 @@ __title__ = "AddConstraintFlowVelocity"
|
||||
__author__ = "Markus Hovorka"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandFemConstraintFlowVelocity
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from .FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from PyGui import FemCommands
|
||||
|
||||
|
||||
class Command(FemCommands.FemCommands):
|
||||
|
||||
class _CommandFemConstraintFlowVelocity(FemCommands):
|
||||
"The FEM_ConstraintFlowVelocity command definition"
|
||||
def __init__(self):
|
||||
super(Command, self).__init__()
|
||||
super(_CommandFemConstraintFlowVelocity, self).__init__()
|
||||
self.resources = {
|
||||
'Pixmap': 'fem-constraint-flow-velocity',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintFlowVelocity",
|
||||
"Constraint Velocity"),
|
||||
"Constraint Flow Velocity"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintFlowVelocity",
|
||||
"Creates a FEM constraint body heat flux")}
|
||||
"Creates a FEM constraint flow velocity")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
App.ActiveDocument.openTransaction(
|
||||
FreeCAD.ActiveDocument.openTransaction(
|
||||
"Create FemConstraintFlowVelocity")
|
||||
Gui.addModule("ObjectsFem")
|
||||
Gui.doCommand(
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(
|
||||
"FemGui.getActiveAnalysis().Member += "
|
||||
"[ObjectsFem.makeConstraintFlowVelocity()]")
|
||||
"[ObjectsFem.makeConstraintFlowVelocity(FreeCAD.ActiveDocument)]")
|
||||
|
||||
|
||||
Gui.addCommand('FEM_ConstraintFlowVelocity', Command())
|
||||
FreeCADGui.addCommand('FEM_ConstraintFlowVelocity', _CommandFemConstraintFlowVelocity())
|
||||
|
||||
@@ -25,35 +25,37 @@ __title__ = "AddConstraintInitialFlowVelocity"
|
||||
__author__ = "Markus Hovorka"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandFemConstraintInitialFlowVelocity
|
||||
# \ingroup FEM
|
||||
|
||||
|
||||
import FreeCAD
|
||||
from .FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from PyGui import FemCommands
|
||||
|
||||
|
||||
class Command(FemCommands.FemCommands):
|
||||
class _CommandFemConstraintInitialFlowVelocity(FemCommands):
|
||||
|
||||
def __init__(self):
|
||||
super(Command, self).__init__()
|
||||
super(_CommandFemConstraintInitialFlowVelocity, self).__init__()
|
||||
self.resources = {
|
||||
'Pixmap': 'fem-constraint-initial-flow-velocity',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintInitialFlowVelocity",
|
||||
"Constraint Velocity"),
|
||||
"Constraint Initial Flow Velocity"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintInitialFlowVelocity",
|
||||
"Creates a FEM constraint body heat flux")}
|
||||
"Creates a FEM constraint initial flow velocity")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
App.ActiveDocument.openTransaction(
|
||||
FreeCAD.ActiveDocument.openTransaction(
|
||||
"Create FemConstraintInitialFlowVelocity")
|
||||
Gui.addModule("ObjectsFem")
|
||||
Gui.doCommand(
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(
|
||||
"FemGui.getActiveAnalysis().Member += "
|
||||
"[ObjectsFem.makeConstraintInitialFlowVelocity()]")
|
||||
"[ObjectsFem.makeConstraintInitialFlowVelocity(FreeCAD.ActiveDocument)]")
|
||||
|
||||
|
||||
Gui.addCommand('FEM_ConstraintInitialFlowVelocity', Command())
|
||||
FreeCADGui.addCommand('FEM_ConstraintInitialFlowVelocity', _CommandFemConstraintInitialFlowVelocity())
|
||||
|
||||
@@ -21,43 +21,40 @@
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
__title__ = "Elmer"
|
||||
__title__ = "Command Solver Elmer"
|
||||
__author__ = "Markus Hovorka"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandFemSolverZ88
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from .FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import FemGui
|
||||
|
||||
|
||||
class Command(QtCore.QObject):
|
||||
class _CommandFemSolverElmer(FemCommands):
|
||||
"The FEM_SolverElmer command definition"
|
||||
def __init__(self):
|
||||
super(_CommandFemSolverElmer, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-elmer',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("FEM_SolverElmer", "Solver Elmer"),
|
||||
'Accel': "S, E",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("FEM_SolverElmer", "Creates a FEM solver Elmer")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
analysis = FemGui.getActiveAnalysis()
|
||||
App.ActiveDocument.openTransaction("Create Elmer solver object")
|
||||
Gui.addModule("femsolver.elmer.solver")
|
||||
Gui.doCommand(
|
||||
"App.ActiveDocument.%s.Member += "
|
||||
"[femsolver.elmer.solver.create(App.ActiveDocument)]"
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Elmer solver object")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(
|
||||
"FreeCAD.ActiveDocument.%s.Member += "
|
||||
"[ObjectsFem.makeSolverElmer(FreeCAD.ActiveDocument)]"
|
||||
% analysis.Name)
|
||||
App.ActiveDocument.commitTransaction()
|
||||
App.ActiveDocument.recompute()
|
||||
|
||||
def GetResources(self):
|
||||
return {
|
||||
'Pixmap': 'fem-elmer',
|
||||
'MenuText': "Solver Elmer",
|
||||
'Accel': "S, E",
|
||||
'ToolTip': "Creates a FEM solver Elmer"
|
||||
}
|
||||
|
||||
def IsActive(self):
|
||||
analysis = FemGui.getActiveAnalysis()
|
||||
return (analysis is not None
|
||||
and analysis.Document == App.ActiveDocument)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
Gui.addCommand('FEM_SolverElmer', Command())
|
||||
FreeCADGui.addCommand('FEM_SolverElmer', _CommandFemSolverElmer())
|
||||
|
||||
Reference in New Issue
Block a user