Skip to content

Instantly share code, notes, and snippets.

@fragmuffin
Last active August 27, 2017 11:37
Show Gist options
  • Save fragmuffin/b704aa0085247d854fbce2faf3be6ba7 to your computer and use it in GitHub Desktop.
Save fragmuffin/b704aa0085247d854fbce2faf3be6ba7 to your computer and use it in GitHub Desktop.
cadquery implementation of a basic pulley
# Creates a pulley model
import cadquery as cq
from Helpers import show
# Pulley Dimensions (mm)
radius = 20.0
width = 3 # contact area (not including wall thickness)
wall_height = 1.0
wall_width = 1.0
hole_radius = 3.175
key_intrusion = 0.92
# Pulley Base
pulley_half = cq.Workplane("XY") \
.circle(radius + wall_height).extrude(wall_width) \
.faces(">Z").workplane() \
.circle(radius).extrude(width / 2.0)
# Hole
pulley_half = pulley_half.faces(">Z").workplane() \
.moveTo(hole_radius - key_intrusion, hole_radius) \
.lineTo(0.0, hole_radius) \
.threePointArc(
(-hole_radius, 0.0), (0.0, -hole_radius)
) \
.lineTo(hole_radius - key_intrusion, -hole_radius) \
.close() \
.cutThruAll()
# Mirror half to create full pulley
pulley = pulley_half.translate((0, 0, 0)) # copy
pulley = pulley.union(
pulley.translate((0, 0, 0)).mirror(
'XY', basePointVector=(0, 0, wall_width + (width / 2.0))
),
)
show(pulley_half, (204, 204, 204, 0.0))
show(pulley, (204, 204, 204, 0.8))
@fragmuffin
Copy link
Author

fragmuffin commented Aug 27, 2017

Run using cadquery.

I recommend you run in FreeCAD with the cadquery-freecad-module (which is what the cadquery docs will tell you, so just follow those)

pulley_half is designed to be milled twice, then glued together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment