Prepare for submodules
This commit is contained in:
parent
235cc61869
commit
72fa8cdfe5
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Variables for the Minox16 camera
|
||||
**/
|
||||
|
||||
$fn = 150;
|
||||
|
||||
SPACING = 42;
|
||||
WALL_THICKNESS = 1.25 + .5;
|
||||
|
||||
PLANE_BACK = 1.55;
|
||||
|
||||
CART_H = 16.85 + .75;
|
||||
|
||||
FEED_D = 19.14;
|
||||
TAKEUP_D = 22.04;
|
||||
|
||||
TAKEUP_OFFSET_Y = -(TAKEUP_D - FEED_D) / 2;
|
||||
|
||||
CONNECT_X = SPACING - (TAKEUP_D / 2) - (FEED_D / 2) + 2;
|
||||
CONNECT_Y = 8.85;
|
||||
CONNECT_Z = 1.3;
|
||||
|
||||
CONNECT_OFFSET_X = ((TAKEUP_D / 2) - (FEED_D / 2)) / 2;
|
||||
CONNECT_OFFSET_Y = (FEED_D / 2) - (CONNECT_Y / 2) - 5.02;
|
||||
CONNECT_OFFSET_Z = -(CART_H / 2) + (CONNECT_Z / 2);
|
||||
|
||||
FILM_NEG_Y = .75;
|
||||
|
||||
FILM_NEG_OFFSET_Y = 8.5;
|
||||
|
||||
CAP_LIP_H = 5.92;
|
||||
CAP_LIP = .56;
|
||||
CAP_THICKNESS = .5;
|
||||
|
||||
TOP_H = 1;
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
/*
|
||||
Triangles.scad
|
||||
Author: Tim Koopman
|
||||
https://github.com/tkoopman/Delta-Diamond/blob/master/OpenSCAD/Triangles.scad
|
||||
|
||||
angleCA
|
||||
/|\
|
||||
a / H \ c
|
||||
/ | \
|
||||
angleAB ------- angleBC
|
||||
b
|
||||
|
||||
Standard Parameters
|
||||
center: true/false
|
||||
If true same as centerXYZ = [true, true, true]
|
||||
|
||||
centerXYZ: Vector of 3 true/false values [CenterX, CenterY, CenterZ]
|
||||
center must be left undef
|
||||
|
||||
height: The 3D height of the Triangle. Ignored if heights defined
|
||||
|
||||
heights: Vector of 3 height values heights @ [angleAB, angleBC, angleCA]
|
||||
If CenterZ is true each height will be centered individually, this means
|
||||
the shape will be different depending on CenterZ. Most times you will want
|
||||
CenterZ to be true to get the shape most people want.
|
||||
*/
|
||||
|
||||
/*
|
||||
Triangle
|
||||
a: Length of side a
|
||||
b: Length of side b
|
||||
angle: angle at point angleAB
|
||||
*/
|
||||
module Triangle(
|
||||
a, b, angle, height=1, heights=undef,
|
||||
center=undef, centerXYZ=[false,false,false])
|
||||
{
|
||||
// Calculate Heights at each point
|
||||
heightAB = ((heights==undef) ? height : heights[0])/2;
|
||||
heightBC = ((heights==undef) ? height : heights[1])/2;
|
||||
heightCA = ((heights==undef) ? height : heights[2])/2;
|
||||
centerZ = (center || (center==undef && centerXYZ[2]))?0:max(heightAB,heightBC,heightCA);
|
||||
|
||||
// Calculate Offsets for centering
|
||||
offsetX = (center || (center==undef && centerXYZ[0]))?((cos(angle)*a)+b)/3:0;
|
||||
offsetY = (center || (center==undef && centerXYZ[1]))?(sin(angle)*a)/3:0;
|
||||
|
||||
pointAB1 = [-offsetX,-offsetY, centerZ-heightAB];
|
||||
pointAB2 = [-offsetX,-offsetY, centerZ+heightAB];
|
||||
pointBC1 = [b-offsetX,-offsetY, centerZ-heightBC];
|
||||
pointBC2 = [b-offsetX,-offsetY, centerZ+heightBC];
|
||||
pointCA1 = [(cos(angle)*a)-offsetX,(sin(angle)*a)-offsetY, centerZ-heightCA];
|
||||
pointCA2 = [(cos(angle)*a)-offsetX,(sin(angle)*a)-offsetY, centerZ+heightCA];
|
||||
|
||||
polyhedron(
|
||||
points=[ pointAB1, pointBC1, pointCA1,
|
||||
pointAB2, pointBC2, pointCA2 ],
|
||||
triangles=[
|
||||
[0, 1, 2],
|
||||
[3, 5, 4],
|
||||
[0, 3, 1],
|
||||
[1, 3, 4],
|
||||
[1, 4, 2],
|
||||
[2, 4, 5],
|
||||
[2, 5, 0],
|
||||
[0, 5, 3] ] );
|
||||
}
|
||||
|
||||
/*
|
||||
Isosceles Triangle
|
||||
Exactly 2 of the following paramaters must be defined.
|
||||
If all 3 defined H will be ignored.
|
||||
b: length of side b
|
||||
angle: angle at points angleAB & angleBC.
|
||||
*/
|
||||
module Isosceles_Triangle(
|
||||
b, angle, H=undef, height=1, heights=undef,
|
||||
center=undef, centerXYZ=[true, false, false])
|
||||
{
|
||||
valid = (angle!=undef)?((angle < 90) && (b!=undef||H!=undef)) : (b!=undef&&H!=undef);
|
||||
ANGLE = (angle!=undef) ? angle : atan(H / (b/2));
|
||||
a = (b==undef)?(H/sin((180-(angle*2))/2)) :
|
||||
(b / cos(ANGLE))/2;
|
||||
B = (b==undef)? (cos(angle)*a)*2:b;
|
||||
if (valid)
|
||||
{
|
||||
Triangle(a=a, b=B, angle=ANGLE, height=height, heights=heights,
|
||||
center=center, centerXYZ=centerXYZ);
|
||||
} else {
|
||||
echo("Invalid Isosceles_Triangle. Must specify any 2 of b, angle and H, and if angle used angle must be less than 90");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Right Angled Triangle
|
||||
Create a Right Angled Triangle where the hypotenuse will be calculated.
|
||||
|
||||
|\
|
||||
a| \
|
||||
| \
|
||||
----
|
||||
b
|
||||
a: length of side a
|
||||
b: length of side b
|
||||
*/
|
||||
module Right_Angled_Triangle(
|
||||
a, b, height=1, heights=undef,
|
||||
center=undef, centerXYZ=[false, false, false])
|
||||
{
|
||||
Triangle(a=a, b=b, angle=90, height=height, heights=heights,
|
||||
center=center, centerXYZ=centerXYZ);
|
||||
}
|
||||
|
||||
/*
|
||||
Wedge
|
||||
Is same as Right Angled Triangle with 2 different heights, and rotated.
|
||||
Good for creating support structures.
|
||||
*/
|
||||
module Wedge(a, b, w1, w2)
|
||||
{
|
||||
rotate([90,0,0])
|
||||
Right_Angled_Triangle(a, b, heights=[w1, w2, w1], centerXYZ=[false, false, true]);
|
||||
}
|
||||
|
||||
/*
|
||||
Equilateral Triangle
|
||||
Create a Equilateral Triangle.
|
||||
|
||||
l: Length of all sides (a, b & c)
|
||||
H: Triangle size will be based on the this 2D height
|
||||
When using H, l is ignored.
|
||||
*/
|
||||
module Equilateral_Triangle(
|
||||
l=10, H=undef, height=1, heights=undef,
|
||||
center=undef, centerXYZ=[true,false,false])
|
||||
{
|
||||
L = (H==undef)?l:H/sin(60);
|
||||
Triangle(a=L,b=L,angle=60,height=height, heights=heights,
|
||||
center=center, centerXYZ=centerXYZ);
|
||||
}
|
||||
|
||||
/*
|
||||
Trapezoid
|
||||
Create a Basic Trapezoid (Based on Isosceles_Triangle)
|
||||
|
||||
d
|
||||
/----\
|
||||
/ | \
|
||||
a / H \ c
|
||||
/ | \
|
||||
angle ------------ angle
|
||||
b
|
||||
|
||||
b: Length of side b
|
||||
angle: Angle at points angleAB & angleBC
|
||||
H: The 2D height at which the triangle should be cut to create the trapezoid
|
||||
heights: If vector of size 3 (Standard for triangles) both cd & da will be the same height, if vector have 4 values [ab,bc,cd,da] than each point can have different heights.
|
||||
*/
|
||||
module Trapezoid(
|
||||
b, angle=60, H, height=1, heights=undef,
|
||||
center=undef, centerXYZ=[true,false,false])
|
||||
{
|
||||
validAngle = (angle < 90);
|
||||
adX = H / tan(angle);
|
||||
|
||||
// Calculate Heights at each point
|
||||
heightAB = ((heights==undef) ? height : heights[0])/2;
|
||||
heightBC = ((heights==undef) ? height : heights[1])/2;
|
||||
heightCD = ((heights==undef) ? height : heights[2])/2;
|
||||
heightDA = ((heights==undef) ? height : ((len(heights) > 3)?heights[3]:heights[2]))/2;
|
||||
|
||||
// Centers
|
||||
centerX = (center || (center==undef && centerXYZ[0]))?0:b/2;
|
||||
centerY = (center || (center==undef && centerXYZ[1]))?0:H/2;
|
||||
centerZ = (center || (center==undef && centerXYZ[2]))?0:max(heightAB,heightBC,heightCD,heightDA);
|
||||
|
||||
// Points
|
||||
y = H/2;
|
||||
bx = b/2;
|
||||
dx = (b-(adX*2))/2;
|
||||
|
||||
pointAB1 = [centerX-bx, centerY-y, centerZ-heightAB];
|
||||
pointAB2 = [centerX-bx, centerY-y, centerZ+heightAB];
|
||||
pointBC1 = [centerX+bx, centerY-y, centerZ-heightBC];
|
||||
pointBC2 = [centerX+bx, centerY-y, centerZ+heightBC];
|
||||
pointCD1 = [centerX+dx, centerY+y, centerZ-heightCD];
|
||||
pointCD2 = [centerX+dx, centerY+y, centerZ+heightCD];
|
||||
pointDA1 = [centerX-dx, centerY+y, centerZ-heightDA];
|
||||
pointDA2 = [centerX-dx, centerY+y, centerZ+heightDA];
|
||||
|
||||
validH = (adX < b/2);
|
||||
|
||||
if (validAngle && validH)
|
||||
{
|
||||
polyhedron(
|
||||
points=[ pointAB1, pointBC1, pointCD1, pointDA1,
|
||||
pointAB2, pointBC2, pointCD2, pointDA2 ],
|
||||
triangles=[
|
||||
[0, 1, 2],
|
||||
[0, 2, 3],
|
||||
[4, 6, 5],
|
||||
[4, 7, 6],
|
||||
[0, 4, 1],
|
||||
[1, 4, 5],
|
||||
[1, 5, 2],
|
||||
[2, 5, 6],
|
||||
[2, 6, 3],
|
||||
[3, 6, 7],
|
||||
[3, 7, 0],
|
||||
[0, 7, 4] ] );
|
||||
} else {
|
||||
if (!validAngle) echo("Trapezoid invalid, angle must be less than 90");
|
||||
else echo("Trapezoid invalid, H is larger than triangle");
|
||||
}
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
/*
|
||||
* knurledFinishLib_v2.scad
|
||||
*
|
||||
* Written by aubenc @ Thingiverse
|
||||
*
|
||||
* This script is licensed under the Public Domain license.
|
||||
*
|
||||
* http://www.thingiverse.com/thing:31122
|
||||
*
|
||||
* Derived from knurledFinishLib.scad (also Public Domain license) available at
|
||||
*
|
||||
* http://www.thingiverse.com/thing:9095
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* Drop this script somewhere where OpenSCAD can find it (your current project's
|
||||
* working directory/folder or your OpenSCAD libraries directory/folder).
|
||||
*
|
||||
* Add the line:
|
||||
*
|
||||
* use <knurledFinishLib_v2.scad>
|
||||
*
|
||||
* in your OpenSCAD script and call either...
|
||||
*
|
||||
* knurled_cyl( Knurled cylinder height,
|
||||
* Knurled cylinder outer diameter,
|
||||
* Knurl polyhedron width,
|
||||
* Knurl polyhedron height,
|
||||
* Knurl polyhedron depth,
|
||||
* Cylinder ends smoothed height,
|
||||
* Knurled surface smoothing amount );
|
||||
*
|
||||
* ...or...
|
||||
*
|
||||
* knurl();
|
||||
*
|
||||
* If you use knurled_cyl() module, you need to specify the values for all and
|
||||
*
|
||||
* Call the module ' help(); ' for a little bit more of detail
|
||||
* and/or take a look to the PDF available at http://www.thingiverse.com/thing:9095
|
||||
* for a in depth descrition of the knurl properties.
|
||||
*/
|
||||
|
||||
|
||||
module knurl( k_cyl_hg = 12,
|
||||
k_cyl_od = 25,
|
||||
knurl_wd = 3,
|
||||
knurl_hg = 4,
|
||||
knurl_dp = 1.5,
|
||||
e_smooth = 2,
|
||||
s_smooth = 0)
|
||||
{
|
||||
knurled_cyl(k_cyl_hg, k_cyl_od,
|
||||
knurl_wd, knurl_hg, knurl_dp,
|
||||
e_smooth, s_smooth);
|
||||
}
|
||||
|
||||
module knurled_cyl(chg, cod, cwd, csh, cdp, fsh, smt)
|
||||
{
|
||||
cord=(cod+cdp+cdp*smt/100)/2;
|
||||
cird=cord-cdp;
|
||||
cfn=round(2*cird*PI/cwd);
|
||||
clf=360/cfn;
|
||||
crn=ceil(chg/csh);
|
||||
|
||||
echo("knurled cylinder max diameter: ", 2*cord);
|
||||
echo("knurled cylinder min diameter: ", 2*cird);
|
||||
|
||||
if( fsh < 0 )
|
||||
{
|
||||
union()
|
||||
{
|
||||
shape(fsh, cird+cdp*smt/100, cord, cfn*4, chg);
|
||||
|
||||
translate([0,0,-(crn*csh-chg)/2])
|
||||
knurled_finish(cord, cird, clf, csh, cfn, crn);
|
||||
}
|
||||
}
|
||||
else if ( fsh == 0 )
|
||||
{
|
||||
intersection()
|
||||
{
|
||||
cylinder(h=chg, r=cord-cdp*smt/100, $fn=2*cfn, center=false);
|
||||
|
||||
translate([0,0,-(crn*csh-chg)/2])
|
||||
knurled_finish(cord, cird, clf, csh, cfn, crn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
intersection()
|
||||
{
|
||||
shape(fsh, cird, cord-cdp*smt/100, cfn*4, chg);
|
||||
|
||||
translate([0,0,-(crn*csh-chg)/2])
|
||||
knurled_finish(cord, cird, clf, csh, cfn, crn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module shape(hsh, ird, ord, fn4, hg)
|
||||
{
|
||||
x0= 0; x1 = hsh > 0 ? ird : ord; x2 = hsh > 0 ? ord : ird;
|
||||
y0=-0.1; y1=0; y2=abs(hsh); y3=hg-abs(hsh); y4=hg; y5=hg+0.1;
|
||||
|
||||
if ( hsh >= 0 )
|
||||
{
|
||||
rotate_extrude(convexity=10, $fn=fn4)
|
||||
polygon(points=[ [x0,y1],[x1,y1],[x2,y2],[x2,y3],[x1,y4],[x0,y4] ],
|
||||
paths=[ [0,1,2,3,4,5] ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rotate_extrude(convexity=10, $fn=fn4)
|
||||
polygon(points=[ [x0,y0],[x1,y0],[x1,y1],[x2,y2],
|
||||
[x2,y3],[x1,y4],[x1,y5],[x0,y5] ],
|
||||
paths=[ [0,1,2,3,4,5,6,7] ]);
|
||||
}
|
||||
}
|
||||
|
||||
module knurled_finish(ord, ird, lf, sh, fn, rn)
|
||||
{
|
||||
for(j=[0:rn-1])
|
||||
assign(h0=sh*j, h1=sh*(j+1/2), h2=sh*(j+1))
|
||||
{
|
||||
for(i=[0:fn-1])
|
||||
assign(lf0=lf*i, lf1=lf*(i+1/2), lf2=lf*(i+1))
|
||||
{
|
||||
polyhedron(
|
||||
points=[
|
||||
[ 0,0,h0],
|
||||
[ ord*cos(lf0), ord*sin(lf0), h0],
|
||||
[ ird*cos(lf1), ird*sin(lf1), h0],
|
||||
[ ord*cos(lf2), ord*sin(lf2), h0],
|
||||
|
||||
[ ird*cos(lf0), ird*sin(lf0), h1],
|
||||
[ ord*cos(lf1), ord*sin(lf1), h1],
|
||||
[ ird*cos(lf2), ird*sin(lf2), h1],
|
||||
|
||||
[ 0,0,h2],
|
||||
[ ord*cos(lf0), ord*sin(lf0), h2],
|
||||
[ ird*cos(lf1), ird*sin(lf1), h2],
|
||||
[ ord*cos(lf2), ord*sin(lf2), h2]
|
||||
],
|
||||
triangles=[
|
||||
[0,1,2],[2,3,0],
|
||||
[1,0,4],[4,0,7],[7,8,4],
|
||||
[8,7,9],[10,9,7],
|
||||
[10,7,6],[6,7,0],[3,6,0],
|
||||
[2,1,4],[3,2,6],[10,6,9],[8,9,4],
|
||||
[4,5,2],[2,5,6],[6,5,9],[9,5,4]
|
||||
],
|
||||
convexity=5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module knurl_help()
|
||||
{
|
||||
echo();
|
||||
echo(" Knurled Surface Library v2 ");
|
||||
echo("");
|
||||
echo(" Modules: ");
|
||||
echo("");
|
||||
echo(" knurled_cyl(parameters... ); - Requires a value for each an every expected parameter (see bellow) ");
|
||||
echo("");
|
||||
echo(" knurl(); - Call to the previous module with a set of default parameters, ");
|
||||
echo(" values may be changed by adding 'parameter_name=value' i.e. knurl(s_smooth=40); ");
|
||||
echo("");
|
||||
echo(" Parameters, all of them in mm but the last one. ");
|
||||
echo("");
|
||||
echo(" k_cyl_hg - [ 12 ] ,, Height for the knurled cylinder ");
|
||||
echo(" k_cyl_od - [ 25 ] ,, Cylinder's Outer Diameter before applying the knurled surfacefinishing. ");
|
||||
echo(" knurl_wd - [ 3 ] ,, Knurl's Width. ");
|
||||
echo(" knurl_hg - [ 4 ] ,, Knurl's Height. ");
|
||||
echo(" knurl_dp - [ 1.5 ] ,, Knurl's Depth. ");
|
||||
echo(" e_smooth - [ 2 ] ,, Bevel's Height at the bottom and the top of the cylinder ");
|
||||
echo(" s_smooth - [ 0 ] ,, Knurl's Surface Smoothing : File donwn the top of the knurl this value, i.e. 40 will snooth it a 40%. ");
|
||||
echo("");
|
||||
}
|
||||
|
|
@ -1,372 +0,0 @@
|
|||
/*
|
||||
* ISO-standard metric threads, following this specification:
|
||||
* http://en.wikipedia.org/wiki/ISO_metric_screw_thread
|
||||
*
|
||||
* Copyright 2017 Dan Kirshner - dan_kirshner@yahoo.com
|
||||
* 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, 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 General Public License for more details.
|
||||
*
|
||||
* See <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Version 2.3. 2017-08-31 Default for leadin: 0 (best for internal threads).
|
||||
* Version 2.2. 2017-01-01 Correction for angle; leadfac option. (Thanks to
|
||||
* Andrew Allen <a2intl@gmail.com>.)
|
||||
* Version 2.1. 2016-12-04 Chamfer bottom end (low-z); leadin option.
|
||||
* Version 2.0. 2016-11-05 Backwards compatibility (earlier OpenSCAD) fixes.
|
||||
* Version 1.9. 2016-07-03 Option: tapered.
|
||||
* Version 1.8. 2016-01-08 Option: (non-standard) angle.
|
||||
* Version 1.7. 2015-11-28 Larger x-increment - for small-diameters.
|
||||
* Version 1.6. 2015-09-01 Options: square threads, rectangular threads.
|
||||
* Version 1.5. 2015-06-12 Options: thread_size, groove.
|
||||
* Version 1.4. 2014-10-17 Use "faces" instead of "triangles" for polyhedron
|
||||
* Version 1.3. 2013-12-01 Correct loop over turns -- don't have early cut-off
|
||||
* Version 1.2. 2012-09-09 Use discrete polyhedra rather than linear_extrude ()
|
||||
* Version 1.1. 2012-09-07 Corrected to right-hand threads!
|
||||
*/
|
||||
|
||||
// Examples.
|
||||
//
|
||||
// Standard M8 x 1.
|
||||
// metric_thread (diameter=8, pitch=1, length=4);
|
||||
|
||||
// Square thread.
|
||||
// metric_thread (diameter=8, pitch=1, length=4, square=true);
|
||||
|
||||
// Non-standard: long pitch, same thread size.
|
||||
//metric_thread (diameter=8, pitch=4, length=4, thread_size=1, groove=true);
|
||||
|
||||
// Non-standard: 20 mm diameter, long pitch, square "trough" width 3 mm,
|
||||
// depth 1 mm.
|
||||
//metric_thread (diameter=20, pitch=8, length=16, square=true, thread_size=6,
|
||||
// groove=true, rectangle=0.333);
|
||||
|
||||
// English: 1/4 x 20.
|
||||
//english_thread (diameter=1/4, threads_per_inch=20, length=1);
|
||||
|
||||
// Tapered. Example -- pipe size 3/4" -- per:
|
||||
// http://www.engineeringtoolbox.com/npt-national-pipe-taper-threads-d_750.html
|
||||
// english_thread (diameter=1.05, threads_per_inch=14, length=3/4, taper=1/16);
|
||||
|
||||
// Thread for mounting on Rohloff hub.
|
||||
//difference () {
|
||||
// cylinder (r=20, h=10, $fn=100);
|
||||
//
|
||||
// metric_thread (diameter=34, pitch=1, length=10, internal=true, n_starts=6);
|
||||
//}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
function segments (diameter) = min (50, ceil (diameter*6));
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// diameter - outside diameter of threads in mm. Default: 8.
|
||||
// pitch - thread axial "travel" per turn in mm. Default: 1.
|
||||
// length - overall axial length of thread in mm. Default: 1.
|
||||
// internal - true = clearances for internal thread (e.g., a nut).
|
||||
// false = clearances for external thread (e.g., a bolt).
|
||||
// (Internal threads should be "cut out" from a solid using
|
||||
// difference ()).
|
||||
// n_starts - Number of thread starts (e.g., DNA, a "double helix," has
|
||||
// n_starts=2). See wikipedia Screw_thread.
|
||||
// thread_size - (non-standard) axial width of a single thread "V" - independent
|
||||
// of pitch. Default: same as pitch.
|
||||
// groove - (non-standard) subtract inverted "V" from cylinder (rather than
|
||||
// add protruding "V" to cylinder).
|
||||
// square - Square threads (per
|
||||
// https://en.wikipedia.org/wiki/Square_thread_form).
|
||||
// rectangle - (non-standard) "Rectangular" thread - ratio depth/(axial) width
|
||||
// Default: 1 (square).
|
||||
// angle - (non-standard) angle (deg) of thread side from perpendicular to
|
||||
// axis (default = standard = 30 degrees).
|
||||
// taper - diameter change per length (National Pipe Thread/ANSI B1.20.1
|
||||
// is 1" diameter per 16" length). Taper decreases from 'diameter'
|
||||
// as z increases.
|
||||
// leadin - 0 (default): no chamfer; 1: chamfer (45 degree) at max-z end;
|
||||
// 2: chamfer at both ends, 3: chamfer at z=0 end.
|
||||
// leadfac - scale of leadin chamfer (default: 1.0 = 1/2 thread).
|
||||
module metric_thread (diameter=8, pitch=1, length=1, internal=false, n_starts=1,
|
||||
thread_size=-1, groove=false, square=false, rectangle=0,
|
||||
angle=30, taper=0, leadin=0, leadfac=1.0)
|
||||
{
|
||||
// thread_size: size of thread "V" different than travel per turn (pitch).
|
||||
// Default: same as pitch.
|
||||
local_thread_size = thread_size == -1 ? pitch : thread_size;
|
||||
local_rectangle = rectangle ? rectangle : 1;
|
||||
|
||||
n_segments = segments (diameter);
|
||||
h = (square || rectangle) ? local_thread_size*local_rectangle/2 : local_thread_size / (2 * tan(angle));
|
||||
|
||||
h_fac1 = (square || rectangle) ? 0.90 : 0.625;
|
||||
|
||||
// External thread includes additional relief.
|
||||
h_fac2 = (square || rectangle) ? 0.95 : 5.3/8;
|
||||
|
||||
tapered_diameter = diameter - length*taper;
|
||||
|
||||
difference () {
|
||||
union () {
|
||||
if (! groove) {
|
||||
metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
||||
local_thread_size, groove, square, rectangle, angle,
|
||||
taper);
|
||||
}
|
||||
|
||||
difference () {
|
||||
|
||||
// Solid center, including Dmin truncation.
|
||||
if (groove) {
|
||||
cylinder (r1=diameter/2, r2=tapered_diameter/2,
|
||||
h=length, $fn=n_segments);
|
||||
} else if (internal) {
|
||||
cylinder (r1=diameter/2 - h*h_fac1, r2=tapered_diameter/2 - h*h_fac1,
|
||||
h=length, $fn=n_segments);
|
||||
} else {
|
||||
|
||||
// External thread.
|
||||
cylinder (r1=diameter/2 - h*h_fac2, r2=tapered_diameter/2 - h*h_fac2,
|
||||
h=length, $fn=n_segments);
|
||||
}
|
||||
|
||||
if (groove) {
|
||||
metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
||||
local_thread_size, groove, square, rectangle,
|
||||
angle, taper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// chamfer z=0 end if leadin is 2 or 3
|
||||
if (leadin == 2 || leadin == 3) {
|
||||
difference () {
|
||||
cylinder (r=diameter/2 + 1, h=h*h_fac1*leadfac, $fn=n_segments);
|
||||
|
||||
cylinder (r2=diameter/2, r1=diameter/2 - h*h_fac1*leadfac, h=h*h_fac1*leadfac,
|
||||
$fn=n_segments);
|
||||
}
|
||||
}
|
||||
|
||||
// chamfer z-max end if leadin is 1 or 2.
|
||||
if (leadin == 1 || leadin == 2) {
|
||||
translate ([0, 0, length + 0.05 - h*h_fac1*leadfac]) {
|
||||
difference () {
|
||||
cylinder (r=diameter/2 + 1, h=h*h_fac1*leadfac, $fn=n_segments);
|
||||
cylinder (r1=tapered_diameter/2, r2=tapered_diameter/2 - h*h_fac1*leadfac, h=h*h_fac1*leadfac,
|
||||
$fn=n_segments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Input units in inches.
|
||||
// Note: units of measure in drawing are mm!
|
||||
module english_thread (diameter=0.25, threads_per_inch=20, length=1,
|
||||
internal=false, n_starts=1, thread_size=-1, groove=false,
|
||||
square=false, rectangle=0, angle=30, taper=0, leadin=0,
|
||||
leadfac=1.0)
|
||||
{
|
||||
// Convert to mm.
|
||||
mm_diameter = diameter*25.4;
|
||||
mm_pitch = (1.0/threads_per_inch)*25.4;
|
||||
mm_length = length*25.4;
|
||||
|
||||
echo (str ("mm_diameter: ", mm_diameter));
|
||||
echo (str ("mm_pitch: ", mm_pitch));
|
||||
echo (str ("mm_length: ", mm_length));
|
||||
metric_thread (mm_diameter, mm_pitch, mm_length, internal, n_starts,
|
||||
thread_size, groove, square, rectangle, angle, taper, leadin,
|
||||
leadfac);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
module metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
||||
thread_size, groove, square, rectangle, angle,
|
||||
taper)
|
||||
{
|
||||
// Number of turns needed.
|
||||
n_turns = floor (length/pitch);
|
||||
|
||||
intersection () {
|
||||
|
||||
// Start one below z = 0. Gives an extra turn at each end.
|
||||
for (i=[-1*n_starts : n_turns+1]) {
|
||||
translate ([0, 0, i*pitch]) {
|
||||
metric_thread_turn (diameter, pitch, internal, n_starts,
|
||||
thread_size, groove, square, rectangle, angle,
|
||||
taper, i*pitch);
|
||||
}
|
||||
}
|
||||
|
||||
// Cut to length.
|
||||
translate ([0, 0, length/2]) {
|
||||
cube ([diameter*3, diameter*3, length], center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
module metric_thread_turn (diameter, pitch, internal, n_starts, thread_size,
|
||||
groove, square, rectangle, angle, taper, z)
|
||||
{
|
||||
n_segments = segments (diameter);
|
||||
fraction_circle = 1.0/n_segments;
|
||||
for (i=[0 : n_segments-1]) {
|
||||
rotate ([0, 0, i*360*fraction_circle]) {
|
||||
translate ([0, 0, i*n_starts*pitch*fraction_circle]) {
|
||||
//current_diameter = diameter - taper*(z + i*n_starts*pitch*fraction_circle);
|
||||
thread_polyhedron ((diameter - taper*(z + i*n_starts*pitch*fraction_circle))/2,
|
||||
pitch, internal, n_starts, thread_size, groove,
|
||||
square, rectangle, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
module thread_polyhedron (radius, pitch, internal, n_starts, thread_size,
|
||||
groove, square, rectangle, angle)
|
||||
{
|
||||
n_segments = segments (radius*2);
|
||||
fraction_circle = 1.0/n_segments;
|
||||
|
||||
local_rectangle = rectangle ? rectangle : 1;
|
||||
|
||||
h = (square || rectangle) ? thread_size*local_rectangle/2 : thread_size / (2 * tan(angle));
|
||||
outer_r = radius + (internal ? h/20 : 0); // Adds internal relief.
|
||||
//echo (str ("outer_r: ", outer_r));
|
||||
|
||||
// A little extra on square thread -- make sure overlaps cylinder.
|
||||
h_fac1 = (square || rectangle) ? 1.1 : 0.875;
|
||||
inner_r = radius - h*h_fac1; // Does NOT do Dmin_truncation - do later with
|
||||
// cylinder.
|
||||
|
||||
translate_y = groove ? outer_r + inner_r : 0;
|
||||
reflect_x = groove ? 1 : 0;
|
||||
|
||||
// Make these just slightly bigger (keep in proportion) so polyhedra will
|
||||
// overlap.
|
||||
x_incr_outer = (! groove ? outer_r : inner_r) * fraction_circle * 2 * PI * 1.02;
|
||||
x_incr_inner = (! groove ? inner_r : outer_r) * fraction_circle * 2 * PI * 1.02;
|
||||
z_incr = n_starts * pitch * fraction_circle * 1.005;
|
||||
|
||||
/*
|
||||
(angles x0 and x3 inner are actually 60 deg)
|
||||
|
||||
/\ (x2_inner, z2_inner) [2]
|
||||
/ \
|
||||
(x3_inner, z3_inner) / \
|
||||
[3] \ \
|
||||
|\ \ (x2_outer, z2_outer) [6]
|
||||
| \ /
|
||||
| \ /|
|
||||
z |[7]\/ / (x1_outer, z1_outer) [5]
|
||||
| | | /
|
||||
| x | |/
|
||||
| / | / (x0_outer, z0_outer) [4]
|
||||
| / | / (behind: (x1_inner, z1_inner) [1]
|
||||
|/ | /
|
||||
y________| |/
|
||||
(r) / (x0_inner, z0_inner) [0]
|
||||
|
||||
*/
|
||||
|
||||
x1_outer = outer_r * fraction_circle * 2 * PI;
|
||||
|
||||
z0_outer = (outer_r - inner_r) * tan(angle);
|
||||
//echo (str ("z0_outer: ", z0_outer));
|
||||
|
||||
//polygon ([[inner_r, 0], [outer_r, z0_outer],
|
||||
// [outer_r, 0.5*pitch], [inner_r, 0.5*pitch]]);
|
||||
z1_outer = z0_outer + z_incr;
|
||||
|
||||
// Give internal square threads some clearance in the z direction, too.
|
||||
bottom = internal ? 0.235 : 0.25;
|
||||
top = internal ? 0.765 : 0.75;
|
||||
|
||||
translate ([0, translate_y, 0]) {
|
||||
mirror ([reflect_x, 0, 0]) {
|
||||
|
||||
if (square || rectangle) {
|
||||
|
||||
// Rule for face ordering: look at polyhedron from outside: points must
|
||||
// be in clockwise order.
|
||||
polyhedron (
|
||||
points = [
|
||||
[-x_incr_inner/2, -inner_r, bottom*thread_size], // [0]
|
||||
[x_incr_inner/2, -inner_r, bottom*thread_size + z_incr], // [1]
|
||||
[x_incr_inner/2, -inner_r, top*thread_size + z_incr], // [2]
|
||||
[-x_incr_inner/2, -inner_r, top*thread_size], // [3]
|
||||
|
||||
[-x_incr_outer/2, -outer_r, bottom*thread_size], // [4]
|
||||
[x_incr_outer/2, -outer_r, bottom*thread_size + z_incr], // [5]
|
||||
[x_incr_outer/2, -outer_r, top*thread_size + z_incr], // [6]
|
||||
[-x_incr_outer/2, -outer_r, top*thread_size] // [7]
|
||||
],
|
||||
|
||||
faces = [
|
||||
[0, 3, 7, 4], // This-side trapezoid
|
||||
|
||||
[1, 5, 6, 2], // Back-side trapezoid
|
||||
|
||||
[0, 1, 2, 3], // Inner rectangle
|
||||
|
||||
[4, 7, 6, 5], // Outer rectangle
|
||||
|
||||
// These are not planar, so do with separate triangles.
|
||||
[7, 2, 6], // Upper rectangle, bottom
|
||||
[7, 3, 2], // Upper rectangle, top
|
||||
|
||||
[0, 5, 1], // Lower rectangle, bottom
|
||||
[0, 4, 5] // Lower rectangle, top
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
||||
// Rule for face ordering: look at polyhedron from outside: points must
|
||||
// be in clockwise order.
|
||||
polyhedron (
|
||||
points = [
|
||||
[-x_incr_inner/2, -inner_r, 0], // [0]
|
||||
[x_incr_inner/2, -inner_r, z_incr], // [1]
|
||||
[x_incr_inner/2, -inner_r, thread_size + z_incr], // [2]
|
||||
[-x_incr_inner/2, -inner_r, thread_size], // [3]
|
||||
|
||||
[-x_incr_outer/2, -outer_r, z0_outer], // [4]
|
||||
[x_incr_outer/2, -outer_r, z0_outer + z_incr], // [5]
|
||||
[x_incr_outer/2, -outer_r, thread_size - z0_outer + z_incr], // [6]
|
||||
[-x_incr_outer/2, -outer_r, thread_size - z0_outer] // [7]
|
||||
],
|
||||
|
||||
faces = [
|
||||
[0, 3, 7, 4], // This-side trapezoid
|
||||
|
||||
[1, 5, 6, 2], // Back-side trapezoid
|
||||
|
||||
[0, 1, 2, 3], // Inner rectangle
|
||||
|
||||
[4, 7, 6, 5], // Outer rectangle
|
||||
|
||||
// These are not planar, so do with separate triangles.
|
||||
[7, 2, 6], // Upper rectangle, bottom
|
||||
[7, 3, 2], // Upper rectangle, top
|
||||
|
||||
[0, 5, 1], // Lower rectangle, bottom
|
||||
[0, 4, 5] // Lower rectangle, top
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
|
@ -49,6 +49,7 @@ module laser_bed () {
|
|||
}
|
||||
|
||||
module rack_side () {
|
||||
echo("LEN", LEN);
|
||||
for (i = [0 : SPOKES / 2]) {
|
||||
rotate([0, 0, i * ANGLE]) {
|
||||
difference () {
|
||||
|
@ -69,6 +70,7 @@ module rack_side () {
|
|||
}
|
||||
|
||||
module stand () {
|
||||
echo("STAND", (LEN / 2) + 40);
|
||||
difference () {
|
||||
rounded_cube([(LEN / 2) + 40, 40, IN / 4], d = DOWEL_D, center = true);
|
||||
translate ([-(LEN / 4), 0, 0]) cylinder(r = (THREADED_D + 4) / 2, h = 275, center = true);
|
||||
|
@ -139,6 +141,9 @@ module printer_plate () {
|
|||
translate([30, 0, 0]) stand_printed_bearing();
|
||||
}
|
||||
|
||||
//printer_plate();
|
||||
//rack_side();
|
||||
//stand();
|
||||
//stand_base();
|
||||
printer_plate();
|
||||
//laser_plate();
|
||||
rotate([0, 0, time]) drying_rack();
|
||||
//rotate([0, 0, time]) drying_rack();
|
||||
|
|
Loading…
Reference in New Issue