little fix to have a minifold STL and adding MCAD library
parent
58492db522
commit
7f4d8d5eae
@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* OpenSCAD 2D Shapes Library (www.openscad.org)
|
||||||
|
* Copyright (C) 2012 Peter Uithoven
|
||||||
|
*
|
||||||
|
* License: LGPL 2.1 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 2D Shapes
|
||||||
|
//ngon(sides, radius, center=false);
|
||||||
|
//complexRoundSquare(size,rads1=[0,0], rads2=[0,0], rads3=[0,0], rads4=[0,0], center=true)
|
||||||
|
//roundedSquare(pos=[10,10],r=2)
|
||||||
|
//ellipsePart(width,height,numQuarters)
|
||||||
|
//donutSlice(innerSize,outerSize, start_angle, end_angle)
|
||||||
|
//pieSlice(size, start_angle, end_angle) //size in radius(es)
|
||||||
|
//ellipse(width, height) {
|
||||||
|
|
||||||
|
// Examples
|
||||||
|
/*use <layouts.scad>;
|
||||||
|
grid(105,105,true,4)
|
||||||
|
{
|
||||||
|
// ellipse
|
||||||
|
ellipse(50,75);
|
||||||
|
|
||||||
|
// part of ellipse (a number of quarters)
|
||||||
|
ellipsePart(50,75,3);
|
||||||
|
ellipsePart(50,75,2);
|
||||||
|
ellipsePart(50,75,1);
|
||||||
|
|
||||||
|
// complexRoundSquare examples
|
||||||
|
complexRoundSquare([75,100],[20,10],[20,10],[20,10],[20,10]);
|
||||||
|
complexRoundSquare([75,100],[0,0],[0,0],[30,50],[20,10]);
|
||||||
|
complexRoundSquare([50,50],[10,20],[10,20],[10,20],[10,20],false);
|
||||||
|
complexRoundSquare([100,100]);
|
||||||
|
complexRoundSquare([100,100],rads1=[20,20],rads3=[20,20]);
|
||||||
|
|
||||||
|
// pie slice
|
||||||
|
pieSlice(50,0,10);
|
||||||
|
pieSlice(50,45,190);
|
||||||
|
pieSlice([50,20],180,270);
|
||||||
|
|
||||||
|
// donut slice
|
||||||
|
donutSlice(20,50,0,350);
|
||||||
|
donutSlice(30,50,190,270);
|
||||||
|
donutSlice([40,22],[50,30],180,270);
|
||||||
|
donutSlice([50,20],50,180,270);
|
||||||
|
donutSlice([20,30],[50,40],0,270);
|
||||||
|
}*/
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
// size, top left radius, top right radius, bottom right radius, bottom left radius, center
|
||||||
|
module complexRoundSquare(size,rads1=[0,0], rads2=[0,0], rads3=[0,0], rads4=[0,0], center=true)
|
||||||
|
{
|
||||||
|
width = size[0];
|
||||||
|
height = size[1];
|
||||||
|
//%square(size=[width, height],center=true);
|
||||||
|
x1 = 0-width/2+rads1[0];
|
||||||
|
y1 = 0-height/2+rads1[1];
|
||||||
|
x2 = width/2-rads2[0];
|
||||||
|
y2 = 0-height/2+rads2[1];
|
||||||
|
x3 = width/2-rads3[0];
|
||||||
|
y3 = height/2-rads3[1];
|
||||||
|
x4 = 0-width/2+rads4[0];
|
||||||
|
y4 = height/2-rads4[1];
|
||||||
|
|
||||||
|
scs = 0.1; //straight corner size
|
||||||
|
|
||||||
|
x = (center)? 0: width/2;
|
||||||
|
y = (center)? 0: height/2;
|
||||||
|
|
||||||
|
translate([x,y,0])
|
||||||
|
{
|
||||||
|
hull() {
|
||||||
|
// top left
|
||||||
|
if(rads1[0] > 0 && rads1[1] > 0)
|
||||||
|
translate([x1,y1]) mirror([1,0]) ellipsePart(rads1[0]*2,rads1[1]*2,1);
|
||||||
|
else
|
||||||
|
translate([x1,y1]) square(size=[scs, scs]);
|
||||||
|
|
||||||
|
// top right
|
||||||
|
if(rads2[0] > 0 && rads2[1] > 0)
|
||||||
|
translate([x2,y2]) ellipsePart(rads2[0]*2,rads2[1]*2,1);
|
||||||
|
else
|
||||||
|
translate([width/2-scs,0-height/2]) square(size=[scs, scs]);
|
||||||
|
|
||||||
|
// bottom right
|
||||||
|
if(rads3[0] > 0 && rads3[1] > 0)
|
||||||
|
translate([x3,y3]) mirror([0,1]) ellipsePart(rads3[0]*2,rads3[1]*2,1);
|
||||||
|
else
|
||||||
|
translate([width/2-scs,height/2-scs]) square(size=[scs, scs]);
|
||||||
|
|
||||||
|
// bottom left
|
||||||
|
if(rads4[0] > 0 && rads4[1] > 0)
|
||||||
|
translate([x4,y4]) rotate([0,0,-180]) ellipsePart(rads4[0]*2,rads4[1]*2,1);
|
||||||
|
else
|
||||||
|
#translate([x4,height/2-scs]) square(size=[scs, scs]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module roundedSquare(pos=[10,10],r=2) {
|
||||||
|
minkowski() {
|
||||||
|
square([pos[0]-r*2,pos[1]-r*2],center=true);
|
||||||
|
circle(r=r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// round shapes
|
||||||
|
// The orientation might change with the implementation of circle...
|
||||||
|
module ngon(sides, radius, center=false){
|
||||||
|
rotate([0, 0, 360/sides/2]) circle(r=radius, $fn=sides, center=center);
|
||||||
|
}
|
||||||
|
module ellipsePart(width,height,numQuarters)
|
||||||
|
{
|
||||||
|
o = 1; //slight overlap to fix a bug
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
ellipse(width,height);
|
||||||
|
if(numQuarters <= 3)
|
||||||
|
translate([0-width/2-o,0-height/2-o,0]) square([width/2+o,height/2+o]);
|
||||||
|
if(numQuarters <= 2)
|
||||||
|
translate([0-width/2-o,-o,0]) square([width/2+o,height/2+o*2]);
|
||||||
|
if(numQuarters < 2)
|
||||||
|
translate([-o,0,0]) square([width/2+o*2,height/2+o]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module donutSlice(innerSize,outerSize, start_angle, end_angle)
|
||||||
|
{
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
pieSlice(outerSize, start_angle, end_angle);
|
||||||
|
if(len(innerSize) > 1) ellipse(innerSize[0]*2,innerSize[1]*2);
|
||||||
|
else circle(innerSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module pieSlice(size, start_angle, end_angle) //size in radius(es)
|
||||||
|
{
|
||||||
|
rx = ((len(size) > 1)? size[0] : size);
|
||||||
|
ry = ((len(size) > 1)? size[1] : size);
|
||||||
|
trx = rx* sqrt(2) + 1;
|
||||||
|
try = ry* sqrt(2) + 1;
|
||||||
|
a0 = (4 * start_angle + 0 * end_angle) / 4;
|
||||||
|
a1 = (3 * start_angle + 1 * end_angle) / 4;
|
||||||
|
a2 = (2 * start_angle + 2 * end_angle) / 4;
|
||||||
|
a3 = (1 * start_angle + 3 * end_angle) / 4;
|
||||||
|
a4 = (0 * start_angle + 4 * end_angle) / 4;
|
||||||
|
if(end_angle > start_angle)
|
||||||
|
intersection() {
|
||||||
|
if(len(size) > 1)
|
||||||
|
ellipse(rx*2,ry*2);
|
||||||
|
else
|
||||||
|
circle(rx);
|
||||||
|
polygon([
|
||||||
|
[0,0],
|
||||||
|
[trx * cos(a0), try * sin(a0)],
|
||||||
|
[trx * cos(a1), try * sin(a1)],
|
||||||
|
[trx * cos(a2), try * sin(a2)],
|
||||||
|
[trx * cos(a3), try * sin(a3)],
|
||||||
|
[trx * cos(a4), try * sin(a4)],
|
||||||
|
[0,0]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module ellipse(width, height) {
|
||||||
|
scale([1, height/width, 1]) circle(r=width/2);
|
||||||
|
}
|
@ -0,0 +1,327 @@
|
|||||||
|
// Enhancement of OpenSCAD Primitives Solid with Trinagles
|
||||||
|
// Copyright (C) 2011 Rene BAUMANN, Switzerland
|
||||||
|
//
|
||||||
|
// 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, see <http://www.gnu.org/licenses/>
|
||||||
|
// or write to the Free Software Foundation, Inc.,
|
||||||
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
// ================================================================
|
||||||
|
//
|
||||||
|
// File providing functions and modules to draw 3D - triangles
|
||||||
|
// created in the X-Y plane with hight h, using various triangle
|
||||||
|
// specification methods.
|
||||||
|
// Standard traingle geometrical definition is used. Vertices are named A,B,C,
|
||||||
|
// side a is opposite vertex A a.s.o. the angle at vertex A is named alpha,
|
||||||
|
// B(beta), C(gamma).
|
||||||
|
//
|
||||||
|
// This SW is a contribution to the Free Software Community doing a marvelous
|
||||||
|
// job of giving anyone access to knowledge and tools to educate himselfe.
|
||||||
|
//
|
||||||
|
// Author: Rene Baumann
|
||||||
|
// Date: 11.09.2011
|
||||||
|
// Edition: 0.3 11.09.2011 For review by Marius
|
||||||
|
// Edition: 0.4 11.11.2011 Ref to GPL2.1 added
|
||||||
|
//
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_sides2coord
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Enter triangle sides a,b,c and to get the A,B,C - corner
|
||||||
|
// co-ordinates. The trinagle's c-side lies on the x-axis
|
||||||
|
// and A-corner in the co-ordinates center [0,0,0]. Geometry rules
|
||||||
|
// required that a + b is greater then c. The traingle's vertices are
|
||||||
|
// computed such that it is located in the X-Y plane, side c is on the
|
||||||
|
// positive x-axis.
|
||||||
|
// PARAMETER:
|
||||||
|
// a : real length of side a
|
||||||
|
// b : real length of side b
|
||||||
|
// c : real length of side c
|
||||||
|
// RETURNS:
|
||||||
|
// vertices : [Acord,Bcord,Ccord] Array of vertices coordinates
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// vertices[0] : Acord vertex A cordinates the like [x,y,z]
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_sides2coord (a,b,c) = [
|
||||||
|
[0,0,0],
|
||||||
|
[c,0,0],
|
||||||
|
[(pow(c,2)+pow(a,2)-pow(b,2))/(2*c),sqrt ( pow(a,2) -
|
||||||
|
pow((pow(c,2)+pow(a,2)-pow(b,2))/(2*c),2)),0]];
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_centerOfGravityCoord
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Enter triangle A,B,C - corner coordinates to get the
|
||||||
|
// triangles Center of Gravity coordinates. It is assumed
|
||||||
|
// the triangle is parallel to the X-Y plane. The function
|
||||||
|
// returns always zero for the z-coordinate
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
// RETURNS:
|
||||||
|
// CG : [x,y,0] Center of gravity coordinate in X-Y-plane
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// cg = 3dtri_centerOfGravityCoord(vertices[0],vertices[1],vertices[2]);
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_centerOfGravityCoord (Acord,Bcord,Ccord) = [
|
||||||
|
(Acord[0]+Bcord[0]+Ccord[0])/3,(Acord[1]+Bcord[1]+Ccord[1])/3,0];
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_centerOfcircumcircle
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Enter triangle A,B,C - corner coordinates to get the
|
||||||
|
// circum circle coordinates. It is assumed
|
||||||
|
// the triangle is parallel to the X-Y plane. The function
|
||||||
|
// returns always zero for the z-coordinate
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
// RETURNS:
|
||||||
|
// cc : [x,y,0] Circumcircle center
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// cc = 3dtri_centerOfcircumcircle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_centerOfcircumcircle (Acord,Bcord,Ccord) =
|
||||||
|
[0.5*Bcord[0],
|
||||||
|
0.5*((pow(Ccord[1],2)+pow(Ccord[0],2)-Bcord[0]*Ccord[0])/Ccord[1]),
|
||||||
|
0];
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_radiusOfcircumcircle
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Provides the triangle's radius from circumcircle to the vertices.
|
||||||
|
// It is assumed the triangle is parallel to the X-Y plane. The function
|
||||||
|
// returns always zero for the z-coordinate
|
||||||
|
// PARAMETER:
|
||||||
|
// Vcord : [x,y,z] Coordinates of a vertex A or B,C
|
||||||
|
// CCcord : [x,y,z] Coordinates of circumcircle
|
||||||
|
// r : Radius at vertices if round corner triangle used,
|
||||||
|
// else enter "0"
|
||||||
|
// RETURNS:
|
||||||
|
// cr : Circumcircle radius
|
||||||
|
//
|
||||||
|
// COMMENT: Calculate circumcircle radius of trinagle with round vertices having
|
||||||
|
// radius R = 2
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// cc = 3dtri_centerOfcircumcircle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// cr = 3dtri_radiusOfcircumcircle (vertices[0],cc,2);
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_radiusOfcircumcircle (Vcord,CCcord,R) =
|
||||||
|
sqrt(pow(CCcord[0]-Vcord[0],2)+pow(CCcord[1]-Vcord[1],2))+ R;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_radiusOfIn_circle
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Enter triangle A,B,C - corner coordinates to get the
|
||||||
|
// in-circle radius. It is assumed the triangle is parallel to the
|
||||||
|
// X-Y plane. The function always returns zero for the z-coordinate.
|
||||||
|
// Formula used for inner circle radius: r = 2A /(a+b+c)
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
//
|
||||||
|
// RETURNS:
|
||||||
|
// ir : real radius of in-circle
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// ir = 3dtri_radiusOfIn_circle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_radiusOfIn_circle (Acord,Bcord,Ccord) =
|
||||||
|
Bcord[0]*Ccord[1]/(Bcord[0]+sqrt(pow(Ccord[0]-Bcord[0],2)+pow(Ccord[1],2))+
|
||||||
|
sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ===========================================
|
||||||
|
//
|
||||||
|
// FUNCTION: 3dtri_centerOfIn_circle
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Enter triangle A,B,C - corner coordinates to get the
|
||||||
|
// in-circle coordinates. It is assumed
|
||||||
|
// the triangle is parallel to the X-Y plane. The function
|
||||||
|
// returns always zero for the z-coordinate
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
// r : real radius of in-circle
|
||||||
|
// RETURNS:
|
||||||
|
// ic : [x,y,0] In-circle center co-ordinates
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// vertices = 3dtri_sides2coord (3,4,5);
|
||||||
|
// ir = 3dtri_radiusOfIn_circle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// ic = 3dtri_centerOfIn_circle (vertices[0],vertices[1],vertices[2],ir);
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
function 3dtri_centerOfIn_circle (Acord,Bcord,Ccord,r) =
|
||||||
|
[(Bcord[0]+sqrt(pow(Ccord[0]-Bcord[0],2)+pow(Ccord[1],2))+
|
||||||
|
sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)))/2-sqrt(pow(Ccord[0]-Bcord[0],2)+pow(Ccord[1],2)),r,0];
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ============================================
|
||||||
|
//
|
||||||
|
// MODULE: 3dtri_draw
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Draw a standard solid triangle with A,B,C - vertices specified by its
|
||||||
|
// co-ordinates and height "h", as given by the input parameters.
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
// h : real Hight of the triangle
|
||||||
|
// RETURNS:
|
||||||
|
// none
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// You might use the result from function 3dtri_sides2coord
|
||||||
|
// to call module 3dtri_draw ( vertices[0],vertices[1],vertices[2], h)
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
module 3dtri_draw ( Acord, Bcord, Ccord, h) {
|
||||||
|
polyhedron (points=[Acord,Bcord,Ccord,
|
||||||
|
Acord+[0,0,h],Bcord+[0,0,h],Ccord+[0,0,h]],
|
||||||
|
triangles=[ [0,1,2],[0,2,3],[3,2,5],
|
||||||
|
[3,5,4],[1,5,2],[4,5,1],
|
||||||
|
[4,1,0],[0,3,4]]);
|
||||||
|
|
||||||
|
};
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ==============================================
|
||||||
|
//
|
||||||
|
// MODULE: 3dtri_rnd_draw
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Draw a round corner triangle with A,B,C - vertices specified by its
|
||||||
|
// co-ordinates, height h and round vertices having radius "r".
|
||||||
|
// As specified by the input parameters.
|
||||||
|
// Please note, the tringles side lenght gets extended by "2 * r",
|
||||||
|
// and the vertices coordinates define the centers of the
|
||||||
|
// circles with radius "r".
|
||||||
|
// PARAMETER:
|
||||||
|
// Acord : [x,y,z] Coordinates of vertex A
|
||||||
|
// Bcord : [x,y,z] Coordinates of vertex B
|
||||||
|
// Ccord : [x,y,z] Coordinates of vertex C
|
||||||
|
// h : real Hight of the triangle
|
||||||
|
// r : real Radius from vertices coordinates
|
||||||
|
// RETURNS:
|
||||||
|
// none
|
||||||
|
//
|
||||||
|
// COMMENT:
|
||||||
|
// You might use the result from function 3dtri_sides2coord
|
||||||
|
// to call module 3dtri_rnd_draw ( vertices[0],vertices[1],vertices[2], h, r)
|
||||||
|
// -------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
module 3dtri_rnd_draw ( Acord, Bcord, Ccord, h, r) {
|
||||||
|
Avect=Ccord-Bcord; // vector pointing from vertex B to vertex C
|
||||||
|
p0=Acord + [0,-r,0];
|
||||||
|
p1=Bcord + [0,-r,0];
|
||||||
|
p2=Bcord + [r*Avect[1]/sqrt(pow(Avect[0],2)+pow(Avect[1],2)),
|
||||||
|
-r*Avect[0]/sqrt(pow(Avect[0],2)+pow(Avect[1],2)) ,0];
|
||||||
|
p3=Ccord + [r*Avect[1]/sqrt(pow(Avect[0],2)+pow(Avect[1],2)),
|
||||||
|
-r*Avect[0]/sqrt(pow(Avect[0],2)+pow(Avect[1],2)) ,0];
|
||||||
|
p4=Ccord +[- r*Ccord[1]/sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)),
|
||||||
|
r*Ccord[0]/sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)) ,0];
|
||||||
|
p5=Acord + [- r*Ccord[1]/sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)),
|
||||||
|
r*Ccord[0]/sqrt(pow(Ccord[0],2)+pow(Ccord[1],2)) ,0];
|
||||||
|
bottom_triangles = [[0,1,2],[0,2,3],[0,3,4],[0,4,5]];
|
||||||
|
c_side_triangles = [[7,1,0],[0,6,7]];
|
||||||
|
a_side_triangles = [[2,8,3],[8,9,3]];
|
||||||
|
b_side_triangles = [[4,10,5],[10,11,5]];
|
||||||
|
A_edge_triangles = [[0,5,11],[0,11,6]];
|
||||||
|
B_edge_triangles = [[1,7,2],[2,7,8]];
|
||||||
|
C_edge_triangles = [[3,9,4],[9,10,4]];
|
||||||
|
top_triangles = [[11,7,6],[11,8,7],[11,10,8],[8,10,9]];
|
||||||
|
union () {
|
||||||
|
polyhedron (points=[p0,p1,p2,p3,p4,p5,
|
||||||
|
p0+[0,0,h],p1+[0,0,h],p2+[0,0,h],p3+[0,0,h],p4+[0,0,h],p5+[0,0,h]],
|
||||||
|
triangles=[ bottom_triangles[0],bottom_triangles[1],bottom_triangles[2],bottom_triangles[3],
|
||||||
|
A_edge_triangles[0],A_edge_triangles[1],
|
||||||
|
c_side_triangles[0],c_side_triangles[1],
|
||||||
|
B_edge_triangles[0],B_edge_triangles[1],
|
||||||
|
a_side_triangles[0],a_side_triangles[1],
|
||||||
|
C_edge_triangles[0],C_edge_triangles[1],
|
||||||
|
b_side_triangles[0],b_side_triangles[1],
|
||||||
|
top_triangles[0],top_triangles[1],top_triangles[2],top_triangles[3]]);
|
||||||
|
translate(Acord) cylinder(r1=r,r2=r,h=h,center=false);
|
||||||
|
translate(Bcord) cylinder(r1=r,r2=r,h=h,center=false);
|
||||||
|
translate(Ccord) cylinder(r1=r,r2=r,h=h,center=false);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ==============================================
|
||||||
|
//
|
||||||
|
// Demo Application - copy into new file and uncomment or uncomment here but
|
||||||
|
// without uncommenting the use <...> statement, then press F6 - Key
|
||||||
|
//
|
||||||
|
// use <MCAD/3d_triangle.scad>;
|
||||||
|
//$fn=50;
|
||||||
|
// h =4;
|
||||||
|
// r=2;
|
||||||
|
// echo ("Draws a right angle triangle with its circumcircle and in-circle");
|
||||||
|
// echo ("The calculated co-ordinates and radius are show in this console window");
|
||||||
|
// echo ("Geometry rules for a right angle triangle say, that the circumcircle is the");
|
||||||
|
// echo ("Thales Circle which center must be in the middle of the triangle's c - side");
|
||||||
|
// echo ("===========================================");
|
||||||
|
// vertices = 3dtri_sides2coord (30,40,50);
|
||||||
|
// echo("A = ",vertices[0]," B = ",vertices[1]," C = ",vertices[2]);
|
||||||
|
// cg = 3dtri_centerOfGravityCoord (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// echo (" Center of gravity = ",cg);
|
||||||
|
// cc = 3dtri_centerOfcircumcircle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// echo (" Center of circumcircle = ",cc);
|
||||||
|
// cr = 3dtri_radiusOfcircumcircle (vertices[0],cc,r);
|
||||||
|
// echo(" Radius of circumcircle ",cr);
|
||||||
|
// ir = 3dtri_radiusOfIn_circle (vertices[0],vertices[1],vertices[2]);
|
||||||
|
// echo (" Radius of in-circle = ",ir);
|
||||||
|
// ic = 3dtri_centerOfIn_circle (vertices[0],vertices[1],vertices[2],ir);
|
||||||
|
// echo (" Center of in-circle = ",ic);
|
||||||
|
// translate(cc+[0,0,5*h/2]) difference () {
|
||||||
|
// cylinder (h=5*h,r1=cr+4,r2=cr+4,center=true);
|
||||||
|
// cylinder (h=6*h,r1=cr,r2=cr,center=true);}
|
||||||
|
// difference () {
|
||||||
|
// union () {
|
||||||
|
// difference () {
|
||||||
|
// 3dtri_rnd_draw (vertices[0], vertices[1], vertices[2],5*h,r);
|
||||||
|
// scale([0.8,0.8,1]) translate([6,2,4*h]) 3dtri_rnd_draw (vertices[0], vertices[1], vertices[2],5*h,r);
|
||||||
|
// }
|
||||||
|
// translate (ic+[0,0,5*h]) cylinder(h=10*h,r1=ir+r,r2=ir+r,center=true);
|
||||||
|
// }
|
||||||
|
// translate (ic+[0,0,5*h]) cylinder(h=12*h,r1=0.5*ir,r2=0.5*ir,center=true);
|
||||||
|
// }
|
||||||
|
|
@ -0,0 +1,99 @@
|
|||||||
|
OpenSCAD MCAD Library [![](http://stillmaintained.com/elmom/MCAD.png)](http://stillmaintained.com/elmom/MCAD)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
This library contains components commonly used in designing and moching up
|
||||||
|
mechanical designs. It is currently unfinished and you can expect some 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.
|
||||||
|
|
||||||
|
## Usage ##
|
||||||
|
|
||||||
|
You can import these files in your scripts with `use <MCAD/filename.scad>`,
|
||||||
|
where 'filename' is one of the files listed below like 'motors' or
|
||||||
|
'servos'. Some files include useful constants which will be available
|
||||||
|
with `include <MCAD/filename.scad>`, which should be safe to use on all
|
||||||
|
included files (ie. no top level code should create geometry). (There is
|
||||||
|
a bug/feature that prevents including constants from files that
|
||||||
|
"include" other files - see the openscad mailing list archives for more
|
||||||
|
details. Since the maintainers aren't very responsive, may have to work
|
||||||
|
around this somehow)
|
||||||
|
|
||||||
|
If you host your project in git, you can do `git submodule add URL PATH` in your
|
||||||
|
repo to import this library as a git submodule for easy usage. Then you need to do
|
||||||
|
a `git submodule update --init` after cloning. When you want to update the submodule,
|
||||||
|
do `cd PATH; git checkout master; git pull`. See `git help submodule` for more info.
|
||||||
|
"./get_submodules.py" is shortcut that initializes and updates submodules.
|
||||||
|
|
||||||
|
Currently Provided Tools:
|
||||||
|
|
||||||
|
* regular_shapes.scad
|
||||||
|
- regular polygons, ie. 2D
|
||||||
|
- regular polyhedrons, ie. 3D
|
||||||
|
|
||||||
|
* 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 and beta quality):
|
||||||
|
|
||||||
|
* nuts_and_bolts.scad: for creating metric and imperial bolt/nut holes
|
||||||
|
* bearing.scad: standard/custom bearings
|
||||||
|
* screw.scad: screws and augers
|
||||||
|
* materials.scad: color definitions for different materials
|
||||||
|
* stepper.scad: NEMA standard stepper outlines
|
||||||
|
* servos.scad: servo outlines
|
||||||
|
* boxes.scad: box with rounded corners
|
||||||
|
* triangles.scad: simple triangles
|
||||||
|
* 3d_triangle.scad: more advanced triangles
|
||||||
|
|
||||||
|
Very generally useful functions and constants:
|
||||||
|
|
||||||
|
* math.scad: general math functions
|
||||||
|
* constants.scad: mathematical constants
|
||||||
|
* curves.scad: mathematical functions defining curves
|
||||||
|
* units.scad: easy metric units
|
||||||
|
* utilities.scad: geometric funtions and misc. useful stuff
|
||||||
|
* teardrop.scad (http://www.thingiverse.com/thing:3457): parametric teardrop module
|
||||||
|
* shapes.scad: DEPRECATED simple shapes by Catarina Mota
|
||||||
|
* polyholes.scad: holes that should come out well when printed
|
||||||
|
|
||||||
|
External utils that generate and and process openscad code:
|
||||||
|
|
||||||
|
* openscad_testing.py: testing code, see below
|
||||||
|
* openscad_utils.py: code for scraping function names etc.
|
||||||
|
* SolidPython: An external Python library for solid cad
|
||||||
|
|
||||||
|
## Development ##
|
||||||
|
|
||||||
|
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. If for some reason you
|
||||||
|
want collaborator access, just ask.
|
||||||
|
|
||||||
|
Github is fun (and easy), but I can include code submissions and other
|
||||||
|
improvements directly, and have already included code from various sources
|
||||||
|
(thingiverse is great :)
|
||||||
|
|
||||||
|
### Code style ###
|
||||||
|
I'd prefer to have all included code nicely indented, at least at the block
|
||||||
|
level, and no extraneous whitespace. I'm used to indent with four spaces as
|
||||||
|
opposed to tabs or other mixes of whitespace, but at least try to choose a style
|
||||||
|
and stick to it.
|
||||||
|
|
||||||
|
### Testing ###
|
||||||
|
I've started a minimal testing infrastucture for OpenSCAD code. It's written in
|
||||||
|
python and uses py.test (might be compatible with Nose also). Just type `py.test`
|
||||||
|
inside the lib dir in a terminal and you should see a part of the tests passing
|
||||||
|
and tracebacks for failing tests. It's very simplistic still, but it should test
|
||||||
|
that no syntax errors occur at least.
|
||||||
|
|
||||||
|
The code is included in openscad_testing.py, and can be imported to be
|
||||||
|
used in other codebases.
|
@ -0,0 +1,21 @@
|
|||||||
|
Code that could be integrated:
|
||||||
|
* http://github.com/l0b0/qr2scad
|
||||||
|
* http://github.com/l0b0/img2scad
|
||||||
|
* http://github.com/l0b0/OpenSCAD-Minimizer
|
||||||
|
* http://www.thingiverse.com/thing:4656
|
||||||
|
* http://www.thingiverse.com/thing:4758
|
||||||
|
* http://www.thingiverse.com/thing:6021
|
||||||
|
* Color library: http://www.thingiverse.com/thing:6717
|
||||||
|
* http://www.thingiverse.com/thing:6465
|
||||||
|
|
||||||
|
Integrate these better:
|
||||||
|
* bitmap
|
||||||
|
|
||||||
|
Testing:
|
||||||
|
* add tests for openscad functions
|
||||||
|
* motors.scad
|
||||||
|
* tests for 2D stuff
|
||||||
|
|
||||||
|
Code style:
|
||||||
|
* motors.scad
|
||||||
|
* nuts_and_bolts.scad
|
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
//test_bearing();
|
||||||
|
//test_bearing_hole();
|
||||||
|
|
||||||
|
module test_bearing(){
|
||||||
|
bearing();
|
||||||
|
bearing(pos=[5*cm, 0,0], angle=[90,0,0]);
|
||||||
|
bearing(pos=[-2.5*cm, 0,0], model=688);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_bearing_hole(){
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Common bearing names
|
||||||
|
SkateBearing = 608;
|
||||||
|
|
||||||
|
// Bearing dimensions
|
||||||
|
// model == XXX ? [inner dia, outer dia, width]:
|
||||||
|
function bearingDimensions(model) =
|
||||||
|
model == 608 ? [8*mm, 22*mm, 7*mm]:
|
||||||
|
model == 623 ? [3*mm, 10*mm, 4*mm]:
|
||||||
|
model == 624 ? [4*mm, 13*mm, 5*mm]:
|
||||||
|
model == 627 ? [7*mm, 22*mm, 7*mm]:
|
||||||
|
model == 688 ? [8*mm, 16*mm, 4*mm]:
|
||||||
|
model == 698 ? [8*mm, 19*mm, 6*mm]:
|
||||||
|
[8*mm, 22*mm, 7*mm]; // this is the default
|
||||||
|
|
||||||
|
|
||||||
|
function bearingWidth(model) = bearingDimensions(model)[BEARING_WIDTH];
|
||||||
|
function bearingInnerDiameter(model) = bearingDimensions(model)[BEARING_INNER_DIAMETER];
|
||||||
|
function bearingOuterDiameter(model) = bearingDimensions(model)[BEARING_OUTER_DIAMETER];
|
||||||
|
|
||||||
|
module bearing(pos=[0,0,0], angle=[0,0,0], model=SkateBearing, outline=false,
|
||||||
|
material=Steel, sideMaterial=Brass) {
|
||||||
|
// Common bearing names
|
||||||
|
model =
|
||||||
|
model == "Skate" ? 608 :
|
||||||
|
model;
|
||||||
|
|
||||||
|
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,17 @@
|
|||||||
|
This is an OpenSCAD module that let's you easily (well kinda) create 3D text. I've emulated the Atari 8-Bit fonts A-Z, a-z, 0-9, and most punctuation. You can create them a letter at a time or pass an array of characters. (OpenSCAD doesn't have any real string manipulation)
|
||||||
|
|
||||||
|
It also has a bitmap module that you can use to define your own fonts. It's pretty simple, you pass it an array of numbers, then tell it how many bits per row and it creates cubes (of configurable width and height) in a grid and combines them into a single shape. The number in the array sets the pixel height modifier. So if you set height to 5 and the array value is 2, then the height of that pixel will be 10mm.
|
||||||
|
|
||||||
|
Be careful when defining your own bitmaps in that you can't have two bits only connected diagonally. Otherwise OpenSCAD will say it's not manifold. For instance you can't have:
|
||||||
|
|
||||||
|
0 0 0
|
||||||
|
0 1 0
|
||||||
|
0 0 1
|
||||||
|
|
||||||
|
But you can have:
|
||||||
|
|
||||||
|
0 0 0
|
||||||
|
0 1 1
|
||||||
|
0 0 1
|
||||||
|
|
||||||
|
For more info see: http://www.thingiverse.com/thing:2054
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
Parametric Alphabet Block
|
||||||
|
Tony Buser <tbuser@gmail.com>
|
||||||
|
http://tonybuser.com
|
||||||
|
http://creativecommons.org/licenses/by/3.0/
|
||||||
|
*/
|
||||||
|
|
||||||
|
use <bitmap.scad>
|
||||||
|
|
||||||
|
// change to any letter
|
||||||
|
letter = "A";
|
||||||
|
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
cube(size = 20);
|
||||||
|
translate(v = [2, 2, 17]) {
|
||||||
|
cube(size = [16, 16, 5]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(v = [10, 10, 15]) {
|
||||||
|
8bit_char(letter, 2, 5);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
Height Map Example
|
||||||
|
Tony Buser <tbuser@gmail.com>
|
||||||
|
http://tonybuser.com
|
||||||
|
http://creativecommons.org/licenses/by/3.0/
|
||||||
|
|
||||||
|
Can also dynamically run this by passing an array on the command line:
|
||||||
|
|
||||||
|
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -m make -D bitmap=[2,2,2,0,1,3,2,2,2] -D row_size=3 -s height_map.stl height_map.scad
|
||||||
|
*/
|
||||||
|
|
||||||
|
use <bitmap.scad>
|
||||||
|
|
||||||
|
block_size = 5;
|
||||||
|
height = 5;
|
||||||
|
|
||||||
|
row_size = 10; // 10x10 pixels
|
||||||
|
bitmap = [
|
||||||
|
1,1,0,0,1,1,0,0,1,1,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,
|
||||||
|
0,1,2,2,1,1,2,2,1,0,
|
||||||
|
0,1,2,1,1,1,1,2,1,0,
|
||||||
|
1,1,1,1,3,3,1,1,1,1,
|
||||||
|
1,1,1,1,3,3,1,1,1,1,
|
||||||
|
0,1,2,1,1,1,1,2,1,0,
|
||||||
|
0,1,2,2,1,1,2,2,1,0,
|
||||||
|
1,1,1,1,1,1,1,1,1,1,
|
||||||
|
1,1,0,0,1,1,0,0,1,1
|
||||||
|
];
|
||||||
|
|
||||||
|
bitmap(bitmap, block_size, height, row_size);
|
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Parametric letters for for a necklace
|
||||||
|
Elmo Mäntynen <elmo.mantynen@iki.fi>
|
||||||
|
LGPL 2.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
use <bitmap.scad>
|
||||||
|
|
||||||
|
// change chars array and char_count
|
||||||
|
// OpenSCAD has no string or length methods :(
|
||||||
|
chars = ["M","a","k","e","r","B","o","t"];
|
||||||
|
char_count = 8;
|
||||||
|
|
||||||
|
// block size 1 will result in 8mm per letter
|
||||||
|
block_size = 2;
|
||||||
|
// height is the Z height of each letter
|
||||||
|
height = 3;
|
||||||
|
|
||||||
|
//Hole for the necklace
|
||||||
|
hole_diameter = 5;
|
||||||
|
|
||||||
|
module 8bit_str(chars, char_count, block_size, height) {
|
||||||
|
echo(str("Total Width: ", block_size * 8 * char_count, "mm"));
|
||||||
|
union() {
|
||||||
|
for (count = [0:char_count-1]) {
|
||||||
|
translate(v = [0, count * block_size * 8, 0]) {
|
||||||
|
8bit_char(chars[count], block_size, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module letter(char, block_size, height, hole_diameter) {
|
||||||
|
union() {
|
||||||
|
translate(v = [0,0, hole_diameter*1.3]) {
|
||||||
|
8bit_char(char, block_size, height);
|
||||||
|
}
|
||||||
|
translate(v = [0,0,(hole_diameter*1.3)/2]) {
|
||||||
|
color([0,0,1,1]) {
|
||||||
|
difference() {
|
||||||
|
cube(size = [block_size * 8, block_size * 8, hole_diameter+2], center = true);
|
||||||
|
rotate([90, 0, 0]) cylinder(h = block_size * 8 + 1, r = hole_diameter/2, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix = [["O", "L", "E", "N", "S"],
|
||||||
|
[ "Y", "OE", "N", "Y", "T"]];
|
||||||
|
|
||||||
|
union() {
|
||||||
|
for (column = [0:1]) {
|
||||||
|
for (row = [0:4]) {
|
||||||
|
translate(v=[column*(block_size*1.1)*8, row*(block_size*1.1)*8, 0])
|
||||||
|
letter(matrix[column][row], block_size, height, hole_diameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Parametric Name Tag
|
||||||
|
Tony Buser <tbuser@gmail.com>
|
||||||
|
http://tonybuser.com
|
||||||
|
http://creativecommons.org/licenses/by/3.0/
|
||||||
|
*/
|
||||||
|
|
||||||
|
use <bitmap.scad>
|
||||||
|
|
||||||
|
// change chars array and char_count
|
||||||
|
// OpenSCAD has no string or length methods :(
|
||||||
|
chars = ["R", "E", "P", "R", "A", "P"];
|
||||||
|
char_count = 6;
|
||||||
|
|
||||||
|
|
||||||
|
// block size 1 will result in 8mm per letter
|
||||||
|
block_size = 2;
|
||||||
|
// height is the Z height of each letter
|
||||||
|
height = 3;
|
||||||
|
// Append a hole fo a keyring, necklace etc. ?
|
||||||
|
key_ring_hole = true;
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v = [0,-block_size*8*char_count/2+block_size*8/2,3]) {
|
||||||
|
8bit_str(chars, char_count, block_size, height);
|
||||||
|
}
|
||||||
|
translate(v = [0,0,3/2]) {
|
||||||
|
color([0,0,1,1]) {
|
||||||
|
cube(size = [block_size * 8, block_size * 8 * char_count, 3], center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (key_ring_hole == true){
|
||||||
|
translate([0, block_size * 8 * (char_count+1)/2, 3/2])
|
||||||
|
difference(){
|
||||||
|
cube(size = [block_size * 8, block_size * 8 , 3], center = true);
|
||||||
|
cube(size = [block_size * 4, block_size * 4 , 5], center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
// Library: boxes.scad
|
||||||
|
// Version: 1.0
|
||||||
|
// Author: Marius Kintel
|
||||||
|
// Copyright: 2010
|
||||||
|
// License: BSD
|
||||||
|
|
||||||
|
// roundedBox([width, height, depth], float radius, bool sidesonly);
|
||||||
|
|
||||||
|
// EXAMPLE USAGE:
|
||||||
|
// roundedBox([20, 30, 40], 5, true);
|
||||||
|
|
||||||
|
// size is a vector [w, h, d]
|
||||||
|
module roundedBox(size, radius, sidesonly)
|
||||||
|
{
|
||||||
|
rot = [ [0,0,0], [90,0,90], [90,90,0] ];
|
||||||
|
if (sidesonly) {
|
||||||
|
cube(size - [2*radius,0,0], true);
|
||||||
|
cube(size - [0,2*radius,0], true);
|
||||||
|
for (x = [radius-size[0]/2, -radius+size[0]/2],
|
||||||
|
y = [radius-size[1]/2, -radius+size[1]/2]) {
|
||||||
|
translate([x,y,0]) cylinder(r=radius, h=size[2], center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cube([size[0], size[1]-radius*2, size[2]-radius*2], center=true);
|
||||||
|
cube([size[0]-radius*2, size[1], size[2]-radius*2], center=true);
|
||||||
|
cube([size[0]-radius*2, size[1]-radius*2, size[2]], center=true);
|
||||||
|
|
||||||
|
for (axis = [0:2]) {
|
||||||
|
for (x = [radius-size[axis]/2, -radius+size[axis]/2],
|
||||||
|
y = [radius-size[(axis+1)%3]/2, -radius+size[(axis+1)%3]/2]) {
|
||||||
|
rotate(rot[axis])
|
||||||
|
translate([x,y,0])
|
||||||
|
cylinder(h=size[(axis+2)%3]-2*radius, r=radius, center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (x = [radius-size[0]/2, -radius+size[0]/2],
|
||||||
|
y = [radius-size[1]/2, -radius+size[1]/2],
|
||||||
|
z = [radius-size[2]/2, -radius+size[2]/2]) {
|
||||||
|
translate([x,y,z]) sphere(radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
use <math.scad>
|
||||||
|
include <constants.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,516 @@
|
|||||||
|
// Font Functions
|
||||||
|
// Encoding from http://en.wikipedia.org/wiki/ASCII
|
||||||
|
|
||||||
|
module outline_2d(outline,points,paths,width=0.1,resolution=8) {
|
||||||
|
if(outline && resolution > 4) {
|
||||||
|
for(j=[0:len(paths)-1]) union() {
|
||||||
|
for(i=[1:len(paths[j])-1]) hull() {
|
||||||
|
translate(points[paths[j][i-1]]) circle($fn=resolution,r=width/2);
|
||||||
|
translate(points[paths[j][i]]) circle($fn=resolution,r=width/2);
|
||||||
|
}
|
||||||
|
hull() {
|
||||||
|
translate(points[paths[j][len(paths[j])-1]]) circle($fn=resolution,r=width/2);
|
||||||
|
translate(points[paths[j][0]]) circle($fn=resolution,r=width/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
polygon(points=points,paths=paths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module bold_2d(bold,width=0.2,resolution=8) {
|
||||||
|
for(j=[0:$children-1]) {
|
||||||
|
if(bold) {
|
||||||
|
union() {
|
||||||
|
child(j);
|
||||||
|
for(i=[0:resolution-1]) assign(dx=width*cos(360*i/resolution),dy=width*sin(360*i/resolution))
|
||||||
|
translate([dx,dy]) child(j);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
child(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function 8bit_polyfont(dx=0.1,dy=0.1) = [
|
||||||
|
[8,8,0,"fixed"],["Decimal Byte","Caret Notation","Character Escape Code","Abbreviation","Name","Bound Box","[points,paths]"]
|
||||||
|
,[
|
||||||
|
[ 0,"^@","\0","NUL","Null character",[[0,0],[8,8]],[]]
|
||||||
|
,[ 1,"^A","", "SOH","Start of Header",[[0,0],[8,8]],[]]
|
||||||
|
,[ 2,"^B","", "STX","Start of Text",[[0,0],[8,8]],[]]
|
||||||
|
,[ 3,"^C","", "ETX","End of Text",[[0,0],[8,8]],[]]
|
||||||
|
,[ 4,"^D","", "EOT","End of Transmission",[[0,0],[8,8]],[]]
|
||||||
|
,[ 5,"^E","", "ENQ","Enquiry",[[0,0],[8,8]],[]]
|
||||||
|
,[ 6,"^F","", "ACK","Acknowledgment",[[0,0],[8,8]],[]]
|
||||||
|
,[ 7,"^G","\a","BEL","Bell",[[0,0],[8,8]],[]]
|
||||||
|
,[ 8,"^H","\b","BS", "Backspace",[[0,0],[8,8]],[]]
|
||||||
|
,[ 9,"^I","\t","HT", "Horizontal Tab",[[0,0],[8,8]],[]]
|
||||||
|
,[ 10,"^J","\n","LF", "Line Feed",[[0,0],[8,8]],[]]
|
||||||
|
,[ 11,"^K","\v","VT", "Vertical Tab",[[0,0],[8,8]],[]]
|
||||||
|
,[ 12,"^L","\f","FF", "Form feed",[[0,0],[8,8]],[]]
|
||||||
|
,[ 13,"^M","\r","CR", "Carriage return",[[0,0],[8,8]],[]]
|
||||||
|
,[ 14,"^N","", "SO", "Shift Out",[[0,0],[8,8]],[]]
|
||||||
|
,[ 15,"^O","", "SI", "Shift In",[[0,0],[8,8]],[]]
|
||||||
|
,[ 16,"^P","", "DLE","Data Link Escape",[[0,0],[8,8]],[]]
|
||||||
|
,[ 17,"^Q","", "DC1","Device Control 1",[[0,0],[8,8]],[]]
|
||||||
|
,[ 18,"^R","", "DC2","Device Control 2",[[0,0],[8,8]],[]]
|
||||||
|
,[ 19,"^S","", "DC3","Device Control 3",[[0,0],[8,8]],[]]
|
||||||
|
,[ 20,"^T","", "DC4","Device Control 4",[[0,0],[8,8]],[]]
|
||||||
|
,[ 21,"^U","", "NAK","Negative Acknowledgement",[[0,0],[8,8]],[]]
|
||||||
|
,[ 22,"^V","", "SYN","Synchronous Idle",[[0,0],[8,8]],[]]
|
||||||
|
,[ 23,"^W","", "ETB","End of Transmission Block",[[0,0],[8,8]],[]]
|
||||||
|
,[ 24,"^X","", "CAN","Cancel",[[0,0],[8,8]],[]]
|
||||||
|
,[ 25,"^Y","", "EM", "End of Medium",[[0,0],[8,8]],[]]
|
||||||
|
,[ 26,"^Z","", "SUB","Substitute",[[0,0],[8,8]],[]]
|
||||||
|
,[ 27,"^[","\e","ESC","Escape",[[0,0],[8,8]],[]]
|
||||||
|
,[ 28,"^\\","", "FS", "File Separator",[[0,0],[8,8]],[]]
|
||||||
|
,[ 29,"^]","", "GS", "Group Separator",[[0,0],[8,8]],[]]
|
||||||
|
,[ 30,"^^","", "RS", "Record Separator",[[0,0],[8,8]],[]]
|
||||||
|
,[ 31,"^_","", "US", "Unit Separator",[[0,0],[8,8]],[]]
|
||||||
|
,[ 32," "," ", "", "Space",[[0,0],[2,8]],[]]
|
||||||
|
,[ 33,"!","!", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[5,2],[5,1]
|
||||||
|
,[3,3],[3,7],[5,7],[5,3]]
|
||||||
|
,[[0,1,2,3],[4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 34,"\"","\"","", "",[[0,0],[8,8]],[
|
||||||
|
[[1,4],[1,7],[3,7],[3,4]
|
||||||
|
,[5,4],[5,7],[7,7],[7,4]]
|
||||||
|
,[[0,1,2,3],[4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 35,"#","#", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[0,2],[0,3],[1,3],[1,5],[0,5],[0,6],[1,6],[1,7],[3,7],[3,6],[5,6],[5,7],[7,7]
|
||||||
|
,[7,6],[8,6],[8,5],[7,5],[7,3],[8,3],[8,2],[7,2],[7,1],[5,1],[5,2],[3,2],[3,1]
|
||||||
|
,[3,3],[3,5],[5,5],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],[28,29,30,31]]
|
||||||
|
]]
|
||||||
|
,[ 36,"$","$", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[1,2],[1,3],[5,3],[5,4],[2,4],[2,5],[1,5],[1,6],[2,6],[2,7],[3,7],[3,8],[5,8],[5,7],[7,7],[7,6]
|
||||||
|
,[3,6],[3,5],[6,5],[6,4],[7,4],[7,3],[6,3],[6,2],[5,2],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 37,"%","%", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,3],[2,3],[2,5],[1,5],[1,7],[3,7],[3,5],[4,5],[4,6],[5,6],[5,7],[7,7]
|
||||||
|
,[7,6],[6,6],[6,5],[5,5],[5,4],[4,4],[4,3],[3,3],[3,2],[2,2],[2,1]
|
||||||
|
,[5,1],[5,3],[7,3],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],[24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 38,"&","&", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,4],[2,4],[2,5],[3,5],[3,6],[2,6],[2,7],[3,7],[3,8],[6,8],[6,7],[7,7],[7,6],[6,6],[6,5],[5,5],[5,4]
|
||||||
|
,[8,4],[8,3],[7,3],[7,2],[8,2],[8,1],[6,1],[6,2],[5,2],[5,1]
|
||||||
|
,[3,2],[3,4],[4,4],[4,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29],[30,31,32,33]]
|
||||||
|
]]
|
||||||
|
,[ 39,"'","'", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,4],[3,7],[5,7],[5,4]]
|
||||||
|
,[[0,1,2,3]]
|
||||||
|
]]
|
||||||
|
,[ 40,"(","(", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[2,2],[2,6],[3,6],[3,7],[6,7],[6,6],[5,6],[5,5],[4,5],[4,3],[5,3],[5,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 41,")",")", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[3,2],[3,3],[4,3],[4,5],[3,5],[3,6],[2,6],[2,7],[5,7],[5,6],[6,6],[6,2],[5,2],[5,1],[4,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]]
|
||||||
|
]]
|
||||||
|
,[ 42,"*","*", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,2],[1,3],[2,3],[2,4],[0,4],[0,5],[2,5],[2,6],[1,6],[1,7],[3,7],[3,6],[5,6],[5,7],[7,7],[7,6],[6,6]
|
||||||
|
,[6,5],[8,5],[8,4],[6,4],[6,3],[7,3],[7,2],[5,2],[5,3],[3,3],[3,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 43,"+","+", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,3],[1,3],[1,5],[3,5],[3,7],[5,7],[5,5],[7,5],[7,3],[5,3],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 44,",",",", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,0],[2,1],[3,1],[3,3],[5,3],[5,1],[4,1],[4,0]]
|
||||||
|
,[[0,1,2,3,4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 45,"-","-", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,3],[1,5],[7,5],[7,3]]
|
||||||
|
,[[0,1,2,3]]
|
||||||
|
]]
|
||||||
|
,[ 46,".",".", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,3],[5,3],[5,1]]
|
||||||
|
,[[0,1,2,3]]
|
||||||
|
]]
|
||||||
|
,[ 47,"/","/", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,3],[2,3],[2,4],[3,4],[3,5],[4,5],[4,6],[5,6],[5,7],[7,7],[7,6],[6,6],[6,5],[5,5],[5,4],[4,4],[4,3],[3,3],[3,2],[2,2],[2,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]]
|
||||||
|
]]
|
||||||
|
,[ 48,"0","0", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,3],[5,3],[5,2]
|
||||||
|
,[3,4],[3,6],[5,6],[5,5],[4,5],[4,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15],[16,17,18,19,20,21]]
|
||||||
|
]]
|
||||||
|
,[ 49,"1","1", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[3,2],[3,5],[2,5],[2,6],[3,6],[3,7],[5,7],[5,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 50,"2","2", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[2,2],[2,3],[3,3],[3,4],[4,4],[4,5],[5,5],[5,6],[3,6],[3,5],[1,5],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,5],[6,5],[6,4],[5,4],[5,3],[4,3],[4,2],[3,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]]
|
||||||
|
]]
|
||||||
|
,[ 51,"3","3", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,3],[3,3],[3,2],[5,2],[5,3],[4,3],[4,4],[3,4],[3,5],[4,5],[4,6],[1,6],[1,7],[7,7],[7,6],[6,6],[6,5],[5,5],[5,4],[6,4],[6,3],[7,3],[7,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 52,"4","4", "", "",[[0,0],[8,8]],[
|
||||||
|
[[4,1],[4,2],[1,2],[1,4],[2,4],[2,5],[3,5],[3,6],[4,6],[4,7],[6,7],[6,3],[7,3],[7,2],[6,2],[6,1]
|
||||||
|
,[3,3],[3,4],[4,4],[4,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 53,"5","5", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,3],[3,3],[3,2],[5,2],[5,4],[1,4],[1,7],[7,7],[7,6],[3,6],[3,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 54,"6","6", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[3,6],[3,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,4],[5,4],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 55,"7","7", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,3],[3,3],[3,4],[4,4],[4,5],[5,5],[5,6],[1,6],[1,7],[7,7],[7,5],[6,5],[6,4],[5,4],[5,3],[4,3],[4,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[ 56,"8","8", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,4],[2,4],[2,5],[1,5],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,4],[5,4],[5,2]
|
||||||
|
,[3,5],[3,6],[5,6],[5,5]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],[20,21,22,23],[24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 57,"9","9", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[4,2],[4,3],[5,3],[5,4],[2,4],[2,5],[1,5],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,3],[6,3],[6,2],[5,2],[5,1]
|
||||||
|
,[3,5],[3,6],[5,6],[5,5]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],[20,21,22,23]]
|
||||||
|
]]
|
||||||
|
,[ 58,":",":", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,3],[5,3],[5,1]
|
||||||
|
,[3,4],[3,6],[5,6],[5,4]]
|
||||||
|
,[[0,1,2,3],[4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 59,";",";", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,0],[2,1],[3,1],[3,3],[5,3],[5,1],[4,1],[4,0]
|
||||||
|
,[3,4],[3,6],[5,6],[5,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7],[8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 60,"<","<", "", "",[[0,0],[8,8]],[
|
||||||
|
[[5,1],[5,2],[4,2],[4,3],[3,3],[3,4],[2,4],[2,5],[3,5],[3,6],[4,6],[4,7],[5,7],[5,8],[7,8],[7,7],[6,7],[6,6],[5,6],[5,5],[4,5],[4,4],[5,4],[5,3],[6,3],[6,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 61,"=","=", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,2],[1,3],[7,3],[7,2]
|
||||||
|
,[1,5],[1,6],[7,6],[7,5]]
|
||||||
|
,[[0,1,2,3],[4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 62,">",">", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[2,2],[2,3],[3,3],[3,4],[4,4],[4,5],[3,5],[3,6],[2,6],[2,7],[1,7],[1,8],[3,8],[3,7],[4,7],[4,6],[5,6],[5,5],[6,5],[6,4],[5,4],[5,3],[4,3],[4,2],[3,2],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 63,"?","?", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[5,2],[5,1]
|
||||||
|
,[3,3],[3,4],[4,4],[4,5],[5,5],[5,6],[3,6],[3,5],[1,5],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,5],[6,5],[6,4],[5,4],[5,3]]
|
||||||
|
,[[0,1,2,3],[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]]
|
||||||
|
]]
|
||||||
|
,[ 64,"@","@", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,3],[4,3],[4,5],[5,5],[5,6],[3,6],[3,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[ 65,"A","A", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,5],[2,5],[2,6],[3,6],[3,7],[5,7],[5,6],[6,6],[6,5],[7,5],[7,1],[5,1],[5,2],[3,2],[3,1]
|
||||||
|
,[3,3],[3,5],[5,5],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 66,"B","B", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[6,7],[6,6],[7,6],[7,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]
|
||||||
|
,[3,5],[3,6],[5,6],[5,5]
|
||||||
|
,[3,2],[3,4],[5,4],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 67,"C","C", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,5],[5,5],[5,6],[3,6],[3,2],[5,2],[5,3],[7,3],[7,2],[6,2],[6,1]] ,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 68,"D","D", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[5,7],[5,6],[6,6],[6,5],[7,5],[7,3],[6,3],[6,2],[5,2],[5,1]
|
||||||
|
,[3,2],[3,6],[4,6],[4,5],[5,5],[5,3],[4,3],[4,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 69,"E","E", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[7,7],[7,6],[3,6],[3,5],[6,5],[6,4],[3,4],[3,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 70,"F","F", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[7,7],[7,6],[3,6],[3,5],[6,5],[6,4],[3,4],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9]]
|
||||||
|
]]
|
||||||
|
,[ 71,"G","G", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[7,7],[7,6],[3,6],[3,2],[5,2],[5,3],[4,3],[4,4],[7,4],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 72,"H","H", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,5],[5,5],[5,7],[7,7],[7,1],[5,1],[5,4],[3,4],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 73,"I","I", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[3,2],[3,6],[1,6],[1,7],[7,7],[7,6],[5,6],[5,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[ 74,"J","J", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,3],[3,3],[3,2],[5,2],[5,6],[4,6],[4,7],[7,7],[7,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[ 75,"K","K", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,5],[4,5],[4,6],[5,6],[5,7],[7,7],[7,6],[6,6],[6,5],[5,5],[5,3],[6,3],[6,2],[7,2],[7,1],[5,1],[5,2],[4,2],[4,3],[3,3],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]]
|
||||||
|
]]
|
||||||
|
,[ 76,"L","L", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5]]
|
||||||
|
]]
|
||||||
|
,[ 77,"M","M", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,6],[4,6],[4,5],[5,5],[5,6],[6,6],[6,7],[8,7],[8,1],[6,1],[6,4],[5,4],[5,3],[4,3],[4,4],[3,4],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 78,"N","N", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,6],[4,6],[4,5],[5,5],[5,7],[7,7],[7,1],[5,1],[5,2],[4,2],[4,3],[3,3],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 79,"O","O", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,6],[5,6],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 80,"P","P", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[6,7],[6,6],[7,6],[7,4],[6,4],[6,3],[3,3],[3,1]
|
||||||
|
,[3,4],[3,6],[5,6],[5,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[ 81,"Q","Q", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[2,6],[2,7],[6,7],[6,6],[7,6],[7,3],[6,3],[6,2],[7,2],[7,1],[5,1],[5,2],[4,2],[4,1]
|
||||||
|
,[3,3],[3,6],[5,6],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],[18,19,20,21]]
|
||||||
|
]]
|
||||||
|
,[ 82,"R","R", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[6,7],[6,6],[7,6],[7,4],[6,4],[6,2],[7,2],[7,1],[5,1],[5,2],[4,2],[4,3],[3,3],[3,1]
|
||||||
|
,[3,4],[3,6],[5,6],[5,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 83,"S","S", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[5,2],[5,4],[2,4],[2,5],[1,5],[1,6],[2,6],[2,7],[6,7],[6,6],[3,6],[3,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 84,"T","T", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,6],[1,6],[1,7],[7,7],[7,6],[5,6],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 85,"U","U", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,2],[5,2],[5,7],[7,7],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 86,"V","V", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[2,2],[2,3],[1,3],[1,7],[3,7],[3,3],[5,3],[5,7],[7,7],[7,3],[6,3],[6,2],[5,2],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 87,"W","W", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,4],[4,4],[4,5],[5,5],[5,4],[6,4],[6,7],[8,7],[8,1],[6,1],[6,2],[5,2],[5,3],[4,3],[4,2],[3,2],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 88,"X","X", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,3],[2,3],[2,5],[1,5],[1,7],[3,7],[3,5],[5,5],[5,7],[7,7],[7,5],[6,5],[6,3],[7,3],[7,1],[5,1],[5,3],[3,3],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[ 89,"Y","Y", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,4],[2,4],[2,5],[1,5],[1,7],[3,7],[3,5],[5,5],[5,7],[7,7],[7,5],[6,5],[6,4],[5,4],[5,1],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]]
|
||||||
|
]]
|
||||||
|
,[ 90,"Z","Z", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,3],[2,3],[2,4],[3,4],[3,5],[4,5],[4,6],[1,6],[1,7],[7,7],[7,6],[6,6],[6,5],[5,5],[5,4],[4,4],[4,3],[3,3],[3,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]]
|
||||||
|
]]
|
||||||
|
,[ 91,"[","[", "", "",[[0,0],[8,8]],[ // ] ]
|
||||||
|
[[2,1],[2,7],[6,7],[6,6],[4,6],[4,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 92,"\\","\\","", "",[[0,0],[8,8]],[
|
||||||
|
[[6,1],[6,2],[5,2],[5,3],[4,3],[4,4],[3,4],[3,5],[2,5],[2,6],[1,6],[1,7],[3,7],[3,6],[4,6],[4,5],[5,5],[5,4],[6,4],[6,3],[7,3],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]]
|
||||||
|
]]
|
||||||
|
,[ 93,"]","]", "", "",[[0,0],[8,8]],[ // [ [
|
||||||
|
[[2,1],[2,2],[4,2],[4,6],[2,6],[2,7],[6,7],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7]]
|
||||||
|
]]
|
||||||
|
,[ 94,"^","^", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,4],[2,5]
|
||||||
|
,[3-dx,5],[3,5+dy]
|
||||||
|
,[3,6]
|
||||||
|
,[4-dx,6],[4,6+dy]
|
||||||
|
,[4,7],[5,7]
|
||||||
|
,[5,6+dy],[5+dx,6]
|
||||||
|
,[6,6]
|
||||||
|
,[6,5+dy],[6+dx,5]
|
||||||
|
,[7,5],[7,4],[6,4]
|
||||||
|
,[6,5-dy],[6-dx,5]
|
||||||
|
,[5,5]
|
||||||
|
,[5,6-dy],[5-dx,6],[4+dx,6],[4,6-dy]
|
||||||
|
,[4,5]
|
||||||
|
,[3+dx,5],[3,5-dy]
|
||||||
|
,[3,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[ 95,"_","_", "", "",[[0,0],[8,8]],[
|
||||||
|
[[0,0],[0,1],[8,1],[8,0]]
|
||||||
|
,[[0,1,2,3]]
|
||||||
|
]]
|
||||||
|
,[ 96,"`","`", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,6],[2,7],[3,7]
|
||||||
|
,[3,6+dy],[3+dx,6]
|
||||||
|
,[4,6]
|
||||||
|
,[4,5+dy],[4+dx,5]
|
||||||
|
,[5,5],[5,4],[4,4]
|
||||||
|
,[4,5-dy],[4-dx,5]
|
||||||
|
,[3,5]
|
||||||
|
,[3,6-dy],[3-dx,6]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[ 97,"a","a", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,3],[2,3],[2,4],[5,4],[5,5],[2,5],[2,6],[6,6],[6,5],[7,5],[7,1]
|
||||||
|
,[3,2],[3,3],[5,3],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[ 98,"b","b", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,5],[6,5],[6,4],[7,4],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,4],[5,4],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[ 99,"c","c", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,5],[2,5],[2,6],[6,6],[6,5],[3,5],[3,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[100,"d","d", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,4],[2,4],[2,5],[5,5],[5,7],[7,7],[7,1]
|
||||||
|
,[3,2],[3,4],[5,4],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[101,"e","e", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,5],[2,5],[2,6],[6,6],[6,5],[7,5],[7,3],[3,3],[3,2],[6,2],[6,1]
|
||||||
|
,[3,4],[3,5],[5,5],[5,4]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[102,"f","f", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,4],[2,4],[2,5],[3,5],[3,6],[4,6],[4,7],[7,7],[7,6],[5,6],[5,5],[7,5],[7,4],[5,4],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[103,"g","g", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,0],[1,1],[5,1],[5,2],[2,2],[2,3],[1,3],[1,5],[2,5],[2,6],[6,6],[6,5],[7,5],[7,1],[6,1],[6,0]
|
||||||
|
,[3,3],[3,5],[5,5],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],[16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[104,"h","h", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,5],[6,5],[6,4],[7,4],[7,1],[5,1],[5,4],[3,4],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[105,"i","i", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[3,2],[3,4],[2,4],[2,5],[5,5],[5,2],[6,2],[6,1]
|
||||||
|
,[3,6],[3,7],[5,7],[5,6]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[106,"j","j", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,0],[2,1],[5,1],[5,5],[7,5],[7,1],[6,1],[6,0]
|
||||||
|
,[5,6],[5,7],[7,7],[7,6]]
|
||||||
|
,[[0,1,2,3,4,5,6,7],[8,9,10,11]]
|
||||||
|
]]
|
||||||
|
,[107,"k","k", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,7],[3,7],[3,4],[4,4],[4,5],[6,5],[6,4],[5,4],[5,3],[6,3],[6,2],[7,2],[7,1],[5,1],[5,2],[4,2],[4,3],[3,3],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[108,"l","l", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[3,2],[3,6],[2,6],[2,7],[5,7],[5,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9]]
|
||||||
|
]]
|
||||||
|
,[109,"m","m", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,6],[3,6],[3,5],[5,5],[5,6],[7,6],[7,5],[8,5],[8,1],[6,1],[6,3],[5,3],[5,2],[4,2],[4,3],[3,3],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[110,"n","n", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,6],[6,6],[6,5],[7,5],[7,1],[5,1],[5,5],[3,5],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9]]
|
||||||
|
]]
|
||||||
|
,[111,"o","o", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,5],[2,5],[2,6],[6,6],[6,5],[7,5],[7,2],[6,2],[6,1]
|
||||||
|
,[3,2],[3,5],[5,5],[5,2]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11],[12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[112,"p","p", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,0],[1,6],[6,6],[6,5],[7,5],[7,3],[6,3],[6,2],[3,2],[3,0]
|
||||||
|
,[3,3],[3,5],[5,5],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[113,"q","q", "", "",[[0,0],[8,8]],[
|
||||||
|
[[5,0],[5,2],[2,2],[2,3],[1,3],[1,5],[2,5],[2,6],[7,6],[7,0]
|
||||||
|
,[3,3],[3,5],[5,5],[5,3]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9],[10,11,12,13]]
|
||||||
|
]]
|
||||||
|
,[114,"r","r", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,6],[6,6],[6,5],[7,5],[7,4],[5,4],[5,5],[3,5],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9]]
|
||||||
|
]]
|
||||||
|
,[115,"s","s", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[5,2],[5,3],[2,3],[2,4],[1,4],[1,5],[2,5],[2,6],[7,6],[7,5],[3,5],[3,4],[6,4],[6,3],[7,3],[7,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[116,"t","t", "", "",[[0,0],[8,8]],[
|
||||||
|
[[4,1],[4,2],[3,2],[3,5],[1,5],[1,6],[3,6],[3,7],[5,7],[5,6],[7,6],[7,5],[5,5],[5,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[117,"u","u", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[1,2],[1,6],[3,6],[3,2],[5,2],[5,6],[7,6],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9]]
|
||||||
|
]]
|
||||||
|
,[118,"v","v", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,1],[3,2],[2,2],[2,3],[1,3],[1,6],[3,6],[3,3],[5,3],[5,6],[7,6],[7,3],[6,3],[6,2],[5,2],[5,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]]
|
||||||
|
]]
|
||||||
|
,[119,"w","w", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,3],[1,3],[1,6],[3,6],[3,4],[4,4],[4,5],[5,5],[5,4],[6,4],[6,6],[8,6],[8,3],[7,3],[7,1],[5,1],[5,2],[4,2],[4,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[120,"x","x", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[2,2],[2,3],[3,3],[3,4],[2,4],[2,5],[1,5],[1,6],[3,6],[3,5],[5,5],[5,6],[7,6],[7,5],[6,5],[6,4],[5,4],[5,3],[6,3],[6,2],[7,2],[7,1],[5,1],[5,2],[3,2],[3,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]]
|
||||||
|
]]
|
||||||
|
,[121,"y","y", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,0],[1,1],[4,1],[4,2],[2,2],[2,3],[1,3],[1,6],[3,6],[3,3],[5,3],[5,6],[7,6],[7,2],[6,2],[6,1],[5,1],[5,0]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
|
||||||
|
]]
|
||||||
|
,[122,"z","z", "", "",[[0,0],[8,8]],[
|
||||||
|
[[1,1],[1,2],[2,2],[2,3],[3,3],[3,4],[4,4],[4,5],[1,5],[1,6],[7,6],[7,5],[6,5],[6,4],[5,4],[5,3],[4,3],[4,2],[7,2],[7,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[123,"{","{", "", "",[[0,0],[8,8]],[
|
||||||
|
[[4,1],[4,2],[3,2],[3,4],[2,4],[2,5],[3,5],[3,7],[4,7],[4,8],[6,8],[6,7],[5,7],[5,5],[4,5],[4,4],[5,4],[5,2],[6,2],[6,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[124,"|","|", "", "",[[0,0],[8,8]],[
|
||||||
|
[[3,0],[3,8],[5,8],[5,0]]
|
||||||
|
,[[0,1,2,3]]
|
||||||
|
]]
|
||||||
|
,[125,"}","}", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,1],[2,2],[3,2],[3,4],[4,4],[4,5],[3,5],[3,7],[2,7],[2,8],[4,8],[4,7],[5,7],[5,5],[6,5],[6,4],[5,4],[5,2],[4,2],[4,1]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[126,"~","~", "", "",[[0,0],[8,8]],[
|
||||||
|
[[2,5],[2,6]
|
||||||
|
,[3-dx,6],[3,6+dy]
|
||||||
|
,[3,7],[5,7],[5,6]
|
||||||
|
,[6-dx,6],[6,6+dy]
|
||||||
|
,[6,7],[7,7],[7,6]
|
||||||
|
,[6+dx,6],[6,6-dy]
|
||||||
|
,[6,5],[4,5],[4,6]
|
||||||
|
,[3+dx,6],[3,6-dy]
|
||||||
|
,[3,5]]
|
||||||
|
,[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]
|
||||||
|
]]
|
||||||
|
,[127,"^?","", "DEL","Delete",[[0,0],[8,8]],[]]
|
||||||
|
] ];
|
||||||
|
|
@ -0,0 +1,177 @@
|
|||||||
|
// Copyright 2010 D1plo1d
|
||||||
|
// LGPL 2.1
|
||||||
|
|
||||||
|
|
||||||
|
//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,5 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.system("git submodule update --init")
|
@ -0,0 +1,189 @@
|
|||||||
|
/*********************************
|
||||||
|
* OpenSCAD GridBeam Library *
|
||||||
|
* (c) Timothy Schmidt 2013 *
|
||||||
|
* http://www.github.com/gridbeam *
|
||||||
|
* License: LGPL 2.1 or later *
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/* Todo:
|
||||||
|
- implement "dxf" mode
|
||||||
|
- implement hole cutout pattern - interference based on hole size, compatible with two sizes above and below the currently set size.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// zBeam(segments) - create a vertical gridbeam strut 'segments' long
|
||||||
|
// xBeam(segments) - create a horizontal gridbeam strut along the X axis
|
||||||
|
// yBeam(segments) - create a horizontal gridbeam strut along the Y axis
|
||||||
|
// zBolt(segments) - create a bolt 'segments' in length
|
||||||
|
// xBolt(segments)
|
||||||
|
// yBolt(segments)
|
||||||
|
// topShelf(width, depth, corners) - create a shelf suitable for use in gridbeam structures width and depth in 'segments', corners == 1 notches corners
|
||||||
|
// bottomShelf(width, depth, corners) - like topShelf, but aligns shelf to underside of beams
|
||||||
|
// backBoard(width, height, corners) - create a backing board suitable for use in gridbeam structures width and height in 'segments', corners == 1 notches corners
|
||||||
|
// frontBoard(width, height, corners) - like backBoard, but aligns board to front side of beams
|
||||||
|
// translateBeam([x, y, z]) - translate gridbeam struts or shelves in X, Y, or Z axes in units 'segments'
|
||||||
|
|
||||||
|
// To render the DXF file from the command line:
|
||||||
|
// openscad -x connector.dxf -D'mode="dxf"' connector.scad
|
||||||
|
mode = "model";
|
||||||
|
//mode = "dxf";
|
||||||
|
|
||||||
|
include <units.scad>
|
||||||
|
|
||||||
|
beam_width = inch * 1.5;
|
||||||
|
beam_hole_diameter = inch * 5/16;
|
||||||
|
beam_hole_radius = beam_hole_diameter / 2;
|
||||||
|
beam_is_hollow = 1;
|
||||||
|
beam_wall_thickness = inch * 1/8;
|
||||||
|
beam_shelf_thickness = inch * 1/4;
|
||||||
|
|
||||||
|
module zBeam(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
difference() {
|
||||||
|
cube([beam_width, beam_width, beam_width * segments]);
|
||||||
|
for(i = [0 : segments - 1]) {
|
||||||
|
translate([beam_width / 2, beam_width + 1, beam_width * i + beam_width / 2])
|
||||||
|
rotate([90,0,0])
|
||||||
|
cylinder(r=beam_hole_radius, h=beam_width + 2);
|
||||||
|
|
||||||
|
translate([-1, beam_width / 2, beam_width * i + beam_width / 2])
|
||||||
|
rotate([0,90,0])
|
||||||
|
cylinder(r=beam_hole_radius, h=beam_width + 2);
|
||||||
|
}
|
||||||
|
if (beam_is_hollow == 1) {
|
||||||
|
translate([beam_wall_thickness, beam_wall_thickness, -1])
|
||||||
|
cube([beam_width - beam_wall_thickness * 2, beam_width - beam_wall_thickness * 2, beam_width * segments + 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module xBeam(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
translate([0,0,beam_width])
|
||||||
|
rotate([0,90,0])
|
||||||
|
zBeam(segments);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module yBeam(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
translate([0,0,beam_width])
|
||||||
|
rotate([-90,0,0])
|
||||||
|
zBeam(segments);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module zBolt(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module xBolt(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module yBolt(segments) {
|
||||||
|
if (mode == "model") {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module translateBeam(v) {
|
||||||
|
for (i = [0 : $children - 1]) {
|
||||||
|
translate(v * beam_width) child(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module topShelf(width, depth, corners) {
|
||||||
|
if (mode == "model") {
|
||||||
|
difference() {
|
||||||
|
cube([width * beam_width, depth * beam_width, beam_shelf_thickness]);
|
||||||
|
|
||||||
|
if (corners == 1) {
|
||||||
|
translate([-1, -1, -1])
|
||||||
|
cube([beam_width + 2, beam_width + 2, beam_shelf_thickness + 2]);
|
||||||
|
translate([-1, (depth - 1) * beam_width, -1])
|
||||||
|
cube([beam_width + 2, beam_width + 2, beam_shelf_thickness + 2]);
|
||||||
|
translate([(width - 1) * beam_width, -1, -1])
|
||||||
|
cube([beam_width + 2, beam_width + 2, beam_shelf_thickness + 2]);
|
||||||
|
translate([(width - 1) * beam_width, (depth - 1) * beam_width, -1])
|
||||||
|
cube([beam_width + 2, beam_width + 2, beam_shelf_thickness + 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module bottomShelf(width, depth, corners) {
|
||||||
|
if (mode == "model") {
|
||||||
|
translate([0,0,-beam_shelf_thickness])
|
||||||
|
topShelf(width, depth, corners);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module backBoard(width, height, corners) {
|
||||||
|
if (mode == "model") {
|
||||||
|
translate([beam_width, 0, 0])
|
||||||
|
difference() {
|
||||||
|
cube([beam_shelf_thickness, width * beam_width, height * beam_width]);
|
||||||
|
|
||||||
|
if (corners == 1) {
|
||||||
|
translate([-1, -1, -1])
|
||||||
|
cube([beam_shelf_thickness + 2, beam_width + 2, beam_width + 2]);
|
||||||
|
translate([-1, -1, (height - 1) * beam_width])
|
||||||
|
cube([beam_shelf_thickness + 2, beam_width + 2, beam_width + 2]);
|
||||||
|
translate([-1, (width - 1) * beam_width, -1])
|
||||||
|
cube([beam_shelf_thickness + 2, beam_width + 2, beam_width + 2]);
|
||||||
|
translate([-1, (width - 1) * beam_width, (height - 1) * beam_width])
|
||||||
|
cube([beam_shelf_thickness + 2, beam_width + 2, beam_width + 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module frontBoard(width, height, corners) {
|
||||||
|
if (mode == "model") {
|
||||||
|
translate([-beam_width - beam_shelf_thickness, 0, 0])
|
||||||
|
backBoard(width, height, corners);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == "dxf") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
// License: LGPL 2.1
|
||||||
|
|
||||||
|
rodsize = 6; //threaded/smooth rod diameter in mm
|
||||||
|
xaxis = 182.5; //width of base in mm
|
||||||
|
yaxis = 266.5; //length of base in mm
|
||||||
|
|
||||||
|
|
||||||
|
screwsize = 3; //bearing bore/screw diameter in mm
|
||||||
|
bearingsize = 10; //outer diameter of bearings in mm
|
||||||
|
bearingwidth = 4; //width of bearings in mm
|
||||||
|
|
||||||
|
|
||||||
|
rodpitch = rodsize / 6;
|
||||||
|
rodnutsize = 0.8 * rodsize;
|
||||||
|
rodnutdiameter = 1.9 * rodsize;
|
||||||
|
rodwashersize = 0.2 * rodsize;
|
||||||
|
rodwasherdiameter = 2 * rodsize;
|
||||||
|
screwpitch = screwsize / 6;
|
||||||
|
nutsize = 0.8 * screwsize;
|
||||||
|
nutdiameter = 1.9 * screwsize;
|
||||||
|
washersize = 0.2 * screwsize;
|
||||||
|
washerdiameter = 2 * screwsize;
|
||||||
|
partthick = 2 * rodsize;
|
||||||
|
vertexrodspace = 2 * rodsize;
|
||||||
|
|
||||||
|
|
||||||
|
c = [0.3, 0.3, 0.3];
|
||||||
|
rodendoffset = rodnutsize + rodwashersize * 2 + partthick / 2;
|
||||||
|
vertexoffset = vertexrodspace + rodendoffset;
|
||||||
|
|
||||||
|
|
||||||
|
renderrodthreads = false;
|
||||||
|
renderscrewthreads = false;
|
||||||
|
fn = 36;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module rod(length, threaded) if (threaded && renderrodthreads) {
|
||||||
|
linear_extrude(height = length, center = true, convexity = 10, twist = -360 * length / rodpitch, $fn = fn)
|
||||||
|
translate([rodsize * 0.1 / 2, 0, 0])
|
||||||
|
circle(r = rodsize * 0.9 / 2, $fn = fn);
|
||||||
|
} else cylinder(h = length, r = rodsize / 2, center = true, $fn = fn);
|
||||||
|
|
||||||
|
|
||||||
|
module screw(length, nutpos, washer, bearingpos = -1) union(){
|
||||||
|
translate([0, 0, -length / 2]) if (renderscrewthreads) {
|
||||||
|
linear_extrude(height = length, center = true, convexity = 10, twist = -360 * length / screwpitch, $fn = fn)
|
||||||
|
translate([screwsize * 0.1 / 2, 0, 0])
|
||||||
|
circle(r = screwsize * 0.9 / 2, $fn = fn);
|
||||||
|
} else cylinder(h = length, r = screwsize / 2, center = true, $fn = fn);
|
||||||
|
render() difference() {
|
||||||
|
translate([0, 0, screwsize / 2]) cylinder(h = screwsize, r = screwsize, center = true, $fn = fn);
|
||||||
|
translate([0, 0, screwsize]) cylinder(h = screwsize, r = screwsize / 2, center = true, $fn = 6);
|
||||||
|
}
|
||||||
|
if (washer > 0 && nutpos > 0) {
|
||||||
|
washer(nutpos);
|
||||||
|
nut(nutpos + washersize);
|
||||||
|
} else if (nutpos > 0) nut(nutpos);
|
||||||
|
if (bearingpos >= 0) bearing(bearingpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module bearing(position) render() translate([0, 0, -position - bearingwidth / 2]) union() {
|
||||||
|
difference() {
|
||||||
|
cylinder(h = bearingwidth, r = bearingsize / 2, center = true, $fn = fn);
|
||||||
|
cylinder(h = bearingwidth * 2, r = bearingsize / 2 - 1, center = true, $fn = fn);
|
||||||
|
}
|
||||||
|
difference() {
|
||||||
|
cylinder(h = bearingwidth - 0.5, r = bearingsize / 2 - 0.5, center = true, $fn = fn);
|
||||||
|
cylinder(h = bearingwidth * 2, r = screwsize / 2 + 0.5, center = true, $fn = fn);
|
||||||
|
}
|
||||||
|
difference() {
|
||||||
|
cylinder(h = bearingwidth, r = screwsize / 2 + 1, center = true, $fn = fn);
|
||||||
|
cylinder(h = bearingwidth + 0.1, r = screwsize / 2, center = true, $fn = fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module nut(position, washer) render() translate([0, 0, -position - nutsize / 2]) {
|
||||||
|
intersection() {
|
||||||
|
scale([1, 1, 0.5]) sphere(r = 1.05 * screwsize, center = true);
|
||||||
|
difference() {
|
||||||
|
cylinder (h = nutsize, r = nutdiameter / 2, center = true, $fn = 6);
|
||||||
|
cylinder(r = screwsize / 2, h = nutsize + 0.1, center = true, $fn = fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (washer > 0) washer(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module washer(position) render() translate ([0, 0, -position - washersize / 2]) difference() {
|
||||||
|
cylinder(r = washerdiameter / 2, h = washersize, center = true, $fn = fn);
|
||||||
|
cylinder(r = screwsize / 2, h = washersize + 0.1, center = true, $fn = fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
module rodnut(position, washer) render() translate([0, 0, position]) {
|
||||||
|
intersection() {
|
||||||
|
scale([1, 1, 0.5]) sphere(r = 1.05 * rodsize, center = true);
|
||||||
|
difference() {
|
||||||
|
cylinder (h = rodnutsize, r = rodnutdiameter / 2, center = true, $fn = 6);
|
||||||
|
rod(rodnutsize + 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (washer == 1 || washer == 4) rodwasher(((position > 0) ? -1 : 1) * (rodnutsize + rodwashersize) / 2);
|
||||||
|
if (washer == 2 || washer == 4) rodwasher(((position > 0) ? 1 : -1) * (rodnutsize + rodwashersize) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module rodwasher(position) render() translate ([0, 0, position]) difference() {
|
||||||
|
cylinder(r = rodwasherdiameter / 2, h = rodwashersize, center = true, $fn = fn);
|
||||||
|
rod(rodwashersize + 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rod(20);
|
||||||
|
translate([rodsize * 2.5, 0, 0]) rod(20, true);
|
||||||
|
translate([rodsize * 5, 0, 0]) screw(10, true);
|
||||||
|
translate([rodsize * 7.5, 0, 0]) bearing();
|
||||||
|
translate([rodsize * 10, 0, 0]) rodnut();
|
||||||
|
translate([rodsize * 12.5, 0, 0]) rodwasher();
|
||||||
|
translate([rodsize * 15, 0, 0]) nut();
|
||||||
|
translate([rodsize * 17.5, 0, 0]) washer();
|
@ -0,0 +1,698 @@
|
|||||||
|
// Parametric Involute Bevel and Spur Gears by GregFrost
|
||||||
|
// It is licensed under the Creative Commons - GNU LGPL 2.1 license.
|
||||||
|
// © 2010 by GregFrost, thingiverse.com/Amp
|
||||||
|
// http://www.thingiverse.com/thing:3575 and http://www.thingiverse.com/thing:3752
|
||||||
|
|
||||||
|
// 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(){
|
||||||
|
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 ();
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_bevel_gear(){bevel_gear();}
|
||||||
|
|
||||||
|
//bevel_gear();
|
||||||
|
|
||||||
|
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,2,1],[0,3,2],[0,4,3],[0,1,5],[1,2,5],[2,3,5],[3,4,5],[0,5,4]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
flat=false)
|
||||||
|
{
|
||||||
|
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_exturde_flat_option(flat=flat, 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)
|
||||||
|
linear_exturde_flat_option(flat=flat, height=gear_thickness)
|
||||||
|
circle (r=rim_radius);
|
||||||
|
if (flat == false && hub_thickness > gear_thickness)
|
||||||
|
translate ([0,0,gear_thickness])
|
||||||
|
linear_exturde_flat_option(flat=flat, height=hub_thickness-gear_thickness)
|
||||||
|
circle (r=hub_diameter/2);
|
||||||
|
}
|
||||||
|
translate ([0,0,-1])
|
||||||
|
linear_exturde_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
|
||||||
|
circle (r=bore_diameter/2);
|
||||||
|
if (circles>0)
|
||||||
|
{
|
||||||
|
for(i=[0:circles-1])
|
||||||
|
rotate([0,0,i*360/circles])
|
||||||
|
translate([circle_orbit_diameter/2,0,-1])
|
||||||
|
linear_exturde_flat_option(flat =flat, height=max(gear_thickness,rim_thickness)+3)
|
||||||
|
circle(r=circle_diameter/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module linear_exturde_flat_option(flat =false, height = 10, center = false, convexity = 2, twist = 0)
|
||||||
|
{
|
||||||
|
if(flat==false)
|
||||||
|
{
|
||||||
|
linear_extrude(height = height, center = center, convexity = convexity, twist= twist) child(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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,44 @@
|
|||||||
|
/*
|
||||||
|
* OpenSCAD Layout Library (www.openscad.org)
|
||||||
|
* Copyright (C) 2012 Peter Uithoven
|
||||||
|
*
|
||||||
|
* License: LGPL 2.1 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
//list(iHeight);
|
||||||
|
//grid(iWidth,iHeight,inYDir = true,limit=3)
|
||||||
|
|
||||||
|
// Examples:
|
||||||
|
/*list(15)
|
||||||
|
{
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
}*/
|
||||||
|
/*grid(30,15,false,2)
|
||||||
|
{
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
square([25,10]);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
module list(iHeight)
|
||||||
|
{
|
||||||
|
for (i = [0 : $children-1])
|
||||||
|
translate([0,i*iHeight]) child(i);
|
||||||
|
}
|
||||||
|
module grid(iWidth,iHeight,inYDir = true,limit=3)
|
||||||
|
{
|
||||||
|
for (i = [0 : $children-1])
|
||||||
|
{
|
||||||
|
translate([(inYDir)? (iWidth)*(i%limit) : (iWidth)*floor(i/limit),
|
||||||
|
(inYDir)? (iHeight)*floor(i/limit) : (iHeight)*(i%limit)])
|
||||||
|
child(i);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
// This file is placed under the public domain
|
||||||
|
|
||||||
|
// from: http://www.thingiverse.com/thing:9512
|
||||||
|
|
||||||
|
|
||||||
|
// EXAMPLES:
|
||||||
|
// standard LEGO 2x1 tile has no pin
|
||||||
|
// block(1,2,1/3,reinforcement=false,flat_top=true);
|
||||||
|
// standard LEGO 2x1 flat has pin
|
||||||
|
// block(1,2,1/3,reinforcement=true);
|
||||||
|
// standard LEGO 2x1 brick has pin
|
||||||
|
// block(1,2,1,reinforcement=true);
|
||||||
|
// standard LEGO 2x1 brick without pin
|
||||||
|
// block(1,2,1,reinforcement=false);
|
||||||
|
// standard LEGO 2x1x5 brick has no pin and has hollow knobs
|
||||||
|
// block(1,2,5,reinforcement=false,hollow_knob=true);
|
||||||
|
|
||||||
|
|
||||||
|
knob_diameter=4.8; //knobs on top of blocks
|
||||||
|
knob_height=2;
|
||||||
|
knob_spacing=8.0;
|
||||||
|
wall_thickness=1.45;
|
||||||
|
roof_thickness=1.05;
|
||||||
|
block_height=9.5;
|
||||||
|
pin_diameter=3; //pin for bottom blocks with width or length of 1
|
||||||
|
post_diameter=6.5;
|
||||||
|
reinforcing_width=1.5;
|
||||||
|
axle_spline_width=2.0;
|
||||||
|
axle_diameter=5;
|
||||||
|
cylinder_precision=0.5;
|
||||||
|
|
||||||
|
/* EXAMPLES:
|
||||||
|
|
||||||
|
block(2,1,1/3,axle_hole=false,circular_hole=true,reinforcement=true,hollow_knob=true,flat_top=true);
|
||||||
|
|
||||||
|
translate([50,-10,0])
|
||||||
|
block(1,2,1/3,axle_hole=false,circular_hole=true,reinforcement=false,hollow_knob=true,flat_top=true);
|
||||||
|
|
||||||
|
translate([10,0,0])
|
||||||
|
block(2,2,1/3,axle_hole=false,circular_hole=true,reinforcement=true,hollow_knob=true,flat_top=true);
|
||||||
|
translate([30,0,0])
|
||||||
|
block(2,2,1/3,axle_hole=false,circular_hole=true,reinforcement=true,hollow_knob=false,flat_top=false);
|
||||||
|
translate([50,0,0])
|
||||||
|
block(2,2,1/3,axle_hole=false,circular_hole=true,reinforcement=true,hollow_knob=true,flat_top=false);
|
||||||
|
translate([0,20,0])
|
||||||
|
block(3,2,2/3,axle_hole=false,circular_hole=true,reinforcement=true,hollow_knob=true,flat_top=false);
|
||||||
|
translate([20,20,0])
|
||||||
|
block(3,2,1,axle_hole=true,circular_hole=false,reinforcement=true,hollow_knob=false,flat_top=false);
|
||||||
|
translate([40,20,0])
|
||||||
|
block(3,2,1/3,axle_hole=false,circular_hole=false,reinforcement=false,hollow_knob=false,flat_top=false);
|
||||||
|
translate([0,-10,0])
|
||||||
|
block(1,5,1/3,axle_hole=true,circular_hole=false,reinforcement=true,hollow_knob=false,flat_top=false);
|
||||||
|
translate([0,-20,0])
|
||||||
|
block(1,5,1/3,axle_hole=true,circular_hole=false,reinforcement=true,hollow_knob=true,flat_top=false);
|
||||||
|
translate([0,-30,0])
|
||||||
|
block(1,5,1/3,axle_hole=true,circular_hole=false,reinforcement=true,hollow_knob=true,flat_top=true);
|
||||||
|
//*/
|
||||||
|
|
||||||
|
module block(width,length,height,axle_hole=false,reinforcement=false, hollow_knob=false, flat_top=false, circular_hole=false, solid_bottom=true, center=false) {
|
||||||
|
overall_length=(length-1)*knob_spacing+knob_diameter+wall_thickness*2;
|
||||||
|
overall_width=(width-1)*knob_spacing+knob_diameter+wall_thickness*2;
|
||||||
|
center= center==true ? 1 : 0;
|
||||||
|
translate(center*[-overall_length/2, -overall_width/2, 0])
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
// body:
|
||||||
|
cube([overall_length,overall_width,height*block_height]);
|
||||||
|
// knobs:
|
||||||
|
if (flat_top != true)
|
||||||
|
translate([knob_diameter/2+wall_thickness,knob_diameter/2+wall_thickness,0])
|
||||||
|
for (ycount=[0:width-1])
|
||||||
|
for (xcount=[0:length-1]) {
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,0])
|
||||||
|
difference() {
|
||||||
|
cylinder(r=knob_diameter/2,h=block_height*height+knob_height,$fs=cylinder_precision);
|
||||||
|
if (hollow_knob==true)
|
||||||
|
translate([0,0,-roof_thickness])
|
||||||
|
cylinder(r=pin_diameter/2,h=block_height*height+knob_height+2*roof_thickness,$fs=cylinder_precision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// hollow bottom:
|
||||||
|
if (solid_bottom == false)
|
||||||
|
translate([wall_thickness,wall_thickness,-roof_thickness]) cube([overall_length-wall_thickness*2,overall_width-wall_thickness*2,block_height*height]);
|
||||||
|
// flat_top -> groove around bottom
|
||||||
|
if (flat_top == true) {
|
||||||
|
translate([-wall_thickness/2,-wall_thickness*2/3,-wall_thickness/2])
|
||||||
|
cube([overall_length+wall_thickness,wall_thickness,wall_thickness]);
|
||||||
|
translate([-wall_thickness/2,overall_width-wall_thickness/3,-wall_thickness/2])
|
||||||
|
cube([overall_length+wall_thickness,wall_thickness,wall_thickness]);
|
||||||
|
|
||||||
|
translate([-wall_thickness*2/3,-wall_thickness/2,-wall_thickness/2])
|
||||||
|
cube([wall_thickness,overall_width+wall_thickness,wall_thickness]);
|
||||||
|
translate([overall_length-wall_thickness/3,0,-wall_thickness/2])
|
||||||
|
cube([wall_thickness,overall_width+wall_thickness,wall_thickness]);
|
||||||
|
}
|
||||||
|
if (axle_hole==true)
|
||||||
|
if (width>1 && length>1) for (ycount=[1:width-1])
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,roof_thickness]) axle(height);
|
||||||
|
if (circular_hole==true)
|
||||||
|
if (width>1 && length>1) for (ycount=[1:width-1])
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,roof_thickness])
|
||||||
|
cylinder(r=knob_diameter/2, h=height*block_height+roof_thickness/4,$fs=cylinder_precision);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reinforcement==true && width>1 && length>1)
|
||||||
|
difference() {
|
||||||
|
for (ycount=[1:width-1])
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,0]) reinforcement(height);
|
||||||
|
for (ycount=[1:width-1])
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,-roof_thickness/2]) cylinder(r=knob_diameter/2, h=height*block_height+roof_thickness, $fs=cylinder_precision);
|
||||||
|
}
|
||||||
|
// posts:
|
||||||
|
if (solid_bottom == false)
|
||||||
|
if (width>1 && length>1) for (ycount=[1:width-1])
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,ycount*knob_spacing,0]) post(height);
|
||||||
|
|
||||||
|
if (reinforcement == true && width==1 && length!=1)
|
||||||
|
for (xcount=[1:length-1])
|
||||||
|
translate([xcount*knob_spacing,overall_width/2,0]) cylinder(r=pin_diameter/2,h=block_height*height,$fs=cylinder_precision);
|
||||||
|
|
||||||
|
if (reinforcement == true && length==1 && width!=1)
|
||||||
|
for (ycount=[1:width-1])
|
||||||
|
translate([overall_length/2,ycount*knob_spacing,0]) cylinder(r=pin_diameter/2,h=block_height*height,$fs=cylinder_precision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module post(height) {
|
||||||
|
difference() {
|
||||||
|
cylinder(r=post_diameter/2, h=height*block_height-roof_thickness/2,$fs=cylinder_precision);
|
||||||
|
translate([0,0,-roof_thickness/2])
|
||||||
|
cylinder(r=knob_diameter/2, h=height*block_height+roof_thickness/4,$fs=cylinder_precision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module reinforcement(height) {
|
||||||
|
union() {
|
||||||
|
translate([0,0,height*block_height/2]) union() {
|
||||||
|
cube([reinforcing_width,knob_spacing+knob_diameter+wall_thickness/2,height*block_height],center=true);
|
||||||
|
rotate(v=[0,0,1],a=90) cube([reinforcing_width,knob_spacing+knob_diameter+wall_thickness/2,height*block_height], center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module axle(height) {
|
||||||
|
translate([0,0,height*block_height/2]) union() {
|
||||||
|
cube([axle_diameter,axle_spline_width,height*block_height],center=true);
|
||||||
|
cube([axle_spline_width,axle_diameter,height*block_height],center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
//Copyright (C) 2013 Alex Davies
|
||||||
|
//License: LGPL 2.1 or later
|
||||||
|
//todo, make library work with negative lengths by adding triangles to the inside of every surface. basicaly copy and paste the current triangles set and reverse the first and last digit of every triangle. In 4 character traingles switcht the middle ones around as well. Not sure if that' actually useful though.
|
||||||
|
|
||||||
|
module rightpyramid(rightpyramidx, rightpyramidy, rightpyramidz) {
|
||||||
|
polyhedron ( points = [[0,0,0],
|
||||||
|
[rightpyramidx, 0, 0],
|
||||||
|
[0, rightpyramidy, 0],
|
||||||
|
[rightpyramidx, rightpyramidy, 0],
|
||||||
|
[rightpyramidx/2, rightpyramidy, rightpyramidz]],
|
||||||
|
|
||||||
|
triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module cornerpyramid(cornerpyramidx, cornerpyramidy, cornerpyramidz) {
|
||||||
|
polyhedron ( points = [[0,0,0],
|
||||||
|
[cornerpyramidx, 0, 0],
|
||||||
|
[0, cornerpyramidy, 0],
|
||||||
|
[cornerpyramidx, cornerpyramidy, 0],
|
||||||
|
[0, cornerpyramidy, cornerpyramidz]],
|
||||||
|
|
||||||
|
triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module eqlpyramid(eqlpyramidx, eqlpyramidy, eqlpyramidz) {
|
||||||
|
polyhedron ( points = [[0,0,0],
|
||||||
|
[eqlpyramidx, 0, 0],
|
||||||
|
[0, eqlpyramidy, 0],
|
||||||
|
[eqlpyramidx, eqlpyramidy, 0],
|
||||||
|
[eqlpyramidx/2, eqlpyramidy/2, eqlpyramidz]],
|
||||||
|
|
||||||
|
triangles = [[0,1,2],[2,1,3],[4,1,0],[3,1,4],[2,3,4],[0,2,4]]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module rightprism(rightprismx,rightprismy,rightprismz){
|
||||||
|
polyhedron ( points = [[0,0,0],
|
||||||
|
[rightprismx,0,0],
|
||||||
|
[rightprismx,rightprismy,0],
|
||||||
|
[0,rightprismy,0],
|
||||||
|
[0,rightprismy,rightprismz],
|
||||||
|
[0,0,rightprismz]],
|
||||||
|
triangles = [[0,1,2,3],[5,1,0],[5,4,2,1],[4,3,2],[0,3,4,5]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module eqlprism(rightprismx,rightprismy,rightprismz){
|
||||||
|
polyhedron ( points = [[0,0,0],
|
||||||
|
[rightprismx,0,0],
|
||||||
|
[rightprismx,rightprismy,0],
|
||||||
|
[0,rightprismy,0],
|
||||||
|
[rightprismx/2,rightprismy,rightprismz],
|
||||||
|
[rightprismx/2,0,rightprismz]],
|
||||||
|
triangles = [[0,1,2,3],[5,1,0],[5,4,2,1],[4,3,2],[0,3,4,5]]);
|
||||||
|
}
|
||||||
|
|
@ -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,111 @@
|
|||||||
|
/*
|
||||||
|
* OpenSCAD Metric Fastners Library (www.openscad.org)
|
||||||
|
* Copyright (C) 2010-2011 Giles Bathgate
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License,
|
||||||
|
* LGPL version 2.1, or (at your option) any later version of the GPL.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$fn=50;
|
||||||
|
apply_chamfer=true;
|
||||||
|
|
||||||
|
module cap_bolt(dia,len)
|
||||||
|
{
|
||||||
|
e=1.5*dia;
|
||||||
|
h1=1.25*dia;
|
||||||
|
cylinder(r=dia/2,h=len);
|
||||||
|
translate([0,0,-h1]) cylinder(r=e/2,h=h1);
|
||||||
|
}
|
||||||
|
|
||||||
|
module csk_bolt(dia,len)
|
||||||
|
{
|
||||||
|
h1=0.6*dia;
|
||||||
|
h2=len-h1;
|
||||||
|
cylinder(r=dia/2,h=h2);
|
||||||
|
cylinder(r1=dia,r2=dia/2,h=h1);
|
||||||
|
}
|
||||||
|
|
||||||
|
module washer(dia)
|
||||||
|
{
|
||||||
|
t=0.1*dia;
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
cylinder(r=dia,h=t);
|
||||||
|
translate([0,0,-t/2])cylinder(r=dia/2,h=t*2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module flat_nut(dia)
|
||||||
|
{
|
||||||
|
m=0.8*dia;
|
||||||
|
e=1.8*dia;
|
||||||
|
c=0.2*dia;
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
cylinder(r=e/2,h=m,$fn=6);
|
||||||
|
translate([0,0,-m/2])cylinder(r=dia/2,h=m*2);
|
||||||
|
if(apply_chamfer)
|
||||||
|
translate([0,0,c])cylinder_chamfer(e/2,c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module bolt(dia,len)
|
||||||
|
{
|
||||||
|
e=1.8*dia;
|
||||||
|
k=0.7*dia;
|
||||||
|
c=0.2*dia;
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
cylinder(r=e/2,h=k,$fn=6);
|
||||||
|
if(apply_chamfer)
|
||||||
|
translate([0,0,c])cylinder_chamfer(e/2,c);
|
||||||
|
}
|
||||||
|
|
||||||
|
cylinder(r=dia/2,h=len);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module cylinder_chamfer(r1,r2)
|
||||||
|
{
|
||||||
|
t=r1-r2;
|
||||||
|
p=r2*2;
|
||||||
|
rotate_extrude()
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
translate([t,-p])square([p,p]);
|
||||||
|
translate([t,0])circle(r2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module chamfer(len,r)
|
||||||
|
{
|
||||||
|
p=r*2;
|
||||||
|
linear_extrude(height=len)
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
square([p,p]);
|
||||||
|
circle(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
//csk_bolt(3,14);
|
||||||
|
//washer(3);
|
||||||
|
//flat_nut(3);
|
||||||
|
//bolt(4,14);
|
||||||
|
//cylinder_chamfer(8,1);
|
||||||
|
//chamfer(10,2);
|
||||||
|
}
|
@ -0,0 +1,98 @@
|
|||||||
|
// Copyright 2010 D1plo1d
|
||||||
|
|
||||||
|
// This library is dual licensed under the GPL 3.0 and the GNU Lesser General Public License as per http://creativecommons.org/licenses/LGPL/2.1/ .
|
||||||
|
|
||||||
|
include <math.scad>
|
||||||
|
|
||||||
|
|
||||||
|
//generates a motor mount for the specified nema standard #.
|
||||||
|
module stepper_motor_mount(nema_standard,slide_distance=0, mochup=true, tolerance=0) {
|
||||||
|
//dimensions from:
|
||||||
|
// http://www.numberfactory.com/NEMA%20Motor%20Dimensions.htm
|
||||||
|
if (nema_standard == 17)
|
||||||
|
{
|
||||||
|
_stepper_motor_mount(
|
||||||
|
motor_shaft_diameter = 0.1968*mm_per_inch,
|
||||||
|
motor_shaft_length = 0.945*mm_per_inch,
|
||||||
|
pilot_diameter = 0.866*mm_per_inch,
|
||||||
|
pilot_length = 0.80*mm_per_inch,
|
||||||
|
mounting_bolt_circle = 1.725*mm_per_inch,
|
||||||
|
bolt_hole_size = 3.5,
|
||||||
|
bolt_hole_distance = 1.220*mm_per_inch,
|
||||||
|
slide_distance = slide_distance,
|
||||||
|
mochup = mochup,
|
||||||
|
tolerance=tolerance);
|
||||||
|
}
|
||||||
|
if (nema_standard == 23)
|
||||||
|
{
|
||||||
|
_stepper_motor_mount(
|
||||||
|
motor_shaft_diameter = 0.250*mm_per_inch,
|
||||||
|
motor_shaft_length = 0.81*mm_per_inch,
|
||||||
|
pilot_diameter = 1.500*mm_per_inch,
|
||||||
|
pilot_length = 0.062*mm_per_inch,
|
||||||
|
mounting_bolt_circle = 2.625*mm_per_inch,
|
||||||
|
bolt_hole_size = 0.195*mm_per_inch,
|
||||||
|
bolt_hole_distance = 1.856*mm_per_inch,
|
||||||
|
slide_distance = slide_distance,
|
||||||
|
mochup = mochup,
|
||||||
|
tolerance=tolerance);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//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,
|
||||||
|
tolerance = 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
// == centered mount points ==
|
||||||
|
//mounting circle inset
|
||||||
|
translate([0,slide_distance/2,0]) circle(r = pilot_diameter/2 + tolerance);
|
||||||
|
square([pilot_diameter,slide_distance],center=true);
|
||||||
|
translate([0,-slide_distance/2,0]) circle(r = pilot_diameter/2 + tolerance);
|
||||||
|
|
||||||
|
//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 + tolerance);
|
||||||
|
translate([0,-slide_distance/2,0]) circle(bolt_hole_size/2 + tolerance);
|
||||||
|
square([bolt_hole_size+2*tolerance,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,29 @@
|
|||||||
|
/*
|
||||||
|
* Multiplication along certain curves
|
||||||
|
*
|
||||||
|
* Copyright by Elmo Mäntynen, 2012.
|
||||||
|
* Licenced under LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
include <units.scad>
|
||||||
|
|
||||||
|
use <utilities.scad>
|
||||||
|
|
||||||
|
// TODO check that the axis parameter works as intended
|
||||||
|
// Duplicate everything $no of times around an $axis, for $angle/360 rounds
|
||||||
|
module spin(no, angle=360, axis=Z){
|
||||||
|
for (i = [1:no]){
|
||||||
|
rotate(normalized_axis(axis)*angle*no/i) union(){
|
||||||
|
for (i = [0 : $children-1]) child(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Doesn't work currently
|
||||||
|
module duplicate(axis=Z) spin(no=2, axis=axis) child(0);
|
||||||
|
|
||||||
|
module linear_multiply(no, separation, axis=Z){
|
||||||
|
for (i = [0:no-1]){
|
||||||
|
translate(i*separation*axis) child(0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,183 @@
|
|||||||
|
// Copyright 2010 D1plo1d
|
||||||
|
|
||||||
|
// This library is dual licensed under the GPL 3.0 and the GNU Lesser General Public License as per http://creativecommons.org/licenses/LGPL/2.1/ .
|
||||||
|
|
||||||
|
//testNutsAndBolts();
|
||||||
|
|
||||||
|
module SKIPtestNutsAndBolts()
|
||||||
|
{
|
||||||
|
$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]);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
import py
|
||||||
|
import os.path
|
||||||
|
from openscad_utils import *
|
||||||
|
|
||||||
|
|
||||||
|
temppath = py.test.ensuretemp('MCAD')
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
if "modpath" in metafunc.funcargnames:
|
||||||
|
for fpath, modnames in collect_test_modules().items():
|
||||||
|
basename = os.path.splitext(os.path.split(str(fpath))[1])[0]
|
||||||
|
#os.system("cp %s %s/" % (fpath, temppath))
|
||||||
|
if "modname" in metafunc.funcargnames:
|
||||||
|
for modname in modnames:
|
||||||
|
print modname
|
||||||
|
metafunc.addcall(id=basename+"/"+modname, funcargs=dict(modname=modname, modpath=fpath))
|
||||||
|
else:
|
||||||
|
metafunc.addcall(id=os.path.split(str(fpath))[1], funcargs=dict(modpath=fpath))
|
||||||
|
|
||||||
|
|
||||||
|
def test_module_compile(modname, modpath):
|
||||||
|
tempname = modpath.basename + '-' + modname + '.scad'
|
||||||
|
fpath = temppath.join(tempname)
|
||||||
|
stlpath = temppath.join(tempname + ".stl")
|
||||||
|
f = fpath.open('w')
|
||||||
|
code = """
|
||||||
|
//generated testfile
|
||||||
|
use <%s>
|
||||||
|
|
||||||
|
%s();
|
||||||
|
""" % (modpath, modname)
|
||||||
|
print code
|
||||||
|
f.write(code)
|
||||||
|
f.flush()
|
||||||
|
output = call_openscad(path=fpath, stlpath=stlpath, timeout=15)
|
||||||
|
print output
|
||||||
|
assert output[0] is 0
|
||||||
|
for s in ("warning", "error"):
|
||||||
|
assert s not in output[2].strip().lower()
|
||||||
|
assert len(stlpath.readlines()) > 2
|
||||||
|
|
||||||
|
def test_file_compile(modpath):
|
||||||
|
stlpath = temppath.join(modpath.basename + "-test.stl")
|
||||||
|
output = call_openscad(path=modpath, stlpath=stlpath)
|
||||||
|
print output
|
||||||
|
assert output[0] is 0
|
||||||
|
for s in ("warning", "error"):
|
||||||
|
assert s not in output[2].strip().lower()
|
||||||
|
assert len(stlpath.readlines()) == 2
|
||||||
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
import py, re, os, signal, time, commands, sys
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
|
mod_re = (r"\bmodule\s+(", r")\s*\(\s*")
|
||||||
|
func_re = (r"\bfunction\s+(", r")\s*\(")
|
||||||
|
|
||||||
|
def extract_definitions(fpath, name_re=r"\w+", def_re=""):
|
||||||
|
regex = name_re.join(def_re)
|
||||||
|
matcher = re.compile(regex)
|
||||||
|
return (m.group(1) for m in matcher.finditer(fpath.read()))
|
||||||
|
|
||||||
|
def extract_mod_names(fpath, name_re=r"\w+"):
|
||||||
|
return extract_definitions(fpath, name_re=name_re, def_re=mod_re)
|
||||||
|
|
||||||
|
def extract_func_names(fpath, name_re=r"\w+"):
|
||||||
|
return extract_definitions(fpath, name_re=name_re, def_re=func_re)
|
||||||
|
|
||||||
|
def collect_test_modules(dirpath=None):
|
||||||
|
dirpath = dirpath or 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
|
||||||
|
|
||||||
|
class Timeout(Exception): pass
|
||||||
|
|
||||||
|
def call_openscad(path, stlpath, timeout=5):
|
||||||
|
if sys.platform == 'darwin': exe = 'OpenSCAD.app/Contents/MacOS/OpenSCAD'
|
||||||
|
else: exe = 'openscad'
|
||||||
|
command = [exe, '-s', str(stlpath), str(path)]
|
||||||
|
print command
|
||||||
|
if timeout:
|
||||||
|
try:
|
||||||
|
proc = Popen(command,
|
||||||
|
stdout=PIPE, stderr=PIPE, close_fds=True)
|
||||||
|
calltime = time.time()
|
||||||
|
time.sleep(0.05)
|
||||||
|
#print calltime
|
||||||
|
while True:
|
||||||
|
if proc.poll() is not None:
|
||||||
|
break
|
||||||
|
time.sleep(0.5)
|
||||||
|
#print time.time()
|
||||||
|
if time.time() > calltime + timeout:
|
||||||
|
raise Timeout()
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
proc.terminate()
|
||||||
|
proc.kill()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return (proc.returncode,) + proc.communicate()
|
||||||
|
else:
|
||||||
|
output = commands.getstatusoutput(" ".join(command))
|
||||||
|
return output + ('', '')
|
||||||
|
|
||||||
|
def parse_output(text):
|
||||||
|
pass
|
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2011 Nophead (of RepRap fame)
|
||||||
|
// This file is licensed under the terms of Creative Commons Attribution 3.0 Unported.
|
||||||
|
|
||||||
|
// Using this holes should come out approximately right when printed
|
||||||
|
module polyhole(h, d) {
|
||||||
|
n = max(round(2 * d),3);
|
||||||
|
rotate([0,0,180])
|
||||||
|
cylinder(h = h, r = (d / 2) / cos (180 / n), $fn = n);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_polyhole(){
|
||||||
|
difference() {
|
||||||
|
cube(size = [100,27,3]);
|
||||||
|
union() {
|
||||||
|
for(i = [1:10]) {
|
||||||
|
translate([(i * i + i)/2 + 3 * i , 8,-1])
|
||||||
|
polyhole(h = 5, d = i);
|
||||||
|
|
||||||
|
assign(d = i + 0.5)
|
||||||
|
translate([(d * d + d)/2 + 3 * d, 19,-1])
|
||||||
|
polyhole(h = 5, d = d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,248 @@
|
|||||||
|
/*
|
||||||
|
* OpenSCAD Shapes Library (www.openscad.org)
|
||||||
|
* Copyright (C) 2010-2011 Giles Bathgate, Elmo Mäntynen
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License,
|
||||||
|
* LGPL version 2.1, or (at your option) any later version of the GPL.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 2D regular shapes
|
||||||
|
|
||||||
|
module triangle(radius)
|
||||||
|
{
|
||||||
|
o=radius/2; //equivalent to radius*sin(30)
|
||||||
|
a=radius*sqrt(3)/2; //equivalent to radius*cos(30)
|
||||||
|
polygon(points=[[-a,-o],[0,radius],[a,-o]],paths=[[0,1,2]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module reg_polygon(sides,radius)
|
||||||
|
{
|
||||||
|
function dia(r) = sqrt(pow(r*2,2)/2); //sqrt((r*2^2)/2) if only we had an exponention op
|
||||||
|
if(sides<2) square([radius,0]);
|
||||||
|
if(sides==3) triangle(radius);
|
||||||
|
if(sides==4) square([dia(radius),dia(radius)],center=true);
|
||||||
|
if(sides>4) circle(r=radius,$fn=sides);
|
||||||
|
}
|
||||||
|
|
||||||
|
module pentagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(5,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hexagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(6,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module heptagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(7,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module octagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(8,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module nonagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(9,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module decagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(10,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hendecagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(11,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module dodecagon(radius)
|
||||||
|
{
|
||||||
|
reg_polygon(12,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module ring(inside_diameter, thickness){
|
||||||
|
difference(){
|
||||||
|
circle(r=(inside_diameter+thickness*2)/2);
|
||||||
|
circle(r=inside_diameter/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module ellipse(width, height) {
|
||||||
|
scale([1, height/width, 1]) circle(r=width/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ratio of lenght and width is about 1.39 for a real egg
|
||||||
|
module egg_outline(width, length){
|
||||||
|
translate([0, width/2, 0]) union(){
|
||||||
|
rotate([0, 0, 180]) difference(){
|
||||||
|
ellipse(width, 2*length-width);
|
||||||
|
translate([-length/2, 0, 0]) square(length);
|
||||||
|
}
|
||||||
|
circle(r=width/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//3D regular shapes
|
||||||
|
|
||||||
|
module cone(height, radius, center = false)
|
||||||
|
{
|
||||||
|
cylinder(height, radius, 0, center);
|
||||||
|
}
|
||||||
|
|
||||||
|
module oval_prism(height, rx, ry, center = false)
|
||||||
|
{
|
||||||
|
scale([1, rx/ry, 1]) cylinder(h=height, r=ry, center=center);
|
||||||
|
}
|
||||||
|
|
||||||
|
module oval_tube(height, rx, ry, wall, center = false)
|
||||||
|
{
|
||||||
|
difference() {
|
||||||
|
scale([1, ry/rx, 1]) cylinder(h=height, r=rx, center=center);
|
||||||
|
translate([0,0,-height/2]) scale([(rx-wall)/rx, (ry-wall)/rx, 2]) cylinder(h=height, r=rx, center=center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module cylinder_tube(height, radius, wall, center = false)
|
||||||
|
{
|
||||||
|
tubify(radius,wall)
|
||||||
|
cylinder(h=height, r=radius, center=center);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tubifies any regular prism
|
||||||
|
module tubify(radius,wall)
|
||||||
|
{
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
child(0);
|
||||||
|
translate([0, 0, -0.1]) scale([(radius-wall)/radius, (radius-wall)/radius, 2]) child(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module triangle_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) triangle(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module triangle_tube(height,radius,wall)
|
||||||
|
{
|
||||||
|
tubify(radius,wall) triangle_prism(height,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module pentagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) pentagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module pentagon_tube(height,radius,wall)
|
||||||
|
{
|
||||||
|
tubify(radius,wall) pentagon_prism(height,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hexagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) hexagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hexagon_tube(height,radius,wall)
|
||||||
|
{
|
||||||
|
tubify(radius,wall) hexagon_prism(height,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module heptagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) heptagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module heptagon_tube(height,radius,wall)
|
||||||
|
{
|
||||||
|
tubify(radius,wall) heptagon_prism(height,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module octagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) octagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module octagon_tube(height,radius,wall)
|
||||||
|
{
|
||||||
|
tubify(radius,wall) octagon_prism(height,radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module nonagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) nonagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module decagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) decagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hendecagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) hendecagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module dodecagon_prism(height,radius)
|
||||||
|
{
|
||||||
|
linear_extrude(height=height) dodecagon(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
module torus(outerRadius, innerRadius)
|
||||||
|
{
|
||||||
|
r=(outerRadius-innerRadius)/2;
|
||||||
|
rotate_extrude() translate([innerRadius+r,0,0]) circle(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
module torus2(r1, r2)
|
||||||
|
{
|
||||||
|
rotate_extrude() translate([r1,0,0]) circle(r2);
|
||||||
|
}
|
||||||
|
|
||||||
|
module oval_torus(inner_radius, thickness=[0, 0])
|
||||||
|
{
|
||||||
|
rotate_extrude() translate([inner_radius+thickness[0]/2,0,0]) ellipse(width=thickness[0], height=thickness[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module triangle_pyramid(radius)
|
||||||
|
{
|
||||||
|
o=radius/2; //equivalent to radius*sin(30)
|
||||||
|
a=radius*sqrt(3)/2; //equivalent to radius*cos(30)
|
||||||
|
polyhedron(points=[[-a,-o,-o],[a,-o,-o],[0,radius,-o],[0,0,radius]],triangles=[[0,1,2],[1,2,3],[0,1,3],[0,2,3]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module square_pyramid(base_x, base_y,height)
|
||||||
|
{
|
||||||
|
w=base_x/2;
|
||||||
|
h=base_y/2;
|
||||||
|
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,height]],triangles=[[0,3,2,1], [0,1,4], [1,2,4], [2,3,4], [3,0,4]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module egg(width, lenght){
|
||||||
|
rotate_extrude()
|
||||||
|
difference(){
|
||||||
|
egg_outline(width, lenght);
|
||||||
|
translate([-lenght, 0, 0]) cube(2*lenght, center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests:
|
||||||
|
|
||||||
|
test_square_pyramid(){square_pyramid(10, 20, 30);}
|
@ -0,0 +1,64 @@
|
|||||||
|
// Parametric screw-like things (ball screws, augers)
|
||||||
|
// License: GNU LGPL 2.1 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_radius, inner_radius, taper_ratio = 0.25) {
|
||||||
|
union(){
|
||||||
|
helix(pitch, length)
|
||||||
|
polygon(points=[[0,inner_radius],[outside_radius,(inner_radius * taper_ratio)],[outside_radius,(inner_radius * -1 * taper_ratio)],[0,(-1 * inner_radius)]], paths=[[0,1,2,3]]);
|
||||||
|
cylinder(h=length, r=inner_radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_auger(){translate([50, 0, 0]) auger(40, 80, 25, 5);}
|
||||||
|
|
||||||
|
|
||||||
|
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,108 @@
|
|||||||
|
/**
|
||||||
|
* Servo outline library
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* - Eero 'rambo' af Heurlin 2010-
|
||||||
|
*
|
||||||
|
* License: LGPL 2.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
use <triangles.scad>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align DS420 digital servo
|
||||||
|
*
|
||||||
|
* @param vector position The position vector
|
||||||
|
* @param vector rotation The rotation vector
|
||||||
|
* @param boolean screws If defined then "screws" will be added and when the module is differenced() from something if will have holes for the screws
|
||||||
|
* @param number axle_lenght If defined this will draw "backgound" indicator for the main axle
|
||||||
|
*/
|
||||||
|
module alignds420(position, rotation, screws = 0, axle_lenght = 0)
|
||||||
|
{
|
||||||
|
translate(position)
|
||||||
|
{
|
||||||
|
rotate(rotation)
|
||||||
|
{
|
||||||
|
union()
|
||||||
|
{
|
||||||
|
// Main axle
|
||||||
|
translate([0,0,17])
|
||||||
|
{
|
||||||
|
cylinder(r=6, h=8, $fn=30);
|
||||||
|
cylinder(r=2.5, h=10.5, $fn=20);
|
||||||
|
}
|
||||||
|
// Box and ears
|
||||||
|
translate([-6,-6,0])
|
||||||
|
{
|
||||||
|
cube([12, 22.8,19.5], false);
|
||||||
|
translate([0,-5, 17])
|
||||||
|
{
|
||||||
|
cube([12, 7, 2.5]);
|
||||||
|
}
|
||||||
|
translate([0, 20.8, 17])
|
||||||
|
{
|
||||||
|
cube([12, 7, 2.5]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (screws > 0)
|
||||||
|
{
|
||||||
|
translate([0,(-10.2 + 1.8),11.5])
|
||||||
|
{
|
||||||
|
# cylinder(r=1.8/2, h=6, $fn=6);
|
||||||
|
}
|
||||||
|
translate([0,(21.0 - 1.8),11.5])
|
||||||
|
{
|
||||||
|
# cylinder(r=1.8/2, h=6, $fn=6);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// The large slope
|
||||||
|
translate([-6,0,19])
|
||||||
|
{
|
||||||
|
rotate([90,0,90])
|
||||||
|
{
|
||||||
|
triangle(4, 18, 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This seems to get too complex fast
|
||||||
|
// Small additional axes
|
||||||
|
translate([0,6,17])
|
||||||
|
{
|
||||||
|
cylinder(r=2.5, h=6, $fn=10);
|
||||||
|
cylinder(r=1.25, h=8, $fn=10);
|
||||||
|
}
|
||||||
|
// Small slope
|
||||||
|
difference()
|
||||||
|
{
|
||||||
|
translate([-6,-6,19.0])
|
||||||
|
{
|
||||||
|
cube([12,6.5,4]);
|
||||||
|
}
|
||||||
|
translate([7,-7,24.0])
|
||||||
|
{
|
||||||
|
rotate([-90,0,90])
|
||||||
|
{
|
||||||
|
triangle(3, 8, 14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// So we render a cube instead of the small slope on a cube
|
||||||
|
translate([-6,-6,19.0])
|
||||||
|
{
|
||||||
|
cube([12,6.5,4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (axle_lenght > 0)
|
||||||
|
{
|
||||||
|
% cylinder(r=0.9, h=axle_lenght, center=true, $fn=8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests:
|
||||||
|
module test_alignds420(){alignds420(screws=1);}
|
@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
* OpenSCAD Shapes Library (www.openscad.org)
|
||||||
|
* Copyright (C) 2009 Catarina Mota
|
||||||
|
* Copyright (C) 2010 Elmo Mäntynen
|
||||||
|
*
|
||||||
|
* License: LGPL 2.1 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 2D Shapes
|
||||||
|
//ngon(sides, radius, center=false);
|
||||||
|
|
||||||
|
// 3D Shapes
|
||||||
|
//box(width, height, depth);
|
||||||
|
//roundedBox(width, height, depth, factor);
|
||||||
|
//cone(height, radius);
|
||||||
|
//ellipticalCylinder(width, height, depth);
|
||||||
|
//ellipsoid(width, height);
|
||||||
|
//tube(height, radius, wall, center = false);
|
||||||
|
//tube2(height, ID, OD, center = false);
|
||||||
|
//ovalTube(width, height, depth, wall, center = false);
|
||||||
|
//hexagon(height, depth);
|
||||||
|
//octagon(height, depth);
|
||||||
|
//dodecagon(height, depth);
|
||||||
|
//hexagram(height, depth);
|
||||||
|
//rightTriangle(adjacent, opposite, depth);
|
||||||
|
//equiTriangle(side, depth);
|
||||||
|
//12ptStar(height, depth);
|
||||||
|
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
// size is a vector [w, h, d]
|
||||||
|
module box(width, height, depth) {
|
||||||
|
cube([width, height, depth], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// size is a vector [w, h, d]
|
||||||
|
module roundedBox(width, height, depth, radius) {
|
||||||
|
size=[width, height, depth];
|
||||||
|
cube(size - [2*radius,0,0], true);
|
||||||
|
cube(size - [0,2*radius,0], true);
|
||||||
|
for (x = [radius-size[0]/2, -radius+size[0]/2],
|
||||||
|
y = [radius-size[1]/2, -radius+size[1]/2]) {
|
||||||
|
translate([x,y,0]) cylinder(r=radius, h=size[2], center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module cone(height, radius, center = false) {
|
||||||
|
cylinder(height, radius, 0, center);
|
||||||
|
}
|
||||||
|
|
||||||
|
module ellipticalCylinder(w,h, height, center = false) {
|
||||||
|
scale([1, h/w, 1]) cylinder(h=height, r=w, center=center);
|
||||||
|
}
|
||||||
|
|
||||||
|
module ellipsoid(w, h, center = false) {
|
||||||
|
scale([1, h/w, 1]) sphere(r=w/2, center=center);
|
||||||
|
}
|
||||||
|
|
||||||
|
// wall is wall thickness
|
||||||
|
module tube(height, radius, wall, center = false) {
|
||||||
|
difference() {
|
||||||
|
cylinder(h=height, r=radius, center=center);
|
||||||
|
cylinder(h=height, r=radius-wall, center=center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wall is wall thickness
|
||||||
|
module tube2(height, ID, OD, center = false) {
|
||||||
|
difference() {
|
||||||
|
cylinder(h=height, r=OD/2, center=center);
|
||||||
|
cylinder(h=height, r=ID/2, center=center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wall is wall thickness
|
||||||
|
module ovalTube(height, rx, ry, wall, center = false) {
|
||||||
|
difference() {
|
||||||
|
scale([1, ry/rx, 1]) cylinder(h=height, r=rx, center=center);
|
||||||
|
scale([(rx-wall)/rx, (ry-wall)/rx, 1]) cylinder(h=height, r=rx, center=center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// size is the XY plane size, height in Z
|
||||||
|
module hexagon(size, height) {
|
||||||
|
boxWidth = size/1.75;
|
||||||
|
for (r = [-60, 0, 60]) rotate([0,0,r]) cube([boxWidth, size, height], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// size is the XY plane size, height in Z
|
||||||
|
module octagon(size, height) {
|
||||||
|
intersection() {
|
||||||
|
cube([size, size, height], true);
|
||||||
|
rotate([0,0,45]) cube([size, size, height], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// size is the XY plane size, height in Z
|
||||||
|
module dodecagon(size, height) {
|
||||||
|
intersection() {
|
||||||
|
hexagon(size, height);
|
||||||
|
rotate([0,0,90]) hexagon(size, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// size is the XY plane size, height in Z
|
||||||
|
module hexagram(size, height) {
|
||||||
|
boxWidth=size/1.75;
|
||||||
|
for (v = [[0,1],[0,-1],[1,-1]]) {
|
||||||
|
intersection() {
|
||||||
|
rotate([0,0,60*v[0]]) cube([size, boxWidth, height], true);
|
||||||
|
rotate([0,0,60*v[1]]) cube([size, boxWidth, height], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module rightTriangle(adjacent, opposite, height) {
|
||||||
|
difference() {
|
||||||
|
translate([-adjacent/2,opposite/2,0]) cube([adjacent, opposite, height], true);
|
||||||
|
translate([-adjacent,0,0]) {
|
||||||
|
rotate([0,0,atan(opposite/adjacent)]) dislocateBox(adjacent*2, opposite, height+2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module equiTriangle(side, height) {
|
||||||
|
difference() {
|
||||||
|
translate([-side/2,side/2,0]) cube([side, side, height], true);
|
||||||
|
rotate([0,0,30]) dislocateBox(side*2, side, height);
|
||||||
|
translate([-side,0,0]) {
|
||||||
|
rotate([0,0,60]) dislocateBox(side*2, side, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module 12ptStar(size, height) {
|
||||||
|
starNum = 3;
|
||||||
|
starAngle = 360/starNum;
|
||||||
|
for (s = [1:starNum]) {
|
||||||
|
rotate([0, 0, s*starAngle]) cube([size, size, height], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
//MOVES THE ROTATION AXIS OF A BOX FROM ITS CENTER TO THE BOTTOM LEFT CORNER
|
||||||
|
module dislocateBox(w, h, d) {
|
||||||
|
translate([0,0,-d/2]) cube([w,h,d]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// Tests
|
||||||
|
//module test2D_ellipse(){ellipse(10, 5);}
|
||||||
|
module test_ellipsoid(){ellipsoid(10, 5);}
|
||||||
|
|
||||||
|
//module test2D_egg_outline(){egg_outline();}
|
@ -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,45 @@
|
|||||||
|
/* From http://www.thingiverse.com/thing:3457
|
||||||
|
© 2010 whosawhatsis
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
This script generates a teardrop shape at the appropriate angle to prevent overhangs greater than 45 degrees. The angle is in degrees, and is a rotation around the Y axis. You can then rotate around Z to point it in any direction. Rotation around X or Y will cause the angle to be wrong.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module teardrop(radius, length, angle) {
|
||||||
|
rotate([0, angle, 0]) union() {
|
||||||
|
linear_extrude(height = length, center = true, convexity = radius, twist = 0)
|
||||||
|
circle(r = radius, center = true, $fn = 30);
|
||||||
|
linear_extrude(height = length, center = true, convexity = radius, twist = 0)
|
||||||
|
projection(cut = false) rotate([0, -angle, 0]) translate([0, 0, radius * sin(45) * 1.5]) cylinder(h = radius * sin(45), r1 = radius * sin(45), r2 = 0, center = true, $fn = 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
//I worked this portion out when a bug was causing the projection above to take FOREVER to calculate. It works as a replacement, and I figured I'd leave it here just in case.
|
||||||
|
/*
|
||||||
|
#polygon(points = [[radius * cos(-angle / 2), radius * sin(-angle / 2), 0],[radius * cos(-angle / 2), radius * -sin(-angle / 2), 0],[(sin(-angle - 45) + cos(-angle - 45)) * radius, 0, 0]], paths = [[0, 1, 2]]);
|
||||||
|
#polygon(points = [[radius * -cos(-angle / 2), radius * sin(-angle / 2), 0],[radius * -cos(-angle / 2), radius * -sin(-angle / 2), 0],[(sin(-angle - 45) + cos(-angle - 45)) * radius, 0, 0]], paths = [[0, 1, 2]]);
|
||||||
|
#polygon(points = [[radius * sin(-angle / 2), radius * cos(-angle / 2), 0],[radius * sin(-angle / 2), radius * -cos(-angle / 2), 0],[(sin(-angle - 45) + cos(-angle - 45)) * radius, 0, 0]], paths = [[0, 1, 2]]);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_teardrop(){
|
||||||
|
translate([0, -15, 0]) teardrop(5, 20, 90);
|
||||||
|
translate([0, 0, 0]) teardrop(5, 20, 60);
|
||||||
|
translate([0, 15, 0]) teardrop(5, 20, 45);
|
||||||
|
}
|
||||||
|
|
||||||
|
//test_teardrop();
|
@ -0,0 +1,18 @@
|
|||||||
|
import py
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
dirpath = py.path.local("./")
|
||||||
|
|
||||||
|
def pytest_generate_tests(metafunc):
|
||||||
|
if "filename" in metafunc.funcargnames:
|
||||||
|
for fpath in dirpath.visit('*.scad'):
|
||||||
|
metafunc.addcall(id=fpath.basename, funcargs=dict(filename=fpath.basename))
|
||||||
|
for fpath in dirpath.visit('*.py'):
|
||||||
|
name = fpath.basename
|
||||||
|
if not (name.startswith('test_') or name.startswith('_')):
|
||||||
|
metafunc.addcall(id=fpath.basename, funcargs=dict(filename=fpath.basename))
|
||||||
|
|
||||||
|
def test_README(filename):
|
||||||
|
README = dirpath.join('README').read()
|
||||||
|
|
||||||
|
assert filename in README
|
@ -0,0 +1 @@
|
|||||||
|
from openscad_testing import *
|
@ -0,0 +1,6 @@
|
|||||||
|
// License: GNU LGPL 2.1 or later.
|
||||||
|
// © 2010 by Elmo Mäntynen
|
||||||
|
|
||||||
|
module local_scale(v, reference=[0, 0, 0]) {
|
||||||
|
translate(-reference) scale(v) translate(reference) child(0);
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* Simple triangles library
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* - Eero 'rambo' af Heurlin 2010-
|
||||||
|
*
|
||||||
|
* License: LGPL 2.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard right-angled triangle
|
||||||
|
*
|
||||||
|
* @param number o_len Lenght of the opposite side
|
||||||
|
* @param number a_len Lenght of the adjacent side
|
||||||
|
* @param number depth How wide/deep the triangle is in the 3rd dimension
|
||||||
|
* @todo a better way ?
|
||||||
|
*/
|
||||||
|
module triangle(o_len, a_len, depth)
|
||||||
|
{
|
||||||
|
linear_extrude(height=depth)
|
||||||
|
{
|
||||||
|
polygon(points=[[0,0],[a_len,0],[0,o_len]], paths=[[0,1,2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard right-angled triangle (tangent version)
|
||||||
|
*
|
||||||
|
* @param number angle of adjacent to hypotenuse (ie tangent)
|
||||||
|
* @param number a_len Lenght of the adjacent side
|
||||||
|
* @param number depth How wide/deep the triangle is in the 3rd dimension
|
||||||
|
*/
|
||||||
|
module a_triangle(tan_angle, a_len, depth)
|
||||||
|
{
|
||||||
|
linear_extrude(height=depth)
|
||||||
|
{
|
||||||
|
polygon(points=[[0,0],[a_len,0],[0,tan(tan_angle) * a_len]], paths=[[0,1,2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests:
|
||||||
|
module test_triangle() { triangle(5, 5, 5); }
|
||||||
|
module test_a_triangle() { a_triangle(45, 5, 5); }
|
||||||
|
module test_triangles()
|
||||||
|
{
|
||||||
|
// Generate a bunch of triangles by sizes
|
||||||
|
for (i = [1:10])
|
||||||
|
{
|
||||||
|
translate([i*7, -30, i*7])
|
||||||
|
{
|
||||||
|
triangle(i*5, sqrt(i*5+pow(i,2)), 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a bunch of triangles by angle
|
||||||
|
for (i = [1:85/5])
|
||||||
|
{
|
||||||
|
translate([i*7, 22, i*7])
|
||||||
|
{
|
||||||
|
a_triangle(i*5, 10, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,290 @@
|
|||||||
|
//===========================================
|
||||||
|
// Public Domain Epi- and Hypo- trochoids in OpenSCAD
|
||||||
|
// version 1.0
|
||||||
|
// by Matt Moses, 2011, mmoses152@gmail.com
|
||||||
|
// http://www.thingiverse.com/thing:8067
|
||||||
|
//
|
||||||
|
// This file is public domain. Use it for any purpose, including commercial
|
||||||
|
// applications. Attribution would be nice, but is not required. There is
|
||||||
|
// no warranty of any kind, including its correctness, usefulness, or safety.
|
||||||
|
//
|
||||||
|
// An EPITROCHOID is a curve traced by a point
|
||||||
|
// fixed at a distance "d"
|
||||||
|
// to the center of a circle of radius "r"
|
||||||
|
// as the circle rolls
|
||||||
|
// outside another circle of radius "R".
|
||||||
|
//
|
||||||
|
// An HYPOTROCHOID is a curve traced by a point
|
||||||
|
// fixed at a distance "d"
|
||||||
|
// to the center of a circle of radius "r"
|
||||||
|
// as the circle rolls
|
||||||
|
// inside another circle of radius "R".
|
||||||
|
//
|
||||||
|
// An EPICYCLOID is an epitrochoid with d = r.
|
||||||
|
//
|
||||||
|
// An HYPOCYCLOID is an hypotrochoid with d = r.
|
||||||
|
//
|
||||||
|
// See http://en.wikipedia.org/wiki/Epitrochoid
|
||||||
|
// and http://en.wikipedia.org/wiki/Hypotrochoid
|
||||||
|
//
|
||||||
|
// Beware the polar forms of the equations on Wikipedia...
|
||||||
|
// They are correct, but theta is measured to the center of the small disk!!
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
// There are several different methods for extruding. The best are probably
|
||||||
|
// the ones using linear extrude.
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Demo - draws one of each, plus some little wheels and sticks.
|
||||||
|
//
|
||||||
|
// Fun stuff to try:
|
||||||
|
// Animate, try FPS = 5 and Steps = 200
|
||||||
|
// R = 2, r = 1, d = 0.2
|
||||||
|
// R = 4, r = 1, d = 1
|
||||||
|
// R = 2, r = 1, d = 0.5
|
||||||
|
//
|
||||||
|
// What happens when you make d > r ??
|
||||||
|
// What happens when d < 0 ??
|
||||||
|
// What happens when r < 0 ??
|
||||||
|
//
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
$fn = 30;
|
||||||
|
|
||||||
|
thickness = 2;
|
||||||
|
R = 4;
|
||||||
|
r = 1;
|
||||||
|
d = 1;
|
||||||
|
n = 60; // number of wedge segments
|
||||||
|
|
||||||
|
alpha = 360*$t;
|
||||||
|
|
||||||
|
color([0, 0, 1])
|
||||||
|
translate([0, 0, -0.5])
|
||||||
|
cylinder(h = 1, r= R, center = true);
|
||||||
|
|
||||||
|
color([0, 1, 0])
|
||||||
|
epitrochoid(R,r,d,n,thickness);
|
||||||
|
|
||||||
|
color([1, 0, 0])
|
||||||
|
translate([ (R+r)*cos(alpha) , (R+r)*sin(alpha), -0.5]) {
|
||||||
|
rotate([0, 0, alpha + R/r*alpha]) {
|
||||||
|
cylinder(h = 1, r = r, center = true);
|
||||||
|
translate([-d, 0, 1.5]) {
|
||||||
|
cylinder(h = 2.2, r = 0.1, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
translate([2*(abs(R) + abs(r) + abs(d)), 0, 0]){
|
||||||
|
color([0, 0, 1])
|
||||||
|
translate([0, 0, -0.5])
|
||||||
|
difference() {
|
||||||
|
cylinder(h = 1, r = 1.1*R, center = true);
|
||||||
|
cylinder(h = 1.1, r= R, center = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
color([0, 1, 0])
|
||||||
|
hypotrochoid(R,r,d,n,thickness);
|
||||||
|
|
||||||
|
color([1, 0, 0])
|
||||||
|
translate([ (R-r)*cos(alpha) , (R-r)*sin(alpha), -0.5]) {
|
||||||
|
rotate([0, 0, alpha - R/r*alpha]) {
|
||||||
|
cylinder(h = 1, r = r, center = true);
|
||||||
|
translate([d, 0, 1.5]) {
|
||||||
|
cylinder(h = 2.2, r = 0.1, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This just makes a twisted hypotrochoid
|
||||||
|
translate([0,14, 0])
|
||||||
|
hypotrochoidLinear(4, 1, 1, 40, 40, 10, 30);
|
||||||
|
|
||||||
|
// End of Demo Section
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Epitrochoid
|
||||||
|
//
|
||||||
|
module epitrochoid(R, r, d, n, thickness) {
|
||||||
|
dth = 360/n;
|
||||||
|
for ( i = [0:n-1] ) {
|
||||||
|
polyhedron(points = [[0,0,0],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i), 0],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1)), 0],
|
||||||
|
[0,0,thickness],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i), thickness],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1)), thickness]],
|
||||||
|
triangles = [[0, 2, 1],
|
||||||
|
[0, 1, 3],
|
||||||
|
[3, 1, 4],
|
||||||
|
[3, 4, 5],
|
||||||
|
[0, 3, 2],
|
||||||
|
[2, 3, 5],
|
||||||
|
[1, 2, 4],
|
||||||
|
[2, 5, 4]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Hypotrochoid
|
||||||
|
//
|
||||||
|
module hypotrochoid(R, r, d, n, thickness) {
|
||||||
|
dth = 360/n;
|
||||||
|
for ( i = [0:n-1] ) {
|
||||||
|
polyhedron(points = [[0,0,0],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i), 0],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1)), 0],
|
||||||
|
[0,0,thickness],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i), thickness],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1)), thickness]],
|
||||||
|
triangles = [[0, 2, 1],
|
||||||
|
[0, 1, 3],
|
||||||
|
[3, 1, 4],
|
||||||
|
[3, 4, 5],
|
||||||
|
[0, 3, 2],
|
||||||
|
[2, 3, 5],
|
||||||
|
[1, 2, 4],
|
||||||
|
[2, 5, 4]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Epitrochoid Wedge with Bore
|
||||||
|
//
|
||||||
|
module epitrochoidWBore(R, r, d, n, p, thickness, rb) {
|
||||||
|
dth = 360/n;
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polyhedron(points = [[rb*cos(dth*i), rb*sin(dth*i),0],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i), 0],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1)), 0],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1)), 0],
|
||||||
|
[rb*cos(dth*i), rb*sin(dth*i), thickness],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i), thickness],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1)), thickness],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1)), thickness]],
|
||||||
|
triangles = [[0, 1, 4], [4, 1, 5],
|
||||||
|
[1, 2, 5], [5, 2, 6],
|
||||||
|
[2, 3, 7], [7, 6, 2],
|
||||||
|
[3, 0, 4], [4, 7, 3],
|
||||||
|
[4, 5, 7], [7, 5, 6],
|
||||||
|
[0, 3, 1], [1, 3, 2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Epitrochoid Wedge with Bore, Linear Extrude
|
||||||
|
//
|
||||||
|
module epitrochoidWBoreLinear(R, r, d, n, p, thickness, rb, twist) {
|
||||||
|
dth = 360/n;
|
||||||
|
linear_extrude(height = thickness, convexity = 10, twist = twist) {
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polygon(points = [[rb*cos(dth*i), rb*sin(dth*i)],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i)],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1))],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1))]],
|
||||||
|
paths = [[0, 1, 2, 3]], convexity = 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Epitrochoid Wedge, Linear Extrude
|
||||||
|
//
|
||||||
|
module epitrochoidLinear(R, r, d, n, p, thickness, twist) {
|
||||||
|
dth = 360/n;
|
||||||
|
linear_extrude(height = thickness, convexity = 10, twist = twist) {
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polygon(points = [[0, 0],
|
||||||
|
[(R+r)*cos(dth*i) - d*cos((R+r)/r*dth*i), (R+r)*sin(dth*i) - d*sin((R+r)/r*dth*i)],
|
||||||
|
[(R+r)*cos(dth*(i+1)) - d*cos((R+r)/r*dth*(i+1)), (R+r)*sin(dth*(i+1)) - d*sin((R+r)/r*dth*(i+1))]],
|
||||||
|
paths = [[0, 1, 2]], convexity = 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Hypotrochoid Wedge with Bore
|
||||||
|
//
|
||||||
|
module hypotrochoidWBore(R, r, d, n, p, thickness, rb) {
|
||||||
|
dth = 360/n;
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polyhedron(points = [[rb*cos(dth*i), rb*sin(dth*i),0],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i), 0],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1)), 0],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1)), 0],
|
||||||
|
[rb*cos(dth*i), rb*sin(dth*i), thickness],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i), thickness],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1)), thickness],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1)), thickness]],
|
||||||
|
triangles = [[0, 1, 4], [4, 1, 5],
|
||||||
|
[1, 2, 5], [5, 2, 6],
|
||||||
|
[2, 3, 7], [7, 6, 2],
|
||||||
|
[3, 0, 4], [4, 7, 3],
|
||||||
|
[4, 5, 7], [7, 5, 6],
|
||||||
|
[0, 3, 1], [1, 3, 2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Hypotrochoid Wedge with Bore, Linear Extrude
|
||||||
|
//
|
||||||
|
module hypotrochoidWBoreLinear(R, r, d, n, p, thickness, rb, twist) {
|
||||||
|
dth = 360/n;
|
||||||
|
linear_extrude(height = thickness, convexity = 10, twist = twist) {
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polygon(points = [[rb*cos(dth*i), rb*sin(dth*i)],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i)],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1))],
|
||||||
|
[rb*cos(dth*(i+1)), rb*sin(dth*(i+1))]],
|
||||||
|
paths = [[0, 1, 2, 3]], convexity = 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================
|
||||||
|
// Hypotrochoid Wedge, Linear Extrude
|
||||||
|
//
|
||||||
|
module hypotrochoidLinear(R, r, d, n, p, thickness, twist) {
|
||||||
|
dth = 360/n;
|
||||||
|
linear_extrude(height = thickness, convexity = 10, twist = twist) {
|
||||||
|
union() {
|
||||||
|
for ( i = [0:p-1] ) {
|
||||||
|
polygon(points = [[0, 0],
|
||||||
|
[(R-r)*cos(dth*i) + d*cos((R-r)/r*dth*i), (R-r)*sin(dth*i) - d*sin((R-r)/r*dth*i)],
|
||||||
|
[(R-r)*cos(dth*(i+1)) + d*cos((R-r)/r*dth*(i+1)), (R-r)*sin(dth*(i+1)) - d*sin((R-r)/r*dth*(i+1))]],
|
||||||
|
paths = [[0, 1, 2]], convexity = 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//===========================================
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
X = [1, 0, 0];
|
||||||
|
Y = [0, 1, 0];
|
||||||
|
Z = [0, 0, 1];
|
||||||
|
|
||||||
|
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,10 @@
|
|||||||
|
// Copyright 2011 Elmo Mäntynen
|
||||||
|
// LGPL 2.1
|
||||||
|
|
||||||
|
// Give a list of 4+4 points (check order) to form an 8 point polyhedron
|
||||||
|
module connect_squares(points){
|
||||||
|
polyhedron(points=points,
|
||||||
|
triangles=[[0,1,2], [3,0,2], [7,6,5], [7,5,4], // Given polygons
|
||||||
|
[0,4,1], [4,5,1], [1,5,2], [2,5,6], // Connecting
|
||||||
|
[2,6,3], [3,6,7], [3,4,0], [3,7,4]]);// sides
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Utility functions.
|
||||||
|
*
|
||||||
|
* Originally by Hans Häggström, 2010.
|
||||||
|
* Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
include <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 normalized_axis(a) = a == "x" ? [1, 0, 0]:
|
||||||
|
a == "y" ? [0, 1, 0]:
|
||||||
|
a == "z" ? [0, 0, 1]: normalized(a);
|
||||||
|
|
||||||
|
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, ":"));
|
||||||
|
}
|
Loading…
Reference in New Issue