Outline the strategy for v4: all work on stacking and alternate sizes will be worked into a new library that is completely parametric and which has a new approach to the design which relies on a support-less design that has straight overhangs that appear below the curved spiral.

This commit is contained in:
Matt McWilliams 2025-01-19 11:21:07 -05:00
parent 2d82d2d04f
commit 2200af28eb
7 changed files with 1548 additions and 41 deletions

View File

@ -228,10 +228,6 @@ if (PART == "spiral") {
gnal_spindle_bottom();
} else if (PART == "spindle_single") {
gnal_spindle_single();
} else if (PART == "spindle_stacking") {
rotate([0, 180, 0]) gnal_stacking_spindle();
} else if (PART == "30ft_spiral") {
gnal_50ft_spiral(spiral_count = 19, od = 127, reinforced = false);
} else if (PART == "spiral_test") {
difference () {
gnal_50ft_spiral();

View File

@ -793,37 +793,4 @@ module gnal_spindle_single () {
translate([0, 0, -37.5 - SINGLE_INSERT + (21 / 2) - 1]) {
cylinder(r = 10 / 2, h = 21, center = true, $fn = FINE);
}
}
module gnal_stacking_spindle () {
OD = 10.5 + .3;
IN_LEN = 21;
LEN = 17.1;
ALT_LEN = 27.1;
difference () {
union () {
gnal_spindle_base();
translate([0, 0, -23.75]) gnal_spacer_solid();
}
//inner screw negative
translate([0, 0, -30]) union() {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
translate([0, 0, 0.2]) {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
}
}
}
difference () {
outer_screw(LEN - 2);
}
}

829
scad/libraries/gnal_v4.scad Normal file
View File

@ -0,0 +1,829 @@
//GNAL v3 Shared Library
include <./path_extrude.scad>;
include <./threads.scad>;
include <./Triangles.scad>;
/**
* THREADS
* TOP (large screw)
* metric_thread (diameter=13.6, pitch=1.5 ,thread_size = 1.6, length = 21);
* TOP VOID
* metric_thread (diameter=13.6 + .5, pitch=1.5, thread_size = 1.6, length = 21);
* + clone translated along Z by 0.2mm
* BOTTOM (small screw)
* metric_thread (diameter=10, pitch=1.5, thread_size = 1.6, length=LEN);
* SINGLE LEVEL (middle screw)
*
*/
DEBUG = false;
FINE = 200;
OD = 10 + .5;
PITCH = 1.5;
THREAD = 1.6;
LEN = 21;
INSERT_D = 26;
SINGLE_THREAD_D = 12;
function X (start_r, spacing, fn, r, i) = (start_r + (r * spacing) + (i * calcIncrement(spacing, fn))) * cos(i * calcAngle(fn));
function Y (start_r, spacing, fn, r, i) = (start_r + (r * spacing) + (i * calcIncrement(spacing, fn))) * sin(i * calcAngle(fn));
function circ (d) = PI * d;
function calcFacetSize (end_d, fn) = circ( end_d ) / fn;
//function calcSteps(rotations, fn) = fn * rotations;
function calcAngle (fn) = 360 / fn;
function calcFn(start_d, start_fn, end_d, spacing, r) = start_fn +
( ((circ(calcR(start_d, spacing, r) * 2) - circ(start_d) )
/ (circ(end_d) - circ(start_d))) * ($fn - start_fn));
function calcR(start_d, spacing, r) = (start_d / 2) + (spacing * r);
function calcIncrement(spacing, fn) = spacing / fn;
/**
* spiral_7 - Combination of spiral_3 and spiral_4 that doesn't sacrifice
* performance. Hits an overflow when $fn is higher than 245 which creates
* 8418 vectors at 60 rotations. This is an edge case, only appearing in OpenSCAD
* 2019.05 (and maybe earlier), but should be explored.
**/
module spiral (rotations = 40, start_d = 48, spacing = 2.075, bottom = -7.1, fn) {
diam = (rotations * spacing * 2) + start_d;
echo("DIAM", diam);
echo("SPIRAL", rotations * PI * ((start_d + diam) / 2));
//bottom = -7.1;
w = 1.4;
top_w = .8;
top_offset = (w - top_w);
h = 2.2;
facetProfile = [
[w, -bottom],
[0, -bottom],
[0, 0],
[top_offset, -h],
[w, -h],
[w, 0]
];
end_d = start_d + (spacing * 2 * rotations);
end_r = end_d / 2;
start_r = start_d / 2;
facetSize = calcFacetSize(end_d, fn);
start_fn = round(circ(start_d) / facetSize);
spiralPath = [ for (r = [0 : rotations - 1]) for (i = [0 : round(calcFn(start_d, start_fn, end_d, spacing, r )) - 1 ])
[
X(start_r, spacing, round(calcFn(start_d, start_fn, end_d, spacing, r )), r, i),
Y(start_r, spacing, round(calcFn(start_d, start_fn, end_d, spacing, r )), r, i),
0]
];
path_extrude(exShape=facetProfile, exPath=spiralPath);
}
module spiral_reinforcement ( start_d = 48, spacing = 2.075, bottom = -2, fn) {
rotations = 1;
w = 1;
top_w = .8;
top_offset = (w - top_w);
h = 2.2;
facetProfile = [
[w, -bottom],
[0, -bottom],
[0, 0],
[0, -h],
[w, -h],
[w, 0]
];
end_d = start_d + (spacing * 2 * rotations);
end_r = end_d / 2;
start_r = start_d / 2;
facetSize = calcFacetSize(end_d, fn);
start_fn = round(circ(start_d) / facetSize);
spiralPath = [ for (r = [0 : rotations - 1]) for (i = [0 : round(calcFn(start_d, start_fn, end_d, spacing, r )) - 1 ])
[
X(start_r, spacing, round(calcFn(start_d, start_fn, end_d, spacing, r )), r, i),
Y(start_r, spacing, round(calcFn(start_d, start_fn, end_d, spacing, r )), r, i),
0]
];
path_extrude(exShape=facetProfile, exPath=spiralPath);
}
/**
* Core (center of the reel)
**/
module gnal_spiral_core () {
$fn = 360;
core_center_h = 4.2 + 3;;
core_bottom_outer_d = 53;
core_bottom_outer_void_d = 44;
core_bottom_outer_h = 4.2;
core_d = 29.5;
core_h = 8.5;
core_bottom_d = 26;
core_bottom_h = 4.2;
top_z_offset = (core_h / 2) - (core_center_h / 2);
core_void_outer_d = 20.5;
core_void_inner_d = 14.5;
core_void_h = 11.5;
arms_outer_d = 48;
arms_inner_d = 48 - 7;
void_d = 18;
film_void = 0.6;
difference () {
union() {
//center
translate([0, 0, -core_center_h / 2]) {
cylinder(r = (core_bottom_outer_d - 1) / 2, h = core_center_h, center = true);
}
//top
translate([0, 0, top_z_offset]) {
cylinder(r = core_d / 2, h = core_h + core_center_h, center = true);
}
}
cylinder(r = void_d / 2, h = 30, center = true);
translate([0, 0, -7.2]) spiral_insert_void();
}
//arms
difference () {
union () {
translate([0, 0, top_z_offset]) difference() {
//adjusted arm (shorter)
intersection () {
cylinder(r = arms_outer_d / 2, h = core_h + core_center_h, center = true);
translate([1, 0, 0]) cylinder(r = arms_outer_d / 2, h = core_h + core_center_h, center = true);
}
intersection () {
cylinder(r = arms_inner_d / 2, h = core_h + core_center_h + 1, center = true);
translate([1, 0, 0]) cylinder(r = arms_inner_d / 2, h = core_h + core_center_h + 1, center = true);
}
translate([0, arms_outer_d / 2, 0]) cube([arms_outer_d, arms_outer_d, arms_outer_d], center = true);
}
//rounded arm end
translate([(arms_outer_d + arms_inner_d) / 4, 0, top_z_offset]) cylinder(r = 3.5 / 2, h = core_h + core_center_h, center = true, $fn = 40);
//adjusted arm
translate([-((arms_outer_d + arms_inner_d) / 4) + 1, 0, top_z_offset]) cylinder(r = 3.5 / 2, h = core_h + core_center_h, center = true, $fn = 40);
difference () {
rotate([0, 0, -120]) translate([13.75, 0, top_z_offset]) cube([16, 20, core_h + core_center_h], center = true);
//remove piece from adjusted arm
translate([-19, -14, 0]) rotate([0, 0, 10]) cube([4, 4, 30], center = true);
//remove piece from non-adjusted arm
rotate([0, 0, 45]) translate([-19, -14, 0]) rotate([0, 0, -10]) cube([4, 4, 30], center = true);
rotate([0, 0, -120 - 37]) translate([18, 0, top_z_offset]) {
cylinder(r = 6.8 / 2, h = 30, center = true);
translate([-4, -2, 0]) cube([4, 4, 30], center = true);
}
rotate([0, 0, -120 + 37]) translate([18, 0, top_z_offset]) {
cylinder(r = 6.8 / 2, h = 30, center = true);
translate([-4, 2, 0]) cube([4, 4, 30], center = true);
}
}
}
//film void (notches)
rotate([0, 0, -120]) {
translate([20, -5, 0]) {
rotate([0, 0, 45]) {
cube([20, film_void, 30], center = true);
}
}
}
rotate([0, 0, -120]) {
translate([20, 5, 0]) {
rotate([0, 0, -45]) {
cube([20, film_void, 30], center = true);
}
}
}
//flatten piece
rotate([0, 0, -120]) translate([25, 0, 0]) difference () {
cylinder(r = 8 / 2, h = 30, center = true);
translate([-6.9, 0, 0]) cube([8, 8, 30], center = true);
}
cylinder(r = core_void_outer_d / 2, h = core_void_h, center = true);
rotate([0, 0, -120]) translate([20, 0, -1.5]) rotate([0, 0, 45]) cube([20, 20, 3.01], center = true);
cylinder(r = void_d / 2, h = 30, center = true);
translate([0, 0, -7.2]) spiral_insert_void();
}
}
module spiral_insert_void () {
intersection () {
rotate([0, 45, 0]) cube([3, INSERT_D + 2, 3], center = true);
cylinder(r = (INSERT_D + 1) / 2, h = 6, center = true);
}
intersection () {
rotate([0, 45, 90]) cube([3, INSERT_D + 2, 3], center = true);
cylinder(r = (INSERT_D + 1) / 2, h = 6, center = true);
}
}
module gnal_spiral_bottom_insert_s8 () {
$fn = 160;
OD = 10.5 + .3;
void_d = 18 - .6;
H = 17;
D2 = INSERT_D;
translate([0, 0, 0]) difference () {
union () {
cylinder(r = void_d / 2, h = H, center = true);
//skirt
translate([0, 0, -(H - 1) / 2]) cylinder(r = D2 / 2, h = 1.5, center = true);
//notches
translate([0, 0, -((H - 2.5) / 2) - .1]) {
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
rotate([0, 0, 90]) difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
}
}
translate([0, 0, -LEN / 2]) {
if (DEBUG) {
cylinder(r = OD / 2, h = LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length=LEN);
}
}
}
}
module gnal_spiral_bottom_insert_16 () {
$fn = 160;
OD = 10.5 + .3;
void_d = 18 - .6;
H = 17 + 8;
D2 = INSERT_D;
RIDGES = 8;
RIDGE_D = 3;
translate([0, 0, 0]) difference () {
union () {
cylinder(r = void_d / 2, h = H, center = true);
//skirt
translate([0, 0, -(H - 1) / 2]) cylinder(r = D2 / 2, h = 1.5, center = true);
//notches
translate([0, 0, -((H - 2.5) / 2) - .1]) {
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
rotate([0, 0, 90]) difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
}
}
translate([0, 0, -(H / 2) - 2]) {
if (DEBUG) {
cylinder(r = OD / 2, h = LEN + 8);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length=LEN + 8);
}
}
translate([0, 0, 8.5]) {
for (i = [0: RIDGES - 1]) {
rotate([0, 0, i * (360 / RIDGES)]) translate([void_d / 2, 0, 0]) cylinder(r = RIDGE_D / 2, h = 8.1, center = true);
}
}
}
}
/**
* Comment to preserve my sanity when developing: This single-spiral
* insert is the same height as the s8 insert but has a different
* diameter void fo the screw to prevent mismatching of spindle screws
* designed for different purposes.
**/
module gnal_spiral_bottom_insert_single () {
$fn = 160;
void_d = 18 - .6;
H = 17;
D2 = INSERT_D;
translate([0, 0, 0]) difference () {
union () {
cylinder(r = void_d / 2, h = H, center = true);
//skirt
translate([0, 0, -(H - 1) / 2]) cylinder(r = D2 / 2, h = 1.5, center = true);
//notches
translate([0, 0, -((H - 2.5) / 2) - .1]) {
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
intersection () {
cylinder(r = D2 / 2, h = 6, center = true);
rotate([0, 0, 90]) difference () {
rotate([0, 45, 0]) cube([3, D2 + 2, 3], center = true);
translate([0, 0, -1.5]) cube([6, D2 + 3, 3], center = true);
}
}
}
}
translate([0, 0, -LEN / 2]) {
if (DEBUG) {
cylinder(r = SINGLE_THREAD_D / 2, h = LEN);
} else {
metric_thread (diameter=SINGLE_THREAD_D, pitch=PITCH, thread_size = THREAD, length = LEN);
}
}
}
}
/**
* Spacers
**/
module spacer_ridges () {
ridges = 16;
for (i = [0 : ridges]) {
rotate([0, 0, i * (360 / ridges)]) translate([13.5, 0, 0]) cylinder(r = 1.25, h = 8, $fn = 60);
}
}
module spacer_ridges_loose () {
ridges = 16;
intersection () {
union () {
for (i = [0 : ridges]) {
rotate([0, 0, i * (360 / ridges)]) translate([13.7, 0, 0]) cylinder(r = 1.25, h = 8, $fn = 60);
}
}
cylinder(r = 13.7, h = 12, center = true);
}
}
module spacer_outer_ridges () {
ridges = 24;
H = 6.5;
difference () {
union () {
for (i = [0 : ridges]) {
rotate([0, 0, i * (360 / ridges)]) translate([14.6, 0, -4.75]) cylinder(r = 1.25, h = 8, $fn = 30);
}
}
translate([0, 0, -4.1]) difference () {
cylinder(r = 33 / 2, h = 4, center = true, $fn = 100);
cylinder(r2 = 33 / 2, r1 = 27.75 / 2, h = 4.1, center = true, $fn = 100);
}
}
}
module gnal_spacer_solid () {
core_d = 29.5;
core_bottom_d = 26.2 + .2;
void_d = 18;
h = 8;
RIDGES = 8;
RIDGE_D = 3;
translate([0, 0, 0]) difference () {
union () {
difference () {
cylinder(r = core_d / 2, h = h, center = true, $fn = 200);
}
translate([0, 0, -.75]) rotate([0, 180, 0]) spacer_outer_ridges();
}
}
}
/**
* This spacer attaches to the top piece when it is used
* for Super8 film.
**/
module gnal_spacer () {
add = 3.25;
core_d = 29.5;
core_bottom_d = 26.2 + .2;
void_d = 22.5;
h = 8 + add;
translate([0, 0, (add / 2) - 1]) difference () {
union () {
difference () {
cylinder(r = core_d / 2, h = h, center = true, $fn = 200);
translate([0, 0, 8]) cylinder(r = core_bottom_d / 2, h = h, center = true, $fn = 200);
cylinder(r = void_d / 2, h = h + 1, center = true, $fn = 200);
}
translate([0, 0, 0]) spacer_ridges_loose();
spacer_outer_ridges();
}
//trim top
translate([0, 0, h - 0.1]) cylinder(r = (core_d + 1) / 2, h = h, center = true, $fn = 200);
//trim bottom
translate([0, 0, -h + 0.9]) cylinder(r = (core_d + 1) / 2, h = h, center = true, $fn = 200);
}
}
module gnal_spacer_16 () {
core_d = 29.5;
core_bottom_d = 26.2 + .2;
void_d = 18.3;
h = 8;
RIDGES = 8;
RIDGE_D = 3;
difference () {
gnal_spacer_solid();
cylinder(r = void_d / 2, h = h + 1, center = true, $fn = 200);
}
translate([0, 0, 0]) {
for (i = [0: RIDGES - 1]) {
rotate([0, 0, i * (360 / RIDGES)]) translate([void_d / 2, 0, 0]) cylinder(r = RIDGE_D / 2, h = 8, center = true);
}
}
}
/**
* Spindles
**/
module gnal_spindle_base ( ) {
D = 8.45 * 2;
H = 20;
union() {
translate([0, 0, -15]) {
cylinder(r = D / 2, h = H, center = true, $fn = FINE);
}
}
}
module gnal_spindle_bottom_base ( HEX = false) {
//for grip
BUMP = 2; //diameter
BUMPS = 6;
TOP_D = 19;
TOP_H = 9.5;
TOP_OFFSET = -24.5;
union() {
gnal_spindle_base();
//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, TOP_OFFSET]) {
cylinder(r = BUMP, h = TOP_H, center = true, $fn = 60);
}
}
}
}
}
module outer_screw (LEN) {
OD = 10;
PITCH = 1.5;
THREAD = 1.6;
difference () {
translate([0, 0, -7.1]) {
if (DEBUG) {
cylinder(r = OD / 2, h = LEN);
} else {
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 gnal_spindle_bottom (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 () {
gnal_spindle_bottom_base(HEX);
//inner screw negative
translate([0, 0, -30]) union() {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
translate([0, 0, 0.2]) {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
}
}
}
difference () {
//outer screw
if (ALT) {
outer_screw(ALT_LEN);
} else {
outer_screw(LEN);
}
}
}
module number_one () {
rotate([0, 45, 0]) cube([1, 6, 1], center = true);
translate([0, 6 / 2, 0]) rotate([45, 0, 0]) cube([2, 1, 1], center = true);
translate([0, -6 / 2, 0]) rotate([45, 0, 0]) cube([2, 1, 1], center = true);
}
module gnal_spindle_top () {
D = 50;
THICKNESS = 2.5;
H = 19.5;
ROUND = 8;
HANDLE_D = 13.25;
HANDLE_BASE = 16;
HANDLE_TOP = 13;
HANDLE_H = 54.5;
NOTCHES = 17;
NOTCH = 1.5;
FINE = 200;
difference () {
//cup
translate([0, 0, ROUND - 2]) minkowski () {
cylinder(r = (D / 2) - ROUND, h = (H * 2) - ROUND, center = true, $fn = FINE);
sphere(r = ROUND, $fn = FINE);
}
translate([0, 0, ROUND - 2 + THICKNESS]) minkowski () {
cylinder(r = (D / 2) - THICKNESS - ROUND, h = (H * 2) - ROUND, center = true, $fn = 200);
sphere(r = ROUND, $fn = FINE);
}
//hollow out cup
translate([0, 0, H + ROUND - 4 - 3]) {
cylinder(r = (D / 2) + 1, h = H * 2, center = true);
}
//inner cup bevel
translate([0, 0, (H / 2) - ROUND - 1]) {
cylinder(r1 = (D / 2) - 2.5, r2 = (D / 2) - 2.5 + 1, h = 1, center = true, $fn = FINE);
}
//outer cup bevel
translate([0, 0, (H / 2) - ROUND - 1]) {
difference () {
cylinder(r = (D / 2) + .25, h = 1, center = true, $fn = FINE);
cylinder(r2 = (D / 2) - .8, r1 = (D / 2) - .8 + 1, h = 1, center = true, $fn = FINE);
}
}
//hole in cup
translate([21, 0, -10]) cylinder(r = 3 / 2, h = 40, center = true, $fn = 40);
}
//reference cylinder
//translate([0, 0, -6.6]) color("red") cylinder(r = 50 / 2, h = 19.57, center = true);
//handle
translate([0, 0, -15]) {
difference() {
cylinder(r1 = HANDLE_BASE / 2, r2 = HANDLE_TOP / 2, h = HANDLE_H, $fn = FINE);
//text
translate([3 / 2, 0, 15 + 39.75]) number_one();
translate([-3 / 2, 0, 15 + 39.75]) number_one();
//ring negative
translate([0, 0, 31 + 14.5]) {
difference () {
cylinder(r = HANDLE_D / 2 + 2, h = 20, center = true);
cylinder(r = HANDLE_D / 2 - .5, h = 20 + 1, center = true);
}
}
//handle notches
for(i = [0 : NOTCHES]) {
rotate([0, 0, i * (360 / NOTCHES)]) {
translate([0, HANDLE_D / 2 - .5, 31 + 14.5]) {
rotate([0.75, 0, 0]) rotate([0, 0, 45]) {
Right_Angled_Triangle(a = NOTCH, b = NOTCH, height = 20, centerXYZ=[true, true, true]);
}
}
}
}
//bevel handle at top
translate([0, 0, 54.01]) {
difference () {
cylinder(r = 13 / 2, h = 1, center = true);
cylinder(r1 = 12.5 / 2, r2 = 11.5 / 2, h = 1.01, center = true);
}
}
}
}
//attach handle with pyramid cylinder
translate ([0, 0, -13.7]) {
cylinder(r1 = 16 / 2 + 2, r2 = 16 / 2 - .1, h = 3, center = true, $fn = FINE);
}
//plate under cup
translate([0, 0, -17.75]) {
cylinder(r = 31.5 / 2, h = 1, center = true, $fn = FINE);
}
//screw
translate([0, 0, -37.5]) {
if (DEBUG) {
cylinder(r = 13.6 / 2, h = 21);
} else {
metric_thread (diameter=13.6, pitch = PITCH, thread_size = THREAD, length = 21);
}
}
//cylinder plug
translate([0, 0, -37.5 + (21 / 2) - 1]) {
cylinder(r = 12 / 2, h = 21, center = true, $fn = FINE);
}
}
module gnal_spindle_single () {
D = 50;
THICKNESS = 2.5;
H = 19.5;
ROUND = 8;
HANDLE_D = 13.25;
HANDLE_BASE = 16;
HANDLE_TOP = 13;
HANDLE_H = 54.5;
NOTCHES = 17;
NOTCH = 1.5;
FINE = 200;
SINGLE_INSERT = 11;
difference () {
//cup
translate([0, 0, ROUND - 2]) minkowski () {
cylinder(r = (D / 2) - ROUND, h = (H * 2) - ROUND, center = true, $fn = FINE);
sphere(r = ROUND, $fn = FINE);
}
translate([0, 0, ROUND - 2 + THICKNESS]) minkowski () {
cylinder(r = (D / 2) - THICKNESS - ROUND, h = (H * 2) - ROUND, center = true, $fn = 200);
sphere(r = ROUND, $fn = FINE);
}
//hollow out cup
translate([0, 0, H + ROUND - 4 - 3]) {
cylinder(r = (D / 2) + 1, h = H * 2, center = true);
}
//inner cup bevel
translate([0, 0, (H / 2) - ROUND - 1]) {
cylinder(r1 = (D / 2) - 2.5, r2 = (D / 2) - 2.5 + 1, h = 1, center = true, $fn = FINE);
}
//outer cup bevel
translate([0, 0, (H / 2) - ROUND - 1]) {
difference () {
cylinder(r = (D / 2) + .25, h = 1, center = true, $fn = FINE);
cylinder(r2 = (D / 2) - .8, r1 = (D / 2) - .8 + 1, h = 1, center = true, $fn = FINE);
}
}
//hole in cup
translate([21, 0, -10]) cylinder(r = 3 / 2, h = 40, center = true, $fn = 40);
}
//reference cylinder
//translate([0, 0, -6.6]) color("red") cylinder(r = 50 / 2, h = 19.57, center = true);
//handle
translate([0, 0, -15]) {
difference() {
cylinder(r1 = HANDLE_BASE / 2, r2 = HANDLE_TOP / 2, h = HANDLE_H, $fn = FINE);
//text
translate([0, 0, 15 + 39.75]) number_one();
//ring negative
translate([0, 0, 31 + 14.5]) {
difference () {
cylinder(r = HANDLE_D / 2 + 2, h = 20, center = true);
cylinder(r = HANDLE_D / 2 - .5, h = 20 + 1, center = true);
}
}
//handle notches
for(i = [0 : NOTCHES]) {
rotate([0, 0, i * (360 / NOTCHES)]) {
translate([0, HANDLE_D / 2 - .5, 31 + 14.5]) {
rotate([0.75, 0, 0]) rotate([0, 0, 45]) {
Right_Angled_Triangle(a = NOTCH, b = NOTCH, height = 20, centerXYZ=[true, true, true]);
}
}
}
}
//bevel handle at top
translate([0, 0, 54.01]) {
difference () {
cylinder(r = 13 / 2, h = 1, center = true);
cylinder(r1 = 12.5 / 2, r2 = 11.5 / 2, h = 1.01, center = true);
}
}
}
}
//attach handle with pyramid cylinder
translate ([0, 0, -13.7]) {
cylinder(r1 = 16 / 2 + 2, r2 = 16 / 2 - .1, h = 3, center = true, $fn = FINE);
}
//plate under cup
translate([0, 0, -17.75]) {
cylinder(r = 31.5 / 2, h = 1, center = true, $fn = FINE);
}
//insert for single layer
translate ([0, 0, -24.25]) {
cylinder(r = 22 / 2, h = 14, center = true, $fn = FINE);
}
//screw
translate([0, 0, -37.5 - SINGLE_INSERT]) {
if (DEBUG) {
cylinder(r = SINGLE_THREAD_D / 2, h = 21);
} else {
metric_thread (diameter=SINGLE_THREAD_D, pitch = PITCH, thread_size = THREAD, length = 21);
}
}
//cylinder plug
translate([0, 0, -37.5 - SINGLE_INSERT + (21 / 2) - 1]) {
cylinder(r = 10 / 2, h = 21, center = true, $fn = FINE);
}
}
module gnal_stacking_spindle () {
OD = 10.5 + .3;
IN_LEN = 21;
LEN = 17.1;
ALT_LEN = 27.1;
difference () {
union () {
gnal_spindle_base();
translate([0, 0, -23.75]) gnal_spacer_solid();
}
//inner screw negative
translate([0, 0, -30]) union() {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
translate([0, 0, 0.2]) {
if (DEBUG) {
cylinder(r = OD / 2, h = IN_LEN);
} else {
metric_thread (diameter=OD, pitch=PITCH, thread_size = THREAD, length = IN_LEN);
}
}
}
}
difference () {
outer_screw(LEN - 2);
}
}

476
scad/v4/gnal.scad Normal file
View File

@ -0,0 +1,476 @@
//V4
include <../libraries/gnal_v4.scad>;
SPOKE_COUNT = 24;
FN = 200;
$fn = FN;
module gnal_100ft_spiral (spiral_count = 60, od = 298.75, quarter = false) {
outer_d = 299;
outer_d_inside = outer_d - 6;
outer_h = 7.5;
spoke_len = 123;
spoke_w = 3;
spoke_h = 4.2 + 3;
spoke_2_len = 85;
spoke_cross_1_d = 63;
spoke_cross_1_w = 18;
spoke_cross_2_d = 108;
spoke_cross_2_w = 15;
spoke_3_len = 39;
spoke_3_w = 2;
translate([0, 0, -3.6]) difference () {
cylinder(r = outer_d / 2, h = spoke_h, center = true, $fn = 500);
cylinder(r = outer_d_inside / 2, h = outer_h + 1, center = true, $fn = 500);
}
difference () {
gnal_spiral_core();
//rounded spoke voids
for (i = [0 : SPOKE_COUNT - 1]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([0, 26.75, 0]) {
cylinder(r = 2, h = 20, center = true, $fn = 40);
}
}
}
}
//main spokes
for (i = [0 : SPOKE_COUNT - 1]) {
rotate([0, 0, i * (360 / SPOKE_COUNT)]) {
translate([(spoke_len / 2) + (48 / 2), 0, -3.6]) {
if (quarter && i % 3 == 0 && i % 6 != 0) { //phew!
cube([spoke_len, spoke_w * 2, spoke_h], center = true);
} else {
cube([spoke_len, spoke_w, spoke_h], center = true);
}
}
}
}
//secondary spokes
for (i = [0 : SPOKE_COUNT - 1]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([(outer_d / 2) - (spoke_2_len / 2) - 2, 0, -3.6]) {
cube([spoke_2_len, spoke_w, spoke_h], center = true);
}
}
}
//spoke cross bars
for (i = [0 : SPOKE_COUNT - 1]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([63, 0, -3.6]) {
rotate([0, 0, 20]) {
cube([ spoke_w, 18, spoke_h], center = true);
}
}
}
}
//second spokes
for (i = [0 : SPOKE_COUNT - 1]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([(outer_d / 2) - (spoke_2_len / 2) - 2, 0, -3.6]) {
cube([spoke_2_len, spoke_w, spoke_h], center = true);
}
}
}
//second spoke cross pieces
for (i = [0 : (SPOKE_COUNT * 2) - 1]) {
rotate([0, 0, (i + 0.5) * (360 / (SPOKE_COUNT * 2))]) {
translate([spoke_cross_2_d, 0, -3.6]) {
rotate([0, 0, -20]) {
cube([ spoke_w, spoke_cross_2_w, spoke_h], center = true);
}
}
}
}
//third spokes
for (i = [0 : (SPOKE_COUNT * 2) - 1]) {
rotate([0, 0, (i + 0.5) * (360 / (SPOKE_COUNT * 2))]) {
translate([(outer_d / 2) - (spoke_3_len / 2) - 2, 0, -3.6]) {
cube([spoke_3_len, spoke_3_w, spoke_h], center = true);
}
}
}
translate([0, 0, -.1]) {
rotate([0, 0, -90]) {
film_guide(spiral_count);
}
}
}
module gnal_100ft_spiral_quarter (quarter = "a") {
LEN = 220;
module notch (NOTCH = 5) {
cube([NOTCH, NOTCH, 5], center = true);
translate([0, 0, (5 / 2) + (1 / 2)]) rotate([0, 0, 45]) cylinder(r1 = NOTCH / 1.4, r2 = 0.1, h = 1, center = true, $fn = 4);
}
module quarter () {
NOTCH = 3;
NOTCH_H = -5;
NOTCHES = 7;
OFFSET = 60;
difference () {
cube([LEN, LEN, LEN], center = true);
for (i = [0 : NOTCHES - 1]) {
translate([OFFSET - (i * (LEN / NOTCHES)), -(LEN / 2), NOTCH_H]) rotate([0, 0, 45]) notch(NOTCH);
}
}
for (i = [0 : NOTCHES - 2]) {
translate([-(LEN / 2), OFFSET - (i * (LEN / NOTCHES)), NOTCH_H]) rotate([0, 0, 45]) notch(NOTCH);
}
}
intersection () {
rotate([0, 0, 45]) gnal_100ft_spiral(quarter = true);
if (quarter == "a") {
rotate([0, 0, 0]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "b") {
rotate([0, 0, 90]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "c") {
rotate([0, 0, 180]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "d") {
rotate([0, 0, 270]) translate([LEN / 2, LEN / 2, 0]) quarter();
}
}
}
module gnal_100ft_top () {
H = 5;
center_d = 53;
spoke_w = 4.5;
spokes = 12;
outer_d = 299;
inner_d = 150;
inner_d_2 = 215;
void_d = 22.5;
hole_d = 3.5;
hole_spacing = 37;
core_d = 29.5;
core_bottom_d = 26.2;
difference () {
union () {
cylinder(r = center_d / 2, h = H, center = true, $fn = 100);
for (i = [0 : spokes]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, outer_d / 4, 0]) cube([spoke_w, (outer_d / 2) - 1, H], center = true);
}
//outer spokes
for (i = [0 : spokes * 2]) {
rotate([0, 0, i * (360 / (spokes * 2))]) translate([0, (outer_d / 2) - 25, 0]) cube([spoke_w, (outer_d / 2) - (inner_d_2 / 2) , H], center = true);
}
}
//void
cylinder(r = void_d / 2, h = H + 1, center = true, $fn = 100);
//speed holes
for (i = [0 : 3]) {
rotate([0, 0, (i * 90) + 45]) translate([0, hole_spacing / 2, 0]) cylinder(r = hole_d / 2, h = H + 1, center = true);
}
//rounding of center cylinder
for (i = [0 : spokes]) {
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([-2.75, 26.5, 0]) cylinder(r = 2, h = H+1, center = true, $fn = 40);
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([2.75, 26.5, 0]) cylinder(r = 2, h = H+1, center = true, $fn = 40);
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([0, 26.5, 0]) cube([5, 4, H + 1], center = true);
}
}
difference () {
cylinder(r = (center_d / 2) - 1.8, h = H, center = true, $fn = 200);
cylinder(r = (hole_spacing / 2) + 2, h = H + 1, center = true, $fn = 200);
}
//outer ring
difference () {
cylinder(r = outer_d / 2, h = H, center = true, $fn = 200);
cylinder(r = (outer_d / 2) - 5, h = H + 1, center = true, $fn = 200);
}
//inner ring
difference () {
cylinder(r = inner_d / 2, h = H, center = true, $fn = 200);
cylinder(r = (inner_d / 2) - 5, h = H + 1, center = true, $fn = 200);
}
//second inner ring
difference () {
cylinder(r = inner_d_2 / 2, h = H, center = true, $fn = 200);
cylinder(r = (inner_d_2 / 2) - 5, h = H + 1, center = true, $fn = 200);
}
//rounded cross connectors
for (i = [0 : spokes]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, (inner_d / 2) - (spoke_w / 2), 0]) difference() {
cylinder(r = 6.5, h = H, center = true);
translate([6.25, 6, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.25, 6, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.1, -7, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([6.1, -7, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
difference () {
union () {
translate([0, 0, 3.75 + 1]) cylinder(r = core_d / 2, h = H, center = true, $fn = 60);
translate([0, 0, 3.75 + 1 + 3.2]) cylinder(r = core_bottom_d / 2, h = H, center = true, $fn = 60);
}
cylinder(r = void_d / 2, h = H * 5 , center = true, $fn = 100);
translate([0, 0, 4 + 1 + 2.25]) spacer_ridges();
}
//rounded second ring connectors
for (i = [0 : spokes]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, 205 / 2, 0]) difference () {
translate([0, 2, 0]) cube([13, 12, H], center = true);
translate([6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([6.2, 8.75, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.2, 8.75, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
//second ring connectors
for (i = [0 : spokes * 2]) {
rotate([0, 0, i * (360 / (spokes * 2))]) translate([0, 205 / 2, 0]) difference () {
translate([0, 4, 0]) cube([13, 8, H], center = true);
translate([6.2, 8.75, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.2, 8.75, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
for (i = [0 : spokes * 2]) {
rotate([0, 0, i * (360 / (spokes * 2))]) translate([0, 289 / 2, 0]) difference () {
translate([0, 0, 0]) cube([13, 9, H], center = true);
translate([6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
}
module gnal_50ft_spiral (spiral_count = 40, od = 215, quarter = false, reinforced = true) {
outer_d = od;
outer_d_inside = outer_d - 6;
outer_h = 7.5;
spoke_len = ((outer_d - 48) / 2) - 2.5; //81;
spoke_w = 3;
spoke_h = 4.2 + 3;
spoke_2_len = 43;
translate([0, 0, -3.6]) difference () {
cylinder(r = outer_d / 2, h = spoke_h, center = true, $fn = 500);
cylinder(r = outer_d_inside / 2, h = outer_h + 1, center = true, $fn = 500);
}
difference () {
gnal_spiral_core();
//rounded spoke voids
for (i = [0 : SPOKE_COUNT]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([0, 26.75, 0]) {
cylinder(r = 2, h = 20, center = true, $fn = 40);
}
}
}
}
//main spokes
for (i = [0 : SPOKE_COUNT]) {
rotate([0, 0, i * (360 / SPOKE_COUNT)]) {
translate([(spoke_len / 2) + (48 / 2), 0, -3.6]) {
if (quarter && i % 3 == 0 && i % 6 != 0) { //phew!
cube([spoke_len, spoke_w * 2, spoke_h], center = true);
} else {
cube([spoke_len, spoke_w, spoke_h], center = true);
}
}
}
}
//secondary spokes
/*
for (i = [0 : SPOKE_COUNT]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([(outer_d / 2) - (spoke_2_len / 2) - 2, 0, -3.6]) {
cube([spoke_2_len, spoke_w, spoke_h], center = true);
}
}
}
*/
//spoke cross bars
if (outer_d > 130) {
for (i = [0 : SPOKE_COUNT]) {
rotate([0, 0, (i + 0.5) * (360 / SPOKE_COUNT)]) {
translate([63, 0, -3.6]) {
rotate([0, 0, 20]) {
cube([ spoke_w, 18, spoke_h], center = true);
}
}
}
}
}
translate([0, 0, -.1]) {
rotate([0, 0, -90]) {
film_guide(spiral_count, reinforced = reinforced);
}
}
}
module gnal_50ft_spiral_quarter (quarter = "a") {
LEN = 220;
module notch (NOTCH = 5) {
cube([NOTCH, NOTCH, 5], center = true);
translate([0, 0, (5 / 2) + (1 / 2)]) rotate([0, 0, 45]) cylinder(r1 = NOTCH / 1.4, r2 = 0.1, h = 1, center = true, $fn = 4);
}
module quarter () {
NOTCH = 3;
NOTCH_H = -5;
NOTCHES = 7;
OFFSET = 60;
difference () {
cube([LEN, LEN, LEN], center = true);
for (i = [0 : NOTCHES - 1]) {
translate([OFFSET - (i * (LEN / NOTCHES)), -(LEN / 2), NOTCH_H]) rotate([0, 0, 45]) notch(NOTCH);
}
}
for (i = [0 : NOTCHES - 2]) {
translate([-(LEN / 2), OFFSET - (i * (LEN / NOTCHES)), NOTCH_H]) rotate([0, 0, 45]) notch(NOTCH);
}
}
intersection () {
rotate([0, 0, 45]) gnal_50ft_spiral(quarter = true);
if (quarter == "a") {
rotate([0, 0, 0]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "b") {
rotate([0, 0, 90]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "c") {
rotate([0, 0, 180]) translate([LEN / 2, LEN / 2, 0]) quarter();
} else if (quarter == "d") {
rotate([0, 0, 270]) translate([LEN / 2, LEN / 2, 0]) quarter();
}
}
}
module gnal_50ft_top () {
H = 5;
center_d = 53;
spoke_w = 4.5;
spokes = 12;
outer_d = 215;
inner_d = 150;
void_d = 22.5;
hole_d = 3.5;
hole_spacing = 37;
core_d = 29.5;
core_bottom_d = 26.2;
difference () {
union () {
cylinder(r = center_d / 2, h = H, center = true, $fn = 100);
for (i = [0 : spokes - 1]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, outer_d / 4, 0]) cube([spoke_w, (outer_d / 2) - 1, H], center = true);
}
}
//void
cylinder(r = void_d / 2, h = H + 1, center = true, $fn = 100);
//speed holes
for (i = [0 : 3]) {
rotate([0, 0, (i * 90) + 45]) translate([0, hole_spacing / 2, 0]) cylinder(r = hole_d / 2, h = H + 1, center = true);
}
//rounding of center cylinder
for (i = [0 : spokes - 1]) {
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([-2.75, 26.5, 0]) cylinder(r = 2, h = H+1, center = true, $fn = 40);
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([2.75, 26.5, 0]) cylinder(r = 2, h = H+1, center = true, $fn = 40);
rotate([0, 0, (i + 0.5) * (360 / spokes)]) translate([0, 26.5, 0]) cube([5, 4, H + 1], center = true);
}
}
difference () {
cylinder(r = (center_d / 2) - 1.8, h = H, center = true, $fn = 200);
cylinder(r = (hole_spacing / 2) + 2, h = H + 1, center = true, $fn = 200);
}
//outer ring
difference () {
cylinder(r = outer_d / 2, h = H, center = true, $fn = 200);
cylinder(r = (outer_d / 2) - 5, h = H + 1, center = true, $fn = 200);
}
//inner ring
difference () {
cylinder(r = inner_d / 2, h = H, center = true, $fn = 200);
cylinder(r = (inner_d / 2) - 5, h = H + 1, center = true, $fn = 200);
}
//rounded cross connectors
for (i = [0 : spokes - 1]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, (inner_d / 2) - (spoke_w / 2), 0]) difference() {
cylinder(r = 6.5, h = H, center = true);
translate([6.25, 6, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.25, 6, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.1, -7, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([6.1, -7, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
difference () {
union () {
translate([0, 0, 3.75 + 1]) cylinder(r = core_d / 2, h = H, center = true, $fn = 60);
translate([0, 0, 3.75 + 1 + 3.2]) cylinder(r = core_bottom_d / 2, h = H, center = true, $fn = 60);
}
cylinder(r = void_d / 2, h = H * 5 , center = true, $fn = 100);
translate([0, 0, 4 + 1 + 2.25]) spacer_ridges();
}
//rounded outer ring connectors
for (i = [0 : spokes - 1]) {
rotate([0, 0, i * (360 / spokes)]) translate([0, 205 / 2, 0]) difference () {
cube([13, 9, H], center = true);
translate([6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
translate([-6.2, -4.2, 0]) cylinder(r = 4, h = H + 1, center = true, $fn = 60);
}
}
}
module film_guide (rotations = 60, id = 45.55, spacing = 2.075, bottom = -2) {
spiral(rotations, id, spacing, bottom, $fn);
//reinforce outer spiral
difference () {
spiral_reinforcement(292.9, spacing, -0.1, $fn);
translate([149.125, 9, 0]) cube([5, 20, 10], center = true);
}
}
PART="spiral";
if (PART == "spiral") {
gnal_100ft_spiral();
} else if (PART == "quarter_a") {
gnal_100ft_spiral_quarter("a");
} else if (PART == "quarter_b") {
gnal_100ft_spiral_quarter("b");
} else if (PART == "quarter_c") {
gnal_100ft_spiral_quarter("c");
} else if (PART == "quarter_d") {
gnal_100ft_spiral_quarter("d");
} else if (PART == "top") {
gnal_100ft_top();
} else if (PART == "spacer") {
gnal_spacer();
} else if (PART == "spacer_16") {
gnal_spacer_16();
} else if (PART == "insert_s8") {
gnal_spiral_bottom_insert_s8();
} else if (PART == "insert_16") {
gnal_spiral_bottom_insert_16();
} else if (PART == "insert_single") {
gnal_spiral_bottom_insert_single();
} else if (PART == "spindle_top") {
gnal_spindle_top();
} else if (PART == "spindle_bottom") {
gnal_spindle_bottom();
} else if (PART == "spindle_single") {
gnal_spindle_single();
} else if (PART == "spindle_stacking") {
rotate([0, 180, 0]) gnal_stacking_spindle();
}

View File

@ -25,7 +25,6 @@ FILES=(
"spindle_bottom"
"spindle_top"
"spindle_single"
"spindle_stacking"
"insert_s8"
"insert_16"
"spacer"
@ -231,10 +230,10 @@ do
done
# add license to directories for zip
cp ./LICENSE.txt "./stl/${SIZE}_v3/"
cp ./LICENSE.txt "./stl/${SIZE}_${V}/"
# zip all
zip -x ".*" -r "./releases/gnal_${SIZE}_v3.zip" "./stl/${SIZE}_v3/"
zip -x ".*" -r "./releases/gnal_${SIZE}_${V}.zip" "./stl/${SIZE}_${V}/"
# tar all
tar --exclude=".*" -czvf "./releases/gnal_${SIZE}_v3.tar.gz" "./stl/${SIZE}_v3/"
tar --exclude=".*" -czvf "./releases/gnal_${SIZE}_${V}.tar.gz" "./stl/${SIZE}_${V}/"
done

240
scripts/v4.sh Normal file
View File

@ -0,0 +1,240 @@
#!/bin/bash
V="v4"
# Commit changes before running this build script
echo "Rendering GNAL ${V}"
bash ./scripts/deps.sh
bash ./scripts/license.sh
VERSION=`bash ./scripts/version.sh`
CPU=`bash ./scripts/cpu.sh`
DIST=./stl
CSG=./csg
IMG=./img
NOTES=./notes/${V}.csv
DB="./notes/renders.sqlite"
STEP=false
LOGGING=true
#"quarter_a" "quarter_b" "quarter_c" "quarter_d"
#quarter pieces not rendering properly
FILES=(
"spindle_bottom"
"spindle_top"
"spindle_single"
"spindle_stacking"
"insert_s8"
"insert_16"
"spacer"
"spacer_16"
"insert_single"
"top"
"spiral"
)
SIZES=( "50ft" "100ft" )
mkdir -p "${DIST}"
if [ $STEP = true ]; then
mkdir -p "${CSG}"
fi
if [[ ! -f "${DB}" ]]; then
cat "./notes/setup.sql" | sqlite3 "${DB}"
fi
db () {
sqlite3 "${DB}" "${1}"
}
render_part () {
scad="${1}"
SIZE="${2}"
FILE="${3}"
stl="${DIST}/${SIZE}_${V}/gnal_${SIZE}_${FILE}.stl"
csg="${CSG}/${SIZE}_${V}/gnal_${SIZE}_${FILE}.csg"
png="${IMG}/gnal_${SIZE}_${V}_${FILE}.png"
echo "${scad} - ${FILE}"
start=`date +%s`
if [[ "${SIZE}" == "100ft" ]]; then
openscad --enable manifold --csglimit=20000000 -o "$stl" -D "PART=\"${FILE}\"" -D "FN=800" -D "DEBUG=false" "${scad}"
else
openscad --enable manifold --csglimit=20000000 -o "$stl" -D "PART=\"${FILE}\"" -D "FN=600" -D "DEBUG=false" "${scad}"
fi
end=`date +%s`
runtime=$((end-start))
fileSize=`wc -c < "$stl"`
fileSize=`echo $fileSize | xargs`
if ! [ -x "$(command -v admesh)" ]; then
facets="-1"
volume="-1"
X="-1"
Y="-1"
Z="-1"
else
firstline=`head -n 1 "$stl"`
if [[ $firstline == solid* ]]; then
#order stl file if ascii
python3 scripts/c14n_stl.py "$stl"
#convert from ascii to binary
tmpBinary=`mktemp`
admesh -c -b "$tmpBinary" "$stl"
newSize=`wc -c < "$tmpBinary"`
newSize=`echo $newSize | xargs`
if [ $newSize -lt $fileSize ]; then
cp "$tmpBinary" "$stl"
percent=`echo "scale=1;($newSize/$fileSize)*100" | bc`
fileSize="${newSize}"
echo "Binary conversion created STL file ${percent}% of original"
else
echo "Binary STL is larger than ASCII original, skipping conversion..."
fi
rm "$tmpBinary"
fi
ao=`admesh -c "$stl"`
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
minX=`echo "$ao" | grep "Min X" | awk '{print $4}'`
minX=`echo "${minX//,/}"`
maxX=`echo "$ao" | grep "Min X" | awk '{print $8}'`
minY=`echo "$ao" | grep "Min Y" | awk '{print $4}'`
minY=`echo "${minY//,/}"`
maxY=`echo "$ao" | grep "Min Y" | awk '{print $8}'`
minZ=`echo "$ao" | grep "Min Z" | awk '{print $4}'`
minZ=`echo "${minZ//,/}"`
maxZ=`echo "$ao" | grep "Min Z" | awk '{print $8}'`
X=`echo "scale=5;($maxX)-($minX)" | bc`
Y=`echo "scale=5;($maxY)-($minY)" | bc`
Z=`echo "scale=5;($maxZ)-($minZ)" | bc`
fi
hash=`sha256sum "$stl" | awk '{ print $1 }'`
commit=`git rev-parse --short HEAD`
if [ ${LOGGING} = true ]; then
line="${VERSION},${CPU},$stl,$hash,$fileSize,$srchash,$srcsize,$facets,$volume,$runtime,$commit"
echo "$line" >> $NOTES
echo "$line"
fi
TIME=`date '+%s'`
QUERY="INSERT OR IGNORE INTO renders ( \
time, \
commit_id, \
source, \
model, \
stl, \
stl_size, \
facets, \
volume, \
x, \
y, \
z, \
render_time, \
source_hash, \
stl_hash, \
openscad, \
cpu \
) \
VALUES ( \
$TIME, \
'$commit', \
'$scad', \
'$FILE', \
'$stl', \
$fileSize, \
$facets, \
$volume, \
$X, \
$Y, \
$Z, \
$runtime, \
'$srchash', \
'$hash', \
'$VERSION', \
'$CPU' \
)"
#echo -n "${QUERY}"
db "${QUERY}"
if [ ${STEP} = true ] && [[ "${FILE}" == "spiral" ]]; then
mkdir -p "${CSG}/${SIZE}_${V}/"
start=`date +%s`
if [[ "${SIZE}" == "100ft" ]]; then
openscad --enable manifold --csglimit=20000000 -o "$csg" -D "PART=\"${FILE}\"" -D "FN=800" -D "DEBUG=false" "${scad}"
else
openscad --enable manifold --csglimit=20000000 -o "$csg" -D "PART=\"${FILE}\"" -D "FN=600" -D "DEBUG=false" "${scad}"
fi
end=`date +%s`
runtime=$((end-start))
echo "Compiling CSG took ${runtime}sec"
fi
echo "Rendering image of ${stl}..."
if [[ "${FILE}" == "spiral" ]]; then
tmp=`mktemp`
fullPath=`realpath "${stl}"`
data="import(\"${fullPath}\");"
echo data > "${tmp}.scad"
openscad -o "$png" --enable manifold --csglimit=20000000 --imgsize=2048,2048 --colorscheme=DeepOcean "${tmp}.scad"
else
openscad -o "$png" --enable manifold --csglimit=20000000 --imgsize=2048,2048 --colorscheme=DeepOcean -D "DEBUG=false" -D "PART=\"${FILE}\"" "${scad}"
fi
}
if [[ "${1}" != "" ]]; then
LOGGING=false
SIZE="${1}"
scad="./scad/${SIZE}_${V}/gnal_${SIZE}.scad"
srchash=`sha256sum "${scad}" | awk '{ print $1 }'`
srcsize=`wc -c < "${scad}"`
srcsize=`echo $srcsize | xargs`
mkdir -p "${DIST}/${SIZE}_${V}"
if [[ "${2}" != "" ]]; then
FILE="${2}"
render_part "${scad}" "${SIZE}" "${FILE}"
else
for FILE in "${FILES[@]}"; do
render_part "${scad}" "${SIZE}" "${FILE}"
done
fi
exit 0
fi
echo "openscad,cpu,stl,stl_hash,stl_size,source_hash,source_size,facets,volume,render_time,commit" > $NOTES
for SIZE in "${SIZES[@]}"
do
:
scad="./scad/${V}/gnal.scad"
srchash=`sha256sum "${scad}" | awk '{ print $1 }'`
srcsize=`wc -c < "${scad}"`
srcsize=`echo $srcsize | xargs`
mkdir -p "${DIST}/${SIZE}_${V}"
for FILE in "${FILES[@]}"; do
render_part "${scad}" "${SIZE}" "${FILE}"
done
# add license to directories for zip
cp ./LICENSE.txt "./stl/${SIZE}_${V}/"
# zip all
zip -x ".*" -r "./releases/gnal_${SIZE}_${V}.zip" "./stl/${SIZE}_${V}/"
# tar all
tar --exclude=".*" -czvf "./releases/gnal_${SIZE}_${V}.tar.gz" "./stl/${SIZE}_${V}/"
done