FEM: code formating, commands, use double quotes instead of single ones

This commit is contained in:
Bernd Hahnebach
2019-08-16 07:58:34 +02:00
parent 2c9eef4bbb
commit 9bb420caf4
4 changed files with 359 additions and 359 deletions

View File

@@ -35,8 +35,8 @@ def makeAnalysis(
doc,
name="Analysis"
):
'''makeAnalysis(document, [name]):
makes a Fem Analysis object'''
"""makeAnalysis(document, [name]):
makes a Fem Analysis object"""
obj = doc.addObject("Fem::FemAnalysis", name)
return obj
@@ -46,8 +46,8 @@ def makeConstraintBearing(
doc,
name="ConstraintBearing"
):
'''makeConstraintBearing(document, [name]):
makes a Fem ConstraintBearing object'''
"""makeConstraintBearing(document, [name]):
makes a Fem ConstraintBearing object"""
obj = doc.addObject("Fem::ConstraintBearing", name)
return obj
@@ -56,8 +56,8 @@ def makeConstraintBodyHeatSource(
doc,
name="ConstraintBodyHeatSource"
):
'''makeConstraintBodyHeatSource(document, [name]):
makes a Fem ConstraintBodyHeatSource object'''
"""makeConstraintBodyHeatSource(document, [name]):
makes a Fem ConstraintBodyHeatSource object"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import _FemConstraintBodyHeatSource
_FemConstraintBodyHeatSource.Proxy(obj)
@@ -71,8 +71,8 @@ def makeConstraintContact(
doc,
name="ConstraintContact"
):
'''makeConstraintContact(document, [name]):
makes a Fem ConstraintContact object'''
"""makeConstraintContact(document, [name]):
makes a Fem ConstraintContact object"""
obj = doc.addObject("Fem::ConstraintContact", name)
return obj
@@ -81,8 +81,8 @@ def makeConstraintDisplacement(
doc,
name="ConstraintDisplacement"
):
'''makeConstraintDisplacement(document, [name]):
makes a Fem ConstraintDisplacement object'''
"""makeConstraintDisplacement(document, [name]):
makes a Fem ConstraintDisplacement object"""
obj = doc.addObject("Fem::ConstraintDisplacement", name)
return obj
@@ -91,8 +91,8 @@ def makeConstraintElectrostaticPotential(
doc,
name="ConstraintElectrostaticPotential"
):
'''makeConstraintElectrostaticPotential(document, [name]):
makes a Fem ElectrostaticPotential object'''
"""makeConstraintElectrostaticPotential(document, [name]):
makes a Fem ElectrostaticPotential object"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import _FemConstraintElectrostaticPotential
_FemConstraintElectrostaticPotential.Proxy(obj)
@@ -106,8 +106,8 @@ def makeConstraintFixed(
doc,
name="ConstraintFixed"
):
'''makeConstraintFixed(document, [name]):
makes a Fem ConstraintFixed object'''
"""makeConstraintFixed(document, [name]):
makes a Fem ConstraintFixed object"""
obj = doc.addObject("Fem::ConstraintFixed", name)
return obj
@@ -116,8 +116,8 @@ def makeConstraintFlowVelocity(
doc,
name="ConstraintFlowVelocity"
):
'''makeConstraintFlowVelocity(document, [name]):
makes a Fem ConstraintFlowVelocity object'''
"""makeConstraintFlowVelocity(document, [name]):
makes a Fem ConstraintFlowVelocity object"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import _FemConstraintFlowVelocity
_FemConstraintFlowVelocity.Proxy(obj)
@@ -131,8 +131,8 @@ def makeConstraintFluidBoundary(
doc,
name="ConstraintFluidBoundary"
):
'''makeConstraintFluidBoundary(document, name):
makes a Fem ConstraintFluidBoundary object'''
"""makeConstraintFluidBoundary(document, name):
makes a Fem ConstraintFluidBoundary object"""
obj = doc.addObject("Fem::ConstraintFluidBoundary", name)
return obj
@@ -141,8 +141,8 @@ def makeConstraintForce(
doc,
name="ConstraintForce"
):
'''makeConstraintForce(document, [name]):
makes a Fem ConstraintForce object'''
"""makeConstraintForce(document, [name]):
makes a Fem ConstraintForce object"""
obj = doc.addObject("Fem::ConstraintForce", name)
return obj
@@ -151,8 +151,8 @@ def makeConstraintGear(
doc,
name="ConstraintGear"
):
'''makeConstraintGear(document, [name]):
makes a Fem ConstraintGear object'''
"""makeConstraintGear(document, [name]):
makes a Fem ConstraintGear object"""
obj = doc.addObject("Fem::ConstraintGear", name)
return obj
@@ -161,8 +161,8 @@ def makeConstraintHeatflux(
doc,
name="ConstraintHeatflux"
):
'''makeConstraintHeatflux(document, [name]):
makes a Fem ConstraintHeatflux object'''
"""makeConstraintHeatflux(document, [name]):
makes a Fem ConstraintHeatflux object"""
obj = doc.addObject("Fem::ConstraintHeatflux", name)
return obj
@@ -171,8 +171,8 @@ def makeConstraintInitialFlowVelocity(
doc,
name="ConstraintInitialFlowVelocity"
):
'''makeConstraintInitialFlowVelocity(document, [name]):
makes a Fem ConstraintInitialFlowVelocity object'''
"""makeConstraintInitialFlowVelocity(document, [name]):
makes a Fem ConstraintInitialFlowVelocity object"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import _FemConstraintInitialFlowVelocity
_FemConstraintInitialFlowVelocity.Proxy(obj)
@@ -186,8 +186,8 @@ def makeConstraintInitialTemperature(
doc,
name="ConstraintInitialTemperature"
):
'''makeConstraintInitialTemperature(document, name):
makes a Fem ConstraintInitialTemperature object'''
"""makeConstraintInitialTemperature(document, name):
makes a Fem ConstraintInitialTemperature object"""
obj = doc.addObject("Fem::ConstraintInitialTemperature", name)
return obj
@@ -196,8 +196,8 @@ def makeConstraintPlaneRotation(
doc,
name="ConstraintPlaneRotation"
):
'''makeConstraintPlaneRotation(document, [name]):
makes a Fem ConstraintPlaneRotation object'''
"""makeConstraintPlaneRotation(document, [name]):
makes a Fem ConstraintPlaneRotation object"""
obj = doc.addObject("Fem::ConstraintPlaneRotation", name)
return obj
@@ -206,8 +206,8 @@ def makeConstraintPressure(
doc,
name="ConstraintPressure"
):
'''makeConstraintPressure(document, [name]):
makes a Fem ConstraintPressure object'''
"""makeConstraintPressure(document, [name]):
makes a Fem ConstraintPressure object"""
obj = doc.addObject("Fem::ConstraintPressure", name)
return obj
@@ -216,8 +216,8 @@ def makeConstraintPulley(
doc,
name="ConstraintPulley"
):
'''makeConstraintPulley(document, [name]):
makes a Fem ConstraintPulley object'''
"""makeConstraintPulley(document, [name]):
makes a Fem ConstraintPulley object"""
obj = doc.addObject("Fem::ConstraintPulley", name)
return obj
@@ -226,8 +226,8 @@ def makeConstraintSelfWeight(
doc,
name="ConstraintSelfWeight"
):
'''makeConstraintSelfWeight(document, [name]):
creates an self weight object to define a gravity load'''
"""makeConstraintSelfWeight(document, [name]):
creates an self weight object to define a gravity load"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import _FemConstraintSelfWeight
_FemConstraintSelfWeight._FemConstraintSelfWeight(obj)
@@ -243,8 +243,8 @@ def makeConstraintTemperature(
doc,
name="ConstraintTemperature"
):
'''makeConstraintTemperature(document, [name]):
makes a Fem ConstraintTemperature object'''
"""makeConstraintTemperature(document, [name]):
makes a Fem ConstraintTemperature object"""
obj = doc.addObject("Fem::ConstraintTemperature", name)
return obj
@@ -253,8 +253,8 @@ def makeConstraintTransform(
doc,
name="ConstraintTransform"
):
'''makeConstraintTransform(document, [name]):
makes a Fem ConstraintTransform object'''
"""makeConstraintTransform(document, [name]):
makes a Fem ConstraintTransform object"""
obj = doc.addObject("Fem::ConstraintTransform", name)
return obj
@@ -264,8 +264,8 @@ def makeElementFluid1D(
doc,
name="ElementFluid1D"
):
'''makeElementFluid1D(document, [name]):
creates an 1D fluid element object to define 1D flow'''
"""makeElementFluid1D(document, [name]):
creates an 1D fluid element object to define 1D flow"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemElementFluid1D
_FemElementFluid1D._FemElementFluid1D(obj)
@@ -277,13 +277,13 @@ def makeElementFluid1D(
def makeElementGeometry1D(
doc,
sectiontype='Rectangular',
sectiontype="Rectangular",
width=10.0,
height=25.0,
name="ElementGeometry1D"
):
'''makeElementGeometry1D(document, [width], [height], [name]):
creates an 1D geometry element object to define a cross section'''
"""makeElementGeometry1D(document, [width], [height], [name]):
creates an 1D geometry element object to define a cross section"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemElementGeometry1D
_FemElementGeometry1D._FemElementGeometry1D(obj)
@@ -309,8 +309,8 @@ def makeElementGeometry2D(
thickness=20.0,
name="ElementGeometry2D"
):
'''makeElementGeometry2D(document, [thickness], [name]):
creates an 2D geometry element object to define a plate thickness'''
"""makeElementGeometry2D(document, [thickness], [name]):
creates an 2D geometry element object to define a plate thickness"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemElementGeometry2D
_FemElementGeometry2D._FemElementGeometry2D(obj)
@@ -325,8 +325,8 @@ def makeElementRotation1D(
doc,
name="ElementRotation1D"
):
'''makeElementRotation1D(document, [name]):
creates an 1D geometry rotation element object to rotate a 1D cross section'''
"""makeElementRotation1D(document, [name]):
creates an 1D geometry rotation element object to rotate a 1D cross section"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemElementRotation1D
_FemElementRotation1D._FemElementRotation1D(obj)
@@ -341,12 +341,12 @@ def makeMaterialFluid(
doc,
name="FluidMaterial"
):
'''makeMaterialFluid(document, [name]):
makes a FEM Material for fluid'''
"""makeMaterialFluid(document, [name]):
makes a FEM Material for fluid"""
obj = doc.addObject("App::MaterialObjectPython", name)
from femobjects import _FemMaterial
_FemMaterial._FemMaterial(obj)
obj.Category = 'Fluid'
obj.Category = "Fluid"
if FreeCAD.GuiUp:
from femguiobjects import _ViewProviderFemMaterial
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
@@ -358,8 +358,8 @@ def makeMaterialMechanicalNonlinear(
base_material,
name="MechanicalMaterialNonlinear"
):
'''makeMaterialMechanicalNonlinear(document, base_material, [name]):
creates a nonlinear material object'''
"""makeMaterialMechanicalNonlinear(document, base_material, [name]):
creates a nonlinear material object"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemMaterialMechanicalNonlinear
_FemMaterialMechanicalNonlinear._FemMaterialMechanicalNonlinear(obj)
@@ -376,8 +376,8 @@ def makeMaterialReinforced(
doc,
name="MaterialReinforced"
):
'''makeMaterialReinforced(document, [matrix_material], [reinforcement_material], [name]):
creates a reinforced material object'''
"""makeMaterialReinforced(document, [matrix_material], [reinforcement_material], [name]):
creates a reinforced material object"""
obj = doc.addObject("App::MaterialObjectPython", name)
from femobjects import _FemMaterialReinforced
_FemMaterialReinforced._FemMaterialReinforced(obj)
@@ -391,12 +391,12 @@ def makeMaterialSolid(
doc,
name="MechanicalSolidMaterial"
):
'''makeMaterialSolid(document, [name]):
makes a FEM Material for solid'''
"""makeMaterialSolid(document, [name]):
makes a FEM Material for solid"""
obj = doc.addObject("App::MaterialObjectPython", name)
from femobjects import _FemMaterial
_FemMaterial._FemMaterial(obj)
obj.Category = 'Solid'
obj.Category = "Solid"
if FreeCAD.GuiUp:
from femguiobjects import _ViewProviderFemMaterial
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
@@ -409,8 +409,8 @@ def makeMeshBoundaryLayer(
base_mesh,
name="MeshBoundaryLayer"
):
'''makeMeshBoundaryLayer(document, base_mesh, [name]):
creates a FEM mesh BoundaryLayer object to define boundary layer properties'''
"""makeMeshBoundaryLayer(document, base_mesh, [name]):
creates a FEM mesh BoundaryLayer object to define boundary layer properties"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemMeshBoundaryLayer
_FemMeshBoundaryLayer._FemMeshBoundaryLayer(obj)
@@ -430,8 +430,8 @@ def makeMeshGmsh(
doc,
name="MeshGmsh"
):
'''makeMeshGmsh(document, [name]):
makes a Gmsh FEM mesh object'''
"""makeMeshGmsh(document, [name]):
makes a Gmsh FEM mesh object"""
obj = doc.addObject("Fem::FemMeshObjectPython", name)
from femobjects import _FemMeshGmsh
_FemMeshGmsh._FemMeshGmsh(obj)
@@ -447,8 +447,8 @@ def makeMeshGroup(
use_label=False,
name="MeshGroup"
):
'''makeMeshGroup(document, base_mesh, [use_label], [name]):
creates a FEM mesh region object to define properties for a region of a FEM mesh'''
"""makeMeshGroup(document, base_mesh, [use_label], [name]):
creates a FEM mesh region object to define properties for a region of a FEM mesh"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemMeshGroup
_FemMeshGroup._FemMeshGroup(obj)
@@ -469,8 +469,8 @@ def makeMeshNetgen(
doc,
name="MeshNetgen"
):
'''makeMeshNetgen(document, [name]):
makes a Fem MeshShapeNetgenObject object'''
"""makeMeshNetgen(document, [name]):
makes a Fem MeshShapeNetgenObject object"""
obj = doc.addObject("Fem::FemMeshShapeNetgenObject", name)
return obj
@@ -481,8 +481,8 @@ def makeMeshRegion(
element_length=0.0,
name="MeshRegion"
):
'''makeMeshRegion(document, base_mesh, [element_length], [name]):
creates a FEM mesh region object to define properties for a region of a FEM mesh'''
"""makeMeshRegion(document, base_mesh, [element_length], [name]):
creates a FEM mesh region object to define properties for a region of a FEM mesh"""
obj = doc.addObject("Fem::FeaturePython", name)
from femobjects import _FemMeshRegion
_FemMeshRegion._FemMeshRegion(obj)
@@ -503,7 +503,7 @@ def makeMeshResult(
doc,
name="MeshResult"
):
'''makeMeshResult(document, name): makes a Fem MeshResult object'''
"""makeMeshResult(document, name): makes a Fem MeshResult object"""
obj = doc.addObject("Fem::FemMeshObjectPython", name)
from femobjects import _FemMeshResult
_FemMeshResult._FemMeshResult(obj)
@@ -518,9 +518,9 @@ def makeResultMechanical(
doc,
name="MechanicalResult"
):
'''makeResultMechanical(document, [name]):
creates an mechanical result object to hold FEM results'''
obj = doc.addObject('Fem::FemResultObjectPython', name)
"""makeResultMechanical(document, [name]):
creates an mechanical result object to hold FEM results"""
obj = doc.addObject("Fem::FemResultObjectPython", name)
from femobjects import _FemResultMechanical
_FemResultMechanical._FemResultMechanical(obj)
if FreeCAD.GuiUp:
@@ -534,8 +534,8 @@ def makePostVtkFilterClipRegion(
base_vtk_result,
name="VtkFilterClipRegion"
):
'''makePostVtkFilterClipRegion(document, base_vtk_result, [name]):
creates an FEM post processing region clip filter object (vtk based)'''
"""makePostVtkFilterClipRegion(document, base_vtk_result, [name]):
creates an FEM post processing region clip filter object (vtk based)"""
obj = doc.addObject("Fem::FemPostClipFilter", name)
tmp_filter_list = base_vtk_result.Filter
tmp_filter_list.append(obj)
@@ -549,8 +549,8 @@ def makePostVtkFilterClipScalar(
base_vtk_result,
name="VtkFilterClipScalar"
):
'''makePostVtkFilterClipScalar(document, base_vtk_result, [name]):
creates an FEM post processing scalar clip filter object (vtk based)'''
"""makePostVtkFilterClipScalar(document, base_vtk_result, [name]):
creates an FEM post processing scalar clip filter object (vtk based)"""
obj = doc.addObject("Fem::FemPostScalarClipFilter", name)
tmp_filter_list = base_vtk_result.Filter
tmp_filter_list.append(obj)
@@ -564,8 +564,8 @@ def makePostVtkFilterCutFunction(
base_vtk_result,
name="VtkFilterCutFunction"
):
'''makePostVtkFilterCutFunction(document, base_vtk_result, [name]):
creates an FEM post processing cut function filter object (vtk based)'''
"""makePostVtkFilterCutFunction(document, base_vtk_result, [name]):
creates an FEM post processing cut function filter object (vtk based)"""
obj = doc.addObject("Fem::FemPostClipFilter", name)
tmp_filter_list = base_vtk_result.Filter
tmp_filter_list.append(obj)
@@ -579,8 +579,8 @@ def makePostVtkFilterWarp(
base_vtk_result,
name="VtkFilterWarp"
):
'''makePostVtkFilterWarp(document, base_vtk_result, [name]):
creates an FEM post processing warp filter object (vtk based)'''
"""makePostVtkFilterWarp(document, base_vtk_result, [name]):
creates an FEM post processing warp filter object (vtk based)"""
obj = doc.addObject("Fem::FemPostWarpVectorFilter", name)
tmp_filter_list = base_vtk_result.Filter
tmp_filter_list.append(obj)
@@ -593,8 +593,8 @@ def makePostVtkResult(
doc, base_result,
name="VtkResult"
):
'''makePostVtkResult(document, base_result [name]):
creates an FEM post processing result object (vtk based) to hold FEM results'''
"""makePostVtkResult(document, base_result [name]):
creates an FEM post processing result object (vtk based) to hold FEM results"""
obj = doc.addObject("Fem::FemPostPipeline", name)
obj.load(base_result)
return obj
@@ -605,10 +605,10 @@ def makeEquationElasticity(
doc,
base_solver
):
'''makeEquationElasticity(document, base_solver):
creates a FEM elasticity equation for a solver'''
"""makeEquationElasticity(document, base_solver):
creates a FEM elasticity equation for a solver"""
obj = doc.SolverElmer.addObject(
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, 'Elasticity')
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Elasticity")
)[0]
return obj
@@ -617,10 +617,10 @@ def makeEquationElectrostatic(
doc,
base_solver
):
'''makeEquationElectrostatic(document, base_solver):
creates a FEM electrostatic equation for a solver'''
"""makeEquationElectrostatic(document, base_solver):
creates a FEM electrostatic equation for a solver"""
obj = doc.SolverElmer.addObject(
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, 'Electrostatic')
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Electrostatic")
)[0]
return obj
@@ -629,10 +629,10 @@ def makeEquationFlow(
doc,
base_solver
):
'''makeEquationFlow(document, base_solver):
creates a FEM flow equation for a solver'''
"""makeEquationFlow(document, base_solver):
creates a FEM flow equation for a solver"""
obj = doc.SolverElmer.addObject(
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, 'Flow')
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Flow")
)[0]
return obj
@@ -641,10 +641,10 @@ def makeEquationFluxsolver(
doc,
base_solver
):
'''makeEquationFluxsolver(document, base_solver):
creates a FEM fluxsolver equation for a solver'''
"""makeEquationFluxsolver(document, base_solver):
creates a FEM fluxsolver equation for a solver"""
obj = doc.SolverElmer.addObject(
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, 'Fluxsolver')
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Fluxsolver")
)[0]
return obj
@@ -653,10 +653,10 @@ def makeEquationHeat(
doc,
base_solver
):
'''makeEquationHeat(document, base_solver):
creates a FEM heat equation for a solver'''
"""makeEquationHeat(document, base_solver):
creates a FEM heat equation for a solver"""
obj = doc.SolverElmer.addObject(
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, 'Heat')
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Heat")
)[0]
return obj
@@ -665,8 +665,8 @@ def makeSolverCalculixCcxTools(
doc,
name="CalculiXccxTools"
):
'''makeSolverCalculixCcxTools(document, [name]):
makes a Calculix solver object for the ccx tools module'''
"""makeSolverCalculixCcxTools(document, [name]):
makes a Calculix solver object for the ccx tools module"""
obj = doc.addObject("Fem::FemSolverObjectPython", name)
from femobjects import _FemSolverCalculix
_FemSolverCalculix._FemSolverCalculix(obj)
@@ -680,8 +680,8 @@ def makeSolverCalculix(
doc,
name="SolverCalculiX"
):
'''makeSolverCalculix(document, [name]):
makes a Calculix solver object'''
"""makeSolverCalculix(document, [name]):
makes a Calculix solver object"""
import femsolver.calculix.solver
obj = femsolver.calculix.solver.create(doc, name)
return obj
@@ -691,8 +691,8 @@ def makeSolverElmer(
doc,
name="SolverElmer"
):
'''makeSolverElmer(document, [name]):
makes a Elmer solver object'''
"""makeSolverElmer(document, [name]):
makes a Elmer solver object"""
import femsolver.elmer.solver
obj = femsolver.elmer.solver.create(doc, name)
return obj
@@ -702,21 +702,21 @@ def makeSolverZ88(
doc,
name="SolverZ88"
):
'''makeSolverZ88(document, [name]):
makes a Z88 solver object'''
"""makeSolverZ88(document, [name]):
makes a Z88 solver object"""
import femsolver.z88.solver
obj = femsolver.z88.solver.create(doc, name)
return obj
'''
"""
# get the supportedTypes
App.newDocument()
module = 'Fem'
FreeCADGui.doCommand('import ' + module)
module = "Fem"
FreeCADGui.doCommand("import " + module)
for s in sorted(App.ActiveDocument.supportedTypes()):
if s.startswith(module):
print(s)
'''
"""
## @}

View File

@@ -58,7 +58,7 @@ False if TestSolverFrameWork.__name__ else True
# in tearDown method to not close the document
'''
"""
# examples from within FreeCAD:
# all FEM tests
import Test, TestFem
@@ -277,4 +277,4 @@ doc = FreeCAD.open(app_home + 'data/examples/FemCalculixCantilever3D_newSolver.F
doc = FreeCAD.open(app_home + 'data/examples/Fem.FCStd')
doc = FreeCAD.open(app_home + 'data/examples/Fem2.FCStd')
'''
"""

File diff suppressed because it is too large Load Diff

View File

@@ -39,10 +39,10 @@ if FreeCAD.GuiUp:
class CommandManager(object):
def __init__(self):
self.resources = {
'Pixmap': 'FemWorkbench',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command MenuText"),
'Accel': "",
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command ToolTip")
"Pixmap": "FemWorkbench",
"MenuText": QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command MenuText"),
"Accel": "",
"ToolTip": QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command ToolTip")
}
# FIXME add option description
self.is_active = None
@@ -56,51 +56,51 @@ class CommandManager(object):
def IsActive(self):
if not self.is_active:
active = False
elif self.is_active == 'allways':
elif self.is_active == "allways":
active = True
elif self.is_active == 'with_document':
elif self.is_active == "with_document":
active = FreeCADGui.ActiveDocument is not None
elif self.is_active == 'with_analysis':
elif self.is_active == "with_analysis":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc()
elif self.is_active == 'with_results':
elif self.is_active == "with_results":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc() \
and (self.results_present() or self.result_mesh_present())
elif self.is_active == 'with_selresult':
elif self.is_active == "with_selresult":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc() \
and self.result_selected()
elif self.is_active == 'with_part_feature':
elif self.is_active == "with_part_feature":
active = FreeCADGui.ActiveDocument is not None \
and self.part_feature_selected()
elif self.is_active == 'with_femmesh':
elif self.is_active == "with_femmesh":
active = FreeCADGui.ActiveDocument is not None \
and self.femmesh_selected()
elif self.is_active == 'with_gmsh_femmesh':
elif self.is_active == "with_gmsh_femmesh":
active = FreeCADGui.ActiveDocument is not None \
and self.gmsh_femmesh_selected()
elif self.is_active == 'with_femmesh_andor_res':
elif self.is_active == "with_femmesh_andor_res":
active = FreeCADGui.ActiveDocument is not None \
and self.with_femmesh_andor_res_selected()
elif self.is_active == 'with_material':
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_which_has_no_nonlinear_material':
elif self.is_active == "with_material_solid_which_has_no_nonlinear_material":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc() \
and self.material_solid_selected() \
and self.has_no_nonlinear_material()
elif self.is_active == 'with_solver':
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_solver_elmer':
elif self.is_active == "with_solver_elmer":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc() \
and self.solver_elmer_selected()
elif self.is_active == 'with_analysis_without_solver':
elif self.is_active == "with_analysis_without_solver":
active = FemGui.getActiveAnalysis() is not None \
and self.active_analysis_in_active_doc() \
and not self.analysis_has_solver()
@@ -110,7 +110,7 @@ class CommandManager(object):
results = False
analysis_members = FemGui.getActiveAnalysis().Group
for o in analysis_members:
if o.isDerivedFrom('Fem::FemResultObject'):
if o.isDerivedFrom("Fem::FemResultObject"):
results = True
return results
@@ -118,7 +118,7 @@ class CommandManager(object):
result_mesh = False
analysis_members = FemGui.getActiveAnalysis().Group
for o in analysis_members:
if femutils.is_of_type(o, 'Fem::FemMeshResult'):
if femutils.is_of_type(o, "Fem::FemMeshResult"):
result_mesh = True
return result_mesh
@@ -183,8 +183,8 @@ class CommandManager(object):
and o.Proxy.Type == "Fem::MaterialMechanicalNonlinear" \
and o.LinearBaseMaterial == self.selobj:
FreeCAD.Console.PrintError(
'{} is based on the selected material: {}. '
'Only one nonlinear object for each material allowed.\n'
"{} is based on the selected material: {}. "
"Only one nonlinear object for each material allowed.\n"
.format(o.Name, self.selobj)
)
return False