Skip to content

Instantly share code, notes, and snippets.

@hovissimo
Last active August 29, 2015 14:15
Show Gist options
  • Save hovissimo/0c16ce542036f4431722 to your computer and use it in GitHub Desktop.
Save hovissimo/0c16ce542036f4431722 to your computer and use it in GitHub Desktop.
openjscad file for making gauge tools to measure curve radius in mm
/***************************
* Author: Hovis
* File: metric radius gauges.jscad
* Description: This file can be used with openjscad.org to generate 3d models for some tools I designed. The tools are gauges to measure the radii of inside and outside corners by guess-and-check. These 3d models are intended to be easy to print on any 3d printer.
* License: GPL v2
***************************/
function main() {
// These are the mm radii
var sizes = [2, 3, 4, 5, 6, 7];
var shapes = [];
var index = 0;
sizes.forEach(function(radius) {
shapes.push(
radius_gauge(radius).translate([index*radius*5+5, index*-10, 0])
);
index++;
});
return shapes;
}
function radius_gauge(radius) {
// This circle will cut out the 45deg corner
var negative_circle_45 = {
x: 2*radius,
y: 2*radius + sqrt(8*pow(radius, 2))
};
// This circle will cut out the 90deg corner
var negative_circle_90 = {
x: -2*radius,
y: 3.5*radius
};
// tangent points 1/2 and 3/4 (and the orgigin) describe a polygon that
// fills the corners before the negative circles are cut away
var tangent1_x = negative_circle_45.x + radius*cos(180);
var tangent1_y = negative_circle_45.y + radius*sin(180);
var tangent2_x = negative_circle_45.x + radius*cos(-45);
var tangent2_y = negative_circle_45.y + radius*sin(-45);
var tangent3_x = negative_circle_90.x + radius*cos(270);
var tangent3_y = negative_circle_90.y + radius*sin(270);
var tangent4_x = negative_circle_90.x + radius*cos(0);
var tangent4_y = negative_circle_90.y + radius*sin(0);
var shape = union(
// Make the rounded-corner box for the 90deg corners
hull(
circle({r:radius, center:true}).translate([0, 0]),
circle({r:radius, center:true}).translate([-3*radius,0]),
circle({r:radius, center:true}).translate([-3*radius,1.5*radius]),
circle({r:radius, center:true}).translate([0,1.5*radius])
),
// Add the "straight" leg for the 45deg corner
hull(
circle({r:radius, center:true}).translate([0, 0]),
circle({r:radius, center:true}).translate([0,6*radius])
),
// Add the angled leg for the 45deg corner
hull(
circle({r:radius, center:true}).translate([0, 0]),
circle({r:radius, center:true}).translate([4.5*radius, 4.5*radius])
),
// Add the inside corner polygons
polygon({points: [ [tangent1_x, tangent1_y], [0,0], [tangent2_x, tangent2_y]]}),
polygon({points: [ [tangent3_x, tangent3_y], [tangent4_x, tangent4_y], [0,0]]})
).extrude().subtract(
// and cut away the negative circles
circle({r:radius, center:true}).translate([negative_circle_45.x, negative_circle_45.y]).extrude()
).subtract(
circle({r:radius, center:true}).translate([negative_circle_90.x, negative_circle_90.y]).extrude()
);
// cut out the hole for hanging tool on a wire
return shape.subtract(cylinder());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment