Skip to content

Commit b38bfda

Browse files
committed
remove expression for involute gear dw, it doesn't update correctly
1 parent 23a649c commit b38bfda

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

freecad/gears/features.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ def add_computed_properties(self, obj):
190190
obj.addProperty("App::PropertyLength", "df",
191191
"computed", "root diameter", 1)
192192
obj.addProperty("App::PropertyLength", "traverse_module", "computed", "traverse module of the generated gear", 1)
193-
obj.addProperty("App::PropertyLength", "dw", "computed", "The pitch diameter.")
194-
obj.setExpression('dw', 'teeth * traverse_module') # calculate via expression to ease usage for placement
195-
obj.setEditorMode('dw', 1) # set read-only after setting the expression, else it won't be visible. bug?
193+
obj.addProperty("App::PropertyLength", "dw", "computed", "The pitch diameter.", 1)
196194
obj.addProperty("App::PropertyAngle", "angular_backlash", "computed",
197195
"The angle by which this gear can turn without moving the mating gear.")
198196
obj.setExpression('angular_backlash', 'backlash / dw * 360° / pi') # calculate via expression to ease usage for placement
@@ -215,15 +213,15 @@ def add_accuracy_properties(self, obj):
215213
"accuracy", "number of points for spline")
216214

217215
def compute_traverse_properties(self, obj):
218-
if "properties_from_tool" in obj.PropertiesList:
219-
obj.gear.properties_from_tool = obj.properties_from_tool
216+
if obj.properties_from_tool:
220217
obj.traverse_module = obj.module / np.cos(obj.gear.beta)
221218
else:
222219
obj.traverse_module = obj.module
223220

224221
obj.transverse_pitch = "{}mm".format(obj.gear.pitch)
225222
obj.da = "{}mm".format(obj.gear.da)
226223
obj.df = "{}mm".format(obj.gear.df)
224+
obj.dw = "{}mm".format(obj.gear.dw)
227225

228226
def generate_gear_shape(self, obj):
229227
obj.gear.double_helix = obj.double_helix
@@ -237,8 +235,9 @@ def generate_gear_shape(self, obj):
237235
obj.gear.backlash = obj.backlash.Value * \
238236
(-obj.reversed_backlash + 0.5) * 2.
239237
obj.gear.head = obj.head
240-
obj.gear._update()
238+
obj.gear.properties_from_tool = obj.properties_from_tool
241239

240+
obj.gear._update()
242241
self.compute_traverse_properties(obj)
243242

244243

0 commit comments

Comments
 (0)