[FEM] adapt electrostatic examples to changed unit handling

- also a coding improvement
This commit is contained in:
Uwe
2022-03-26 04:54:36 +01:00
parent a450c50765
commit bff25dfdd1
2 changed files with 3 additions and 4 deletions

View File

@@ -190,7 +190,7 @@ def setup(doc=None, solvertype="elmer"):
name_pot1 = "ElectrostaticPotential1"
con_elect_pot1 = ObjectsFem.makeConstraintElectrostaticPotential(doc, name_pot1)
con_elect_pot1.References = [(geom_obj, "Face2")]
con_elect_pot1.Potential = 0.00
con_elect_pot1.Potential = "0 V"
con_elect_pot1.CapacitanceBody = 1
con_elect_pot1.CapacitanceBodyEnabled = True
con_elect_pot1.PotentialEnabled = True
@@ -204,7 +204,7 @@ def setup(doc=None, solvertype="elmer"):
(geom_obj, "Face5"),
(geom_obj, "Face6"),
(geom_obj, "Face11")]
con_elect_pot2.Potential = 1.00
con_elect_pot2.Potential = "1 V"
con_elect_pot2.CapacitanceBody = 2
con_elect_pot2.CapacitanceBodyEnabled = True
con_elect_pot2.PotentialEnabled = True

View File

@@ -32,7 +32,6 @@ __url__ = "https://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from FreeCAD import Units
from femguiutils import selection_widgets
from femtools import femutils
from femtools import membertools
@@ -120,7 +119,7 @@ class _TaskPanel(object):
# we could run into a syntax error on getting the quantity
potential = None
try:
potential = Units.Quantity(self._paramWidget.potentialQSB.text())
potential = self._paramWidget.potentialQSB.property('value')
except ValueError:
FreeCAD.Console.PrintMessage(
"Wrong input. Not recognised input: '{}' "