-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7a7e62
commit 234ac74
Showing
6 changed files
with
431 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
// file axes.scad | ||
// Creates 3D axis visualizations | ||
// (c) 2021 Rich Cameron | ||
// released under a Creative Commons CC-BY 4.0 International License | ||
// All measurements in mm | ||
|
||
radius = 100; //radius of the base | ||
base = 2; //thickness of the base part | ||
axes = 90; //length of the xy axes | ||
xythick = 4; //width of the xy axes | ||
zthick = 5; //width of the z axis | ||
zlength = 20; //length of the z axis | ||
angle = 90; //degrees of the wedge on the protractor | ||
clearance = .3; //clearance between connecting parts | ||
tube = 20;//length of the z axis connector | ||
tubewall = 1.2; //radial wall thickness of the connector tube | ||
line = 2; //thickness of lines on grids | ||
|
||
$fs = .2; | ||
$fa = 2; | ||
|
||
// Remove comments from one of the next five code lines to get the element you want. | ||
// Make sure to keep the other parameters consistent so that the pieces will fit together. | ||
|
||
// Uncomment next line to get xy axes. | ||
//translate(-(xythick * 2.5 + zthick) * [1, 1, 0]) xyaxes(); | ||
|
||
// Uncomment next line to get vertical grid. | ||
//translate(-(xythick * 2.5 + zthick) * [1, 1, 0]) rotate(angle) zgrid(); | ||
|
||
// Uncomment next line to get the protractor-style wedge. | ||
//protractor(); | ||
|
||
// Uncomment the next line to get the xy grid. | ||
//xygrid(); | ||
|
||
// Uncomment the next line to get the polar wedge grid. | ||
//polargrid(); | ||
|
||
|
||
|
||
module protractor() difference() { | ||
union() { | ||
linear_extrude(base, convexity = 5) offset(zthick) arc(radius - zthick); | ||
cylinder(r = zthick, h = base + line / 2); | ||
intersection() { | ||
cylinder(r = radius, h = base + line / 2); | ||
union() { | ||
for(a = [0:10:angle]) rotate(a) translate([radius, 0, base]) rotate([0, 90, 0]) cylinder(r = line / 2, h = 20, center = true, $fn = 4); | ||
for(a = [0:5:angle]) rotate(a) translate([radius, 0, base]) rotate([0, 90, 0]) cylinder(r = line / 2, h = 6, center = true, $fn = 4); | ||
} | ||
} | ||
cylinder(r = zthick / 2, h = xythick + zlength); | ||
} | ||
linear_extrude(base + line / 2, convexity = 5) for(a = [0:angle]) rotate(a) translate([radius, 0, 0]) rotate(180) circle(.5, $fn = 4); | ||
*circle(zthick / 2 + clearance); | ||
} | ||
|
||
module polargrid() difference() { | ||
union() { | ||
linear_extrude(base, convexity = 5) offset(zthick) arc(radius - zthick); | ||
cylinder(r = zthick, h = base + line / 2); | ||
intersection() { | ||
cylinder(r = radius, h = base + line / 2); | ||
union() { | ||
for(a = [0:15:angle]) rotate(a) translate([radius, 0, base]) rotate([0, 90, 0]) cylinder(r = line / 2, h = radius * 2, center = true, $fn = 4); | ||
for(a = [0:5:angle]) rotate(a) translate([radius, 0, base]) rotate([0, 90, 0]) cylinder(r = line / 2, h = 6, center = true, $fn = 4); | ||
} | ||
} | ||
intersection() { | ||
linear_extrude(base + line / 2) arc(); | ||
rotate_extrude() for(i = [10:10:radius - 5]) translate([i, base, 0]) circle(r = line / 2, $fn = 4); | ||
} | ||
cylinder(r = zthick / 2, h = xythick + zlength); | ||
} | ||
linear_extrude(base + line / 2, convexity = 5) for(a = [0:angle]) rotate(a) translate([radius, 0, 0]) rotate(180) circle(.5, $fn = 4); | ||
*circle(zthick / 2 + clearance); | ||
} | ||
|
||
module xygrid() { | ||
union() { | ||
linear_extrude(base, convexity = 5) offset(zthick) square(radius); | ||
cylinder(r = zthick, h = base + line / 2); | ||
intersection() { | ||
hull() { | ||
linear_extrude(base + line / 2, convexity = 5)square(radius); | ||
linear_extrude(base, convexity = 5) offset(line / 2) square(radius); | ||
} | ||
union() { | ||
for(x = [0:10:radius]) translate([x, 0, base]) rotate([0, 90, 90]) cylinder(r = line / 2, h = radius + line, $fn = 4); | ||
for(y = [0:10:radius]) translate([0, y, base]) rotate([0, 90, 0]) cylinder(r = line / 2, h = radius + line, $fn = 4); | ||
} | ||
} | ||
cylinder(r = zthick / 2, h = xythick + zlength); | ||
} | ||
} | ||
|
||
module xyaxes() { | ||
linear_extrude(xythick) difference() { | ||
for(a = [0, 1]) mirror([a, -a, 0]) { | ||
hull() for(i = [0, axes - xythick / 2]) translate([i, 0, 0]) circle(xythick / 2, $fn = 4); | ||
translate([axes, 0, 0]) rotate(135) difference() { | ||
square(xythick * 3); | ||
translate([xythick, xythick, 0]) square(xythick * 3); | ||
} | ||
circle(xythick * 1.5); | ||
} | ||
circle(zthick / 2 + clearance); | ||
} | ||
*cylinder(r = zthick / 2, h = xythick + axes); | ||
linear_extrude(tube) difference() { | ||
offset(tubewall) circle(zthick / 2 + clearance); | ||
circle(zthick / 2 + clearance); | ||
} | ||
} | ||
|
||
module zgrid() intersection() { | ||
rotate([90, 0, 0]) linear_extrude(zthick * 2, center = true, convexity = 5) intersection() { | ||
translate([-zthick, 0, 0]) square([radius + zthick, radius]); | ||
offset(5) offset(-5) square([radius * 2, radius * 2], center = true); | ||
} | ||
union() { | ||
linear_extrude(xythick, convexity = 5) difference() { | ||
circle(zthick); | ||
circle(zthick / 2 + clearance); | ||
} | ||
linear_extrude(radius, convexity = 5) difference() { | ||
union() { | ||
offset(tubewall) circle(zthick / 2 + clearance); | ||
square([radius, zthick / 2 + clearance + tubewall]); | ||
for(x = [0:10:radius]) translate([x, 0, 0]) circle(line / 2, $fn = 4); | ||
} | ||
circle(zthick / 2 + clearance); | ||
} | ||
for(z = [0:10:radius]) translate([zthick / 2 + clearance, 0, z]) rotate([0, 90, 0]) cylinder(r = line / 2, h = radius - zthick / 2 - clearance, $fn = 4); | ||
} | ||
} | ||
|
||
module arc(radius = radius, angle = angle) intersection() { | ||
circle(radius); | ||
if(angle < 180) intersection_for(a = [0, 180 - angle]) rotate(-a) translate([-radius, 0, 0]) square(radius * 2); | ||
else for(a = [0, 180 - angle]) rotate(-a) translate([-radius, 0, 0]) square(radius * 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// file revolution.scad | ||
// creates 3D surface of revolution from 2D shape | ||
// (c) 2020-2021 Rich Cameron | ||
// released under a Creative Commons CC-BY 4.0 International License | ||
|
||
|
||
wall = 4; //width of 2D shape | ||
thick = 4; // thickness of 2D shape | ||
hole = 2; // size of hole in 3D shape for pivot | ||
clearance = .3; //clearance between 2D and 3D shape | ||
|
||
$fs = .2; | ||
$fa = 2; | ||
|
||
translate([40, 70, 0]) frame(); | ||
revolution(); | ||
translate([80, 0, 0]) revolution(true); | ||
|
||
// The following lines define different shapes of rotation. | ||
// Remove the "//" from one, and only one, of these lines. | ||
|
||
// Create a double cone from a square rotated about a diagonal | ||
// Note: makes 2 cones, need to be assembled | ||
//module shape() rotate(45) square(50, center = true); | ||
|
||
// Create a cylinder from a square rotated about a line parallel to a side: | ||
//module shape() translate([0, 25, 0]) rotate(0) square(50, center = true); | ||
|
||
// Create a sphere from a circle rotated about a diameter | ||
// Note: makes 2 hemispheres need to be assembled | ||
//module shape() circle (25, center = true); | ||
|
||
//Create a shape from a hexagon rotated about line thru vertices: | ||
//module shape() translate([0, 25 * cos(180 / 6), 0]) rotate(0) circle(r = 25, $fn = 6); | ||
|
||
//Create a shape from an octagon rotated about a line parallel to a side | ||
//module shape() translate([0, 25 * cos(180 / 8), 0]) rotate(180 / 8) circle(r = 25, $fn = 8); | ||
|
||
// Create a shape from a triangle, rotate in x | ||
//module shape() translate([0, 25 * cos(180 / 3), 0]) rotate(-30) circle(r = 25, $fn = 3); | ||
|
||
//End definitions | ||
|
||
|
||
module outline() for(i = [0, 1]) mirror([i, 0, 0]) shape(); | ||
|
||
module frame() translate([0, 0, thick / 2]) { | ||
difference() { | ||
linear_extrude(thick, center = true, convexity = 5) difference() { | ||
offset(wall + clearance) outline(); | ||
offset(clearance) outline(); | ||
} | ||
rotate([90, 0, 0]) cylinder(r = hole / 2, h = 1000, center = true); | ||
} | ||
#%linear_extrude(.1) shape(); | ||
} | ||
|
||
module revolution(bottom = false) rotate_extrude() intersection() { | ||
mirror([0, bottom ? 1 : 0, 0]) outline(); | ||
translate([hole / 2, 0, 0]) square(1000); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// file ellipse_slider.scad | ||
// creates an ellipse with two holes and a slider so that | ||
// one can prove that the sum of the distances from the two foci | ||
// to a point on the ellipse is constant | ||
// (c) 2020 Rich Cameron | ||
// released under a Creative Commons CC-BY 4.0 International License | ||
d = [80, 60]; // minor and major axes, mm | ||
holesize = 5; //diameter of the focus holes | ||
h = 8; // thickness of the piece | ||
wall = 2; | ||
|
||
$fs = .2; | ||
$fa = 2; | ||
|
||
focus = [max(0, sqrt(pow(d[0], 2) - pow(d[1], 2)) / 2), max(0, sqrt(pow(d[1], 2) - pow(d[0], 2)) / 2)]; | ||
|
||
translate([0, 0, h / 2]) difference() { | ||
for(i = [0, 1]) mirror([0, 0, i]) | ||
hull() for(i = [0, 1]) translate([0, 0, -h / 2]) linear_extrude(1 + i * h / 2) offset(i * -h / 2) scale([1 / d[1], 1 / d[0], 1]) circle(d[0] * d[1] / 2); | ||
for(i = [-1, 1]) translate(i * focus) rotate_extrude() for(m = [0, 1]) mirror([0, m, 0]) { | ||
square([holesize / 2, h]); | ||
translate([holesize / 2, h / 2 - wall, 0]) hull() for(a = [45, 90]) rotate(a) square([h, holesize / 2]); | ||
}; | ||
} | ||
|
||
rotate((d[0] > d[1]) ? 0 : -90) translate([0, min(d) / 2 + 2, h / 2 + 1]) slider(); | ||
|
||
module slider() difference() { | ||
linear_extrude(h + 2, convexity = 5, center = true) difference() { | ||
offset(1 + wall) offset(-1) circle(holesize); | ||
} | ||
linear_extrude(h - 2.9, center = true) offset(1) offset(-1) intersection() { | ||
rotate(45) offset(-.5) square(holesize * 2); | ||
circle(holesize); | ||
translate([-holesize, -.5, 0]) square(holesize * 2); | ||
} | ||
rotate([0, 90, 0]) linear_extrude(holesize * 3, center = true, convexity = 5) difference() { | ||
translate([0, -h, 0]) square(h * 2, center = true); | ||
circle(h / 2 - 1, $fn = 4); | ||
} | ||
for(i = [0, 1]) mirror([0, 0, i]) translate([0, 0, h / 2 - 1.5]) intersection() { | ||
rotate([0, 90, 0]) rotate_extrude() rotate(90) offset(1) offset(-1) intersection() { | ||
rotate(45) offset(-.5) square(holesize * 2); | ||
circle(holesize); | ||
translate([-holesize, -.5, 0]) square(holesize * 2); | ||
} | ||
translate([0, 0, holesize]) cube(holesize * 2, center = true); | ||
} | ||
} |
Oops, something went wrong.