diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-06 19:58:54 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-06 19:58:54 (GMT) |
commit | c342e41e2f5084ac37b0a92f04c75949d5f352e9 (patch) | |
tree | dbf95429854f45b143b6b71a6fab2c79779d2a63 /examples | |
parent | 9326da227bffc063290edf7e272f70cccfc0339d (diff) |
Clifford Wolf:
Added polygon() statement
Added min/max functions
git-svn-id: http://svn.clifford.at/openscad/trunk@222 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example017.scad | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/examples/example017.scad b/examples/example017.scad new file mode 100644 index 0000000..d6c9173 --- /dev/null +++ b/examples/example017.scad @@ -0,0 +1,121 @@ + +thickness = 6; +locklen1 = 15; +locklen2 = 10; +boltlen = 15; +midhole = 10; +inner1_to_inner2 = 50; +total_height = 80; + +module shape_tripod() +{ + x1 = 0; + x2 = x1 + thickness; + x3 = x2 + locklen1; + x4 = x3 + thickness; + x5 = x4 + inner1_to_inner2; + x6 = x5 - thickness; + x7 = x6 - locklen2; + x8 = x7 - thickness; + x9 = x8 - thickness; + x10 = x9 - thickness; + + y1 = 0; + y2 = y1 + thickness; + y3 = y2 + thickness; + y4 = y3 + thickness; + y5 = y3 + total_height - 4*thickness; + y6 = y5 + thickness; + + union() + { + difference() { + polygon([ + [ x1, y2 ], [ x2, y2 ], + [ x2, y1 ], [ x3, y1 ], [ x3, y2 ], + [ x4, y2 ], [ x4, y1 ], [ x5, y1 ], + [ x5 + thickness, y3 ], [ x5, y4 ], + [ x5, y5 ], + [ x6, y5 ], [ x6, y6 ], [ x7, y6 ], [ x7, y5 ], [ x8, y5 ], + [ x8, y6 ], [ x9, y5 ], + [ x9, y4 ], [ x10, y3 ], + [ x2, y3 ] + ]); + translate([ x10, y4 ]) circle(thickness); + translate([ x5 + thickness, y4 ]) circle(thickness); + } + + translate([ x5, y1 ]) + square([ boltlen - thickness, thickness*2 ]); + + translate([ x5 + boltlen - thickness, y2 ]) circle(thickness); + + translate([ x2, y2 ]) intersection() { + circle(thickness); + translate([ -thickness*2, 0 ]) square(thickness*2); + } + + translate([ x8, y5 ]) intersection() { + circle(thickness); + translate([ -thickness*2, 0 ]) square(thickness*2); + } + } +} + +module shape_inner_disc() +{ + difference() { + circle(midhole + boltlen + 2*thickness + locklen2); + for (alpha = [ 0, 120, 240 ]) + rotate(alpha) translate([ 0, midhole + boltlen + thickness + locklen2/2 ]) square([ thickness, locklen2 ], true); + circle(midhole + boltlen); + } +} + +module shape_outer_disc() +{ + difference() { + circle(midhole + boltlen + inner1_to_inner2 + 2*thickness + locklen1); + for (alpha = [ 0, 120, 240 ]) + rotate(alpha) translate([ 0, midhole + boltlen + inner1_to_inner2 + thickness + locklen1/2 ]) square([ thickness, locklen1 ], true); + circle(midhole + boltlen + inner1_to_inner2); + } +} + +module parts() +{ + tripod_x_off = locklen1 - locklen2 + inner1_to_inner2; + tripod_y_off = max(midhole + boltlen + inner1_to_inner2 + 4*thickness + locklen1, total_height); + + shape_inner_disc(); + shape_outer_disc(); + + for (s = [ [1,1], [-1,1], [1,-1] ]) + render() scale(s) translate([ tripod_x_off, -tripod_y_off ]) shape_tripod(); +} + +module exploded() +{ + translate([ 0, 0, total_height + thickness ]) linear_extrude(height = thickness, convexity = 4) shape_inner_disc(); + linear_extrude(height = thickness, convexity = 4) shape_outer_disc(); + + for (alpha = [ 0, 120, 240 ]) + rotate(alpha) translate([ 0, thickness*2 + locklen1 + inner1_to_inner2 + boltlen + midhole, 1.5*thickness ]) + rotate([ 90, 0, -90 ]) linear_extrude(height = thickness, convexity = 10, center = true) shape_tripod(); + +} + +module assembled() +{ + translate([ 0, 0, total_height - thickness*2 ]) linear_extrude(height = thickness, convexity = 4) shape_inner_disc(); + linear_extrude(height = thickness, convexity = 4) shape_outer_disc(); + + for (alpha = [ 0, 120, 240 ]) + rotate(alpha) translate([ 0, thickness*2 + locklen1 + inner1_to_inner2 + boltlen + midhole, 0 ]) + rotate([ 90, 0, -90 ]) linear_extrude(height = thickness, convexity = 10, center = true) shape_tripod(); + +} + +parts(); +// exploded(); +// assembled(); |