New Y rod idler and logo
New idler based on the one used in the Mendel90 although there are improvements such as the nut trap. I added a new library called MCAD to /libs folder basically it is nuts, bolts gears and screws. The logo has been added as a .dxf file created in Inkscape. I have added another library "logo" to /libs folder it contains the dxf file. STL files with and without logo added to /Hardware/Y_axis/stl/pull/3/head
parent
58b1ccd591
commit
ed633d8432
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
|
|
||||||
use <../libs/build_plate.scad>
|
use <../libs/build_plate.scad>
|
||||||
use <../libs/MCAD-master/nuts_and_bolts.scad>
|
use <../libs/MCAD/nuts_and_bolts.scad>
|
||||||
fileNameLogo = "../libs/logo/cyclone_logo.dxf";
|
fileNameLogo = "../libs/logo/cyclone_logoC.dxf";
|
||||||
|
|
||||||
M8_rod_diam = 8.2;
|
M8_rod_diam = 8.2;
|
||||||
M3_rod_diam = 3.2;
|
M3_rod_diam = 3.2;
|
||||||
|
|
@ -20,8 +20,6 @@ frame_width = 25;
|
||||||
frame_height = Y_rod_height-smooth_rod_margin;
|
frame_height = Y_rod_height-smooth_rod_margin;
|
||||||
frame_depth = 10;
|
frame_depth = 10;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module mainBlock(){
|
module mainBlock(){
|
||||||
union(){
|
union(){
|
||||||
//main block
|
//main block
|
||||||
|
|
@ -47,7 +45,6 @@ module gap(){
|
||||||
cube([frame_width/2,frame_depth/8,frame_depth],center=true);
|
cube([frame_width/2,frame_depth/8,frame_depth],center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module hole(){
|
module hole(){
|
||||||
scale([0.77,1.5,0.77])
|
scale([0.77,1.5,0.77])
|
||||||
//main block shirnked
|
//main block shirnked
|
||||||
|
|
@ -70,6 +67,7 @@ module M3rodAndNut(){
|
||||||
nutHole(3);
|
nutHole(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module supportL(){
|
module supportL(){
|
||||||
mirror([0,0,0])
|
mirror([0,0,0])
|
||||||
translate([17,40 -10/4,0]){
|
translate([17,40 -10/4,0]){
|
||||||
|
|
@ -80,11 +78,12 @@ module supportL(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module supportR(){
|
module supportR(){
|
||||||
mirror([1,0,0,])
|
mirror([1,0,0,])
|
||||||
supportL();
|
supportL();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module mainBody(){
|
module mainBody(){
|
||||||
mainBlock();
|
mainBlock();
|
||||||
supportR();
|
supportR();
|
||||||
|
|
@ -103,10 +102,9 @@ module logo(mirror = 0){
|
||||||
resize([20,20,1.2])
|
resize([20,20,1.2])
|
||||||
linear_extrude(file = fileNameLogo, height=2);
|
linear_extrude(file = fileNameLogo, height=2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module Y_rod_idler(side = 0){
|
module Y_rod_idler(side = 0, logo = 0){
|
||||||
/*if left, side = 1
|
/*if left, side = 1
|
||||||
if right, side = 0*/
|
if right, side = 0*/
|
||||||
mirror([side,0,0])
|
mirror([side,0,0])
|
||||||
|
|
@ -116,30 +114,30 @@ module Y_rod_idler(side = 0){
|
||||||
M3rodAndNut();
|
M3rodAndNut();
|
||||||
gap();
|
gap();
|
||||||
hole();
|
hole();
|
||||||
|
if(logo)
|
||||||
logo(side);
|
logo(side);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module show_printbed(){
|
module show_printbed(){
|
||||||
translate([frame_width/2,frame_height/2,-frame_depth/2]) build_plate(3,150,140);
|
translate([frame_width/2,frame_height/2,-frame_depth/2]) build_plate(3,150,140);
|
||||||
|
|
||||||
}
|
}
|
||||||
module Y_rod_idler_left(){
|
|
||||||
|
module Y_rod_idler_left(logo){
|
||||||
translate([-25,0,0])
|
translate([-25,0,0])
|
||||||
Y_rod_idler(1);
|
Y_rod_idler(1, logo);
|
||||||
}
|
}
|
||||||
module Y_rod_idler_right(){
|
|
||||||
|
module Y_rod_idler_right(logo){
|
||||||
translate([25,0,0])
|
translate([25,0,0])
|
||||||
Y_rod_idler(0);
|
Y_rod_idler(0, logo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
Y_rod_idler_right();
|
Y_rod_idler_right(logo = 1);
|
||||||
Y_rod_idler_left();
|
Y_rod_idler_left(logo = 1);
|
||||||
|
// Y_rod_idler_right(); // Without logo
|
||||||
|
// Y_rod_idler_left(); // Without logo
|
||||||
show_printbed();
|
show_printbed();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,35 @@
|
||||||
|
OpenSCAD MCAD Library
|
||||||
|
=====================
|
||||||
|
|
||||||
|
This library contains components commonly used in designing and moching up mechanical designs. It is currently unfinished and still undergoing considerable API changes however many things are already working.
|
||||||
|
|
||||||
|
This library is licensed under the LGPL 2.1
|
||||||
|
See http://creativecommons.org/licenses/LGPL/2.1/ or the included file, lgpl-2.1.txt.
|
||||||
|
|
||||||
|
Currently Provided Tools:
|
||||||
|
|
||||||
|
* involute_gears.scad (http://www.thingiverse.com/thing:3575):
|
||||||
|
- gear()
|
||||||
|
- bevel_gear()
|
||||||
|
- bevel_gear_pair()
|
||||||
|
|
||||||
|
* gears.scad (Old version):
|
||||||
|
- gear(number_of_teeth, circular_pitch OR diametrial_pitch, pressure_angle OPTIONAL, clearance OPTIONAL)
|
||||||
|
|
||||||
|
* motors.scad:
|
||||||
|
- stepper_motor_mount(nema_standard, slide_distance OPTIONAL, mochup OPTIONAL)
|
||||||
|
|
||||||
|
Other tools (alpha quality):
|
||||||
|
* nuts_and_bolts.scad: for creating metric and imperial bolt/nut holes
|
||||||
|
* bearing.scad: standard/custom bearings
|
||||||
|
* screw.cad: screws and augers
|
||||||
|
* materials.scad: color definitions for different materials
|
||||||
|
|
||||||
|
Utils:
|
||||||
|
* math.scad: general math functions
|
||||||
|
* constants.scad: mathematical constants
|
||||||
|
* curves.scad: mathematical functions defining curves
|
||||||
|
* units.scad: easy metric units
|
||||||
|
* utilities: geometric funtions and misc. useful stuff
|
||||||
|
|
||||||
|
You are welcome to fork this project in github and request pulls. I will try to accomodate the community as much as possible in this.
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* Bearing model.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
include <units.scad>
|
||||||
|
include <materials.scad>
|
||||||
|
|
||||||
|
// Example, uncomment to view
|
||||||
|
//bearing_test();
|
||||||
|
//bearing_hole_test();
|
||||||
|
|
||||||
|
module bearing_test(){
|
||||||
|
bearing();
|
||||||
|
bearing(pos=[5*cm, 0,0], angle=[90,0,0]);
|
||||||
|
bearing(pos=[-2.5*cm, 0,0], model=Bearing688);
|
||||||
|
}
|
||||||
|
|
||||||
|
module bearing_hole_test(){
|
||||||
|
difference(){
|
||||||
|
translate([0, 0, 3.5]) cube(size=[30, 30, 7-10*epsilon], center=true);
|
||||||
|
bearing(outline=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BEARING_INNER_DIAMETER = 0;
|
||||||
|
BEARING_OUTER_DIAMETER = 1;
|
||||||
|
BEARING_WIDTH = 2;
|
||||||
|
|
||||||
|
Bearing608 = [8*mm, 22*mm, 7*mm];
|
||||||
|
Bearing627 = [7*mm, 22*mm, 7*mm];
|
||||||
|
Bearing688 = [8*mm, 16*mm, 5*mm];
|
||||||
|
SkateBearing = Bearing608;
|
||||||
|
|
||||||
|
function bearingWidth(model) = model[BEARING_WIDTH];
|
||||||
|
function bearingInnerDiameter(model) = model[BEARING_INNER_DIAMETER];
|
||||||
|
function bearingOuterDiameter(model) = model[BEARING_OUTER_DIAMETER];
|
||||||
|
|
||||||
|
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
|
||||||
|
material=Steel, sideMaterial=Brass) {
|
||||||
|
w = bearingWidth(model);
|
||||||
|
innerD = outline==false ? bearingInnerDiameter(model) : 0;
|
||||||
|
outerD = bearingOuterDiameter(model);
|
||||||
|
|
||||||
|
innerRim = innerD + (outerD - innerD) * 0.2;
|
||||||
|
outerRim = outerD - (outerD - innerD) * 0.2;
|
||||||
|
midSink = w * 0.1;
|
||||||
|
|
||||||
|
translate(pos) rotate(angle) union() {
|
||||||
|
color(material)
|
||||||
|
difference() {
|
||||||
|
// Basic ring
|
||||||
|
Ring([0,0,0], outerD, innerD, w, material, material);
|
||||||
|
|
||||||
|
if (outline==false) {
|
||||||
|
// Side shields
|
||||||
|
Ring([0,0,-epsilon], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
|
||||||
|
Ring([0,0,w-midSink], outerRim, innerRim, epsilon+midSink, sideMaterial, material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module Ring(pos, od, id, h, material, holeMaterial) {
|
||||||
|
color(material) {
|
||||||
|
translate(pos)
|
||||||
|
difference() {
|
||||||
|
cylinder(r=od/2, h=h, $fs = 0.01);
|
||||||
|
color(holeMaterial)
|
||||||
|
translate([0,0,-10*epsilon])
|
||||||
|
cylinder(r=id/2, h=h+20*epsilon, $fs = 0.01);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
// MIT license
|
||||||
|
|
||||||
|
|
||||||
|
TAU = 6.2831853071; //2*PI, see http://tauday.com/
|
||||||
|
PI = TAU/2;
|
||||||
|
|
||||||
|
// translates a imperial measurement in inches to meters
|
||||||
|
mm_per_inch = 25.4;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Parametric curves, to be used as paths
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
// © 2010 by Elmo Mäntynen
|
||||||
|
|
||||||
|
include <constants.scad>
|
||||||
|
use <math.scad>
|
||||||
|
|
||||||
|
|
||||||
|
/* A circular helix of radius a and pitch 2πb is described by the following parametrisation:
|
||||||
|
x(t) = a*cos(t),
|
||||||
|
y(t) = a*sin(t),
|
||||||
|
z(t) = b*t
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function b(pitch) = pitch/(TAU);
|
||||||
|
function t(pitch, z) = z/b(pitch);
|
||||||
|
|
||||||
|
function helix_curve(pitch, radius, z) =
|
||||||
|
[radius*cos(deg(t(pitch, z))), radius*sin(deg(t(pitch, z))), z];
|
||||||
|
|
||||||
|
|
@ -0,0 +1,173 @@
|
||||||
|
//test_involute_curve();
|
||||||
|
test_gears();
|
||||||
|
demo_3d_gears();
|
||||||
|
|
||||||
|
// Geometry Sources:
|
||||||
|
// http://www.cartertools.com/involute.html
|
||||||
|
// gears.py (inkscape extension: /usr/share/inkscape/extensions/gears.py)
|
||||||
|
// Usage:
|
||||||
|
// Diametral pitch: Number of teeth per unit length.
|
||||||
|
// Circular pitch: Length of the arc from one tooth to the next
|
||||||
|
// Clearance: Radial distance between top of tooth on one gear to bottom of gap on another.
|
||||||
|
|
||||||
|
module gear(number_of_teeth,
|
||||||
|
circular_pitch=false, diametral_pitch=false,
|
||||||
|
pressure_angle=20, clearance = 0)
|
||||||
|
{
|
||||||
|
if (circular_pitch==false && diametral_pitch==false) echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
|
||||||
|
|
||||||
|
//Convert diametrial pitch to our native circular pitch
|
||||||
|
circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);
|
||||||
|
|
||||||
|
// Pitch diameter: Diameter of pitch circle.
|
||||||
|
pitch_diameter = number_of_teeth * circular_pitch / 180;
|
||||||
|
pitch_radius = pitch_diameter/2;
|
||||||
|
|
||||||
|
// Base Circle
|
||||||
|
base_diameter = pitch_diameter*cos(pressure_angle);
|
||||||
|
base_radius = base_diameter/2;
|
||||||
|
|
||||||
|
// Diametrial pitch: Number of teeth per unit length.
|
||||||
|
pitch_diametrial = number_of_teeth / pitch_diameter;
|
||||||
|
|
||||||
|
// Addendum: Radial distance from pitch circle to outside circle.
|
||||||
|
addendum = 1/pitch_diametrial;
|
||||||
|
|
||||||
|
//Outer Circle
|
||||||
|
outer_radius = pitch_radius+addendum;
|
||||||
|
outer_diameter = outer_radius*2;
|
||||||
|
|
||||||
|
// Dedendum: Radial distance from pitch circle to root diameter
|
||||||
|
dedendum = addendum + clearance;
|
||||||
|
|
||||||
|
// Root diameter: Diameter of bottom of tooth spaces.
|
||||||
|
root_radius = pitch_radius-dedendum;
|
||||||
|
root_diameter = root_radius * 2;
|
||||||
|
|
||||||
|
half_thick_angle = 360 / (4 * number_of_teeth);
|
||||||
|
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
rotate(half_thick_angle) circle($fn=number_of_teeth*2, r=root_radius*1.001);
|
||||||
|
|
||||||
|
for (i= [1:number_of_teeth])
|
||||||
|
//for (i = [0])
|
||||||
|
{
|
||||||
|
rotate([0,0,i*360/number_of_teeth])
|
||||||
|
{
|
||||||
|
involute_gear_tooth(
|
||||||
|
pitch_radius = pitch_radius,
|
||||||
|
root_radius = root_radius,
|
||||||
|
base_radius = base_radius,
|
||||||
|
outer_radius = outer_radius,
|
||||||
|
half_thick_angle = half_thick_angle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module involute_gear_tooth(
|
||||||
|
pitch_radius,
|
||||||
|
root_radius,
|
||||||
|
base_radius,
|
||||||
|
outer_radius,
|
||||||
|
half_thick_angle
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pitch_to_base_angle = involute_intersect_angle( base_radius, pitch_radius );
|
||||||
|
|
||||||
|
outer_to_base_angle = involute_intersect_angle( base_radius, outer_radius );
|
||||||
|
|
||||||
|
base1 = 0 - pitch_to_base_angle - half_thick_angle;
|
||||||
|
pitch1 = 0 - half_thick_angle;
|
||||||
|
outer1 = outer_to_base_angle - pitch_to_base_angle - half_thick_angle;
|
||||||
|
|
||||||
|
b1 = polar_to_cartesian([ base1, base_radius ]);
|
||||||
|
p1 = polar_to_cartesian([ pitch1, pitch_radius ]);
|
||||||
|
o1 = polar_to_cartesian([ outer1, outer_radius ]);
|
||||||
|
|
||||||
|
b2 = polar_to_cartesian([ -base1, base_radius ]);
|
||||||
|
p2 = polar_to_cartesian([ -pitch1, pitch_radius ]);
|
||||||
|
o2 = polar_to_cartesian([ -outer1, outer_radius ]);
|
||||||
|
|
||||||
|
// ( root_radius > base_radius variables )
|
||||||
|
pitch_to_root_angle = pitch_to_base_angle - involute_intersect_angle(base_radius, root_radius );
|
||||||
|
root1 = pitch1 - pitch_to_root_angle;
|
||||||
|
root2 = -pitch1 + pitch_to_root_angle;
|
||||||
|
r1_t = polar_to_cartesian([ root1, root_radius ]);
|
||||||
|
r2_t = polar_to_cartesian([ -root1, root_radius ]);
|
||||||
|
|
||||||
|
// ( else )
|
||||||
|
r1_f = polar_to_cartesian([ base1, root_radius ]);
|
||||||
|
r2_f = polar_to_cartesian([ -base1, root_radius ]);
|
||||||
|
|
||||||
|
if (root_radius > base_radius)
|
||||||
|
{
|
||||||
|
//echo("true");
|
||||||
|
polygon( points = [
|
||||||
|
r1_t,p1,o1,o2,p2,r2_t
|
||||||
|
], convexity = 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
polygon( points = [
|
||||||
|
r1_f, b1,p1,o1,o2,p2,b2,r2_f
|
||||||
|
], convexity = 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mathematical Functions
|
||||||
|
//===============
|
||||||
|
|
||||||
|
// Finds the angle of the involute about the base radius at the given distance (radius) from it's center.
|
||||||
|
//source: http://www.mathhelpforum.com/math-help/geometry/136011-circle-involute-solving-y-any-given-x.html
|
||||||
|
|
||||||
|
function involute_intersect_angle(base_radius, radius) = sqrt( pow(radius/base_radius,2) - 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Polar coord [angle, radius] to cartesian coord [x,y]
|
||||||
|
|
||||||
|
function polar_to_cartesian(polar) = [
|
||||||
|
polar[1]*cos(polar[0]),
|
||||||
|
polar[1]*sin(polar[0])
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Test Cases
|
||||||
|
//===============
|
||||||
|
|
||||||
|
module test_gears()
|
||||||
|
{
|
||||||
|
gear(number_of_teeth=51,circular_pitch=200);
|
||||||
|
translate([0, 50])gear(number_of_teeth=17,circular_pitch=200);
|
||||||
|
translate([-50,0]) gear(number_of_teeth=17,diametral_pitch=1);
|
||||||
|
}
|
||||||
|
|
||||||
|
module demo_3d_gears()
|
||||||
|
{
|
||||||
|
//double helical gear
|
||||||
|
// (helics don't line up perfectly - for display purposes only ;)
|
||||||
|
translate([50,0])
|
||||||
|
{
|
||||||
|
linear_extrude(height = 10, center = true, convexity = 10, twist = -45)
|
||||||
|
gear(number_of_teeth=17,diametral_pitch=1);
|
||||||
|
translate([0,0,10]) linear_extrude(height = 10, center = true, convexity = 10, twist = 45)
|
||||||
|
gear(number_of_teeth=17,diametral_pitch=1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//spur gear
|
||||||
|
translate([0,-50]) linear_extrude(height = 10, center = true, convexity = 10, twist = 0)
|
||||||
|
gear(number_of_teeth=17,diametral_pitch=1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_involute_curve()
|
||||||
|
{
|
||||||
|
for (i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
|
||||||
|
{
|
||||||
|
translate(polar_to_cartesian([involute_intersect_angle( 0.1,i) , i ])) circle($fn=15, r=0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,678 @@
|
||||||
|
// Parametric Involute Bevel and Spur Gears by GregFrost
|
||||||
|
// It is licensed under the Creative Commons - GNU GPL license.
|
||||||
|
// © 2010 by GregFrost
|
||||||
|
// http://www.thingiverse.com/thing:3575
|
||||||
|
|
||||||
|
// Simple Test:
|
||||||
|
//gear (circular_pitch=700,
|
||||||
|
// gear_thickness = 12,
|
||||||
|
// rim_thickness = 15,
|
||||||
|
// hub_thickness = 17,
|
||||||
|
// circles=8);
|
||||||
|
|
||||||
|
//Complex Spur Gear Test:
|
||||||
|
//test_gears ();
|
||||||
|
|
||||||
|
// Meshing Double Helix:
|
||||||
|
//test_meshing_double_helix ();
|
||||||
|
|
||||||
|
module test_meshing_double_helix(){
|
||||||
|
test_meshing_double_helix ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Demonstrate the backlash option for Spur gears.
|
||||||
|
//test_backlash ();
|
||||||
|
|
||||||
|
// Demonstrate how to make meshing bevel gears.
|
||||||
|
//test_bevel_gear_pair();
|
||||||
|
|
||||||
|
module test_bevel_gear_pair(){
|
||||||
|
bevel_gear_pair ();
|
||||||
|
}
|
||||||
|
|
||||||
|
pi=3.1415926535897932384626433832795;
|
||||||
|
|
||||||
|
//==================================================
|
||||||
|
// Bevel Gears:
|
||||||
|
// Two gears with the same cone distance, circular pitch (measured at the cone distance)
|
||||||
|
// and pressure angle will mesh.
|
||||||
|
|
||||||
|
module bevel_gear_pair (
|
||||||
|
gear1_teeth = 41,
|
||||||
|
gear2_teeth = 7,
|
||||||
|
axis_angle = 90,
|
||||||
|
outside_circular_pitch=1000)
|
||||||
|
{
|
||||||
|
outside_pitch_radius1 = gear1_teeth * outside_circular_pitch / 360;
|
||||||
|
outside_pitch_radius2 = gear2_teeth * outside_circular_pitch / 360;
|
||||||
|
pitch_apex1=outside_pitch_radius2 * sin (axis_angle) +
|
||||||
|
(outside_pitch_radius2 * cos (axis_angle) + outside_pitch_radius1) / tan (axis_angle);
|
||||||
|
cone_distance = sqrt (pow (pitch_apex1, 2) + pow (outside_pitch_radius1, 2));
|
||||||
|
pitch_apex2 = sqrt (pow (cone_distance, 2) - pow (outside_pitch_radius2, 2));
|
||||||
|
echo ("cone_distance", cone_distance);
|
||||||
|
pitch_angle1 = asin (outside_pitch_radius1 / cone_distance);
|
||||||
|
pitch_angle2 = asin (outside_pitch_radius2 / cone_distance);
|
||||||
|
echo ("pitch_angle1, pitch_angle2", pitch_angle1, pitch_angle2);
|
||||||
|
echo ("pitch_angle1 + pitch_angle2", pitch_angle1 + pitch_angle2);
|
||||||
|
|
||||||
|
rotate([0,0,90])
|
||||||
|
translate ([0,0,pitch_apex1+20])
|
||||||
|
{
|
||||||
|
translate([0,0,-pitch_apex1])
|
||||||
|
bevel_gear (
|
||||||
|
number_of_teeth=gear1_teeth,
|
||||||
|
cone_distance=cone_distance,
|
||||||
|
pressure_angle=30,
|
||||||
|
outside_circular_pitch=outside_circular_pitch);
|
||||||
|
|
||||||
|
rotate([0,-(pitch_angle1+pitch_angle2),0])
|
||||||
|
translate([0,0,-pitch_apex2])
|
||||||
|
bevel_gear (
|
||||||
|
number_of_teeth=gear2_teeth,
|
||||||
|
cone_distance=cone_distance,
|
||||||
|
pressure_angle=30,
|
||||||
|
outside_circular_pitch=outside_circular_pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Bevel Gear Finishing Options:
|
||||||
|
bevel_gear_flat = 0;
|
||||||
|
bevel_gear_back_cone = 1;
|
||||||
|
|
||||||
|
module bevel_gear (
|
||||||
|
number_of_teeth=11,
|
||||||
|
cone_distance=100,
|
||||||
|
face_width=20,
|
||||||
|
outside_circular_pitch=1000,
|
||||||
|
pressure_angle=30,
|
||||||
|
clearance = 0.2,
|
||||||
|
bore_diameter=5,
|
||||||
|
gear_thickness = 15,
|
||||||
|
backlash = 0,
|
||||||
|
involute_facets=0,
|
||||||
|
finish = -1)
|
||||||
|
{
|
||||||
|
echo ("bevel_gear",
|
||||||
|
"teeth", number_of_teeth,
|
||||||
|
"cone distance", cone_distance,
|
||||||
|
face_width,
|
||||||
|
outside_circular_pitch,
|
||||||
|
pressure_angle,
|
||||||
|
clearance,
|
||||||
|
bore_diameter,
|
||||||
|
involute_facets,
|
||||||
|
finish);
|
||||||
|
|
||||||
|
// Pitch diameter: Diameter of pitch circle at the fat end of the gear.
|
||||||
|
outside_pitch_diameter = number_of_teeth * outside_circular_pitch / 180;
|
||||||
|
outside_pitch_radius = outside_pitch_diameter / 2;
|
||||||
|
|
||||||
|
// The height of the pitch apex.
|
||||||
|
pitch_apex = sqrt (pow (cone_distance, 2) - pow (outside_pitch_radius, 2));
|
||||||
|
pitch_angle = asin (outside_pitch_radius/cone_distance);
|
||||||
|
|
||||||
|
echo ("Num Teeth:", number_of_teeth, " Pitch Angle:", pitch_angle);
|
||||||
|
|
||||||
|
finish = (finish != -1) ? finish : (pitch_angle < 45) ? bevel_gear_flat : bevel_gear_back_cone;
|
||||||
|
|
||||||
|
apex_to_apex=cone_distance / cos (pitch_angle);
|
||||||
|
back_cone_radius = apex_to_apex * sin (pitch_angle);
|
||||||
|
|
||||||
|
// Calculate and display the pitch angle. This is needed to determine the angle to mount two meshing cone gears.
|
||||||
|
|
||||||
|
// Base Circle for forming the involute teeth shape.
|
||||||
|
base_radius = back_cone_radius * cos (pressure_angle);
|
||||||
|
|
||||||
|
// Diametrial pitch: Number of teeth per unit length.
|
||||||
|
pitch_diametrial = number_of_teeth / outside_pitch_diameter;
|
||||||
|
|
||||||
|
// Addendum: Radial distance from pitch circle to outside circle.
|
||||||
|
addendum = 1 / pitch_diametrial;
|
||||||
|
// Outer Circle
|
||||||
|
outer_radius = back_cone_radius + addendum;
|
||||||
|
|
||||||
|
// Dedendum: Radial distance from pitch circle to root diameter
|
||||||
|
dedendum = addendum + clearance;
|
||||||
|
dedendum_angle = atan (dedendum / cone_distance);
|
||||||
|
root_angle = pitch_angle - dedendum_angle;
|
||||||
|
|
||||||
|
root_cone_full_radius = tan (root_angle)*apex_to_apex;
|
||||||
|
back_cone_full_radius=apex_to_apex / tan (pitch_angle);
|
||||||
|
|
||||||
|
back_cone_end_radius =
|
||||||
|
outside_pitch_radius -
|
||||||
|
dedendum * cos (pitch_angle) -
|
||||||
|
gear_thickness / tan (pitch_angle);
|
||||||
|
back_cone_descent = dedendum * sin (pitch_angle) + gear_thickness;
|
||||||
|
|
||||||
|
// Root diameter: Diameter of bottom of tooth spaces.
|
||||||
|
root_radius = back_cone_radius - dedendum;
|
||||||
|
|
||||||
|
half_tooth_thickness = outside_pitch_radius * sin (360 / (4 * number_of_teeth)) - backlash / 4;
|
||||||
|
half_thick_angle = asin (half_tooth_thickness / back_cone_radius);
|
||||||
|
|
||||||
|
face_cone_height = apex_to_apex-face_width / cos (pitch_angle);
|
||||||
|
face_cone_full_radius = face_cone_height / tan (pitch_angle);
|
||||||
|
face_cone_descent = dedendum * sin (pitch_angle);
|
||||||
|
face_cone_end_radius =
|
||||||
|
outside_pitch_radius -
|
||||||
|
face_width / sin (pitch_angle) -
|
||||||
|
face_cone_descent / tan (pitch_angle);
|
||||||
|
|
||||||
|
// For the bevel_gear_flat finish option, calculate the height of a cube to select the portion of the gear that includes the full pitch face.
|
||||||
|
bevel_gear_flat_height = pitch_apex - (cone_distance - face_width) * cos (pitch_angle);
|
||||||
|
|
||||||
|
// translate([0,0,-pitch_apex])
|
||||||
|
difference ()
|
||||||
|
{
|
||||||
|
intersection ()
|
||||||
|
{
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
rotate (half_thick_angle)
|
||||||
|
translate ([0,0,pitch_apex-apex_to_apex])
|
||||||
|
cylinder ($fn=number_of_teeth*2, r1=root_cone_full_radius,r2=0,h=apex_to_apex);
|
||||||
|
for (i = [1:number_of_teeth])
|
||||||
|
// for (i = [1:1])
|
||||||
|
{
|
||||||
|
rotate ([0,0,i*360/number_of_teeth])
|
||||||
|
{
|
||||||
|
involute_bevel_gear_tooth (
|
||||||
|
back_cone_radius = back_cone_radius,
|
||||||
|
root_radius = root_radius,
|
||||||
|
base_radius = base_radius,
|
||||||
|
outer_radius = outer_radius,
|
||||||
|
pitch_apex = pitch_apex,
|
||||||
|
cone_distance = cone_distance,
|
||||||
|
half_thick_angle = half_thick_angle,
|
||||||
|
involute_facets = involute_facets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finish == bevel_gear_back_cone)
|
||||||
|
{
|
||||||
|
translate ([0,0,-back_cone_descent])
|
||||||
|
cylinder (
|
||||||
|
$fn=number_of_teeth*2,
|
||||||
|
r1=back_cone_end_radius,
|
||||||
|
r2=back_cone_full_radius*2,
|
||||||
|
h=apex_to_apex + back_cone_descent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
translate ([-1.5*outside_pitch_radius,-1.5*outside_pitch_radius,0])
|
||||||
|
cube ([3*outside_pitch_radius,
|
||||||
|
3*outside_pitch_radius,
|
||||||
|
bevel_gear_flat_height]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finish == bevel_gear_back_cone)
|
||||||
|
{
|
||||||
|
translate ([0,0,-face_cone_descent])
|
||||||
|
cylinder (
|
||||||
|
r1=face_cone_end_radius,
|
||||||
|
r2=face_cone_full_radius * 2,
|
||||||
|
h=face_cone_height + face_cone_descent+pitch_apex);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate ([0,0,pitch_apex - apex_to_apex])
|
||||||
|
cylinder (r=bore_diameter/2,h=apex_to_apex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module involute_bevel_gear_tooth (
|
||||||
|
back_cone_radius,
|
||||||
|
root_radius,
|
||||||
|
base_radius,
|
||||||
|
outer_radius,
|
||||||
|
pitch_apex,
|
||||||
|
cone_distance,
|
||||||
|
half_thick_angle,
|
||||||
|
involute_facets)
|
||||||
|
{
|
||||||
|
// echo ("involute_bevel_gear_tooth",
|
||||||
|
// back_cone_radius,
|
||||||
|
// root_radius,
|
||||||
|
// base_radius,
|
||||||
|
// outer_radius,
|
||||||
|
// pitch_apex,
|
||||||
|
// cone_distance,
|
||||||
|
// half_thick_angle);
|
||||||
|
|
||||||
|
min_radius = max (base_radius*2,root_radius*2);
|
||||||
|
|
||||||
|
pitch_point =
|
||||||
|
involute (
|
||||||
|
base_radius*2,
|
||||||
|
involute_intersect_angle (base_radius*2, back_cone_radius*2));
|
||||||
|
pitch_angle = atan2 (pitch_point[1], pitch_point[0]);
|
||||||
|
centre_angle = pitch_angle + half_thick_angle;
|
||||||
|
|
||||||
|
start_angle = involute_intersect_angle (base_radius*2, min_radius);
|
||||||
|
stop_angle = involute_intersect_angle (base_radius*2, outer_radius*2);
|
||||||
|
|
||||||
|
res=(involute_facets!=0)?involute_facets:($fn==0)?5:$fn/4;
|
||||||
|
|
||||||
|
translate ([0,0,pitch_apex])
|
||||||
|
rotate ([0,-atan(back_cone_radius/cone_distance),0])
|
||||||
|
translate ([-back_cone_radius*2,0,-cone_distance*2])
|
||||||
|
union ()
|
||||||
|
{
|
||||||
|
for (i=[1:res])
|
||||||
|
{
|
||||||
|
assign (
|
||||||
|
point1=
|
||||||
|
involute (base_radius*2,start_angle+(stop_angle - start_angle)*(i-1)/res),
|
||||||
|
point2=
|
||||||
|
involute (base_radius*2,start_angle+(stop_angle - start_angle)*(i)/res))
|
||||||
|
{
|
||||||
|
assign (
|
||||||
|
side1_point1 = rotate_point (centre_angle, point1),
|
||||||
|
side1_point2 = rotate_point (centre_angle, point2),
|
||||||
|
side2_point1 = mirror_point (rotate_point (centre_angle, point1)),
|
||||||
|
side2_point2 = mirror_point (rotate_point (centre_angle, point2)))
|
||||||
|
{
|
||||||
|
polyhedron (
|
||||||
|
points=[
|
||||||
|
[back_cone_radius*2+0.1,0,cone_distance*2],
|
||||||
|
[side1_point1[0],side1_point1[1],0],
|
||||||
|
[side1_point2[0],side1_point2[1],0],
|
||||||
|
[side2_point2[0],side2_point2[1],0],
|
||||||
|
[side2_point1[0],side2_point1[1],0],
|
||||||
|
[0.1,0,0]],
|
||||||
|
triangles=[[0,1,2],[0,2,3],[0,3,4],[0,5,1],[1,5,2],[2,5,3],[3,5,4],[0,4,5]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module gear (
|
||||||
|
number_of_teeth=15,
|
||||||
|
circular_pitch=false, diametral_pitch=false,
|
||||||
|
pressure_angle=28,
|
||||||
|
clearance = 0.2,
|
||||||
|
gear_thickness=5,
|
||||||
|
rim_thickness=8,
|
||||||
|
rim_width=5,
|
||||||
|
hub_thickness=10,
|
||||||
|
hub_diameter=15,
|
||||||
|
bore_diameter=5,
|
||||||
|
circles=0,
|
||||||
|
backlash=0,
|
||||||
|
twist=0,
|
||||||
|
involute_facets=0)
|
||||||
|
{
|
||||||
|
if (circular_pitch==false && diametral_pitch==false)
|
||||||
|
echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
|
||||||
|
|
||||||
|
//Convert diametrial pitch to our native circular pitch
|
||||||
|
circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);
|
||||||
|
|
||||||
|
// Pitch diameter: Diameter of pitch circle.
|
||||||
|
pitch_diameter = number_of_teeth * circular_pitch / 180;
|
||||||
|
pitch_radius = pitch_diameter/2;
|
||||||
|
echo ("Teeth:", number_of_teeth, " Pitch radius:", pitch_radius);
|
||||||
|
|
||||||
|
// Base Circle
|
||||||
|
base_radius = pitch_radius*cos(pressure_angle);
|
||||||
|
|
||||||
|
// Diametrial pitch: Number of teeth per unit length.
|
||||||
|
pitch_diametrial = number_of_teeth / pitch_diameter;
|
||||||
|
|
||||||
|
// Addendum: Radial distance from pitch circle to outside circle.
|
||||||
|
addendum = 1/pitch_diametrial;
|
||||||
|
|
||||||
|
//Outer Circle
|
||||||
|
outer_radius = pitch_radius+addendum;
|
||||||
|
|
||||||
|
// Dedendum: Radial distance from pitch circle to root diameter
|
||||||
|
dedendum = addendum + clearance;
|
||||||
|
|
||||||
|
// Root diameter: Diameter of bottom of tooth spaces.
|
||||||
|
root_radius = pitch_radius-dedendum;
|
||||||
|
backlash_angle = backlash / pitch_radius * 180 / pi;
|
||||||
|
half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;
|
||||||
|
|
||||||
|
// Variables controlling the rim.
|
||||||
|
rim_radius = root_radius - rim_width;
|
||||||
|
|
||||||
|
// Variables controlling the circular holes in the gear.
|
||||||
|
circle_orbit_diameter=hub_diameter/2+rim_radius;
|
||||||
|
circle_orbit_curcumference=pi*circle_orbit_diameter;
|
||||||
|
|
||||||
|
// Limit the circle size to 90% of the gear face.
|
||||||
|
circle_diameter=
|
||||||
|
min (
|
||||||
|
0.70*circle_orbit_curcumference/circles,
|
||||||
|
(rim_radius-hub_diameter/2)*0.9);
|
||||||
|
|
||||||
|
difference ()
|
||||||
|
{
|
||||||
|
union ()
|
||||||
|
{
|
||||||
|
difference ()
|
||||||
|
{
|
||||||
|
linear_extrude (height=rim_thickness, convexity=10, twist=twist)
|
||||||
|
gear_shape (
|
||||||
|
number_of_teeth,
|
||||||
|
pitch_radius = pitch_radius,
|
||||||
|
root_radius = root_radius,
|
||||||
|
base_radius = base_radius,
|
||||||
|
outer_radius = outer_radius,
|
||||||
|
half_thick_angle = half_thick_angle,
|
||||||
|
involute_facets=involute_facets);
|
||||||
|
|
||||||
|
if (gear_thickness < rim_thickness)
|
||||||
|
translate ([0,0,gear_thickness])
|
||||||
|
cylinder (r=rim_radius,h=rim_thickness-gear_thickness+1);
|
||||||
|
}
|
||||||
|
if (gear_thickness > rim_thickness)
|
||||||
|
cylinder (r=rim_radius,h=gear_thickness);
|
||||||
|
if (hub_thickness > gear_thickness)
|
||||||
|
translate ([0,0,gear_thickness])
|
||||||
|
cylinder (r=hub_diameter/2,h=hub_thickness-gear_thickness);
|
||||||
|
}
|
||||||
|
translate ([0,0,-1])
|
||||||
|
cylinder (
|
||||||
|
r=bore_diameter/2,
|
||||||
|
h=2+max(rim_thickness,hub_thickness,gear_thickness));
|
||||||
|
if (circles>0)
|
||||||
|
{
|
||||||
|
for(i=[0:circles-1])
|
||||||
|
rotate([0,0,i*360/circles])
|
||||||
|
translate([circle_orbit_diameter/2,0,-1])
|
||||||
|
cylinder(r=circle_diameter/2,h=max(gear_thickness,rim_thickness)+3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module gear_shape (
|
||||||
|
number_of_teeth,
|
||||||
|
pitch_radius,
|
||||||
|
root_radius,
|
||||||
|
base_radius,
|
||||||
|
outer_radius,
|
||||||
|
half_thick_angle,
|
||||||
|
involute_facets)
|
||||||
|
{
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
rotate (half_thick_angle) circle ($fn=number_of_teeth*2, r=root_radius);
|
||||||
|
|
||||||
|
for (i = [1:number_of_teeth])
|
||||||
|
{
|
||||||
|
rotate ([0,0,i*360/number_of_teeth])
|
||||||
|
{
|
||||||
|
involute_gear_tooth (
|
||||||
|
pitch_radius = pitch_radius,
|
||||||
|
root_radius = root_radius,
|
||||||
|
base_radius = base_radius,
|
||||||
|
outer_radius = outer_radius,
|
||||||
|
half_thick_angle = half_thick_angle,
|
||||||
|
involute_facets=involute_facets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module involute_gear_tooth (
|
||||||
|
pitch_radius,
|
||||||
|
root_radius,
|
||||||
|
base_radius,
|
||||||
|
outer_radius,
|
||||||
|
half_thick_angle,
|
||||||
|
involute_facets)
|
||||||
|
{
|
||||||
|
min_radius = max (base_radius,root_radius);
|
||||||
|
|
||||||
|
pitch_point = involute (base_radius, involute_intersect_angle (base_radius, pitch_radius));
|
||||||
|
pitch_angle = atan2 (pitch_point[1], pitch_point[0]);
|
||||||
|
centre_angle = pitch_angle + half_thick_angle;
|
||||||
|
|
||||||
|
start_angle = involute_intersect_angle (base_radius, min_radius);
|
||||||
|
stop_angle = involute_intersect_angle (base_radius, outer_radius);
|
||||||
|
|
||||||
|
res=(involute_facets!=0)?involute_facets:($fn==0)?5:$fn/4;
|
||||||
|
|
||||||
|
union ()
|
||||||
|
{
|
||||||
|
for (i=[1:res])
|
||||||
|
assign (
|
||||||
|
point1=involute (base_radius,start_angle+(stop_angle - start_angle)*(i-1)/res),
|
||||||
|
point2=involute (base_radius,start_angle+(stop_angle - start_angle)*i/res))
|
||||||
|
{
|
||||||
|
assign (
|
||||||
|
side1_point1=rotate_point (centre_angle, point1),
|
||||||
|
side1_point2=rotate_point (centre_angle, point2),
|
||||||
|
side2_point1=mirror_point (rotate_point (centre_angle, point1)),
|
||||||
|
side2_point2=mirror_point (rotate_point (centre_angle, point2)))
|
||||||
|
{
|
||||||
|
polygon (
|
||||||
|
points=[[0,0],side1_point1,side1_point2,side2_point2,side2_point1],
|
||||||
|
paths=[[0,1,2,3,4,0]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mathematical Functions
|
||||||
|
//===============
|
||||||
|
|
||||||
|
// Finds the angle of the involute about the base radius at the given distance (radius) from it's center.
|
||||||
|
//source: http://www.mathhelpforum.com/math-help/geometry/136011-circle-involute-solving-y-any-given-x.html
|
||||||
|
|
||||||
|
function involute_intersect_angle (base_radius, radius) = sqrt (pow (radius/base_radius, 2) - 1) * 180 / pi;
|
||||||
|
|
||||||
|
// Calculate the involute position for a given base radius and involute angle.
|
||||||
|
|
||||||
|
function rotated_involute (rotate, base_radius, involute_angle) =
|
||||||
|
[
|
||||||
|
cos (rotate) * involute (base_radius, involute_angle)[0] + sin (rotate) * involute (base_radius, involute_angle)[1],
|
||||||
|
cos (rotate) * involute (base_radius, involute_angle)[1] - sin (rotate) * involute (base_radius, involute_angle)[0]
|
||||||
|
];
|
||||||
|
|
||||||
|
function mirror_point (coord) =
|
||||||
|
[
|
||||||
|
coord[0],
|
||||||
|
-coord[1]
|
||||||
|
];
|
||||||
|
|
||||||
|
function rotate_point (rotate, coord) =
|
||||||
|
[
|
||||||
|
cos (rotate) * coord[0] + sin (rotate) * coord[1],
|
||||||
|
cos (rotate) * coord[1] - sin (rotate) * coord[0]
|
||||||
|
];
|
||||||
|
|
||||||
|
function involute (base_radius, involute_angle) =
|
||||||
|
[
|
||||||
|
base_radius*(cos (involute_angle) + involute_angle*pi/180*sin (involute_angle)),
|
||||||
|
base_radius*(sin (involute_angle) - involute_angle*pi/180*cos (involute_angle)),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Test Cases
|
||||||
|
//===============
|
||||||
|
|
||||||
|
module test_gears()
|
||||||
|
{
|
||||||
|
translate([17,-15])
|
||||||
|
{
|
||||||
|
gear (number_of_teeth=17,
|
||||||
|
circular_pitch=500,
|
||||||
|
circles=8);
|
||||||
|
|
||||||
|
rotate ([0,0,360*4/17])
|
||||||
|
translate ([39.088888,0,0])
|
||||||
|
{
|
||||||
|
gear (number_of_teeth=11,
|
||||||
|
circular_pitch=500,
|
||||||
|
hub_diameter=0,
|
||||||
|
rim_width=65);
|
||||||
|
translate ([0,0,8])
|
||||||
|
{
|
||||||
|
gear (number_of_teeth=6,
|
||||||
|
circular_pitch=300,
|
||||||
|
hub_diameter=0,
|
||||||
|
rim_width=5,
|
||||||
|
rim_thickness=6,
|
||||||
|
pressure_angle=31);
|
||||||
|
rotate ([0,0,360*5/6])
|
||||||
|
translate ([22.5,0,1])
|
||||||
|
gear (number_of_teeth=21,
|
||||||
|
circular_pitch=300,
|
||||||
|
bore_diameter=2,
|
||||||
|
hub_diameter=4,
|
||||||
|
rim_width=1,
|
||||||
|
hub_thickness=4,
|
||||||
|
rim_thickness=4,
|
||||||
|
gear_thickness=3,
|
||||||
|
pressure_angle=31);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
translate ([-61.1111111,0,0])
|
||||||
|
{
|
||||||
|
gear (number_of_teeth=27,
|
||||||
|
circular_pitch=500,
|
||||||
|
circles=5,
|
||||||
|
hub_diameter=2*8.88888889);
|
||||||
|
|
||||||
|
translate ([0,0,10])
|
||||||
|
{
|
||||||
|
gear (
|
||||||
|
number_of_teeth=14,
|
||||||
|
circular_pitch=200,
|
||||||
|
pressure_angle=5,
|
||||||
|
clearance = 0.2,
|
||||||
|
gear_thickness = 10,
|
||||||
|
rim_thickness = 10,
|
||||||
|
rim_width = 15,
|
||||||
|
bore_diameter=5,
|
||||||
|
circles=0);
|
||||||
|
translate ([13.8888888,0,1])
|
||||||
|
gear (
|
||||||
|
number_of_teeth=11,
|
||||||
|
circular_pitch=200,
|
||||||
|
pressure_angle=5,
|
||||||
|
clearance = 0.2,
|
||||||
|
gear_thickness = 10,
|
||||||
|
rim_thickness = 10,
|
||||||
|
rim_width = 15,
|
||||||
|
hub_thickness = 20,
|
||||||
|
hub_diameter=2*7.222222,
|
||||||
|
bore_diameter=5,
|
||||||
|
circles=0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rotate ([0,0,360*-5/17])
|
||||||
|
translate ([44.444444444,0,0])
|
||||||
|
gear (number_of_teeth=15,
|
||||||
|
circular_pitch=500,
|
||||||
|
hub_diameter=10,
|
||||||
|
rim_width=5,
|
||||||
|
rim_thickness=5,
|
||||||
|
gear_thickness=4,
|
||||||
|
hub_thickness=6,
|
||||||
|
circles=9);
|
||||||
|
|
||||||
|
rotate ([0,0,360*-1/17])
|
||||||
|
translate ([30.5555555,0,-1])
|
||||||
|
gear (number_of_teeth=5,
|
||||||
|
circular_pitch=500,
|
||||||
|
hub_diameter=0,
|
||||||
|
rim_width=5,
|
||||||
|
rim_thickness=10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module meshing_double_helix ()
|
||||||
|
{
|
||||||
|
test_double_helix_gear ();
|
||||||
|
|
||||||
|
mirror ([0,1,0])
|
||||||
|
translate ([58.33333333,0,0])
|
||||||
|
test_double_helix_gear (teeth=13,circles=6);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_double_helix_gear (
|
||||||
|
teeth=17,
|
||||||
|
circles=8)
|
||||||
|
{
|
||||||
|
//double helical gear
|
||||||
|
{
|
||||||
|
twist=200;
|
||||||
|
height=20;
|
||||||
|
pressure_angle=30;
|
||||||
|
|
||||||
|
gear (number_of_teeth=teeth,
|
||||||
|
circular_pitch=700,
|
||||||
|
pressure_angle=pressure_angle,
|
||||||
|
clearance = 0.2,
|
||||||
|
gear_thickness = height/2*0.5,
|
||||||
|
rim_thickness = height/2,
|
||||||
|
rim_width = 5,
|
||||||
|
hub_thickness = height/2*1.2,
|
||||||
|
hub_diameter=15,
|
||||||
|
bore_diameter=5,
|
||||||
|
circles=circles,
|
||||||
|
twist=twist/teeth);
|
||||||
|
mirror([0,0,1])
|
||||||
|
gear (number_of_teeth=teeth,
|
||||||
|
circular_pitch=700,
|
||||||
|
pressure_angle=pressure_angle,
|
||||||
|
clearance = 0.2,
|
||||||
|
gear_thickness = height/2,
|
||||||
|
rim_thickness = height/2,
|
||||||
|
rim_width = 5,
|
||||||
|
hub_thickness = height/2,
|
||||||
|
hub_diameter=15,
|
||||||
|
bore_diameter=5,
|
||||||
|
circles=circles,
|
||||||
|
twist=twist/teeth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_backlash ()
|
||||||
|
{
|
||||||
|
backlash = 2;
|
||||||
|
teeth = 15;
|
||||||
|
|
||||||
|
translate ([-29.166666,0,0])
|
||||||
|
{
|
||||||
|
translate ([58.3333333,0,0])
|
||||||
|
rotate ([0,0,-360/teeth/4])
|
||||||
|
gear (
|
||||||
|
number_of_teeth = teeth,
|
||||||
|
circular_pitch=700,
|
||||||
|
gear_thickness = 12,
|
||||||
|
rim_thickness = 15,
|
||||||
|
rim_width = 5,
|
||||||
|
hub_thickness = 17,
|
||||||
|
hub_diameter=15,
|
||||||
|
bore_diameter=5,
|
||||||
|
backlash = 2,
|
||||||
|
circles=8);
|
||||||
|
|
||||||
|
rotate ([0,0,360/teeth/4])
|
||||||
|
gear (
|
||||||
|
number_of_teeth = teeth,
|
||||||
|
circular_pitch=700,
|
||||||
|
gear_thickness = 12,
|
||||||
|
rim_thickness = 15,
|
||||||
|
rim_width = 5,
|
||||||
|
hub_thickness = 17,
|
||||||
|
hub_diameter=15,
|
||||||
|
bore_diameter=5,
|
||||||
|
backlash = 2,
|
||||||
|
circles=8);
|
||||||
|
}
|
||||||
|
|
||||||
|
color([0,0,128,0.5])
|
||||||
|
translate([0,0,-5])
|
||||||
|
cylinder ($fn=20,r=backlash / 4,h=25);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,502 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Material colors.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Material colors
|
||||||
|
Oak = [0.65, 0.5, 0.4];
|
||||||
|
Pine = [0.85, 0.7, 0.45];
|
||||||
|
Birch = [0.9, 0.8, 0.6];
|
||||||
|
FiberBoard = [0.7, 0.67, 0.6];
|
||||||
|
BlackPaint = [0.2, 0.2, 0.2];
|
||||||
|
Iron = [0.36, 0.33, 0.33];
|
||||||
|
Steel = [0.65, 0.67, 0.72];
|
||||||
|
Stainless = [0.45, 0.43, 0.5];
|
||||||
|
Aluminum = [0.77, 0.77, 0.8];
|
||||||
|
Brass = [0.88, 0.78, 0.5];
|
||||||
|
Transparent = [1, 1, 1, 0.2];
|
||||||
|
|
||||||
|
// Example, uncomment to view
|
||||||
|
//color_demo();
|
||||||
|
|
||||||
|
module color_demo(){
|
||||||
|
// Wood
|
||||||
|
colorTest(Oak, 0, 0);
|
||||||
|
colorTest(Pine, 1, 0);
|
||||||
|
colorTest(Birch, 2, 0);
|
||||||
|
|
||||||
|
// Metals
|
||||||
|
colorTest(Iron, 0, 1);
|
||||||
|
colorTest(Steel, 1, 1);
|
||||||
|
colorTest(Stainless, 2, 1);
|
||||||
|
colorTest(Aluminum, 3, 1);
|
||||||
|
|
||||||
|
// Mixboards
|
||||||
|
colorTest(FiberBoard, 0, 2);
|
||||||
|
|
||||||
|
// Paints
|
||||||
|
colorTest(BlackPaint, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
module colorTest(col, row=0, c=0) {
|
||||||
|
color(col) translate([row * 30,c*30,0]) sphere(r=10);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// MIT license
|
||||||
|
|
||||||
|
include <constants.scad>
|
||||||
|
|
||||||
|
function deg(angle) = 360*angle/TAU;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
// License: GPL 2.0
|
||||||
|
|
||||||
|
include <math.scad>
|
||||||
|
|
||||||
|
|
||||||
|
//generates a motor mount for the specified nema standard #.
|
||||||
|
module stepper_motor_mount(nema_standard,slide_distance=0, mochup=true)
|
||||||
|
{
|
||||||
|
//dimensions from:
|
||||||
|
// http://www.numberfactory.com/NEMA%20Motor%20Dimensions.htm
|
||||||
|
if (nema_standard == 17)
|
||||||
|
{
|
||||||
|
_stepper_motor_mount(
|
||||||
|
motor_shaft_diameter = 0.1968*mm_per_inche,
|
||||||
|
motor_shaft_length = 0.945*mm_per_inche,
|
||||||
|
pilot_diameter = 0.866*mm_per_inche,
|
||||||
|
pilot_length = 0.80*mm_per_inche,
|
||||||
|
mounting_bolt_circle = 1.725*mm_per_inche,
|
||||||
|
bolt_hole_size = 3.5,
|
||||||
|
bolt_hole_distance = 1.220*mm_per_inche,
|
||||||
|
slide_distance = slide_distance,
|
||||||
|
mochup = mochup);
|
||||||
|
}
|
||||||
|
if (nema_standard == 23)
|
||||||
|
{
|
||||||
|
_stepper_motor_mount(
|
||||||
|
motor_shaft_diameter = 0.250*mm_per_inche,
|
||||||
|
motor_shaft_length = 0.81*mm_per_inche,
|
||||||
|
pilot_diameter = 1.500*mm_per_inche,
|
||||||
|
pilot_length = 0.062*mm_per_inche,
|
||||||
|
mounting_bolt_circle = 2.625*mm_per_inche,
|
||||||
|
bolt_hole_size = 0.195*mm_per_inche,
|
||||||
|
bolt_hole_distance = 1.856*mm_per_inche,
|
||||||
|
slide_distance = slide_distance,
|
||||||
|
mochup = mochup);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//inner mehod for creating a stepper motor mount of any dimensions
|
||||||
|
module _stepper_motor_mount(
|
||||||
|
motor_shaft_diameter,
|
||||||
|
motor_shaft_length,
|
||||||
|
pilot_diameter,
|
||||||
|
pilot_length,
|
||||||
|
mounting_bolt_circle,
|
||||||
|
bolt_hole_size,
|
||||||
|
bolt_hole_distance,
|
||||||
|
slide_distance = 0,
|
||||||
|
motor_length = 40, //arbitray - not standardized
|
||||||
|
mochup
|
||||||
|
)
|
||||||
|
{
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
// == centered mount points ==
|
||||||
|
//mounting circle inset
|
||||||
|
translate([0,slide_distance/2,0]) circle(r = pilot_diameter/2);
|
||||||
|
square([pilot_diameter,slide_distance],center=true);
|
||||||
|
translate([0,-slide_distance/2,0]) circle(r = pilot_diameter/2);
|
||||||
|
|
||||||
|
//todo: motor shaft hole
|
||||||
|
|
||||||
|
//mounting screw holes
|
||||||
|
for (x = [-1,1])
|
||||||
|
{
|
||||||
|
for (y = [-1,1])
|
||||||
|
{
|
||||||
|
translate([x*bolt_hole_distance/2,y*bolt_hole_distance/2,0])
|
||||||
|
{
|
||||||
|
translate([0,slide_distance/2,0]) circle(bolt_hole_size/2);
|
||||||
|
translate([0,-slide_distance/2,0]) circle(bolt_hole_size/2);
|
||||||
|
square([bolt_hole_size,slide_distance],center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// == motor mock-up ==
|
||||||
|
//motor box
|
||||||
|
if (mochup == true)
|
||||||
|
{
|
||||||
|
%translate([0,0,-5]) cylinder(h = 5, r = pilot_diameter/2);
|
||||||
|
%translate(v=[0,0,-motor_length/2])
|
||||||
|
{
|
||||||
|
cube(size=[bolt_hole_distance+bolt_hole_size+5,bolt_hole_distance+bolt_hole_size+5,motor_length], center = true);
|
||||||
|
}
|
||||||
|
//shaft
|
||||||
|
%translate(v=[0,0,-(motor_length-motor_shaft_length-2)/2])
|
||||||
|
{
|
||||||
|
%cylinder(r=motor_shaft_diameter/2,h=motor_length+motor_shaft_length--1, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
// License: GPL 2.0
|
||||||
|
|
||||||
|
//testNutsAndBolts();
|
||||||
|
|
||||||
|
module testNutsAndBolts()
|
||||||
|
{
|
||||||
|
$fn = 360;
|
||||||
|
translate([0,15])nutHole(3, proj=2);
|
||||||
|
boltHole(3, length= 30, proj=2);
|
||||||
|
}
|
||||||
|
|
||||||
|
MM = "mm";
|
||||||
|
INCH = "inch"; //Not yet supported
|
||||||
|
|
||||||
|
//Based on: http://www.roymech.co.uk/Useful_Tables/Screws/Hex_Screws.htm
|
||||||
|
METRIC_NUT_AC_WIDTHS =
|
||||||
|
[
|
||||||
|
-1, //0 index is not used but reduces computation
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
6.40,//m3
|
||||||
|
8.10,//m4
|
||||||
|
9.20,//m5
|
||||||
|
11.50,//m6
|
||||||
|
-1,
|
||||||
|
15.00,//m8
|
||||||
|
-1,
|
||||||
|
19.60,//m10
|
||||||
|
-1,
|
||||||
|
22.10,//m12
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
27.70,//m16
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
34.60,//m20
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
41.60,//m24
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
53.1,//m30
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
63.5//m36
|
||||||
|
];
|
||||||
|
METRIC_NUT_THICKNESS =
|
||||||
|
[
|
||||||
|
-1, //0 index is not used but reduces computation
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
2.40,//m3
|
||||||
|
3.20,//m4
|
||||||
|
4.00,//m5
|
||||||
|
5.00,//m6
|
||||||
|
-1,
|
||||||
|
6.50,//m8
|
||||||
|
-1,
|
||||||
|
8.00,//m10
|
||||||
|
-1,
|
||||||
|
10.00,//m12
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
13.00,//m16
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
16.00//m20
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
19.00,//m24
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
24.00,//m30
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
29.00//m36
|
||||||
|
];
|
||||||
|
|
||||||
|
COURSE_METRIC_BOLT_MAJOR_THREAD_DIAMETERS =
|
||||||
|
[//based on max values
|
||||||
|
-1, //0 index is not used but reduces computation
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
2.98,//m3
|
||||||
|
3.978,//m4
|
||||||
|
4.976,//m5
|
||||||
|
5.974,//m6
|
||||||
|
-1,
|
||||||
|
7.972,//m8
|
||||||
|
-1,
|
||||||
|
9.968,//m10
|
||||||
|
-1,
|
||||||
|
11.966,//m12
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
15.962,//m16
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
19.958,//m20
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
23.952,//m24
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
29.947,//m30
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
35.940//m36
|
||||||
|
];
|
||||||
|
|
||||||
|
module nutHole(size, units=MM, tolerance = +0.0001, proj = -1)
|
||||||
|
{
|
||||||
|
//takes a metric screw/nut size and looksup nut dimensions
|
||||||
|
radius = METRIC_NUT_AC_WIDTHS[size]/2+tolerance;
|
||||||
|
height = METRIC_NUT_THICKNESS[size]+tolerance;
|
||||||
|
if (proj == -1)
|
||||||
|
{
|
||||||
|
cylinder(r= radius, h=height, $fn = 6, center=[0,0]);
|
||||||
|
}
|
||||||
|
if (proj == 1)
|
||||||
|
{
|
||||||
|
circle(r= radius, $fn = 6);
|
||||||
|
}
|
||||||
|
if (proj == 2)
|
||||||
|
{
|
||||||
|
translate([-radius/2, 0])
|
||||||
|
square([radius*2, height]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module boltHole(size, units=MM, length, tolerance = +0.0001, proj = -1)
|
||||||
|
{
|
||||||
|
radius = COURSE_METRIC_BOLT_MAJOR_THREAD_DIAMETERS[size]/2+tolerance;
|
||||||
|
//TODO: proper screw cap values
|
||||||
|
capHeight = METRIC_NUT_THICKNESS[size]+tolerance; //METRIC_BOLT_CAP_HEIGHTS[size]+tolerance;
|
||||||
|
capRadius = METRIC_NUT_AC_WIDTHS[size]/2+tolerance; //METRIC_BOLT_CAP_RADIUS[size]+tolerance;
|
||||||
|
|
||||||
|
if (proj == -1)
|
||||||
|
{
|
||||||
|
translate([0, 0, -capHeight])
|
||||||
|
cylinder(r= capRadius, h=capHeight);
|
||||||
|
cylinder(r = radius, h = length);
|
||||||
|
}
|
||||||
|
if (proj == 1)
|
||||||
|
{
|
||||||
|
circle(r = radius);
|
||||||
|
}
|
||||||
|
if (proj == 2)
|
||||||
|
{
|
||||||
|
translate([-capRadius/2, -capHeight])
|
||||||
|
square([capRadius*2, capHeight]);
|
||||||
|
square([radius*2, length]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boltHole(3);
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
import py, re, os, signal, time
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
|
mod_re = (r"\bmodule\s+(", r")\s*\(\s*")
|
||||||
|
func_re = (r"\bfunction\s+(", r")\s*\(")
|
||||||
|
|
||||||
|
def extract_mod_names(fpath, name_re=r"\w+"):
|
||||||
|
regex = name_re.join(mod_re)
|
||||||
|
matcher = re.compile(regex)
|
||||||
|
return (m.group(1) for m in matcher.finditer(fpath.read()))
|
||||||
|
|
||||||
|
def extract_func_names(fpath, name_re=r"\w+"):
|
||||||
|
regex = name_re.join(func_re)
|
||||||
|
matcher = re.compile(regex)
|
||||||
|
return (m.group(1) for m in matcher.finditer(fpath.read()))
|
||||||
|
|
||||||
|
def collect_test_modules():
|
||||||
|
dirpath = py.path.local("./")
|
||||||
|
print "Collecting openscad test module names"
|
||||||
|
|
||||||
|
test_files = {}
|
||||||
|
for fpath in dirpath.visit('*.scad'):
|
||||||
|
#print fpath
|
||||||
|
modules = extract_mod_names(fpath, r"test\w*")
|
||||||
|
#functions = extract_func_names(fpath, r"test\w*")
|
||||||
|
test_files[fpath] = modules
|
||||||
|
return test_files
|
||||||
|
|
||||||
|
collect_test_modules()
|
||||||
|
|
||||||
|
def call_openscad(path, stlpath, timeout=20):
|
||||||
|
try:
|
||||||
|
proc = Popen(['openscad', '-s', str(stlpath), str(path)],
|
||||||
|
stdout=PIPE, stderr=PIPE, close_fds=True)
|
||||||
|
calltime = time.time()
|
||||||
|
#print calltime
|
||||||
|
while True:
|
||||||
|
if proc.poll() is not None:
|
||||||
|
break
|
||||||
|
time.sleep(0.1)
|
||||||
|
#print time.time()
|
||||||
|
if time.time() > calltime + timeout:
|
||||||
|
raise Exception("Timeout")
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
proc.terminate()
|
||||||
|
proc.kill()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return (proc.returncode,) + proc.communicate()
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
// Parametric screw-like things (ball screws, augers)
|
||||||
|
// License: GNU GPL 2.0 or later.
|
||||||
|
// © 2010 by Elmo Mäntynen
|
||||||
|
|
||||||
|
include <curves.scad>
|
||||||
|
|
||||||
|
/* common screw parameter
|
||||||
|
length
|
||||||
|
pitch = length/rotations: the distance between the turns of the thread
|
||||||
|
outside_diameter
|
||||||
|
inner_diameter: thickness of the shaft
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Uncomment to see examples
|
||||||
|
//test_auger();
|
||||||
|
//test_ball_groove();
|
||||||
|
//test_ball_groove2();
|
||||||
|
//test_ball_screw();
|
||||||
|
|
||||||
|
module helix(pitch, length, slices=500){
|
||||||
|
rotations = length/pitch;
|
||||||
|
linear_extrude(height=length, center=false, convexity=10, twist=360*rotations, slices=slices, $fn=100)
|
||||||
|
child(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
module auger(pitch, length, outside_diameter, inner_diameter) {
|
||||||
|
union(){
|
||||||
|
helix(pitch, length)
|
||||||
|
polygon(points=[[10,10],[100,1],[100,-1],[10,-10]], paths=[[0,1,2,3]]);
|
||||||
|
cylinder(h=length, r=20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_auger(){translate([300, 0, 0]) auger(100, 300);}
|
||||||
|
|
||||||
|
|
||||||
|
module ball_groove(pitch, length, diameter, ball_radius=10) {
|
||||||
|
helix(pitch, length, slices=100)
|
||||||
|
translate([diameter, 0, 0])
|
||||||
|
circle(r = ball_radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_ball_groove(){ translate([0, 300, 0]) ball_groove(100, 300, 10);}
|
||||||
|
|
||||||
|
module ball_groove2(pitch, length, diameter, ball_radius, slices=200){
|
||||||
|
rotations = length/pitch;
|
||||||
|
radius=diameter/2;
|
||||||
|
offset = length/slices;
|
||||||
|
union(){
|
||||||
|
for (i = [0:slices]) {
|
||||||
|
assign (z = i*offset){
|
||||||
|
translate(helix_curve(pitch, radius, z)) sphere(ball_radius, $fa=5, $fs=1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_ball_groove2(){translate([0, 0, 0]) ball_groove2(100, 300, 100, 10);}
|
||||||
|
|
||||||
|
module ball_screw(pitch, length, bearing_radius=2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_ball_screw(){}
|
||||||
|
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
* A nema standard stepper motor module.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
include <units.scad>
|
||||||
|
include <materials.scad>
|
||||||
|
|
||||||
|
|
||||||
|
// Demo, uncomment to show:
|
||||||
|
//nema_demo();
|
||||||
|
|
||||||
|
module nema_demo(){
|
||||||
|
for (size = [NemaShort, NemaMedium, NemaLong]) {
|
||||||
|
translate([-100,size*100,0]) motor(Nema34, size, dualAxis=true);
|
||||||
|
translate([0,size*100,0]) motor(Nema23, size, dualAxis=true);
|
||||||
|
translate([100,size*100,0]) motor(Nema17, size, dualAxis=true);
|
||||||
|
translate([200,size*100,0]) motor(Nema14, size, dualAxis=true);
|
||||||
|
translate([300,size*100,0]) motor(Nema11, size, dualAxis=true);
|
||||||
|
translate([400,size*100,0]) motor(Nema08, size, dualAxis=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Parameters:
|
||||||
|
NemaModel = 0;
|
||||||
|
NemaLengthShort = 1;
|
||||||
|
NemaLengthMedium = 2;
|
||||||
|
NemaLengthLong = 3;
|
||||||
|
NemaSideSize = 4;
|
||||||
|
NemaDistanceBetweenMountingHoles = 5;
|
||||||
|
NemaMountingHoleDiameter = 6;
|
||||||
|
NemaMountingHoleDepth = 7;
|
||||||
|
NemaMountingHoleLip = 8;
|
||||||
|
NemaMountingHoleCutoutRadius = 9;
|
||||||
|
NemaEdgeRoundingRadius = 10;
|
||||||
|
NemaRoundExtrusionDiameter = 11;
|
||||||
|
NemaRoundExtrusionHeight = 12;
|
||||||
|
NemaAxleDiameter = 13;
|
||||||
|
NemaFrontAxleLength = 14;
|
||||||
|
NemaBackAxleLength = 15;
|
||||||
|
NemaAxleFlatDepth = 16;
|
||||||
|
NemaAxleFlatLengthFront = 17;
|
||||||
|
NemaAxleFlatLengthBack = 18;
|
||||||
|
|
||||||
|
NemaA = 1;
|
||||||
|
NemaB = 2;
|
||||||
|
NemaC = 3;
|
||||||
|
|
||||||
|
NemaShort = NemaA;
|
||||||
|
NemaMedium = NemaB;
|
||||||
|
NemaLong = NemaC;
|
||||||
|
|
||||||
|
// TODO: The small motors seem to be a bit too long, I picked the size specs from all over the place, is there some canonical reference?
|
||||||
|
Nema08 = [
|
||||||
|
[NemaModel, 8],
|
||||||
|
[NemaLengthShort, 33*mm],
|
||||||
|
[NemaLengthMedium, 43*mm],
|
||||||
|
[NemaLengthLong, 43*mm],
|
||||||
|
[NemaSideSize, 20*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 15.4*mm],
|
||||||
|
[NemaMountingHoleDiameter, 2*mm],
|
||||||
|
[NemaMountingHoleDepth, 1.75*mm],
|
||||||
|
[NemaMountingHoleLip, -1*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 0*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 2*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 16*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.5*mm],
|
||||||
|
[NemaAxleDiameter, 4*mm],
|
||||||
|
[NemaFrontAxleLength, 13.5*mm],
|
||||||
|
[NemaBackAxleLength, 9.9*mm],
|
||||||
|
[NemaAxleFlatDepth, -1*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 0*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 0*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
Nema11 = [
|
||||||
|
[NemaModel, 11],
|
||||||
|
[NemaLengthShort, 32*mm],
|
||||||
|
[NemaLengthMedium, 40*mm],
|
||||||
|
[NemaLengthLong, 52*mm],
|
||||||
|
[NemaSideSize, 28*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 23*mm],
|
||||||
|
[NemaMountingHoleDiameter, 2.5*mm],
|
||||||
|
[NemaMountingHoleDepth, 2*mm],
|
||||||
|
[NemaMountingHoleLip, -1*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 0*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 2.5*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 22*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.8*mm],
|
||||||
|
[NemaAxleDiameter, 5*mm],
|
||||||
|
[NemaFrontAxleLength, 13.7*mm],
|
||||||
|
[NemaBackAxleLength, 10*mm],
|
||||||
|
[NemaAxleFlatDepth, 0.5*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 10*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 9*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
Nema14 = [
|
||||||
|
[NemaModel, 14],
|
||||||
|
[NemaLengthShort, 26*mm],
|
||||||
|
[NemaLengthMedium, 28*mm],
|
||||||
|
[NemaLengthLong, 34*mm],
|
||||||
|
[NemaSideSize, 35.3*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 26*mm],
|
||||||
|
[NemaMountingHoleDiameter, 3*mm],
|
||||||
|
[NemaMountingHoleDepth, 3.5*mm],
|
||||||
|
[NemaMountingHoleLip, -1*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 0*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 5*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 22*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.9*mm],
|
||||||
|
[NemaAxleDiameter, 5*mm],
|
||||||
|
[NemaFrontAxleLength, 18*mm],
|
||||||
|
[NemaBackAxleLength, 10*mm],
|
||||||
|
[NemaAxleFlatDepth, 0.5*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 15*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 9*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
Nema17 = [
|
||||||
|
[NemaModel, 17],
|
||||||
|
[NemaLengthShort, 33*mm],
|
||||||
|
[NemaLengthMedium, 39*mm],
|
||||||
|
[NemaLengthLong, 47*mm],
|
||||||
|
[NemaSideSize, 42.20*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 31.04*mm],
|
||||||
|
[NemaMountingHoleDiameter, 4*mm],
|
||||||
|
[NemaMountingHoleDepth, 4.5*mm],
|
||||||
|
[NemaMountingHoleLip, -1*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 0*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 7*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 22*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.9*mm],
|
||||||
|
[NemaAxleDiameter, 5*mm],
|
||||||
|
[NemaFrontAxleLength, 18*mm],
|
||||||
|
[NemaBackAxleLength, 15*mm],
|
||||||
|
[NemaAxleFlatDepth, 0.5*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 15*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 14*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
Nema23 = [
|
||||||
|
[NemaModel, 23],
|
||||||
|
[NemaLengthShort, 39*mm],
|
||||||
|
[NemaLengthMedium, 54*mm],
|
||||||
|
[NemaLengthLong, 76*mm],
|
||||||
|
[NemaSideSize, 56.4*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 47.14*mm],
|
||||||
|
[NemaMountingHoleDiameter, 4.75*mm],
|
||||||
|
[NemaMountingHoleDepth, 5*mm],
|
||||||
|
[NemaMountingHoleLip, 4.95*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 9.5*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 2.5*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 38.10*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.52*mm],
|
||||||
|
[NemaAxleDiameter, 6.36*mm],
|
||||||
|
[NemaFrontAxleLength, 18.80*mm],
|
||||||
|
[NemaBackAxleLength, 15.60*mm],
|
||||||
|
[NemaAxleFlatDepth, 0.5*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 16*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 14*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
Nema34 = [
|
||||||
|
[NemaModel, 34],
|
||||||
|
[NemaLengthShort, 66*mm],
|
||||||
|
[NemaLengthMedium, 96*mm],
|
||||||
|
[NemaLengthLong, 126*mm],
|
||||||
|
[NemaSideSize, 85*mm],
|
||||||
|
[NemaDistanceBetweenMountingHoles, 69.58*mm],
|
||||||
|
[NemaMountingHoleDiameter, 6.5*mm],
|
||||||
|
[NemaMountingHoleDepth, 5.5*mm],
|
||||||
|
[NemaMountingHoleLip, 5*mm],
|
||||||
|
[NemaMountingHoleCutoutRadius, 17*mm],
|
||||||
|
[NemaEdgeRoundingRadius, 3*mm],
|
||||||
|
[NemaRoundExtrusionDiameter, 73.03*mm],
|
||||||
|
[NemaRoundExtrusionHeight, 1.9*mm],
|
||||||
|
[NemaAxleDiameter, 0.5*inch],
|
||||||
|
[NemaFrontAxleLength, 37*mm],
|
||||||
|
[NemaBackAxleLength, 34*mm],
|
||||||
|
[NemaAxleFlatDepth, 1.20*mm],
|
||||||
|
[NemaAxleFlatLengthFront, 25*mm],
|
||||||
|
[NemaAxleFlatLengthBack, 25*mm],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function motorWidth(model=Nema23) = lookup(NemaSideSize, model);
|
||||||
|
function motorLength(model=Nema23, size=NemaMedium) = lookup(size, model);
|
||||||
|
|
||||||
|
|
||||||
|
module motor(model=Nema23, size=NemaMedium, dualAxis=false, pos=[0,0,0], orientation = [0,0,0]) {
|
||||||
|
|
||||||
|
length = lookup(size, model);
|
||||||
|
|
||||||
|
echo(str(" Motor: Nema",lookup(NemaModel, model),", length= ",length,"mm, dual axis=",dualAxis));
|
||||||
|
|
||||||
|
stepperBlack = BlackPaint;
|
||||||
|
stepperAluminum = Aluminum;
|
||||||
|
|
||||||
|
side = lookup(NemaSideSize, model);
|
||||||
|
|
||||||
|
cutR = lookup(NemaMountingHoleCutoutRadius, model);
|
||||||
|
lip = lookup(NemaMountingHoleLip, model);
|
||||||
|
holeDepth = lookup(NemaMountingHoleDepth, model);
|
||||||
|
|
||||||
|
axleLengthFront = lookup(NemaFrontAxleLength, model);
|
||||||
|
axleLengthBack = lookup(NemaBackAxleLength, model);
|
||||||
|
axleRadius = lookup(NemaAxleDiameter, model) * 0.5;
|
||||||
|
|
||||||
|
extrSize = lookup(NemaRoundExtrusionHeight, model);
|
||||||
|
extrRad = lookup(NemaRoundExtrusionDiameter, model) * 0.5;
|
||||||
|
|
||||||
|
holeDist = lookup(NemaDistanceBetweenMountingHoles, model) * 0.5;
|
||||||
|
holeRadius = lookup(NemaMountingHoleDiameter, model) * 0.5;
|
||||||
|
|
||||||
|
mid = side / 2;
|
||||||
|
|
||||||
|
roundR = lookup(NemaEdgeRoundingRadius, model);
|
||||||
|
|
||||||
|
axleFlatDepth = lookup(NemaAxleFlatDepth, model);
|
||||||
|
axleFlatLengthFront = lookup(NemaAxleFlatLengthFront, model);
|
||||||
|
axleFlatLengthBack = lookup(NemaAxleFlatLengthBack, model);
|
||||||
|
|
||||||
|
color(stepperBlack){
|
||||||
|
translate(pos) rotate(orientation) {
|
||||||
|
translate([-mid, -mid, 0])
|
||||||
|
difference() {
|
||||||
|
cube(size=[side, side, length + extrSize]);
|
||||||
|
|
||||||
|
// Corner cutouts
|
||||||
|
if (lip > 0) {
|
||||||
|
translate([0, 0, lip]) cylinder(h=length, r=cutR);
|
||||||
|
translate([side, 0, lip]) cylinder(h=length, r=cutR);
|
||||||
|
translate([0, side, lip]) cylinder(h=length, r=cutR);
|
||||||
|
translate([side, side, lip]) cylinder(h=length, r=cutR);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rounded edges
|
||||||
|
if (roundR > 0) {
|
||||||
|
translate([mid+mid, mid+mid, length/2])
|
||||||
|
rotate([0,0,45])
|
||||||
|
cube(size=[roundR, roundR*2, 4+length + extrSize+2], center=true);
|
||||||
|
translate([mid-(mid), mid+(mid), length/2])
|
||||||
|
rotate([0,0,45])
|
||||||
|
cube(size=[roundR*2, roundR, 4+length + extrSize+2], center=true);
|
||||||
|
translate([mid+mid, mid-mid, length/2])
|
||||||
|
rotate([0,0,45])
|
||||||
|
cube(size=[roundR*2, roundR, 4+length + extrSize+2], center=true);
|
||||||
|
translate([mid-mid, mid-mid, length/2])
|
||||||
|
rotate([0,0,45])
|
||||||
|
cube(size=[roundR, roundR*2, 4+length + extrSize+2], center=true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bolt holes
|
||||||
|
color(stepperAluminum, $fs=holeRadius/8) {
|
||||||
|
translate([mid+holeDist,mid+holeDist,-1*mm]) cylinder(h=holeDepth+1*mm, r=holeRadius);
|
||||||
|
translate([mid-holeDist,mid+holeDist,-1*mm]) cylinder(h=holeDepth+1*mm, r=holeRadius);
|
||||||
|
translate([mid+holeDist,mid-holeDist,-1*mm]) cylinder(h=holeDepth+1*mm, r=holeRadius);
|
||||||
|
translate([mid-holeDist,mid-holeDist,-1*mm]) cylinder(h=holeDepth+1*mm, r=holeRadius);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grinded flat
|
||||||
|
color(stepperAluminum) {
|
||||||
|
difference() {
|
||||||
|
translate([-1*mm, -1*mm, -extrSize])
|
||||||
|
cube(size=[side+2*mm, side+2*mm, extrSize + 1*mm]);
|
||||||
|
translate([side/2, side/2, -extrSize - 1*mm])
|
||||||
|
cylinder(h=4*mm, r=extrRad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Axle
|
||||||
|
translate([0, 0, extrSize-axleLengthFront]) color(stepperAluminum)
|
||||||
|
difference() {
|
||||||
|
|
||||||
|
cylinder(h=axleLengthFront + 1*mm , r=axleRadius, $fs=axleRadius/10);
|
||||||
|
|
||||||
|
// Flat
|
||||||
|
if (axleFlatDepth > 0)
|
||||||
|
translate([axleRadius - axleFlatDepth,-5*mm,-extrSize*mm -(axleLengthFront-axleFlatLengthFront)] ) cube(size=[5*mm, 10*mm, axleLengthFront]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dualAxis) {
|
||||||
|
translate([0, 0, length+extrSize]) color(stepperAluminum)
|
||||||
|
difference() {
|
||||||
|
|
||||||
|
cylinder(h=axleLengthBack + 0*mm, r=axleRadius, $fs=axleRadius/10);
|
||||||
|
|
||||||
|
// Flat
|
||||||
|
if (axleFlatDepth > 0)
|
||||||
|
translate([axleRadius - axleFlatDepth,-5*mm,(axleLengthBack-axleFlatLengthBack)]) cube(size=[5*mm, 10*mm, axleLengthBack]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module roundedBox(size, edgeRadius) {
|
||||||
|
cube(size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
import py
|
||||||
|
|
||||||
|
from openscad_utils import *
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
if "modpath" in metafunc.funcargnames:
|
||||||
|
if "modname" in metafunc.funcargnames:
|
||||||
|
for fpath, modnames in collect_test_modules().items():
|
||||||
|
for modname in modnames:
|
||||||
|
metafunc.addcall(funcargs=dict(modname=modname, modpath=fpath))
|
||||||
|
else:
|
||||||
|
dirpath = py.path.local("./")
|
||||||
|
for fpath in dirpath.visit('*.scad'):
|
||||||
|
metafunc.addcall(funcargs=dict(modpath=fpath))
|
||||||
|
|
||||||
|
temppath = py.test.ensuretemp('MCAD')
|
||||||
|
|
||||||
|
def test_compile(modname, modpath):
|
||||||
|
tempname = "test_" + modpath.basename + modname
|
||||||
|
fpath = temppath.join(tempname)
|
||||||
|
stlpath = temppath.join(tempname + ".stl")
|
||||||
|
f = fpath.open('w')
|
||||||
|
f.write("""
|
||||||
|
//generated testfile
|
||||||
|
include <%s>
|
||||||
|
|
||||||
|
%s()
|
||||||
|
""" % (modpath, modname))
|
||||||
|
f.flush
|
||||||
|
output = call_openscad(path=fpath, stlpath=stlpath)
|
||||||
|
print output
|
||||||
|
assert output[0] is 0
|
||||||
|
assert "warning" or "error" not in output[2].strip().lowercase()
|
||||||
|
assert len(stlpath.readlines()) > 2
|
||||||
|
|
||||||
|
def test_compile_default(modpath):
|
||||||
|
tempname = "test_" + modpath.basename
|
||||||
|
stlpath = temppath.join(tempname + ".stl")
|
||||||
|
output = call_openscad(path=modpath, stlpath=stlpath)
|
||||||
|
print output
|
||||||
|
assert output[0] is 0
|
||||||
|
assert "warning" or "error" not in output[2].strip().lowercase()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Basic units.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
mm = 1;
|
||||||
|
cm = 10 * mm;
|
||||||
|
dm = 100 * mm;
|
||||||
|
m = 1000 * mm;
|
||||||
|
inch = 25.4 * mm;
|
||||||
|
|
||||||
|
M3 = 3*mm;
|
||||||
|
M4 = 4*mm;
|
||||||
|
M5 = 5*mm;
|
||||||
|
M6 = 6*mm;
|
||||||
|
M8 = 8*mm;
|
||||||
|
|
||||||
|
|
||||||
|
// When a small distance is needed to overlap shapes for boolean cutting, etc.
|
||||||
|
epsilon = 0.01*mm;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Utility functions.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
<units.scad>
|
||||||
|
|
||||||
|
function distance(a, b) = sqrt( (a[0] - b[0])*(a[0] - b[0]) +
|
||||||
|
(a[1] - b[1])*(a[1] - b[1]) +
|
||||||
|
(a[2] - b[2])*(a[2] - b[2]) );
|
||||||
|
|
||||||
|
function length2(a) = sqrt( a[0]*a[0] + a[1]*a[1] );
|
||||||
|
|
||||||
|
function normalized(a) = a / (max(distance([0,0,0], a), 0.00001));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function angleOfNormalizedVector(n) = [0, -atan2(n[2], length2([n[0], n[1]])), atan2(n[1], n[0]) ];
|
||||||
|
|
||||||
|
function angle(v) = angleOfNormalizedVector(normalized(v));
|
||||||
|
|
||||||
|
function angleBetweenTwoPoints(a, b) = angle(normalized(b-a));
|
||||||
|
|
||||||
|
|
||||||
|
CENTER = 0;
|
||||||
|
LEFT = -0.5;
|
||||||
|
RIGHT = 0.5;
|
||||||
|
TOP = 0.5;
|
||||||
|
BOTTOM = -0.5;
|
||||||
|
|
||||||
|
FlatCap =0;
|
||||||
|
ExtendedCap =0.5;
|
||||||
|
CutCap =-0.5;
|
||||||
|
|
||||||
|
|
||||||
|
module fromTo(from=[0,0,0], to=[1*m,0,0], size=[1*cm, 1*cm], align=[CENTER, CENTER], material=[0.5, 0.5, 0.5], name="", endExtras=[0,0], endCaps=[FlatCap, FlatCap], rotation=[0,0,0], printString=true) {
|
||||||
|
|
||||||
|
angle = angleBetweenTwoPoints(from, to);
|
||||||
|
length = distance(from, to) + endCaps[0]*size[0] + endCaps[1]*size[0] + endExtras[0] + endExtras[1];
|
||||||
|
|
||||||
|
if (length > 0) {
|
||||||
|
if (printString) echo(str(" " ,name, " ", size[0], "mm x ", size[1], "mm, length ",length,"mm"));
|
||||||
|
|
||||||
|
color(material)
|
||||||
|
translate(from)
|
||||||
|
rotate(angle)
|
||||||
|
translate( [ -endCaps[0]*size[0] - endExtras[0], size[0]*(-0.5-align[0]), size[1]*(-0.5+align[1]) ] )
|
||||||
|
rotate(rotation)
|
||||||
|
scale([length, size[0], size[1]]) child();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module part(name) {
|
||||||
|
echo("");
|
||||||
|
echo(str(name, ":"));
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue