Skip to content

Commit

Permalink
fixes for worm_gear_holder
Browse files Browse the repository at this point in the history
  • Loading branch information
bat52 committed Feb 4, 2025
1 parent 3ba4b4c commit 44b89a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
30 changes: 21 additions & 9 deletions src/pylele/parts/worm_gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def configure(self):
self.shaft_h = 10
self.shaft_diam = 8

# hex hole
self.hex_hole = 4.3

# string hole
self.string_diam = 2

Expand Down Expand Up @@ -70,10 +73,14 @@ def gen(self) -> Shape:
vnf = worm_gear(mod=, teeth=, worm_diam=, [worm_starts=], [worm_arc=], [crowning=], [left_handed=], [pressure_angle=], [backlash=], [clearance=], [slices=])
"""

tol = self.cut_tolerance if self.isCut else 0

## gear
if self.isCut:
gear = self.api.cylinder_z(self.worm_diam-2*self.worm_drive_teeth,
self.gear_diam/2 + self.gear_teeth)
gear = self.api.cylinder_z(
self.worm_diam-2*self.worm_drive_teeth,
self.gear_diam/2 + self.gear_teeth
)
else:
gear = self.api.genShape(
solid=worm_gear(pitch=self.worm_pitch,
Expand All @@ -86,7 +93,7 @@ def gen(self) -> Shape:
).rotate_z(5)

# shaft
shaft = self.api.cylinder_z(l=self.shaft_h, rad=self.shaft_diam/2)
shaft = self.api.cylinder_z(l=self.shaft_h, rad=self.shaft_diam/2 + tol)

if not self.isCut:
# string hole
Expand Down Expand Up @@ -123,8 +130,8 @@ def gen(self) -> Shape:

## drive
if self.isCut:
drive = self.api.cylinder_z(self.drive_h,
rad=self.worm_diam/2+self.drive_teeth_l
drive = self.api.cylinder_z(self.drive_h+2*tol,
rad=self.worm_diam/2+self.drive_teeth_l+tol
)
else:
drive = self.api.genShape(
Expand All @@ -138,18 +145,23 @@ def gen(self) -> Shape:
)

# drive cylindrical extension
tol = self.cut_tolerance if self.isCut else 0
disk_low = self.api.cylinder_z(l=self.disk_h+tol, rad=(self.worm_diam+tol)/2)
disk_low = self.api.cylinder_z(l=self.disk_h+tol, rad=self.worm_diam/2+tol)
disk_high = disk_low.dup()
disk_low <<= (0,0,-(self.drive_h+self.disk_h)/2)
disk_high <<= (0,0, (self.drive_h+self.disk_h)/2)
drive += disk_low + disk_high

# drive extension
drive_ext = self.api.cylinder_z(l=self.drive_h+2*self.disk_h+2*20*tol + 2*2,
rad=self.hex_hole/2+2+2*tol
)
drive += drive_ext

# hex key hole
if not self.isCut:
# hex key hole
hex_cut = Pencil(
args = ['-i', self.cli.implementation,
'-s', '4.3',
'-s', f'{self.hex_hole}',
'-d','0',
'-fh','0'
]
Expand Down
10 changes: 5 additions & 5 deletions src/pylele/parts/worm_gear_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class WormGearHolder(WormGear):

def configure(self):
WormGear.configure(self)
self.wall_thickness = 2
self.wall_thickness = 2.4
self.holder_thickness = max([
self.worm_diam-2*self.worm_drive_teeth + 2*self.wall_thickness, # from gear
self.worm_diam/2+self.drive_teeth_l + 2*self.wall_thickness, # from drive
])
self.worm_diam-2*self.worm_drive_teeth, # from gear
self.worm_diam/2+self.drive_teeth_l , # from drive
]) + 2*self.wall_thickness + 2*self.cut_tolerance
self.holder_width = 2*(self.gear_diam/2 + self.gear_teeth + self.wall_thickness)

def gen(self) -> Shape:
Expand Down Expand Up @@ -70,7 +70,7 @@ def gen(self) -> Shape:
]
).gen_full()

if False:
if True:
holder += WormGear( args = [
'-i', self.cli.implementation,
]
Expand Down

0 comments on commit 44b89a7

Please sign in to comment.