Fem: Enable expression for the centrif constraint task panel
This commit is contained in:
committed by
Chris Hennes
parent
d94c65ba3f
commit
a5720ec496
@@ -31,6 +31,8 @@ __url__ = "https://www.freecad.org"
|
||||
|
||||
from . import base_fempythonobject
|
||||
|
||||
_PropHelper = base_fempythonobject._PropHelper
|
||||
|
||||
|
||||
class ConstraintCentrif(base_fempythonobject.BaseFemPythonObject):
|
||||
"""
|
||||
@@ -42,18 +44,36 @@ class ConstraintCentrif(base_fempythonobject.BaseFemPythonObject):
|
||||
def __init__(self, obj):
|
||||
super().__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyFrequency",
|
||||
"RotationFrequency",
|
||||
"Constraint CENTRIF",
|
||||
"set rotation frequency f<sub>rot",
|
||||
)
|
||||
obj.setPropertyStatus("RotationFrequency", "LockDynamic")
|
||||
for prop in self._get_properties():
|
||||
prop.add_to_object(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyLinkSubList",
|
||||
"RotationAxis",
|
||||
"Constraint CENTRIF",
|
||||
"set line as axis of rotation",
|
||||
def _get_properties(self):
|
||||
prop = []
|
||||
|
||||
prop.append(
|
||||
_PropHelper(
|
||||
type="App::PropertyFrequency",
|
||||
name="RotationFrequency",
|
||||
group="Constraint Centrif",
|
||||
doc="Set rotation frequency",
|
||||
value="0 1/s",
|
||||
)
|
||||
)
|
||||
obj.setPropertyStatus("RotationAxis", "LockDynamic")
|
||||
prop.append(
|
||||
_PropHelper(
|
||||
type="App::PropertyLinkSubListGlobal",
|
||||
name="RotationAxis",
|
||||
group="Constraint Centrif",
|
||||
doc="Set line as axis of rotation",
|
||||
value=[],
|
||||
)
|
||||
)
|
||||
|
||||
return prop
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
# update old project with new properties
|
||||
for prop in self._get_properties():
|
||||
if prop.name == "RotationAxis":
|
||||
# change RotationAxis to App::PropertyLinkSubListGlobal
|
||||
prop.handle_change_type(obj, old_type="App::PropertyLinkSubList")
|
||||
|
||||
Reference in New Issue
Block a user