FEM: constraint electrostatic potential, better addition of attributs
This commit is contained in:
@@ -39,45 +39,71 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
|
||||
|
||||
def __init__(self, obj):
|
||||
super(ConstraintElectrostaticPotential, self).__init__(obj)
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat",
|
||||
"Potential",
|
||||
"Parameter",
|
||||
"Potential"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"PotentialEnabled",
|
||||
"Parameter",
|
||||
"Potential Enabled"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"PotentialConstant",
|
||||
"Parameter",
|
||||
"Potential Constant"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ElectricInfinity",
|
||||
"Parameter",
|
||||
"Electric Infinity"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ElectricForcecalculation",
|
||||
"Parameter",
|
||||
"Electric Force Calculation"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyInteger",
|
||||
"CapacitanceBody",
|
||||
"Parameter",
|
||||
"Capacitance Body"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"CapacitanceBodyEnabled",
|
||||
"Parameter",
|
||||
"Capacitance Body Enabled"
|
||||
)
|
||||
self.add_properties(obj)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
self.add_properties(obj)
|
||||
|
||||
def add_properties(self, obj):
|
||||
if not hasattr(obj, "Potential"):
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat",
|
||||
"Potential",
|
||||
"Parameter",
|
||||
"Potential"
|
||||
),
|
||||
obj.Potential = 0.0
|
||||
|
||||
if not hasattr(obj, "PotentialEnabled"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"PotentialEnabled",
|
||||
"Parameter",
|
||||
"Potential Enabled"
|
||||
),
|
||||
obj.PotentialEnabled = False
|
||||
|
||||
if not hasattr(obj, "PotentialConstant"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"PotentialConstant",
|
||||
"Parameter",
|
||||
"Potential Constant"
|
||||
),
|
||||
obj.PotentialConstant = False
|
||||
|
||||
if not hasattr(obj, "ElectricInfinity"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ElectricInfinity",
|
||||
"Parameter",
|
||||
"Electric Infinity"
|
||||
),
|
||||
obj.ElectricInfinity = False
|
||||
|
||||
if not hasattr(obj, "ElectricForcecalculation"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ElectricForcecalculation",
|
||||
"Parameter",
|
||||
"Electric Force Calculation"
|
||||
),
|
||||
obj.ElectricForcecalculation = False
|
||||
|
||||
if not hasattr(obj, "CapacitanceBody"):
|
||||
obj.addProperty(
|
||||
"App::PropertyInteger",
|
||||
"CapacitanceBody",
|
||||
"Parameter",
|
||||
"Capacitance Body"
|
||||
),
|
||||
obj.CapacitanceBody = 0
|
||||
|
||||
if not hasattr(obj, "CapacitanceBodyEnabled"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"CapacitanceBodyEnabled",
|
||||
"Parameter",
|
||||
"Capacitance Body Enabled"
|
||||
)
|
||||
obj.CapacitanceBodyEnabled = False
|
||||
|
||||
Reference in New Issue
Block a user