Apply constraint on the head/root fillets of the gears

- Use `App::PropertyFloatConstraint` instead of `App::PropertyFloat`
  in order to get a smaller set of valid options for the parts.

Minimum, maximum, step and default values are set.

Previously you could enter negative numbers which were fixed at the time
of generating the shape avoiding problems but the properties were not
fixed. Now users are not able to enter bad data which leads to a
simplification of the sanitization code.

Proposed upper limit at 1,000. Users are crazy.
This commit is contained in:
hasecilu
2024-11-16 17:57:37 -06:00
committed by lorenz
parent 91206aecdd
commit 09b8d7666f
6 changed files with 24 additions and 24 deletions

View File

@@ -110,23 +110,23 @@ class CycloidGear(BaseGear):
def add_fillet_properties(self, obj):
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
def add_tolerance_properties(self, obj):
obj.addProperty(

View File

@@ -166,23 +166,23 @@ class CycloidGearRack(BaseGear):
def add_fillet_properties(self, obj):
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
def generate_gear_shape(self, obj):
numpoints = obj.numpoints

View File

@@ -175,23 +175,23 @@ class InternalInvoluteGear(BaseGear):
def add_fillet_properties(self, obj):
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
def add_tolerance_properties(self, obj):
obj.addProperty(

View File

@@ -121,23 +121,23 @@ class InvoluteGear(BaseGear):
QT_TRANSLATE_NOOP("App::Property", "undercut"),
)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
def add_helical_properties(self, obj):
obj.addProperty(

View File

@@ -162,23 +162,23 @@ class InvoluteGearRack(BaseGear):
def add_fillet_properties(self, obj):
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
def generate_gear_shape(self, obj):
obj.rack.m = obj.module.Value

View File

@@ -69,23 +69,23 @@ class TimingGearT(BaseGear):
),
)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"head_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-head, radius = head_fillet x module",
),
)
).head_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyFloat",
"App::PropertyFloatConstraint",
"root_fillet",
"fillets",
QT_TRANSLATE_NOOP(
"App::Property",
"a fillet for the tooth-root, radius = root_fillet x module",
),
)
).root_fillet = (0.0, 0.0, 1000.0, 0.01)
obj.addProperty(
"App::PropertyAngle",
"alpha",