Merge remote-tracking branch 'origin/lomo_screw'

This commit is contained in:
M McWilliams 2018-02-28 19:48:51 -05:00
commit 7ccb2d4dd3
3 changed files with 143256 additions and 8 deletions

215
libraries/Triangles.scad Normal file
View File

@ -0,0 +1,215 @@
/*
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");
}
}

View File

@ -3,9 +3,15 @@ include <../../libraries/threads.scad>;
module base () {
$fn = 100;
NUBS = 6;
union() {
translate([0, 0, -15])cylinder(r = 8.45, h = 20, center = true);
translate([0, 0, -24.5])cylinder(r = 11.1, h = 9.5, center = true, $fn = 6);
//hex version
//translate([0, 0, -24.5]) cylinder(r = 11.1, h = 9.5, center = true, $fn = 6);
translate([0, 0, -24.5]) cylinder(r = 19 / 2, h = 9.5, center = true);
for (i = [1 : 6]) {
rotate([0, 0, i * (360 / NUBS)]) translate([0, 19 / 2, -24.5]) cylinder(r = 3.2 / 2, h = 9.5, center = true);
}
}
}
@ -13,7 +19,7 @@ module lomo_bottom_screw () {
base();
difference () {
//outer screw
translate([0, 0, -7.1]) metric_thread (diameter=10, pitch=1.5, length=27.1);
translate([0, 0, -7.1]) metric_thread (diameter=10, pitch=1.5,thread_size = 1.6, length=27.1);
//taper top of screw
translate([0, 0, 19]) difference() {
cylinder(r = 8, h = 3.5, center = true, $fn = 100);
@ -24,11 +30,12 @@ module lomo_bottom_screw () {
}
}
difference() {
//color("green") import("C:\\Users\\mmcwilliams\\Documents\\3DPRINT\\lomo_bottom_screw_half.stl");
//color("blue") translate([36.9, -3.2, 0]) import("C:\\Users\\mmcwilliams\\Documents\\3DPRINT\\lomo_part.stl");
//color("green")
//translate([37, -3.5, 0]) import("./lomo_part_fixed.stl");
import("./lomo_part_half.stl");
//translate([200, 0, 0]) cube([400, 400, 400], center = true);
}
rotate([0, 0, t]) difference() {
lomo_bottom_screw();
//translate([-100, 0, 0])cube([200, 200, 200], center = true);
translate([0, -0.25, -0.05]) rotate([0, 0, t]) difference() {
//color("green") lomo_bottom_screw();
//translate([-20, 0, 0])cube([40, 40, 200], center = true);
}

File diff suppressed because it is too large Load Diff