Skip to content

Commit

Permalink
make hole properties optional (backward-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo committed Dec 18, 2024
1 parent fe3b945 commit 10f68c4
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions freecad/gears/involutegear.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ def generate_gear_shape(self, obj):
gear_shape = helical_extrusion(
base, obj.height.Value, twist_angle, obj.double_helix
)

else:
rw = obj.gear.dw / 2
gear_shape = part.makeCylinder(rw, obj.height.Value)
if hasattr(obj, "axle_hole"):
if obj.axle_hole and obj.axle_holesize.Value > 0:
axle_hole = part.makeCylinder(obj.axle_holesize.Value/2, obj.height.Value)
gear_shape = gear_shape.cut(axle_hole)
Expand All @@ -396,19 +399,7 @@ def generate_gear_shape(self, obj):
hole = part.makeCylinder(obj.offset_holesize.Value/2, obj.height.Value)
hole.Placement.Base = app.Vector(-obj.offset_holeoffset.Value, 0,0) #-obj.offset_holeoffset.Value/2, 0)
gear_shape = gear_shape.cut(hole)
return gear_shape
else:
rw = obj.gear.dw / 2
gear_shape = part.makeCylinder(rw, obj.height.Value)

if obj.axle_hole and obj.axle_holesize.Value > 0:
axle_hole = part.makeCylinder(obj.axle_holesize.Value/2, obj.height.Value)
#hole.Placement.Base = app.Vector(-obj.holesize.Value/2, -obj.holesize.Value/2, 0)
gear_shape = gear_shape.cut(axle_hole)
return gear_shape

if obj.hole and obj.holesize.Value > 0:
hole = part.makeCylinder(obj.holesize.Value/2, obj.height.Value)
hole.Placement.Base = app.Vector(-obj.offset_holeoffset.Value, 0,0) #-obj.holeoffset.Value/2, 0)
gear_shape = gear_shape.cut(hole)

return gear_shape

0 comments on commit 10f68c4

Please sign in to comment.