Skip to content

Instantly share code, notes, and snippets.

@jay3sh
Created June 11, 2011 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jay3sh/1020320 to your computer and use it in GitHub Desktop.
Save jay3sh/1020320 to your computer and use it in GitHub Desktop.
Parametric Bushing generated using Cadmium
#!/usr/bin/python
#
# Parametric bushing
# derived from OpenSCAD script from http://www.thingiverse.com/thing:8697
#
from math import *
from cadmium import *
def generate(height, radius, hole_r, border, recess, num_support):
outer_rings = (
Cylinder(r=radius+border, h=1) +
Cylinder(h=2, r1=radius+border, r2=radius).translate(0,0,1) +
Cylinder(h=height-6, r=radius).translate(0,0,3) +
Cylinder(h=3, r1=radius, r2=radius-border).translate(0,0,height-3)
) - Cylinder(r=radius-(border*2), h=height+border).translate(0,0,-1)
shafts = None
for i in range(num_support):
b = Box((radius-border)*2-0.6, border*2, height) \
.translate(-radius+border+0.4,-border,0) \
.rotate(Z_axis,i*180/num_support)
if shafts:
shafts += b
else:
shafts = b
central_ring = Cylinder(r=hole_r+border*2, h=height)
central_hole = Cylinder(r=hole_r,h=height+2)
recess = Cylinder(r=radius-2*border, h=recess)
return (outer_rings + shafts + central_ring) - \
(central_hole + recess).translate(0,0,-1)
generate(16, 75.0/2, 4.5, 1.56,5,3).toSTL('bushing.stl')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment