FEM: reformat codebase

This commit is contained in:
lyphrowny
2024-06-19 14:29:15 +03:00
parent 8675aa87b4
commit 359c1ae2bb
302 changed files with 6702 additions and 9421 deletions

View File

@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#/***************************************************************************
# /***************************************************************************
# * Copyright (c) 2024 Mario Passaglia <mpassaglia[at]cbc.uba.ar> *
# * *
# * This file is part of FreeCAD. *
@@ -34,6 +34,7 @@ from . import base_fempythonobject
_PropHelper = base_fempythonobject._PropHelper
class BaseFemElement(base_fempythonobject.BaseFemPythonObject):
BaseType = "Fem::BaseFemElement"
@@ -44,16 +45,16 @@ class BaseFemElement(base_fempythonobject.BaseFemPythonObject):
for prop in self._get_properties():
prop.add_to_object(obj)
def _get_properties(self):
prop = []
prop.append(_PropHelper(
type = "App::PropertyLinkSubList",
name = "References",
group = "Element",
doc = "List of element shapes",
value = []
prop.append(
_PropHelper(
type="App::PropertyLinkSubList",
name="References",
group="Element",
doc="List of element shapes",
value=[],
)
)

View File

@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#/***************************************************************************
# /***************************************************************************
# * Copyright (c) 2024 Mario Passaglia <mpassaglia[at]cbc.uba.ar> *
# * *
# * This file is part of FreeCAD. *
@@ -34,6 +34,7 @@ from . import base_fempythonobject
_PropHelper = base_fempythonobject._PropHelper
class BaseFemMeshElement(base_fempythonobject.BaseFemPythonObject):
BaseType = "Fem::BaseFemMeshElement"
@@ -44,16 +45,16 @@ class BaseFemMeshElement(base_fempythonobject.BaseFemPythonObject):
for prop in self._get_properties():
prop.add_to_object(obj)
def _get_properties(self):
prop = []
prop.append(_PropHelper(
type = "App::PropertyLinkSubList",
name = "References",
group = "Mesh Element",
doc = "List of reference shapes",
value = []
prop.append(
_PropHelper(
type="App::PropertyLinkSubList",
name="References",
group="Mesh Element",
doc="List of reference shapes",
value=[],
)
)

View File

@@ -31,7 +31,7 @@ __url__ = "https://www.freecad.org"
# \brief base object for FEM Python Features
class BaseFemPythonObject(object):
class BaseFemPythonObject:
BaseType = "Fem::BaseFemPythonObject"
@@ -55,6 +55,7 @@ class _PropHelper:
Initialization keywords are the same used with PropertyContainer
to add dynamics properties plus "value" for the initial value.
"""
def __init__(self, **kwds):
self.value = kwds.pop("value")
self.info = kwds

View File

@@ -40,12 +40,12 @@ class ConstantVacuumPermittivity(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstantVacuumPermittivity"
def __init__(self, obj):
super(ConstantVacuumPermittivity, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyVacuumPermittivity",
"VacuumPermittivity",
"Constants",
"Overwrites default permittivity of vacuum"
"Overwrites default permittivity of vacuum",
)
obj.setPropertyStatus("VacuumPermittivity", "LockDynamic")
# we must set an expression so that the small value can actually be entered

View File

@@ -43,43 +43,44 @@ class ConstraintBodyHeatSource(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintBodyHeatSource"
def __init__(self, obj):
super(ConstraintBodyHeatSource, self).__init__(obj)
super().__init__(obj)
for prop in self._get_properties():
prop.add_to_object(obj)
def _get_properties(self):
prop = []
prop.append(_PropHelper(
type = "App::PropertyDissipationRate",
name = "DissipationRate",
group = "Constraint Body Heat Source",
doc = "Power dissipated per unit mass",
value = "0 W/kg"
prop.append(
_PropHelper(
type="App::PropertyDissipationRate",
name="DissipationRate",
group="Constraint Body Heat Source",
doc="Power dissipated per unit mass",
value="0 W/kg",
)
)
prop.append(_PropHelper(
type = "App::PropertyPower",
name = "TotalPower",
group = "Constraint Body Heat Source",
doc = "Total power dissipated",
value = "0 W"
prop.append(
_PropHelper(
type="App::PropertyPower",
name="TotalPower",
group="Constraint Body Heat Source",
doc="Total power dissipated",
value="0 W",
)
)
prop.append(_PropHelper(
type = "App::PropertyEnumeration",
name = "Mode",
group = "Constraint Body Heat Source",
doc = "Switch quantity input mode",
value = ["Dissipation Rate", "Total Power"]
prop.append(
_PropHelper(
type="App::PropertyEnumeration",
name="Mode",
group="Constraint Body Heat Source",
doc="Switch quantity input mode",
value=["Dissipation Rate", "Total Power"],
)
)
return prop
def onDocumentRestored(self, obj):
# update old project with new properties
for prop in self._get_properties():

View File

@@ -40,13 +40,13 @@ class ConstraintCentrif(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintCentrif"
def __init__(self, obj):
super(ConstraintCentrif, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyFrequency",
"RotationFrequency",
"Constraint CENTRIF",
"set rotation frequency f<sub>rot"
"set rotation frequency f<sub>rot",
)
obj.setPropertyStatus("RotationFrequency", "LockDynamic")
@@ -54,6 +54,6 @@ class ConstraintCentrif(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLinkSubList",
"RotationAxis",
"Constraint CENTRIF",
"set line as axis of rotation"
"set line as axis of rotation",
)
obj.setPropertyStatus("RotationAxis", "LockDynamic")

View File

@@ -37,7 +37,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintCurrentDensity"
def __init__(self, obj):
super(ConstraintCurrentDensity, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -49,7 +49,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_re_1",
"Vector Potential",
"Real part of current density x-component"
"Real part of current density x-component",
)
obj.setPropertyStatus("CurrentDensity_re_1", "LockDynamic")
obj.CurrentDensity_re_1 = "0 A/m^2"
@@ -58,7 +58,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_re_2",
"Vector Potential",
"Real part of current density y-component"
"Real part of current density y-component",
)
obj.setPropertyStatus("CurrentDensity_re_2", "LockDynamic")
obj.CurrentDensity_re_2 = "0 A/m^2"
@@ -67,7 +67,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_re_3",
"Vector Potential",
"Real part of current density z-component"
"Real part of current density z-component",
)
obj.setPropertyStatus("CurrentDensity_re_3", "LockDynamic")
obj.CurrentDensity_re_3 = "0 A/m^2"
@@ -76,7 +76,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_im_1",
"Vector Potential",
"Imaginary part of current density x-component"
"Imaginary part of current density x-component",
)
obj.setPropertyStatus("CurrentDensity_im_1", "LockDynamic")
obj.CurrentDensity_im_1 = "0 A/m^2"
@@ -85,7 +85,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_im_2",
"Vector Potential",
"Imaginary part of current density y-component"
"Imaginary part of current density y-component",
)
obj.setPropertyStatus("CurrentDensity_im_2", "LockDynamic")
obj.CurrentDensity_im_2 = "0 A/m^2"
@@ -94,7 +94,7 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyCurrentDensity",
"CurrentDensity_im_3",
"Vector Potential",
"Imaginary part of current density z-component"
"Imaginary part of current density z-component",
)
obj.setPropertyStatus("CurrentDensity_im_3", "LockDynamic")
obj.CurrentDensity_im_3 = "0 A/m^2"
@@ -102,55 +102,37 @@ class ConstraintCurrentDensity(base_fempythonobject.BaseFemPythonObject):
# now the enable bools
if not hasattr(obj, "CurrentDensity_re_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_re_1_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_re_1_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_re_1_Disabled", "LockDynamic")
obj.CurrentDensity_re_1_Disabled = True
if not hasattr(obj, "CurrentDensity_re_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_re_2_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_re_2_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_re_2_Disabled", "LockDynamic")
obj.CurrentDensity_re_2_Disabled = True
if not hasattr(obj, "CurrentDensity_re_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_re_3_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_re_3_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_re_3_Disabled", "LockDynamic")
obj.CurrentDensity_re_3_Disabled = True
if not hasattr(obj, "CurrentDensity_im_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_im_1_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_im_1_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_im_1_Disabled", "LockDynamic")
obj.CurrentDensity_im_1_Disabled = True
if not hasattr(obj, "CurrentDensity_im_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_im_2_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_im_2_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_im_2_Disabled", "LockDynamic")
obj.CurrentDensity_im_2_Disabled = True
if not hasattr(obj, "CurrentDensity_im_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"CurrentDensity_im_3_Disabled",
"Vector Potential",
""
"App::PropertyBool", "CurrentDensity_im_3_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("CurrentDensity_im_3_Disabled", "LockDynamic")
obj.CurrentDensity_im_3_Disabled = True

View File

@@ -39,7 +39,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
Type = "Fem::ConstraintElectrostaticPotential"
def __init__(self, obj):
super(ConstraintElectrostaticPotential, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -48,10 +48,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
def add_properties(self, obj):
if not hasattr(obj, "Potential"):
obj.addProperty(
"App::PropertyElectricPotential",
"Potential",
"Parameter",
"Electric Potential"
"App::PropertyElectricPotential", "Potential", "Parameter", "Electric Potential"
)
obj.setPropertyStatus("Potential", "LockDynamic")
# setting 1 V assures that the unit does not switch to mV
@@ -63,7 +60,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_re_1",
"Vector Potential",
"Real part of potential x-component"
"Real part of potential x-component",
)
obj.setPropertyStatus("AV_re_1", "LockDynamic")
obj.AV_re_1 = "0 V"
@@ -72,7 +69,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_re_2",
"Vector Potential",
"Real part of potential y-component"
"Real part of potential y-component",
)
obj.setPropertyStatus("AV_re_2", "LockDynamic")
obj.AV_re_2 = "0 V"
@@ -81,7 +78,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_re_3",
"Vector Potential",
"Real part of potential z-component"
"Real part of potential z-component",
)
obj.setPropertyStatus("AV_re_3", "LockDynamic")
obj.AV_re_3 = "0 V"
@@ -90,7 +87,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_im",
"Vector Potential",
"Imaginary part of scalar potential"
"Imaginary part of scalar potential",
)
obj.setPropertyStatus("AV_im", "LockDynamic")
obj.AV_im = "0 V"
@@ -99,7 +96,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_im_1",
"Vector Potential",
"Imaginary part of potential x-component"
"Imaginary part of potential x-component",
)
obj.setPropertyStatus("AV_im_1", "LockDynamic")
obj.AV_im_1 = "0 V"
@@ -108,7 +105,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_im_2",
"Vector Potential",
"Imaginary part of potential y-component"
"Imaginary part of potential y-component",
)
obj.setPropertyStatus("AV_im_2", "LockDynamic")
obj.AV_im_2 = "0 V"
@@ -117,7 +114,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyElectricPotential",
"AV_im_3",
"Vector Potential",
"Imaginary part of potential z-component"
"Imaginary part of potential z-component",
)
obj.setPropertyStatus("AV_im_3", "LockDynamic")
obj.AV_im_3 = "0 V"
@@ -125,93 +122,49 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
# now the enable bools
if not hasattr(obj, "PotentialEnabled"):
obj.addProperty(
"App::PropertyBool",
"PotentialEnabled",
"Parameter",
"Potential Enabled"
"App::PropertyBool", "PotentialEnabled", "Parameter", "Potential Enabled"
)
obj.setPropertyStatus("PotentialEnabled", "LockDynamic")
obj.PotentialEnabled = True
if not hasattr(obj, "AV_re_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_re_1_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_re_1_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_re_1_Disabled", "LockDynamic")
obj.AV_re_1_Disabled = True
if not hasattr(obj, "AV_re_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_re_2_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_re_2_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_re_2_Disabled", "LockDynamic")
obj.AV_re_2_Disabled = True
if not hasattr(obj, "AV_re_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_re_3_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_re_3_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_re_3_Disabled", "LockDynamic")
obj.AV_re_3_Disabled = True
if not hasattr(obj, "AV_im_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_im_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_im_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_im_Disabled", "LockDynamic")
obj.AV_im_Disabled = True
if not hasattr(obj, "AV_im_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_im_1_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_im_1_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_im_1_Disabled", "LockDynamic")
obj.AV_im_1_Disabled = True
if not hasattr(obj, "AV_im_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_im_2_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_im_2_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_im_2_Disabled", "LockDynamic")
obj.AV_im_2_Disabled = True
if not hasattr(obj, "AV_im_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"AV_im_3_Disabled",
"Vector Potential",
""
)
obj.addProperty("App::PropertyBool", "AV_im_3_Disabled", "Vector Potential", "")
obj.setPropertyStatus("AV_im_3_Disabled", "LockDynamic")
obj.AV_im_3_Disabled = True
if not hasattr(obj, "PotentialConstant"):
obj.addProperty(
"App::PropertyBool",
"PotentialConstant",
"Parameter",
"Potential Constant"
"App::PropertyBool", "PotentialConstant", "Parameter", "Potential Constant"
)
obj.setPropertyStatus("PotentialConstant", "LockDynamic")
obj.PotentialConstant = False
if not hasattr(obj, "ElectricInfinity"):
obj.addProperty(
"App::PropertyBool",
"ElectricInfinity",
"Parameter",
"Electric Infinity"
"App::PropertyBool", "ElectricInfinity", "Parameter", "Electric Infinity"
)
obj.setPropertyStatus("ElectricInfinity", "LockDynamic")
obj.ElectricInfinity = False
@@ -221,17 +174,14 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyBool",
"ElectricForcecalculation",
"Parameter",
"Electric Force Calculation"
"Electric Force Calculation",
)
obj.setPropertyStatus("ElectricForcecalculation", "LockDynamic")
obj.ElectricForcecalculation = False
if not hasattr(obj, "CapacitanceBody"):
obj.addProperty(
"App::PropertyInteger",
"CapacitanceBody",
"Parameter",
"Capacitance Body"
"App::PropertyInteger", "CapacitanceBody", "Parameter", "Capacitance Body"
)
obj.setPropertyStatus("CapacitanceBody", "LockDynamic")
obj.CapacitanceBody = 0
@@ -241,7 +191,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
"App::PropertyBool",
"CapacitanceBodyEnabled",
"Parameter",
"Capacitance Body Enabled"
"Capacitance Body Enabled",
)
obj.setPropertyStatus("CapacitanceBodyEnabled", "LockDynamic")
obj.CapacitanceBodyEnabled = False

View File

@@ -39,26 +39,20 @@ class ConstraintFlowVelocity(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintFlowVelocity"
def __init__(self, obj):
super(ConstraintFlowVelocity, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyVelocity",
"VelocityX",
"Parameter",
"Velocity in x-direction"
"App::PropertyVelocity", "VelocityX", "Parameter", "Velocity in x-direction"
)
obj.setPropertyStatus("VelocityX", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityXFormula",
"Parameter",
"Velocity formula in x-direction"
"Velocity formula in x-direction",
)
obj.setPropertyStatus("VelocityXFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityXUnspecified",
"Parameter",
"Use velocity in x-direction"
"App::PropertyBool", "VelocityXUnspecified", "Parameter", "Use velocity in x-direction"
)
obj.setPropertyStatus("VelocityXUnspecified", "LockDynamic")
obj.VelocityXUnspecified = True
@@ -66,29 +60,23 @@ class ConstraintFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityXHasFormula",
"Parameter",
"Use formula for velocity in x-direction"
"Use formula for velocity in x-direction",
)
obj.setPropertyStatus("VelocityXHasFormula", "LockDynamic")
obj.addProperty(
"App::PropertyVelocity",
"VelocityY",
"Parameter",
"Velocity in y-direction"
"App::PropertyVelocity", "VelocityY", "Parameter", "Velocity in y-direction"
)
obj.setPropertyStatus("VelocityY", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityYFormula",
"Parameter",
"Velocity formula in y-direction"
"Velocity formula in y-direction",
)
obj.setPropertyStatus("VelocityYFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityYUnspecified",
"Parameter",
"Use velocity in y-direction"
"App::PropertyBool", "VelocityYUnspecified", "Parameter", "Use velocity in y-direction"
)
obj.setPropertyStatus("VelocityYUnspecified", "LockDynamic")
obj.VelocityYUnspecified = True
@@ -96,29 +84,23 @@ class ConstraintFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityYHasFormula",
"Parameter",
"Use formula for velocity in y-direction"
"Use formula for velocity in y-direction",
)
obj.setPropertyStatus("VelocityYHasFormula", "LockDynamic")
obj.addProperty(
"App::PropertyVelocity",
"VelocityZ",
"Parameter",
"Velocity in z-direction"
"App::PropertyVelocity", "VelocityZ", "Parameter", "Velocity in z-direction"
)
obj.setPropertyStatus("VelocityZ", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityZFormula",
"Parameter",
"Velocity formula in z-direction"
"Velocity formula in z-direction",
)
obj.setPropertyStatus("VelocityZFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityZUnspecified",
"Parameter",
"Use velocity in z-direction"
"App::PropertyBool", "VelocityZUnspecified", "Parameter", "Use velocity in z-direction"
)
obj.setPropertyStatus("VelocityZUnspecified", "LockDynamic")
obj.VelocityZUnspecified = True
@@ -126,14 +108,11 @@ class ConstraintFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityZHasFormula",
"Parameter",
"Use formula for velocity in z-direction"
"Use formula for velocity in z-direction",
)
obj.setPropertyStatus("VelocityZHasFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"NormalToBoundary",
"Parameter",
"Flow is in normal direction"
"App::PropertyBool", "NormalToBoundary", "Parameter", "Flow is in normal direction"
)
obj.setPropertyStatus("NormalToBoundary", "LockDynamic")

View File

@@ -38,26 +38,20 @@ class ConstraintInitialFlowVelocity(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintInitialFlowVelocity"
def __init__(self, obj):
super(ConstraintInitialFlowVelocity, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyVelocity",
"VelocityX",
"Parameter",
"Velocity in x-direction"
"App::PropertyVelocity", "VelocityX", "Parameter", "Velocity in x-direction"
)
obj.setPropertyStatus("VelocityX", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityXFormula",
"Parameter",
"Velocity formula in x-direction"
"Velocity formula in x-direction",
)
obj.setPropertyStatus("VelocityXFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityXUnspecified",
"Parameter",
"Use velocity in x-direction"
"App::PropertyBool", "VelocityXUnspecified", "Parameter", "Use velocity in x-direction"
)
obj.setPropertyStatus("VelocityXUnspecified", "LockDynamic")
obj.VelocityXUnspecified = True
@@ -65,29 +59,23 @@ class ConstraintInitialFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityXHasFormula",
"Parameter",
"Use formula for velocity in x-direction"
"Use formula for velocity in x-direction",
)
obj.setPropertyStatus("VelocityXHasFormula", "LockDynamic")
obj.addProperty(
"App::PropertyVelocity",
"VelocityY",
"Parameter",
"Velocity in y-direction"
"App::PropertyVelocity", "VelocityY", "Parameter", "Velocity in y-direction"
)
obj.setPropertyStatus("VelocityY", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityYFormula",
"Parameter",
"Velocity formula in y-direction"
"Velocity formula in y-direction",
)
obj.setPropertyStatus("VelocityYFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityYUnspecified",
"Parameter",
"Use velocity in y-direction"
"App::PropertyBool", "VelocityYUnspecified", "Parameter", "Use velocity in y-direction"
)
obj.setPropertyStatus("VelocityYUnspecified", "LockDynamic")
obj.VelocityYUnspecified = True
@@ -95,29 +83,23 @@ class ConstraintInitialFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityYHasFormula",
"Parameter",
"Use formula for velocity in y-direction"
"Use formula for velocity in y-direction",
)
obj.setPropertyStatus("VelocityYHasFormula", "LockDynamic")
obj.addProperty(
"App::PropertyVelocity",
"VelocityZ",
"Parameter",
"Velocity in z-direction"
"App::PropertyVelocity", "VelocityZ", "Parameter", "Velocity in z-direction"
)
obj.setPropertyStatus("VelocityZ", "LockDynamic")
obj.addProperty(
"App::PropertyString",
"VelocityZFormula",
"Parameter",
"Velocity formula in z-direction"
"Velocity formula in z-direction",
)
obj.setPropertyStatus("VelocityZFormula", "LockDynamic")
obj.addProperty(
"App::PropertyBool",
"VelocityZUnspecified",
"Parameter",
"Use velocity in z-direction"
"App::PropertyBool", "VelocityZUnspecified", "Parameter", "Use velocity in z-direction"
)
obj.setPropertyStatus("VelocityZUnspecified", "LockDynamic")
obj.VelocityZUnspecified = True
@@ -125,6 +107,6 @@ class ConstraintInitialFlowVelocity(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"VelocityZHasFormula",
"Parameter",
"Use formula for velocity in z-direction"
"Use formula for velocity in z-direction",
)
obj.setPropertyStatus("VelocityZHasFormula", "LockDynamic")

View File

@@ -37,7 +37,7 @@ class ConstraintInitialPressure(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintInitialPressure"
def __init__(self, obj):
super(ConstraintInitialPressure, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -45,12 +45,7 @@ class ConstraintInitialPressure(base_fempythonobject.BaseFemPythonObject):
def add_properties(self, obj):
if not hasattr(obj, "Pressure"):
obj.addProperty(
"App::PropertyPressure",
"Pressure",
"Parameter",
"Initial Pressure"
)
obj.addProperty("App::PropertyPressure", "Pressure", "Parameter", "Initial Pressure")
obj.setPropertyStatus("Pressure", "LockDynamic")
# we initialize 1 bar
obj.Pressure = "100 kPa"

View File

@@ -37,7 +37,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintMagnetization"
def __init__(self, obj):
super(ConstraintMagnetization, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -49,7 +49,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_re_1",
"Vector Potential",
"Real part of magnetization x-component"
"Real part of magnetization x-component",
)
obj.setPropertyStatus("Magnetization_re_1", "LockDynamic")
obj.Magnetization_re_1 = "0 A/m"
@@ -58,7 +58,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_re_2",
"Vector Potential",
"Real part of magnetization y-component"
"Real part of magnetization y-component",
)
obj.setPropertyStatus("Magnetization_re_2", "LockDynamic")
obj.Magnetization_re_2 = "0 A/m"
@@ -67,7 +67,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_re_3",
"Vector Potential",
"Real part of magnetization z-component"
"Real part of magnetization z-component",
)
obj.setPropertyStatus("Magnetization_re_3", "LockDynamic")
obj.Magnetization_re_3 = "0 A/m"
@@ -76,7 +76,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_im_1",
"Vector Potential",
"Imaginary part of magnetization x-component"
"Imaginary part of magnetization x-component",
)
obj.setPropertyStatus("Magnetization_im_1", "LockDynamic")
obj.Magnetization_im_1 = "0 A/m"
@@ -85,7 +85,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_im_2",
"Vector Potential",
"Imaginary part of magnetization y-component"
"Imaginary part of magnetization y-component",
)
obj.setPropertyStatus("Magnetization_im_2", "LockDynamic")
obj.Magnetization_im_2 = "0 A/m"
@@ -94,7 +94,7 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
"App::PropertyMagnetization",
"Magnetization_im_3",
"Vector Potential",
"Imaginary part of magnetization z-component"
"Imaginary part of magnetization z-component",
)
obj.setPropertyStatus("Magnetization_im_3", "LockDynamic")
obj.Magnetization_im_3 = "0 A/m"
@@ -102,55 +102,37 @@ class ConstraintMagnetization(base_fempythonobject.BaseFemPythonObject):
# now the enable bools
if not hasattr(obj, "Magnetization_re_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_re_1_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_re_1_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_re_1_Disabled", "LockDynamic")
obj.Magnetization_re_1_Disabled = True
if not hasattr(obj, "Magnetization_re_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_re_2_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_re_2_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_re_2_Disabled", "LockDynamic")
obj.Magnetization_re_2_Disabled = True
if not hasattr(obj, "Magnetization_re_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_re_3_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_re_3_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_re_3_Disabled", "LockDynamic")
obj.Magnetization_re_3_Disabled = True
if not hasattr(obj, "Magnetization_im_1_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_im_1_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_im_1_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_im_1_Disabled", "LockDynamic")
obj.Magnetization_im_1_Disabled = True
if not hasattr(obj, "Magnetization_im_2_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_im_2_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_im_2_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_im_2_Disabled", "LockDynamic")
obj.Magnetization_im_2_Disabled = True
if not hasattr(obj, "Magnetization_im_3_Disabled"):
obj.addProperty(
"App::PropertyBool",
"Magnetization_im_3_Disabled",
"Vector Potential",
""
"App::PropertyBool", "Magnetization_im_3_Disabled", "Vector Potential", ""
)
obj.setPropertyStatus("Magnetization_im_3_Disabled", "LockDynamic")
obj.Magnetization_im_3_Disabled = True

View File

@@ -33,6 +33,7 @@ from . import base_fempythonobject
_PropHelper = base_fempythonobject._PropHelper
class ConstraintSectionPrint(base_fempythonobject.BaseFemPythonObject):
"""
The FemConstraintSectionPrint object
@@ -41,27 +42,26 @@ class ConstraintSectionPrint(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintSectionPrint"
def __init__(self, obj):
super(ConstraintSectionPrint, self).__init__(obj)
super().__init__(obj)
for prop in self._get_properties():
prop.add_to_object(obj)
def _get_properties(self):
prop = []
prop.append(_PropHelper(
type = "App::PropertyEnumeration",
name = "Variable",
group = "Constraint Section Print",
doc = "Set facial variable",
value = ["Section Force", "Heat Flux", "Drag Stress"]
prop.append(
_PropHelper(
type="App::PropertyEnumeration",
name="Variable",
group="Constraint Section Print",
doc="Set facial variable",
value=["Section Force", "Heat Flux", "Drag Stress"],
)
)
return prop
def onDocumentRestored(self, obj):
# update old project with new properties
for prop in self._get_properties():

View File

@@ -42,7 +42,7 @@ class ConstraintSelfWeight(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintSelfWeight"
def __init__(self, obj):
super(ConstraintSelfWeight, self).__init__(obj)
super().__init__(obj)
self.addProperty(obj)
@@ -53,17 +53,15 @@ class ConstraintSelfWeight(base_fempythonobject.BaseFemPythonObject):
obj.setEditorMode("References", 2) # do not show in Editor
def addProperty(self, obj):
obj.addProperty("App::PropertyAcceleration",
"GravityAcceleration",
"Gravity",
"Gravity acceleration")
obj.addProperty(
"App::PropertyAcceleration", "GravityAcceleration", "Gravity", "Gravity acceleration"
)
obj.setPropertyStatus("GravityAcceleration", "LockDynamic")
obj.GravityAcceleration = constants.gravity()
obj.addProperty("App::PropertyVector",
"GravityDirection",
"Gravity",
"Normalized gravity direction")
obj.addProperty(
"App::PropertyVector", "GravityDirection", "Gravity", "Normalized gravity direction"
)
obj.setPropertyStatus("GravityDirection", "LockDynamic")
obj.GravityDirection = FreeCAD.Vector(0, 0, -1)

View File

@@ -44,7 +44,7 @@ class ConstraintTie(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintTie"
def __init__(self, obj):
super(ConstraintTie, self).__init__(obj)
super().__init__(obj)
for prop in self._get_properties():
prop.add_to_object(obj)
@@ -52,58 +52,63 @@ class ConstraintTie(base_fempythonobject.BaseFemPythonObject):
def _get_properties(self):
prop = []
prop.append(_PropHelper(
type = "App::PropertyLength",
name = "Tolerance",
group = "Geometry",
doc = "Set max gap between tied faces",
value = "0.0 mm"
prop.append(
_PropHelper(
type="App::PropertyLength",
name="Tolerance",
group="Geometry",
doc="Set max gap between tied faces",
value="0.0 mm",
)
)
prop.append(_PropHelper(
type = "App::PropertyBool",
name = "Adjust",
group = "Geometry",
doc = "Adjust connected nodes",
value = False
prop.append(
_PropHelper(
type="App::PropertyBool",
name="Adjust",
group="Geometry",
doc="Adjust connected nodes",
value=False,
)
)
prop.append(_PropHelper(
type = "App::PropertyBool",
name = "CyclicSymmetry",
group = "Geometry",
doc = "Define cyclic symmetry model",
value = False
prop.append(
_PropHelper(
type="App::PropertyBool",
name="CyclicSymmetry",
group="Geometry",
doc="Define cyclic symmetry model",
value=False,
)
)
prop.append(_PropHelper(
type = "App::PropertyPlacement",
name = "SymmetryAxis",
group = "Geometry",
doc = "Placement of axis of symmetry",
value = FreeCAD.Placement()
prop.append(
_PropHelper(
type="App::PropertyPlacement",
name="SymmetryAxis",
group="Geometry",
doc="Placement of axis of symmetry",
value=FreeCAD.Placement(),
)
)
prop.append(_PropHelper(
type = "App::PropertyInteger",
name = "Sectors",
group = "Geometry",
doc = "Number of sectors",
value = 0
prop.append(
_PropHelper(
type="App::PropertyInteger",
name="Sectors",
group="Geometry",
doc="Number of sectors",
value=0,
)
)
prop.append(_PropHelper(
type = "App::PropertyInteger",
name = "ConnectedSectors",
group = "Geometry",
doc = "Number of connected sectors",
value = 1
prop.append(
_PropHelper(
type="App::PropertyInteger",
name="ConnectedSectors",
group="Geometry",
doc="Number of connected sectors",
value=1,
)
)
return prop
def onDocumentRestored(self, obj):
# update old project with new properties
for prop in self._get_properties():

View File

@@ -31,10 +31,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief element fluid 1D object
from . import base_femelement
from . import base_fempythonobject
class ElementFluid1D(base_femelement.BaseFemElement):
class ElementFluid1D(base_fempythonobject.BaseFemPythonObject):
"""
The element_fluid1D object
"""
@@ -55,19 +55,21 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"PIPE BEND",
"PIPE GATE VALVE",
"LIQUID PUMP",
"PIPE WHITE-COLEBROOK"
"PIPE WHITE-COLEBROOK",
]
known_gas_types = ["NONE"]
known_channel_types = ["NONE"]
def __init__(self, obj):
super(ElementFluid1D, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"FluidSection",
"select fluid section type"
"App::PropertyLinkSubList", "References", "FluidSection", "List of fluid section shapes"
)
obj.setPropertyStatus("References", "LockDynamic")
obj.addProperty(
"App::PropertyEnumeration", "SectionType", "FluidSection", "select fluid section type"
)
obj.setPropertyStatus("SectionType", "LockDynamic")
@@ -75,7 +77,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyEnumeration",
"LiquidSectionType",
"LiquidSection",
"select liquid section type"
"select liquid section type",
)
obj.setPropertyStatus("LiquidSectionType", "LockDynamic")
@@ -83,7 +85,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"ManningArea",
"LiquidManning",
"set area of the manning fluid section"
"set area of the manning fluid section",
)
obj.setPropertyStatus("ManningArea", "LockDynamic")
@@ -91,7 +93,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"ManningRadius",
"LiquidManning",
"set hydraulic radius of manning fluid section"
"set hydraulic radius of manning fluid section",
)
obj.setPropertyStatus("ManningRadius", "LockDynamic")
@@ -99,7 +101,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"ManningCoefficient",
"LiquidManning",
"set coefficient of manning fluid section"
"set coefficient of manning fluid section",
)
obj.setPropertyStatus("ManningCoefficient", "LockDynamic")
@@ -107,14 +109,14 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"EnlargeArea1",
"LiquidEnlargement",
"set initial area of the enlargement fluid section"
"set initial area of the enlargement fluid section",
)
obj.setPropertyStatus("EnlargeArea1", "LockDynamic")
obj.addProperty(
"App::PropertyArea",
"EnlargeArea2",
"LiquidEnlargement",
"set enlarged area of enlargement fluid section"
"set enlarged area of enlargement fluid section",
)
obj.setPropertyStatus("EnlargeArea2", "LockDynamic")
@@ -122,7 +124,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"ContractArea1",
"LiquidContraction",
"set initial area of the contraction fluid section"
"set initial area of the contraction fluid section",
)
obj.setPropertyStatus("ContractArea1", "LockDynamic")
@@ -130,7 +132,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"ContractArea2",
"LiquidContraction",
"set contracted area of contraction fluid section"
"set contracted area of contraction fluid section",
)
obj.setPropertyStatus("ContractArea2", "LockDynamic")
@@ -138,7 +140,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"InletPressure",
"LiquidInlet",
"set inlet pressure for fluid section"
"set inlet pressure for fluid section",
)
obj.setPropertyStatus("InletPressure", "LockDynamic")
@@ -146,7 +148,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"OutletPressure",
"LiquidOutlet",
"set outlet pressure for fluid section"
"set outlet pressure for fluid section",
)
obj.setPropertyStatus("OutletPressure", "LockDynamic")
@@ -154,7 +156,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"InletFlowRate",
"LiquidInlet",
"set inlet mass flow rate for fluid section"
"set inlet mass flow rate for fluid section",
)
obj.setPropertyStatus("InletFlowRate", "LockDynamic")
@@ -162,7 +164,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"OutletFlowRate",
"LiquidOutlet",
"set outlet mass flow rate for fluid section"
"set outlet mass flow rate for fluid section",
)
obj.setPropertyStatus("OutletFlowRate", "LockDynamic")
@@ -170,7 +172,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyBool",
"InletPressureActive",
"LiquidInlet",
"activates or deactivates inlet pressure for fluid section"
"activates or deactivates inlet pressure for fluid section",
)
obj.setPropertyStatus("InletPressureActive", "LockDynamic")
@@ -178,7 +180,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyBool",
"OutletPressureActive",
"LiquidOutlet",
"activates or deactivates outlet pressure for fluid section"
"activates or deactivates outlet pressure for fluid section",
)
obj.setPropertyStatus("OutletPressureActive", "LockDynamic")
@@ -186,7 +188,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyBool",
"InletFlowRateActive",
"LiquidInlet",
"activates or deactivates inlet flow rate for fluid section"
"activates or deactivates inlet flow rate for fluid section",
)
obj.setPropertyStatus("InletFlowRateActive", "LockDynamic")
@@ -194,7 +196,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyBool",
"OutletFlowRateActive",
"LiquidOutlet",
"activates or deactivates outlet flow rate for fluid section"
"activates or deactivates outlet flow rate for fluid section",
)
obj.setPropertyStatus("OutletFlowRateActive", "LockDynamic")
@@ -202,7 +204,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"EntrancePipeArea",
"LiquidEntrance",
"set the pipe area of the entrance fluid section"
"set the pipe area of the entrance fluid section",
)
obj.setPropertyStatus("EntrancePipeArea", "LockDynamic")
@@ -210,7 +212,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"EntranceArea",
"LiquidEntrance",
"set the entrance area of the entrance fluid section"
"set the entrance area of the entrance fluid section",
)
obj.setPropertyStatus("EntranceArea", "LockDynamic")
@@ -218,7 +220,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"DiaphragmPipeArea",
"LiquidDiaphragm",
"set the pipe area of the diaphragm fluid section"
"set the pipe area of the diaphragm fluid section",
)
obj.setPropertyStatus("DiaphragmPipeArea", "LockDynamic")
@@ -226,7 +228,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"DiaphragmArea",
"LiquidDiaphragm",
"set the diaphragm area of the diaphragm fluid section"
"set the diaphragm area of the diaphragm fluid section",
)
obj.setPropertyStatus("DiaphragmArea", "LockDynamic")
@@ -234,7 +236,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"BendPipeArea",
"LiquidBend",
"set pipe area of the bend fluid section"
"set pipe area of the bend fluid section",
)
obj.setPropertyStatus("BendPipeArea", "LockDynamic")
@@ -242,7 +244,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"BendRadiusDiameter",
"LiquidBend",
"set ratio of bend radius over pipe diameter of the bend fluid section"
"set ratio of bend radius over pipe diameter of the bend fluid section",
)
obj.setPropertyStatus("BendRadiusDiameter", "LockDynamic")
@@ -250,7 +252,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"BendAngle",
"LiquidBend",
"set bend angle of the bend fluid section"
"set bend angle of the bend fluid section",
)
obj.setPropertyStatus("BendAngle", "LockDynamic")
@@ -258,7 +260,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"BendLossCoefficient",
"LiquidBend",
"set loss coefficient of the bend fluid section"
"set loss coefficient of the bend fluid section",
)
obj.setPropertyStatus("BendLossCoefficient", "LockDynamic")
@@ -266,7 +268,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"GateValvePipeArea",
"LiquidGateValve",
"set pipe area of the gate valve fluid section"
"set pipe area of the gate valve fluid section",
)
obj.setPropertyStatus("GateValvePipeArea", "LockDynamic")
@@ -274,7 +276,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"GateValveClosingCoeff",
"LiquidGateValve",
"set closing coefficient of the gate valve fluid section"
"set closing coefficient of the gate valve fluid section",
)
obj.setPropertyStatus("GateValveClosingCoeff", "LockDynamic")
@@ -282,7 +284,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloatList",
"PumpFlowRate",
"LiquidPump",
"set the pump characteristic flow rate of the pump fluid section"
"set the pump characteristic flow rate of the pump fluid section",
)
obj.setPropertyStatus("PumpFlowRate", "LockDynamic")
@@ -290,7 +292,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloatList",
"PumpHeadLoss",
"LiquidPump",
"set the pump characteristic head loss of the pump fluid section"
"set the pump characteristic head loss of the pump fluid section",
)
obj.setPropertyStatus("PumpHeadLoss", "LockDynamic")
@@ -298,7 +300,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyArea",
"ColebrookeArea",
"LiquidColebrooke",
"set pipe area of the colebrooke fluid section"
"set pipe area of the colebrooke fluid section",
)
obj.setPropertyStatus("ColebrookeArea", "LockDynamic")
@@ -306,7 +308,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"ColebrookeRadius",
"LiquidColebrooke",
"set hydraulic radius of the colebrooke fluid section"
"set hydraulic radius of the colebrooke fluid section",
)
obj.setPropertyStatus("ColebrookeRadius", "LockDynamic")
@@ -314,7 +316,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"ColebrookeGrainDiameter",
"LiquidColebrooke",
"set grain diameter of the colebrooke fluid section"
"set grain diameter of the colebrooke fluid section",
)
obj.setPropertyStatus("ColebrookeGrainDiameter", "LockDynamic")
@@ -322,15 +324,12 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyFloat",
"ColebrookeFormFactor",
"LiquidColebrooke",
"set coefficient of the colebrooke fluid section"
"set coefficient of the colebrooke fluid section",
)
obj.setPropertyStatus("ColebrookeFormFactor", "LockDynamic")
obj.addProperty(
"App::PropertyEnumeration",
"GasSectionType",
"GasSection",
"select gas section type"
"App::PropertyEnumeration", "GasSectionType", "GasSection", "select gas section type"
)
obj.setPropertyStatus("GasSectionType", "LockDynamic")
@@ -338,7 +337,7 @@ class ElementFluid1D(base_femelement.BaseFemElement):
"App::PropertyEnumeration",
"ChannelSectionType",
"ChannelSection",
"select channel section type"
"select channel section type",
)
obj.setPropertyStatus("ChannelSectionType", "LockDynamic")

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief element geometry 1D object
from . import base_femelement
from . import base_fempythonobject
class ElementGeometry1D(base_femelement.BaseFemElement):
class ElementGeometry1D(base_fempythonobject.BaseFemPythonObject):
"""
The ElementGeometry1D object
"""
@@ -41,13 +41,13 @@ class ElementGeometry1D(base_femelement.BaseFemElement):
known_beam_types = ["Rectangular", "Circular", "Pipe"]
def __init__(self, obj):
super(ElementGeometry1D, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyLength",
"RectWidth",
"RectBeamSection",
"set width of the rectangular beam elements"
"set width of the rectangular beam elements",
)
obj.setPropertyStatus("RectWidth", "LockDynamic")
@@ -55,7 +55,7 @@ class ElementGeometry1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"RectHeight",
"RectBeamSection",
"set height of therectangular beam elements"
"set height of therectangular beam elements",
)
obj.setPropertyStatus("RectHeight", "LockDynamic")
@@ -63,7 +63,7 @@ class ElementGeometry1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"CircDiameter",
"CircBeamSection",
"set diameter of the circular beam elements"
"set diameter of the circular beam elements",
)
obj.setPropertyStatus("CircDiameter", "LockDynamic")
@@ -71,7 +71,7 @@ class ElementGeometry1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"PipeDiameter",
"PipeBeamSection",
"set outer diameter of the pipe beam elements"
"set outer diameter of the pipe beam elements",
)
obj.setPropertyStatus("PipeDiameter", "LockDynamic")
@@ -79,17 +79,18 @@ class ElementGeometry1D(base_femelement.BaseFemElement):
"App::PropertyLength",
"PipeThickness",
"PipeBeamSection",
"set thickness of the pipe beam elements"
"set thickness of the pipe beam elements",
)
obj.setPropertyStatus("PipeThickness", "LockDynamic")
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"BeamSection",
"select beam section type"
"App::PropertyEnumeration", "SectionType", "BeamSection", "select beam section type"
)
obj.setPropertyStatus("SectionType", "LockDynamic")
obj.addProperty(
"App::PropertyLinkSubList", "References", "BeamSection", "List of beam section shapes"
)
obj.setPropertyStatus("References", "LockDynamic")
obj.SectionType = ElementGeometry1D.known_beam_types
obj.SectionType = "Rectangular"

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief element geometry 2D object
from . import base_femelement
from . import base_fempythonobject
class ElementGeometry2D(base_femelement.BaseFemElement):
class ElementGeometry2D(base_fempythonobject.BaseFemPythonObject):
"""
The ElementGeometry2D object
"""
@@ -40,12 +40,20 @@ class ElementGeometry2D(base_femelement.BaseFemElement):
Type = "Fem::ElementGeometry2D"
def __init__(self, obj):
super(ElementGeometry2D, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyLength",
"Thickness",
"ShellThickness",
"set thickness of the shell elements"
"set thickness of the shell elements",
)
obj.setPropertyStatus("Thickness", "LockDynamic")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"ShellThickness",
"List of shell thickness shapes",
)
obj.setPropertyStatus("References", "LockDynamic")

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief element rotation 1D object
from . import base_femelement
from . import base_fempythonobject
class ElementRotation1D(base_femelement.BaseFemElement):
class ElementRotation1D(base_fempythonobject.BaseFemPythonObject):
"""
The ElementRotation1D object
"""
@@ -40,12 +40,14 @@ class ElementRotation1D(base_femelement.BaseFemElement):
Type = "Fem::ElementRotation1D"
def __init__(self, obj):
super(ElementRotation1D, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyAngle",
"Rotation",
"BeamRotation",
"Set the rotation of beam elements"
"App::PropertyAngle", "Rotation", "BeamRotation", "Set the rotation of beam elements"
)
obj.setPropertyStatus("Rotation", "LockDynamic")
obj.addProperty(
"App::PropertyLinkSubList", "References", "BeamRotation", "List of beam rotation shapes"
)
obj.setPropertyStatus("References", "LockDynamic")

View File

@@ -41,7 +41,7 @@ class MaterialCommon(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::MaterialCommon"
def __init__(self, obj):
super(MaterialCommon, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -51,20 +51,14 @@ class MaterialCommon(base_fempythonobject.BaseFemPythonObject):
# References
if not hasattr(obj, "References"):
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"Material",
"List of material shapes"
"App::PropertyLinkSubList", "References", "Material", "List of material shapes"
)
obj.setPropertyStatus("References", "LockDynamic")
# Category
# attribute Category was added in commit 61fb3d429a
if not hasattr(obj, "Category"):
obj.addProperty(
"App::PropertyEnumeration",
"Category",
"Material",
"Material type: fluid or solid"
"App::PropertyEnumeration", "Category", "Material", "Material type: fluid or solid"
)
obj.setPropertyStatus("Category", "LockDynamic")
obj.Category = ["Solid", "Fluid"] # used in TaskPanel

View File

@@ -40,7 +40,7 @@ class MaterialMechanicalNonlinear(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::MaterialMechanicalNonlinear"
def __init__(self, obj):
super(MaterialMechanicalNonlinear, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -77,24 +77,30 @@ class MaterialMechanicalNonlinear(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLink",
"LinearBaseMaterial",
"Base",
"Set the linear material the nonlinear builds upon."
"Set the linear material the nonlinear builds upon.",
)
obj.setPropertyStatus("LinearBaseMaterial", "LockDynamic")
if not hasattr(obj, "MaterialModelNonlinearity"):
choices_nonlinear_material_models = ["isotropic hardening","kinematic hardening"]
choices_nonlinear_material_models = ["isotropic hardening", "kinematic hardening"]
obj.addProperty(
"App::PropertyEnumeration",
"MaterialModelNonlinearity",
"Fem",
"Set the type on nonlinear material model"
"Set the type on nonlinear material model",
)
obj.setPropertyStatus("MaterialModelNonlinearity", "LockDynamic")
obj.MaterialModelNonlinearity = choices_nonlinear_material_models
obj.MaterialModelNonlinearity = choices_nonlinear_material_models[0]
if hasattr(obj, "MaterialModelNonlinearity") and obj.MaterialModelNonlinearity == "simple hardening":
updated_choices_nonlinear_material_models = ["isotropic hardening", "kinematic hardening"]
if (
hasattr(obj, "MaterialModelNonlinearity")
and obj.MaterialModelNonlinearity == "simple hardening"
):
updated_choices_nonlinear_material_models = [
"isotropic hardening",
"kinematic hardening",
]
obj.MaterialModelNonlinearity = updated_choices_nonlinear_material_models
obj.MaterialModelNonlinearity = updated_choices_nonlinear_material_models[0]
@@ -104,7 +110,7 @@ class MaterialMechanicalNonlinear(base_fempythonobject.BaseFemPythonObject):
"YieldPoints",
"Fem",
"Set stress and strain for yield points as a list of strings, "
"each point \"stress, plastic strain\""
'each point "stress, plastic strain"',
)
obj.setPropertyStatus("YieldPoints", "LockDynamic")
obj.YieldPoints = []

View File

@@ -40,29 +40,20 @@ class MaterialReinforced(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::MaterialReinforced"
def __init__(self, obj):
super(MaterialReinforced, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"Material",
"List of material shapes"
"App::PropertyLinkSubList", "References", "Material", "List of material shapes"
)
obj.setPropertyStatus("References", "LockDynamic")
obj.addProperty(
"App::PropertyMap",
"Reinforcement",
"Composites",
"Reinforcement material properties"
"App::PropertyMap", "Reinforcement", "Composites", "Reinforcement material properties"
)
obj.setPropertyStatus("Reinforcement", "LockDynamic")
obj.addProperty(
"App::PropertyEnumeration",
"Category",
"Material",
"Matrix material properties"
"App::PropertyEnumeration", "Category", "Material", "Matrix material properties"
)
obj.setPropertyStatus("Category", "LockDynamic")

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief mesh boundary layer object
from . import base_femmeshelement
from . import base_fempythonobject
class MeshBoundaryLayer(base_femmeshelement.BaseFemMeshElement):
class MeshBoundaryLayer(base_fempythonobject.BaseFemPythonObject):
"""
The MeshBoundaryLayer object
"""
@@ -40,13 +40,13 @@ class MeshBoundaryLayer(base_femmeshelement.BaseFemMeshElement):
Type = "Fem::MeshBoundaryLayer"
def __init__(self, obj):
super(MeshBoundaryLayer, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyInteger",
"NumberOfLayers",
"MeshBoundaryLayerProperties",
"set number of inflation layers for this boundary"
"set number of inflation layers for this boundary",
)
obj.setPropertyStatus("NumberOfLayers", "LockDynamic")
obj.NumberOfLayers = 3
@@ -55,7 +55,7 @@ class MeshBoundaryLayer(base_femmeshelement.BaseFemMeshElement):
"App::PropertyLength",
"MinimumThickness",
"MeshBoundaryLayerProperties",
"set minimum thickness,usually the first inflation layer"
"set minimum thickness,usually the first inflation layer",
)
obj.setPropertyStatus("MinimumThickness", "LockDynamic")
# default to zero, user must specify a proper value for this property
@@ -64,7 +64,15 @@ class MeshBoundaryLayer(base_femmeshelement.BaseFemMeshElement):
"App::PropertyFloat",
"GrowthRate",
"MeshBoundaryLayerProperties",
"set growth rate of inflation layers for smooth transition"
"set growth rate of inflation layers for smooth transition",
)
obj.setPropertyStatus("GrowthRate", "LockDynamic")
obj.GrowthRate = 1.5
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshBoundaryLayerShapes",
"List of FEM mesh region shapes",
)
obj.setPropertyStatus("References", "LockDynamic")

View File

@@ -49,7 +49,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"Frontal",
"BAMG",
"DelQuad",
"Packing Parallelograms"
"Packing Parallelograms",
]
known_mesh_algorithm_3D = [
"Automatic",
@@ -58,30 +58,25 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"Frontal",
"MMG3D",
"R-tree",
"HXT"
"HXT",
]
known_mesh_RecombinationAlgorithms = [
"Simple",
"Blossom",
"Simple full-quad",
"Blossom full-quad"
"Blossom full-quad",
]
known_mesh_HighOrderOptimizers = [
"None",
"Optimization",
"Elastic+Optimization",
"Elastic",
"Fast curving"
]
known_mesh_SubdivisionAlgorithms = [
"None",
"All Quadrangles",
"All Hexahedra",
"Barycentric"
"Fast curving",
]
known_mesh_SubdivisionAlgorithms = ["None", "All Quadrangles", "All Hexahedra", "Barycentric"]
def __init__(self, obj):
super(MeshGmsh, self).__init__(obj)
super().__init__(obj)
self.add_properties(obj)
def onDocumentRestored(self, obj):
@@ -116,27 +111,21 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLinkList",
"MeshBoundaryLayerList",
"Base",
"Mesh boundaries need inflation layers"
"Mesh boundaries need inflation layers",
)
obj.setPropertyStatus("MeshBoundaryLayerList", "LockDynamic")
obj.MeshBoundaryLayerList = []
if not hasattr(obj, "MeshRegionList"):
obj.addProperty(
"App::PropertyLinkList",
"MeshRegionList",
"Base",
"Mesh refinments of the mesh"
"App::PropertyLinkList", "MeshRegionList", "Base", "Mesh refinments of the mesh"
)
obj.setPropertyStatus("MeshRegionList", "LockDynamic")
obj.MeshRegionList = []
if not hasattr(obj, "MeshGroupList"):
obj.addProperty(
"App::PropertyLinkList",
"MeshGroupList",
"Base",
"Mesh groups of the mesh"
"App::PropertyLinkList", "MeshGroupList", "Base", "Mesh groups of the mesh"
)
obj.setPropertyStatus("MeshGroupList", "LockDynamic")
obj.MeshGroupList = []
@@ -146,7 +135,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLink",
"Part",
"FEM Mesh",
"Geometry object, the mesh is made from. The geometry object has to have a Shape."
"Geometry object, the mesh is made from. The geometry object has to have a Shape.",
)
obj.setPropertyStatus("Part", "LockDynamic")
obj.Part = None
@@ -156,7 +145,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLength",
"CharacteristicLengthMax",
"FEM Gmsh Mesh Params",
"Max mesh element size (0.0 = infinity)"
"Max mesh element size (0.0 = infinity)",
)
obj.setPropertyStatus("CharacteristicLengthMax", "LockDynamic")
obj.CharacteristicLengthMax = 0.0 # will be 1e+22
@@ -166,7 +155,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyLength",
"CharacteristicLengthMin",
"FEM Gmsh Mesh Params",
"Min mesh element size"
"Min mesh element size",
)
obj.setPropertyStatus("CharacteristicLengthMin", "LockDynamic")
obj.CharacteristicLengthMin = 0.0
@@ -176,7 +165,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"ElementDimension",
"FEM Gmsh Mesh Params",
"Dimension of mesh elements (Auto = according ShapeType of part to mesh)"
"Dimension of mesh elements (Auto = according ShapeType of part to mesh)",
)
obj.setPropertyStatus("ElementDimension", "LockDynamic")
obj.ElementDimension = MeshGmsh.known_element_dimensions
@@ -187,7 +176,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"ElementOrder",
"FEM Gmsh Mesh Params",
"Order of mesh elements"
"Order of mesh elements",
)
obj.setPropertyStatus("ElementOrder", "LockDynamic")
obj.ElementOrder = MeshGmsh.known_element_orders
@@ -198,7 +187,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"OptimizeStd",
"FEM Gmsh Mesh Params",
"Optimize tetrahedral elements"
"Optimize tetrahedral elements",
)
obj.setPropertyStatus("OptimizeStd", "LockDynamic")
obj.OptimizeStd = True
@@ -208,7 +197,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"OptimizeNetgen",
"FEM Gmsh Mesh Params",
"Optimize tetra elements by use of Netgen"
"Optimize tetra elements by use of Netgen",
)
obj.setPropertyStatus("OptimizeNetgen", "LockDynamic")
obj.OptimizeNetgen = False
@@ -218,7 +207,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"HighOrderOptimize",
"FEM Gmsh Mesh Params",
"Optimization of high order meshes"
"Optimization of high order meshes",
)
obj.setPropertyStatus("HighOrderOptimize", "LockDynamic")
obj.HighOrderOptimize = MeshGmsh.known_mesh_HighOrderOptimizers
@@ -229,7 +218,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"RecombineAll",
"FEM Gmsh Mesh Params",
"Apply recombination algorithm to all surfaces"
"Apply recombination algorithm to all surfaces",
)
obj.setPropertyStatus("RecombineAll", "LockDynamic")
obj.RecombineAll = False
@@ -239,7 +228,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"Recombine3DAll",
"FEM Gmsh Mesh Params",
"Apply recombination algorithm to all volumes"
"Apply recombination algorithm to all volumes",
)
obj.setPropertyStatus("Recombine3DAll", "LockDynamic")
obj.Recombine3DAll = False
@@ -249,7 +238,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"RecombinationAlgorithm",
"FEM Gmsh Mesh Params",
"Recombination algorithm"
"Recombination algorithm",
)
obj.setPropertyStatus("RecombinationAlgorithm", "LockDynamic")
obj.RecombinationAlgorithm = MeshGmsh.known_mesh_RecombinationAlgorithms
@@ -260,7 +249,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"CoherenceMesh",
"FEM Gmsh Mesh Params",
"Removes all duplicate mesh vertices"
"Removes all duplicate mesh vertices",
)
obj.setPropertyStatus("CoherenceMesh", "LockDynamic")
obj.CoherenceMesh = True
@@ -270,7 +259,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyFloat",
"GeometryTolerance",
"FEM Gmsh Mesh Params",
"Geometrical Tolerance (0.0 = GMSH std = 1e-08)"
"Geometrical Tolerance (0.0 = GMSH std = 1e-08)",
)
obj.setPropertyStatus("GeometryTolerance", "LockDynamic")
obj.GeometryTolerance = 1e-06
@@ -280,7 +269,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"SecondOrderLinear",
"FEM Gmsh Mesh Params",
"Second order nodes are created by linear interpolation"
"Second order nodes are created by linear interpolation",
)
obj.setPropertyStatus("SecondOrderLinear", "LockDynamic")
obj.SecondOrderLinear = False
@@ -296,7 +285,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyIntegerConstraint",
"MeshSizeFromCurvature",
"FEM Gmsh Mesh Params",
"number of elements per 2*pi radians, 0 to deactivate"
"number of elements per 2*pi radians, 0 to deactivate",
)
obj.setPropertyStatus("MeshSizeFromCurvature", "LockDynamic")
obj.MeshSizeFromCurvature = (12, 0, 10000, 1)
@@ -306,7 +295,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"Algorithm2D",
"FEM Gmsh Mesh Params",
"mesh algorithm 2D"
"mesh algorithm 2D",
)
obj.setPropertyStatus("Algorithm2D", "LockDynamic")
obj.Algorithm2D = MeshGmsh.known_mesh_algorithm_2D
@@ -317,7 +306,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"Algorithm3D",
"FEM Gmsh Mesh Params",
"mesh algorithm 3D"
"mesh algorithm 3D",
)
obj.setPropertyStatus("Algorithm3D", "LockDynamic")
obj.Algorithm3D = MeshGmsh.known_mesh_algorithm_3D
@@ -328,7 +317,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyBool",
"GroupsOfNodes",
"FEM Gmsh Mesh Params",
"For each group create not only the elements but the nodes too."
"For each group create not only the elements but the nodes too.",
)
obj.setPropertyStatus("GroupsOfNodes", "LockDynamic")
obj.GroupsOfNodes = False
@@ -338,7 +327,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"App::PropertyEnumeration",
"SubdivisionAlgorithm",
"FEM Gmsh Mesh Params",
"Mesh subdivision algorithm"
"Mesh subdivision algorithm",
)
obj.setPropertyStatus("SubdivisionAlgorithm", "LockDynamic")
obj.SubdivisionAlgorithm = MeshGmsh.known_mesh_SubdivisionAlgorithms

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief mesh group object
from . import base_femmeshelement
from . import base_fempythonobject
class MeshGroup(base_femmeshelement.BaseFemMeshElement):
class MeshGroup(base_fempythonobject.BaseFemPythonObject):
"""
The MeshGroup object
"""
@@ -40,12 +40,20 @@ class MeshGroup(base_femmeshelement.BaseFemMeshElement):
Type = "Fem::MeshGroup"
def __init__(self, obj):
super(MeshGroup, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyBool",
"UseLabel",
"MeshGroupProperties",
"The identifier used for export (True: Label, False: Name)"
"The identifier used for export (True: Label, False: Name)",
)
obj.setPropertyStatus("UseLabel", "LockDynamic")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshGroupShapes",
"List of FEM mesh group shapes",
)
obj.setPropertyStatus("References", "LockDynamic")

