Clean up bottom screw script, add ALT and HEX parameters to change the design.

This commit is contained in:
mmcwilliams 2018-03-05 14:55:51 -05:00
parent ce5b2b9ff2
commit cebe5d2310
1 changed files with 65 additions and 44 deletions

View File

@ -1,69 +1,90 @@
t = 0;
include <../../libraries/threads.scad>;
FINE = 60;
//RESOLUTION
FINE = 200;
module base ( HEX = false) {
D = 8.45 * 2;
H = 20;
//for grip
BUMP = 2; //diameter
BUMPS = 6;
TOP_D = 19;
TOP_H = 9.5;
TOP_OFFSET = -24.5;
module base () {
$fn = FINE;
BUMP = 2;
BUMPS = 6;
TOP_H = 9.5;
union() {
translate([0, 0, -15])cylinder(r = 8.45, h = 20, center = true);
//hex top
//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 = TOP_H, center = true);
translate([0, 0, -15]) {
cylinder(r = D / 2, h = H, center = true, $fn = FINE);
}
//hex version
if (HEX) {
translate([0, 0, TOP_OFFSET]) {
cylinder(r = 11.1, h = TOP_H, center = true, $fn = 6);
}
} else {
translate([0, 0, TOP_OFFSET]) {
cylinder(r = TOP_D / 2, h = TOP_H, center = true, $fn = FINE);
}
}
for (i = [0 : BUMPS]) {
rotate([0, 0, (360 / BUMPS) * i]) translate([0, 8.9, -24.5]) cylinder(r = BUMP, h = TOP_H, center = true, $fn = 60);
rotate([0, 0, (360 / BUMPS) * i]) {
translate([0, 8.9, TOP_OFFSET]) {
cylinder(r = BUMP, h = TOP_H, center = true, $fn = 60);
}
}
}
}
}
module lomo_bottom_screw (LEN = 27.1) {
difference () {
base();
//negative cylinder (reference)
//translate([0, 0, -20]) cylinder(r = 13.6 / 2, h = 20, center = true, $fn = 100);
module outer_screw (LEN) {
OD = 10;
PITCH = 1.5;
THREAD = 1.6;
//negative plug (reference)
//translate([0, 0, -20]) cylinder(r = 12 / 2, h = 20, center = true, $fn = FINE);
difference () {
translate([0, 0, -7.1]) metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length=LEN);
//bevel top of screw
translate([0, 0, LEN - 8]) difference() {
cylinder(r = 8, h = 3, center = true, $fn = FINE);
cylinder(r1 = 6, r2 = 3, h = 3.01, center = true, $fn = FINE);
}
}
}
module lomo_bottom_screw (ALT = false, HEX = false) {
OD = 13.6 + .5;
PITCH = 1.5;
THREAD = 1.6;
IN_LEN = 21;
LEN = 17.1;
ALT_LEN = 27.1;
difference () {
base(HEX);
//inner screw negative
translate([0, 0, -30]) union() {
metric_thread (diameter=13.6 + .5, pitch=1.5, thread_size = 1.6, length = 21);
translate([0, 0, 0.2]) metric_thread (diameter=13.6 + .5, pitch=1.5, thread_size = 1.6, length = 21);
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
translate([0, 0, 0.2]) {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
}
}
difference () {
//outer screw
translate([0, 0, -7.1]) metric_thread (diameter=10, pitch=1.5, length=LEN);
translate([0, 0, 26]) cylinder(r = 8, h = 5, center = true, $fn = FINE);
//taper top of screw
translate([0, 0, LEN - 4.2]) difference() {
cylinder(r = 8, h = 3, center = true, $fn = FINE);
cylinder(r1 = 6, r2 = 3, h = 3.01, center = true, $fn = FINE);
}
if (ALT) {
outer_screw(ALT_LEN);
} else {
outer_screw(LEN);
}
//hollow center
cylinder(r = 3.8 / 2, h = 100, center = true, $fn = 60);
}
}
difference() {
//color("green")
//center
translate([0, 0, 29]) lomo_bottom_screw();
//translate([-25, 0, 29]) cube([50, 50, 100], center = true);
}
//translate([0, 0, 7]) cylinder(r = 13.6 / 2, h = 20, center = true, $fn = 100);
translate([0, 0, -20]) rotate([0, 0, t]) difference() {
//translate([-100, 0, 0])cube([200, 200, 200], center = true);
}
translate([0, 0, -30]) {
//metric_thread (diameter=13.6, pitch=1.5 ,thread_size = 1.6, length = 20);
}
translate([0, 0, 29]) rotate([0, 0, t]) lomo_bottom_screw();