From 10f68c4dd72c0272b75c6742ea442ef9ee560b08 Mon Sep 17 00:00:00 2001 From: looooo Date: Wed, 18 Dec 2024 22:03:15 +0100 Subject: [PATCH] make hole properties optional (backward-compatibility --- freecad/gears/involutegear.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/freecad/gears/involutegear.py b/freecad/gears/involutegear.py index 8269707..35e1179 100644 --- a/freecad/gears/involutegear.py +++ b/freecad/gears/involutegear.py @@ -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) @@ -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