View File

@@ -29,10 +29,10 @@ __url__ = "https://www.freecad.org"
# \ingroup FEM
# \brief mesh region object
from . import base_femmeshelement
from . import base_fempythonobject
class MeshRegion(base_femmeshelement.BaseFemMeshElement):
class MeshRegion(base_fempythonobject.BaseFemPythonObject):
"""
The FemMeshRegion object
"""
@@ -40,12 +40,20 @@ class MeshRegion(base_femmeshelement.BaseFemMeshElement):
Type = "Fem::MeshRegion"
def __init__(self, obj):
super(MeshRegion, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyLength",
"CharacteristicLength",
"MeshRegionProperties",
"set characteristic length of FEM elements for this refinement"
"set characteristic length of FEM elements for this refinement",
)
obj.setPropertyStatus("CharacteristicLength", "LockDynamic")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshRegionShapes",
"List of FEM mesh refinement shapes",
)
obj.setPropertyStatus("References", "LockDynamic")

View File

@@ -40,4 +40,4 @@ class MeshResult(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::MeshResult"
def __init__(self, obj):
super(MeshResult, self).__init__(obj)
super().__init__(obj)

View File

@@ -41,33 +41,23 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ResultMechanical"
def __init__(self, obj):
super(ResultMechanical, self).__init__(obj)
super().__init__(obj)
obj.addProperty(
"App::PropertyString",
"ResultType",
"Base",
"Type of the result",
1 # the 1 set the property to ReadOnly
1, # the 1 set the property to ReadOnly
)
obj.setPropertyStatus("ResultType", "LockDynamic")
obj.ResultType = str(self.Type)
# for frequency analysis
obj.addProperty(
"App::PropertyInteger",
"Eigenmode",
"Data",
"",
True
)
obj.addProperty("App::PropertyInteger", "Eigenmode", "Data", "", True)
obj.setPropertyStatus("Eigenmode", "LockDynamic")
obj.addProperty(
"App::PropertyFloat",
"EigenmodeFrequency",
"Data",
"User Defined Results",
True
"App::PropertyFloat", "EigenmodeFrequency", "Data", "User Defined Results", True
)
obj.setPropertyStatus("EigenmodeFrequency", "LockDynamic")
@@ -80,7 +70,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"DisplacementVectors",
"NodeData",
"List of displacement vectors",
True
True,
)
obj.setPropertyStatus("DisplacementVectors", "LockDynamic")
obj.addProperty(
@@ -88,7 +78,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"Peeq",
"NodeData",
"List of equivalent plastic strain values",
True
True,
)
obj.setPropertyStatus("Peeq", "LockDynamic")
obj.addProperty(
@@ -96,7 +86,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"MohrCoulomb",
"NodeData",
"List of Mohr Coulomb stress values",
True
True,
)
obj.setPropertyStatus("MohrCoulomb", "LockDynamic")
obj.addProperty(
@@ -104,7 +94,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"ReinforcementRatio_x",
"NodeData",
"Reinforcement ratio x-direction",
True
True,
)
obj.setPropertyStatus("ReinforcementRatio_x", "LockDynamic")
obj.addProperty(
@@ -112,7 +102,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"ReinforcementRatio_y",
"NodeData",
"Reinforcement ratio y-direction",
True
True,
)
obj.setPropertyStatus("ReinforcementRatio_y", "LockDynamic")
obj.addProperty(
@@ -120,7 +110,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"ReinforcementRatio_z",
"NodeData",
"Reinforcement ratio z-direction",
True
True,
)
obj.setPropertyStatus("ReinforcementRatio_z", "LockDynamic")
# these three principal vectors are used only if there is a reinforced mat obj
@@ -130,7 +120,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"PS1Vector",
"NodeData",
"List of 1st Principal Stress Vectors",
True
True,
)
obj.setPropertyStatus("PS1Vector", "LockDynamic")
obj.addProperty(
@@ -138,7 +128,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"PS2Vector",
"NodeData",
"List of 2nd Principal Stress Vectors",
True
True,
)
obj.setPropertyStatus("PS2Vector", "LockDynamic")
obj.addProperty(
@@ -146,7 +136,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"PS3Vector",
"NodeData",
"List of 3rd Principal Stress Vectors",
True
True,
)
obj.setPropertyStatus("PS3Vector", "LockDynamic")
@@ -156,7 +146,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"DisplacementLengths",
"NodeData",
"List of displacement lengths",
True
True,
)
obj.setPropertyStatus("DisplacementLengths", "LockDynamic")
obj.addProperty(
@@ -164,39 +154,21 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"vonMises",
"NodeData",
"List of von Mises equivalent stresses",
True
True,
)
obj.setPropertyStatus("vonMises", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMax",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "PrincipalMax", "NodeData", "", True)
obj.setPropertyStatus("PrincipalMax", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMed",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "PrincipalMed", "NodeData", "", True)
obj.setPropertyStatus("PrincipalMed", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMin",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "PrincipalMin", "NodeData", "", True)
obj.setPropertyStatus("PrincipalMin", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"MaxShear",
"NodeData",
"List of Maximum Shear stress values",
True
True,
)
obj.setPropertyStatus("MaxShear", "LockDynamic")
obj.addProperty(
@@ -204,7 +176,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"MassFlowRate",
"NodeData",
"List of mass flow rate values",
True
True,
)
obj.setPropertyStatus("MassFlowRate", "LockDynamic")
obj.addProperty(
@@ -212,137 +184,47 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"NetworkPressure",
"NodeData",
"List of network pressure values",
True
True,
)
obj.setPropertyStatus("NetworkPressure", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"UserDefined",
"NodeData",
"User Defined Results",
True
"App::PropertyFloatList", "UserDefined", "NodeData", "User Defined Results", True
)
obj.setPropertyStatus("UserDefined", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"Temperature",
"NodeData",
"Temperature field",
True
"App::PropertyFloatList", "Temperature", "NodeData", "Temperature field", True
)
obj.addProperty(
"App::PropertyVectorList",
"HeatFlux",
"NodeData",
"List of heat flux vectors",
True
"App::PropertyVectorList", "HeatFlux", "NodeData", "List of heat flux vectors", True
)
obj.setPropertyStatus("HeatFlux", "LockDynamic")
obj.setPropertyStatus("Temperature", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXX",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressXX", "NodeData", "", True)
obj.setPropertyStatus("NodeStressXX", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressYY",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressYY", "NodeData", "", True)
obj.setPropertyStatus("NodeStressYY", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressZZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressZZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStressZZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXY",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressXY", "NodeData", "", True)
obj.setPropertyStatus("NodeStressXY", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressXZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStressXZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStressYZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStressYZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStressYZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXX",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainXX", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainXX", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainYY",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainYY", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainYY", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainZZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainZZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainZZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXY", "NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainXY", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainXY", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainXZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainXZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainYZ",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "NodeStrainYZ", "NodeData", "", True)
obj.setPropertyStatus("NodeStrainYZ", "LockDynamic")
obj.addProperty(
"App::PropertyFloatList",
"CriticalStrainRatio",
"NodeData",
"",
True
)
obj.addProperty("App::PropertyFloatList", "CriticalStrainRatio", "NodeData", "", True)
obj.setPropertyStatus("CriticalStrainRatio", "LockDynamic")
# initialize the Stats with the appropriate count of items
@@ -359,7 +241,7 @@ class ResultMechanical(base_fempythonobject.BaseFemPythonObject):
"vonMises",
"NodeData",
"List of von Mises equivalent stresses",
True
True,
)
obj.setPropertyStatus("vonMises", "LockDynamic")
obj.vonMises = obj.StressValues

View File

@@ -36,13 +36,12 @@ from femsolver.calculix.solver import _BaseSolverCalculix
class SolverCcxTools(base_fempythonobject.BaseFemPythonObject, _BaseSolverCalculix):
"""The Fem::FemSolver's Proxy python type, add solver specific properties
"""
"""The Fem::FemSolver's Proxy python type, add solver specific properties"""
Type = "Fem::SolverCcxTools"
def __init__(self, obj):
super(SolverCcxTools, self).__init__(obj)
super().__init__(obj)
# implemented in framework calculix solver module
self.add_attributes(obj)
@@ -51,7 +50,7 @@ class SolverCcxTools(base_fempythonobject.BaseFemPythonObject, _BaseSolverCalcul
"App::PropertyPath",
"WorkingDir",
"Fem",
"Working directory for calculations, will only be used it is left blank in preferences"
"Working directory for calculations, will only be used it is left blank in preferences",
)
obj.setPropertyStatus("WorkingDir", "LockDynamic")
# the working directory is not set, the solver working directory is