From 2ed7936c1129b0ba197e04a9e6528f1616934df3 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Fri, 16 Aug 2019 07:58:34 +0200 Subject: [PATCH] FEM: code formating, commands, use double quotes instead of single ones --- src/Mod/Fem/ObjectsFem.py | 220 +++++++------- src/Mod/Fem/TestFem.py | 4 +- src/Mod/Fem/femcommands/commands.py | 450 ++++++++++++++-------------- src/Mod/Fem/femcommands/manager.py | 44 +-- 4 files changed, 359 insertions(+), 359 deletions(-) diff --git a/src/Mod/Fem/ObjectsFem.py b/src/Mod/Fem/ObjectsFem.py index 711f9682512b..06170930edc1 100644 --- a/src/Mod/Fem/ObjectsFem.py +++ b/src/Mod/Fem/ObjectsFem.py @@ -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) -''' +""" ## @} diff --git a/src/Mod/Fem/TestFem.py b/src/Mod/Fem/TestFem.py index e110cf37d6c1..524ebec7ec19 100644 --- a/src/Mod/Fem/TestFem.py +++ b/src/Mod/Fem/TestFem.py @@ -58,7 +58,7 @@ # 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/Fem.FCStd') doc = FreeCAD.open(app_home + 'data/examples/Fem2.FCStd') -''' +""" diff --git a/src/Mod/Fem/femcommands/commands.py b/src/Mod/Fem/femcommands/commands.py index 79c2ec641516..1b89afcf0c57 100644 --- a/src/Mod/Fem/femcommands/commands.py +++ b/src/Mod/Fem/femcommands/commands.py @@ -35,18 +35,18 @@ class _Analysis(CommandManager): def __init__(self): super(_Analysis, self).__init__() self.resources = { - 'Pixmap': 'fem-analysis', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-analysis", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_Analysis", "Analysis container" ), - 'Accel': "N, A", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "N, A", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_Analysis", "Creates an analysis container with standard solver CalculiX" ) } - self.is_active = 'with_document' + self.is_active = "with_document" def Activated(self): FreeCAD.ActiveDocument.openTransaction("Create Analysis") @@ -68,18 +68,18 @@ class _ClippingPlaneAdd(CommandManager): def __init__(self): super(_ClippingPlaneAdd, self).__init__() self.resources = { - 'Pixmap': 'fem-clipping-plane-add', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-clipping-plane-add", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ClippingPlaneAdd", "Clipping plane on face" ), - # 'Accel': "Z, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + # "Accel": "Z, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ClippingPlaneAdd", "Add a clipping plane on a selected face" ) } - self.is_active = 'with_document' + self.is_active = "with_document" def Activated(self): from femtools import femutils @@ -120,23 +120,23 @@ class _ClippingPlaneRemoveAll(CommandManager): def __init__(self): super(_ClippingPlaneRemoveAll, self).__init__() self.resources = { - 'Pixmap': 'fem-clipping-plane-remove-all', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-clipping-plane-remove-all", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ClippingPlaneRemoveAll", "Remove all clipping planes" ), - # 'Accel': "Z, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + # "Accel": "Z, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ClippingPlaneRemoveAll", "Remove all clipping planes" ) } - self.is_active = 'with_document' + self.is_active = "with_document" def Activated(self): - line1 = 'for node in list(sg.getChildren()):\n' - line2 = ' if isinstance(node, coin.SoClipPlane):\n' - line3 = ' sg.removeChild(node)' + line1 = "for node in list(sg.getChildren()):\n" + line2 = " if isinstance(node, coin.SoClipPlane):\n" + line3 = " sg.removeChild(node)" FreeCADGui.doCommand("from pivy import coin") FreeCADGui.doCommand("sg = Gui.ActiveDocument.ActiveView.getSceneGraph()") FreeCADGui.doCommand("nodes = sg.getChildren()") @@ -148,14 +148,14 @@ class _ConstraintBodyHeatSource(CommandManager): def __init__(self): super(_ConstraintBodyHeatSource, self).__init__() self.resources = { - 'Pixmap': 'fem-constraint-heatflux', # the heatflux icon is used - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "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( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintBodyHeatSource", "Creates a FEM constraint body heat source")} - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -166,14 +166,14 @@ class _ConstraintElectrostaticPotential(CommandManager): def __init__(self): super(_ConstraintElectrostaticPotential, self).__init__() self.resources = { - 'Pixmap': 'fem-constraint-electrostatic-potential', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-constraint-electrostatic-potential", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintElectrostaticPotential", "Constraint electrostatic potential"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintElectrostaticPotential", "Creates a FEM constraint electrostatic potential")} - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -184,14 +184,14 @@ class _ConstraintFlowVelocity(CommandManager): def __init__(self): super(_ConstraintFlowVelocity, self).__init__() self.resources = { - 'Pixmap': 'fem-constraint-flow-velocity', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-constraint-flow-velocity", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintFlowVelocity", "Constraint flow velocity"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintFlowVelocity", "Creates a FEM constraint flow velocity")} - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -202,14 +202,14 @@ class _ConstraintInitialFlowVelocity(CommandManager): def __init__(self): super(_ConstraintInitialFlowVelocity, self).__init__() self.resources = { - 'Pixmap': 'fem-constraint-initial-flow-velocity', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-constraint-initial-flow-velocity", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintInitialFlowVelocity", "Constraint initial flow velocity"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintInitialFlowVelocity", "Creates a FEM constraint initial flow velocity")} - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -220,18 +220,18 @@ class _ConstraintSelfWeight(CommandManager): def __init__(self): super(_ConstraintSelfWeight, self).__init__() self.resources = { - 'Pixmap': 'fem-constraint-selfweight', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-constraint-selfweight", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintSelfWeight", "Constraint self weight" ), - 'Accel': "C, W", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, W", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ConstraintSelfWeight", "Creates a FEM constraint self weight" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -242,18 +242,18 @@ class _ElementFluid1D(CommandManager): def __init__(self): super(_ElementFluid1D, self).__init__() self.resources = { - 'Pixmap': 'fem-element-fluid-1d', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-element-fluid-1d", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementFluid1D", "Fluid section for 1D flow" ), - 'Accel': "C, B", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, B", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementFluid1D", "Creates a FEM fluid section for 1D flow" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -264,18 +264,18 @@ class _ElementGeometry1D(CommandManager): def __init__(self): super(_ElementGeometry1D, self).__init__() self.resources = { - 'Pixmap': 'fem-element-geometry-1d', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-element-geometry-1d", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementGeometry1D", "Beam cross section" ), - 'Accel': "C, B", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, B", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementGeometry1D", "Creates a FEM beam cross section" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -286,18 +286,18 @@ class _ElementGeometry2D(CommandManager): def __init__(self): super(_ElementGeometry2D, self).__init__() self.resources = { - 'Pixmap': 'fem-element-geometry-2d', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-element-geometry-2d", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementGeometry2D", "Shell plate thickness" ), - 'Accel': "C, S", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, S", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementGeometry2D", "Creates a FEM shell plate thickness" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -308,18 +308,18 @@ class _ElementRotation1D(CommandManager): def __init__(self): super(_ElementRotation1D, self).__init__() self.resources = { - 'Pixmap': 'fem-element-rotation-1d', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-element-rotation-1d", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementRotation1D", "Beam rotation" ), - 'Accel': "C, R", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, R", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ElementRotation1D", "Creates a FEM beam rotation" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -330,17 +330,17 @@ class _EquationElectrostatic(CommandManager): def __init__(self): super(_EquationElectrostatic, self).__init__() self.resources = { - 'Pixmap': 'fem-equation-electrostatic', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-equation-electrostatic", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationElectrostatic", "Electrostatic equation" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationElectrostatic", "Creates a FEM equation for electrostatic" ) } - self.is_active = 'with_solver_elmer' + self.is_active = "with_solver_elmer" def Activated(self): self.add_obj_on_gui_selobj_noset_edit(self.__class__.__name__.lstrip("_")) @@ -351,16 +351,16 @@ class _EquationElasticity(CommandManager): def __init__(self): super(_EquationElasticity, self).__init__() self.resources = { - 'Pixmap': 'fem-equation-elasticity', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-equation-elasticity", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationElasticity", "Elasticity equation"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationElasticity", "Creates a FEM equation for elasticity" ) } - self.is_active = 'with_solver_elmer' + self.is_active = "with_solver_elmer" def Activated(self): self.add_obj_on_gui_selobj_noset_edit(self.__class__.__name__.lstrip("_")) @@ -371,17 +371,17 @@ class _EquationFlow(CommandManager): def __init__(self): super(_EquationFlow, self).__init__() self.resources = { - 'Pixmap': 'fem-equation-flow', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-equation-flow", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationFlow", "Flow equation" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationFlow", "Creates a FEM equation for flow" ) } - self.is_active = 'with_solver_elmer' + self.is_active = "with_solver_elmer" def Activated(self): self.add_obj_on_gui_selobj_noset_edit(self.__class__.__name__.lstrip("_")) @@ -392,17 +392,17 @@ class _EquationFluxsolver(CommandManager): def __init__(self): super(_EquationFluxsolver, self).__init__() self.resources = { - 'Pixmap': 'fem-equation-fluxsolver', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-equation-fluxsolver", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationFluxsolver", "Fluxsolver equation" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationFluxsolver", "Creates a FEM equation for fluxsolver" ) } - self.is_active = 'with_solver_elmer' + self.is_active = "with_solver_elmer" def Activated(self): self.add_obj_on_gui_selobj_noset_edit(self.__class__.__name__.lstrip("_")) @@ -413,17 +413,17 @@ class _EquationHeat(CommandManager): def __init__(self): super(_EquationHeat, self).__init__() self.resources = { - 'Pixmap': 'fem-equation-heat', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-equation-heat", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationHeat", "Fluxsolver heat" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_EquationHeat", "Creates a FEM equation for heat" ) } - self.is_active = 'with_solver_elmer' + self.is_active = "with_solver_elmer" def Activated(self): self.add_obj_on_gui_selobj_noset_edit(self.__class__.__name__.lstrip("_")) @@ -434,18 +434,18 @@ class _MaterialEditor(CommandManager): def __init__(self): super(_MaterialEditor, self).__init__() self.resources = { - 'Pixmap': 'Arch_Material_Group', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "Arch_Material_Group", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "Material_Editor", "Material editor" ), - # 'Accel': "Z, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + # "Accel": "Z, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "Material_Editor", "Opens the FreeCAD material editor" ) } - self.is_active = 'allways' + self.is_active = "allways" def Activated(self): FreeCADGui.addModule("MaterialEditor") @@ -457,18 +457,18 @@ class _MaterialFluid(CommandManager): def __init__(self): super(_MaterialFluid, self).__init__() self.resources = { - 'Pixmap': 'fem-material-fluid', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-material-fluid", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialFluid", "Material for fluid" ), - 'Accel': "M, M", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, M", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialFluid", "Creates a FEM material for fluid" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -479,18 +479,18 @@ class _MaterialMechanicalNonlinear(CommandManager): def __init__(self): super(_MaterialMechanicalNonlinear, self).__init__() self.resources = { - 'Pixmap': 'fem-material-nonlinear', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-material-nonlinear", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialMechanicalNonlinear", "Nonlinear mechanical material" ), - 'Accel': "C, W", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "C, W", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialMechanicalNonlinear", "Creates a nonlinear mechanical material" ) } - self.is_active = 'with_material_solid_which_has_no_nonlinear_material' + self.is_active = "with_material_solid_which_has_no_nonlinear_material" def Activated(self): string_lin_mat_obj = "FreeCAD.ActiveDocument.getObject('" + self.selobj.Name + "')" @@ -509,7 +509,7 @@ def Activated(self): # https://forum.freecadweb.org/viewtopic.php?f=18&t=23101&p=180489#p180489 solver_object = None for m in self.active_analysis.Group: - if m.isDerivedFrom('Fem::FemSolverObjectPython'): + if m.isDerivedFrom("Fem::FemSolverObjectPython"): if not solver_object: solver_object = m else: @@ -522,11 +522,11 @@ def Activated(self): if solver_object \ and hasattr(solver_object, "Proxy") \ and ( - solver_object.Proxy.Type == 'Fem::FemSolverCalculixCcxTools' - or solver_object.Proxy.Type == 'Fem::FemSolverObjectCalculix' + solver_object.Proxy.Type == "Fem::FemSolverCalculixCcxTools" + or solver_object.Proxy.Type == "Fem::FemSolverObjectCalculix" ): print( - 'Set MaterialNonlinearity and GeometricalNonlinearity to nonlinear for {}' + "Set MaterialNonlinearity and GeometricalNonlinearity to nonlinear for {}" .format(solver_object.Label) ) solver_object.MaterialNonlinearity = "nonlinear" @@ -540,18 +540,18 @@ class _MaterialReinforced(CommandManager): def __init__(self): super(_MaterialReinforced, self).__init__() self.resources = { - 'Pixmap': 'fem-material-reinforced', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-material-reinforced", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialReinforced", "Reinforced material (concrete)" ), - 'Accel': "M, M", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, M", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialReinforced", "Creates a material for reinforced matrix material such as concrete" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -562,18 +562,18 @@ class _MaterialSolid(CommandManager): def __init__(self): super(_MaterialSolid, self).__init__() self.resources = { - 'Pixmap': 'fem-material', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-material", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialSolid", "Material for solid" ), - 'Accel': "M, M", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, M", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MaterialSolid", "Creates a FEM material for solid" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_set_edit(self.__class__.__name__.lstrip("_")) @@ -584,17 +584,17 @@ class _Mesh2Mesh(CommandManager): def __init__(self): super(_Mesh2Mesh, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-to-mesh', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-to-mesh", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_FEMMesh2Mesh", "FEM mesh to mesh" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_FEMMesh2Mesh", "Convert the surface of a FEM mesh to a mesh" ) } - self.is_active = 'with_femmesh_andor_res' + self.is_active = "with_femmesh_andor_res" def Activated(self): FreeCAD.ActiveDocument.openTransaction("Create Mesh from FEMMesh") @@ -633,18 +633,18 @@ class _MeshBoundaryLayer(CommandManager): def __init__(self): super(_MeshBoundaryLayer, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-boundary-layer', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-boundary-layer", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshBoundaryLayer", "FEM mesh boundary layer" ), - 'Accel': "M, B", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, B", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshBoundaryLayer", "Creates a FEM mesh boundary layer" ) } - self.is_active = 'with_gmsh_femmesh' + self.is_active = "with_gmsh_femmesh" def Activated(self): self.add_obj_on_gui_selobj_set_edit(self.__class__.__name__.lstrip("_")) @@ -655,17 +655,17 @@ class _MeshClear(CommandManager): def __init__(self): super(_MeshClear, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-clear-mesh', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-clear-mesh", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshClear", "Clear FEM mesh"), - # 'Accel': "Z, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + # "Accel": "Z, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshClear", "Clear the Mesh of a FEM mesh object" ) } - self.is_active = 'with_femmesh' + self.is_active = "with_femmesh" def Activated(self): FreeCAD.ActiveDocument.openTransaction("Clear FEM mesh") @@ -682,18 +682,18 @@ class _MeshDisplayInfo(CommandManager): def __init__(self): super(_MeshDisplayInfo, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-print-info', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-print-info", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshDisplayInfo", "Display FEM mesh info" ), - # 'Accel': "Z, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + # "Accel": "Z, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshDisplayInfo", "Display FEM mesh info" ) } - self.is_active = 'with_femmesh' + self.is_active = "with_femmesh" def Activated(self): FreeCAD.ActiveDocument.openTransaction("Display FEM mesh info") @@ -714,23 +714,23 @@ class _MeshGmshFromShape(CommandManager): def __init__(self): super(_MeshGmshFromShape, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-gmsh-from-shape', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-gmsh-from-shape", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshGmshFromShape", "FEM mesh from shape by Gmsh" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshGmshFromShape", "Create a FEM mesh from a shape by Gmsh mesher" ) } - self.is_active = 'with_part_feature' + self.is_active = "with_part_feature" def Activated(self): # a mesh could be made with and without an analysis, # we're going to check not for an analysis in command manager module FreeCAD.ActiveDocument.openTransaction("Create FEM mesh by Gmsh") - mesh_obj_name = 'FEMMeshGmsh' + mesh_obj_name = "FEMMeshGmsh" # if requested by some people add Preference for this # mesh_obj_name = self.selobj.Name + "_Mesh" FreeCADGui.addModule("ObjectsFem") @@ -761,18 +761,18 @@ class _MeshGroup(CommandManager): def __init__(self): super(_MeshGroup, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-from-shape', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-from-shape", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshGroup", "FEM mesh group" ), - 'Accel': "M, G", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, G", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshGroup", "Creates a FEM mesh group" ) } - self.is_active = 'with_gmsh_femmesh' + self.is_active = "with_gmsh_femmesh" def Activated(self): self.add_obj_on_gui_selobj_set_edit(self.__class__.__name__.lstrip("_")) @@ -783,23 +783,23 @@ class _MeshNetgenFromShape(CommandManager): def __init__(self): super(_MeshNetgenFromShape, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-netgen-from-shape', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-netgen-from-shape", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshNetgenFromShape", "FEM mesh from shape by Netgen" ), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshNetgenFromShape", "Create a FEM volume mesh from a solid or face shape by Netgen internal mesher" ) } - self.is_active = 'with_part_feature' + self.is_active = "with_part_feature" def Activated(self): # a mesh could be made with and without an analysis, # we're going to check not for an analysis in command manager module FreeCAD.ActiveDocument.openTransaction("Create FEM mesh Netgen") - mesh_obj_name = 'FEMMeshNetgen' + mesh_obj_name = "FEMMeshNetgen" # if requested by some people add Preference for this # mesh_obj_name = sel[0].Name + "_Mesh" FreeCADGui.addModule("ObjectsFem") @@ -830,18 +830,18 @@ class _MeshRegion(CommandManager): def __init__(self): super(_MeshRegion, self).__init__() self.resources = { - 'Pixmap': 'fem-femmesh-region', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-femmesh-region", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshRegion", "FEM mesh region" ), - 'Accel': "M, R", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "M, R", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_MeshRegion", "Creates a FEM mesh region" ) } - self.is_active = 'with_gmsh_femmesh' + self.is_active = "with_gmsh_femmesh" def Activated(self): self.add_obj_on_gui_selobj_set_edit(self.__class__.__name__.lstrip("_")) @@ -852,18 +852,18 @@ class _ResultShow(CommandManager): def __init__(self): super(_ResultShow, self).__init__() self.resources = { - 'Pixmap': 'fem-post-result-show', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-post-result-show", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ResultShow", "Show result" ), - 'Accel': "S, R", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, R", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ResultShow", "Shows and visualizes selected result data" ) } - self.is_active = 'with_selresult' + self.is_active = "with_selresult" def Activated(self): self.selobj.ViewObject.Document.setEdit(self.selobj.ViewObject, 0) @@ -874,18 +874,18 @@ class _ResultsPurge(CommandManager): def __init__(self): super(_ResultsPurge, self).__init__() self.resources = { - 'Pixmap': 'fem-post-results-purge', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-post-results-purge", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_ResultsPurge", "Purge results" ), - 'Accel': "S, S", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, S", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_ResultsPurge", "Purges all results from active analysis" ) } - self.is_active = 'with_results' + self.is_active = "with_results" def Activated(self): import femresult.resulttools as resulttools @@ -897,18 +897,18 @@ class _SolverCxxtools(CommandManager): def __init__(self): super(_SolverCxxtools, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-standard', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-standard", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverCalculix", "Solver CalculiX Standard" ), - 'Accel': "S, X", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, X", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverCalculix", "Creates a standard FEM solver CalculiX with ccx tools" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): has_nonlinear_material_obj = False @@ -939,17 +939,17 @@ class _SolverCalculix(CommandManager): def __init__(self): super(_SolverCalculix, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-standard', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-standard", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverCalculiX", "Solver CalculiX (experimental)" ), - 'Accel': "S, C", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, C", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverCalculiX", "Creates a FEM solver CalculiX (experimental)" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -960,18 +960,18 @@ class _SolverControl(CommandManager): def __init__(self): super(_SolverControl, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-control', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-control", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverControl", "Solver job control" ), - 'Accel': "S, C", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, C", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverControl", "Changes solver attributes and runs the calculations for the selected solver" ) } - self.is_active = 'with_solver' + self.is_active = "with_solver" def Activated(self): FreeCADGui.ActiveDocument.setEdit(self.selobj, 0) @@ -982,18 +982,18 @@ class _SolverElmer(CommandManager): def __init__(self): super(_SolverElmer, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-elmer', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-elmer", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverElmer", "Solver Elmer" ), - 'Accel': "S, E", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, E", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverElmer", "Creates a FEM solver Elmer" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -1004,18 +1004,18 @@ class _SolverRun(CommandManager): def __init__(self): super(_SolverRun, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-run', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-run", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverRun", "Run solver calculations" ), - 'Accel': "R, C", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "R, C", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverRun", "Runs the calculations for the selected solver" ) } - self.is_active = 'with_solver' + self.is_active = "with_solver" def Activated(self): from femsolver.run import run_fem_solver @@ -1029,18 +1029,18 @@ class _SolverZ88(CommandManager): def __init__(self): super(_SolverZ88, self).__init__() self.resources = { - 'Pixmap': 'fem-solver-standard', - 'MenuText': QtCore.QT_TRANSLATE_NOOP( + "Pixmap": "fem-solver-standard", + "MenuText": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverZ88", "Solver Z88" ), - 'Accel': "S, Z", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP( + "Accel": "S, Z", + "ToolTip": QtCore.QT_TRANSLATE_NOOP( "FEM_SolverZ88", "Creates a FEM solver Z88" ) } - self.is_active = 'with_analysis' + self.is_active = "with_analysis" def Activated(self): self.add_obj_on_gui_noset_edit(self.__class__.__name__.lstrip("_")) @@ -1048,154 +1048,154 @@ def Activated(self): # the string in add command will be the page name on FreeCAD wiki FreeCADGui.addCommand( - 'FEM_Analysis', + "FEM_Analysis", _Analysis() ) FreeCADGui.addCommand( - 'FEM_ClippingPlaneAdd', + "FEM_ClippingPlaneAdd", _ClippingPlaneAdd() ) FreeCADGui.addCommand( - 'FEM_ClippingPlaneRemoveAll', + "FEM_ClippingPlaneRemoveAll", _ClippingPlaneRemoveAll() ) FreeCADGui.addCommand( - 'FEM_ConstraintBodyHeatSource', + "FEM_ConstraintBodyHeatSource", _ConstraintBodyHeatSource() ) FreeCADGui.addCommand( - 'FEM_ConstraintElectrostaticPotential', + "FEM_ConstraintElectrostaticPotential", _ConstraintElectrostaticPotential() ) FreeCADGui.addCommand( - 'FEM_ConstraintFlowVelocity', + "FEM_ConstraintFlowVelocity", _ConstraintFlowVelocity() ) FreeCADGui.addCommand( - 'FEM_ConstraintInitialFlowVelocity', + "FEM_ConstraintInitialFlowVelocity", _ConstraintInitialFlowVelocity() ) FreeCADGui.addCommand( - 'FEM_ConstraintSelfWeight', + "FEM_ConstraintSelfWeight", _ConstraintSelfWeight() ) FreeCADGui.addCommand( - 'FEM_ElementFluid1D', + "FEM_ElementFluid1D", _ElementFluid1D() ) FreeCADGui.addCommand( - 'FEM_ElementGeometry1D', + "FEM_ElementGeometry1D", _ElementGeometry1D() ) FreeCADGui.addCommand( - 'FEM_ElementGeometry2D', + "FEM_ElementGeometry2D", _ElementGeometry2D() ) FreeCADGui.addCommand( - 'FEM_ElementRotation1D', + "FEM_ElementRotation1D", _ElementRotation1D() ) FreeCADGui.addCommand( - 'FEM_EquationElectrostatic', + "FEM_EquationElectrostatic", _EquationElectrostatic() ) FreeCADGui.addCommand( - 'FEM_EquationElasticity', + "FEM_EquationElasticity", _EquationElasticity() ) FreeCADGui.addCommand( - 'FEM_EquationFlow', + "FEM_EquationFlow", _EquationFlow() ) FreeCADGui.addCommand( - 'FEM_EquationFluxsolver', + "FEM_EquationFluxsolver", _EquationFluxsolver() ) FreeCADGui.addCommand( - 'FEM_EquationHeat', + "FEM_EquationHeat", _EquationHeat() ) FreeCADGui.addCommand( - 'FEM_MaterialEditor', + "FEM_MaterialEditor", _MaterialEditor() ) FreeCADGui.addCommand( - 'FEM_MaterialFluid', + "FEM_MaterialFluid", _MaterialFluid() ) FreeCADGui.addCommand( - 'FEM_MaterialMechanicalNonlinear', + "FEM_MaterialMechanicalNonlinear", _MaterialMechanicalNonlinear() ) FreeCADGui.addCommand( - 'FEM_MaterialReinforced', + "FEM_MaterialReinforced", _MaterialReinforced() ) FreeCADGui.addCommand( - 'FEM_MaterialSolid', + "FEM_MaterialSolid", _MaterialSolid() ) FreeCADGui.addCommand( - 'FEM_FEMMesh2Mesh', + "FEM_FEMMesh2Mesh", _Mesh2Mesh() ) FreeCADGui.addCommand( - 'FEM_MeshBoundaryLayer', + "FEM_MeshBoundaryLayer", _MeshBoundaryLayer() ) FreeCADGui.addCommand( - 'FEM_MeshClear', + "FEM_MeshClear", _MeshClear() ) FreeCADGui.addCommand( - 'FEM_MeshDisplayInfo', + "FEM_MeshDisplayInfo", _MeshDisplayInfo() ) FreeCADGui.addCommand( - 'FEM_MeshGmshFromShape', + "FEM_MeshGmshFromShape", _MeshGmshFromShape() ) FreeCADGui.addCommand( - 'FEM_MeshGroup', + "FEM_MeshGroup", _MeshGroup() ) FreeCADGui.addCommand( - 'FEM_MeshNetgenFromShape', + "FEM_MeshNetgenFromShape", _MeshNetgenFromShape() ) FreeCADGui.addCommand( - 'FEM_MeshRegion', + "FEM_MeshRegion", _MeshRegion() ) FreeCADGui.addCommand( - 'FEM_ResultShow', + "FEM_ResultShow", _ResultShow() ) FreeCADGui.addCommand( - 'FEM_ResultsPurge', + "FEM_ResultsPurge", _ResultsPurge() ) FreeCADGui.addCommand( - 'FEM_SolverCalculixCxxtools', + "FEM_SolverCalculixCxxtools", _SolverCxxtools() ) FreeCADGui.addCommand( - 'FEM_SolverCalculiX', + "FEM_SolverCalculiX", _SolverCalculix() ) FreeCADGui.addCommand( - 'FEM_SolverControl', + "FEM_SolverControl", _SolverControl() ) FreeCADGui.addCommand( - 'FEM_SolverElmer', + "FEM_SolverElmer", _SolverElmer() ) FreeCADGui.addCommand( - 'FEM_SolverRun', + "FEM_SolverRun", _SolverRun() ) FreeCADGui.addCommand( - 'FEM_SolverZ88', + "FEM_SolverZ88", _SolverZ88() ) diff --git a/src/Mod/Fem/femcommands/manager.py b/src/Mod/Fem/femcommands/manager.py index ada698b1217c..53aeb7f1ea8f 100644 --- a/src/Mod/Fem/femcommands/manager.py +++ b/src/Mod/Fem/femcommands/manager.py @@ -39,10 +39,10 @@ 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 @@ def GetResources(self): 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 @@ def results_present(self): 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 @@ def result_mesh_present(self): 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 @@ def has_no_nonlinear_material(self): 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