Multicolor experiment

This commit is contained in:
Luke Hubmayer-Werner 2025-01-04 15:37:24 +10:30
parent f34e9feff8
commit e7f4df9099
1 changed files with 84 additions and 45 deletions

View File

@ -4,8 +4,8 @@ include <NylonTuner.scad>
include <CFTubes/common.scad>
// Choose your material by only including one of the below
// include <CFTubes/PLA.scad>
include <CFTubes/PETG.scad>
include <CFTubes/PLA.scad>
// include <CFTubes/PETG.scad>
// Guitar_Scale_Length_mm = 610; // millimetres, slightly over 24inch (609.6mm) Jaguar scale, should be fine for guitar and u-bass
// assert(fret_scale_length(0) == 610); // Make sure the function correctly uses our changed global
@ -17,7 +17,7 @@ include <CFTubes/PETG.scad>
// going with for 21
fret_inlays = [[3, "真"], [5, "尊"], [7, "正"], [9, "清"], [12, "評判"], [15, "愛"], [17, "徳"], [19, "賛"], [21, "良"], [24, "主イエス"]];
module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, target_neck_thickness_additional_points=[], scallop_depth=3, num_frets=24, fret_width=2.4, filler=false) {
module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, target_neck_thickness_additional_points=[], scallop_depth=3, num_frets=24, fret_width=2.4, filler=false, inlays_only=false, side_markers_only=false, fret_layers_only=false, remove_fret_layers=false, engrave_markers=true) {
fw2 = fret_width/2;
neck_length = fret_scale_length(0)+fw2;
neck_width = (num_strings-1)*string_spacing + string_margin*2;
@ -65,6 +65,12 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi
rotate([0, 90]) cylinder(d=fret_width, h = neck_width, center = true, $fn=200);
}
}
module intersect_fret_layers() {
for (fret = [0:num_frets]) {
translate([-500, fret_scale_length(fret)-fret_width/2, -500])
cube([1000, fret_width, 1000]);
}
}
module fret_inlays() {
for (num_text = fret_inlays) {
fret = num_text[0];
@ -95,20 +101,11 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi
}
}
if (filler) { // Somewhat placeholder for now
difference() {
neck_stock();
scallop(25);
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
translate([-neck_width, 0, 0]) cube([neck_width*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
}
} else {
module carved_stock() {
render() difference() {
neck_stock();
scallops();
scallop(num_frets+1);
fret_inlays();
fret_side_markers();
// Chop off anything above the frets
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
// Reduce rest of the body to 0
@ -119,6 +116,31 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi
neck_stock();
}
}
if (filler) { // Somewhat placeholder for now
difference() {
neck_stock();
scallop(25);
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
translate([-neck_width, 0, 0]) cube([neck_width*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
}
} else {
render() intersection() {
difference() {
carved_stock();
if (engrave_markers) {
fret_inlays();
fret_side_markers();
}
if (remove_fret_layers) intersect_fret_layers();
}
if (fret_layers_only || inlays_only || side_markers_only) union() {
if (fret_layers_only) intersect_fret_layers();
if (inlays_only) fret_inlays();
if (side_markers_only) fret_side_markers();
}
}
}
}
module tailpiece(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, scallop_depth=3, fret_width=2.4*6) {
@ -358,6 +380,9 @@ module bridge(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_t
}
module Nylon6String() {
colour_1 = "blue";
id_line_0 = "PLA";
id_line_1 = "1β";
fsl_mm = fret_scale_length(0);
string_diameters_thous = [28, 32, 40, 30, 36, 42];
@ -374,9 +399,9 @@ module Nylon6String() {
target_neck_thickness = 22;
echo(fret_scale_length(8));
echo(fret_scale_length(9));
// target_neck_thickness_additional_points = [[480, 22], [440, 30], [0, 30]];
target_neck_thickness_additional_points = [];
// target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [380, 25], [130, 42], [0, 42]];
target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [380, 25], [0, 25]];
// target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [380, 25], [0, 25]];
// target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [130, 42], [0, 42]];
echo(str("Making a Nylon 6 String with scale length ", fsl_mm, "mm = ", fsl_mm/25.4, "in and neck width ", neck_width, "mm"));
@ -387,15 +412,21 @@ module Nylon6String() {
for (v = CF_Span_Coords(full_length, ply))
translate(v) CFSquare(hole=hole);
}
module MyNeck() {
neck(num_frets=num_frets, num_strings=num_strings, string_margin=string_margin, string_spacing=string_spacing, scallop_depth=scallop_depth, target_neck_thickness=target_neck_thickness, target_neck_thickness_additional_points=target_neck_thickness_additional_points);
module MyNeck(inlays_only=false, side_markers_only=false, fret_layers_only=false, engrave_markers=false, remove_fret_layers=false) {
render() neck(num_frets=num_frets, num_strings=num_strings, string_margin=string_margin, string_spacing=string_spacing, scallop_depth=scallop_depth, target_neck_thickness=target_neck_thickness, target_neck_thickness_additional_points=target_neck_thickness_additional_points, inlays_only=inlays_only, side_markers_only=side_markers_only, fret_layers_only=fret_layers_only, engrave_markers=engrave_markers, remove_fret_layers=remove_fret_layers);
}
module MultiColourNeck() {
color(colour_1) MyNeck(engrave_markers=true, remove_fret_layers=true);
color("white") MyNeck(fret_layers_only=true);
color("green") MyNeck(side_markers_only=true);
color("yellow") MyNeck(inlays_only=true);
}
reinforcing_tube_positions = flatten([
[
for (i=[-1,1]) each [
// Headside reinforcement
[i*21, -40+280, -4],
[i*21.5, -40+280, -4],
[i*17, -40+280, -12],
// Bridgeside reinforcement
[i*16, -40, -7],
@ -408,9 +439,9 @@ module Nylon6String() {
]]);
echo(reinforcing_tube_positions);
// Through span construction
span_coords = CF_Span_Coords();
span_coords = CF_Span_Coords(ply=2);
reinforcing_square_positions = [
for (i=[-1,1]) each [ for (v = span_coords) [i*10, -40, -16] + v ]
for (i=[-1,1]) each [ for (v = span_coords) [i*10, -40, -10] + v ]
];
echo(reinforcing_square_positions);
@ -432,7 +463,8 @@ module Nylon6String() {
}
translate([0,to_origin ? -x0 : 0,0]) render() difference() {
MyNeck();
MultiColourNeck();
color(colour_1) {
translate([-100, 0, -100]) cube([200, x0, 200]);
translate([-100, x1, -100]) cube([200, xn-x1, 200]);
for (v = reinforcing_tube_positions) CFTubeCutout2(v, x0, x1);
@ -440,30 +472,36 @@ module Nylon6String() {
if (test_tolerances_piece) TestTolerancesPiece();
}
}
}
// Test tolerances piece
module TestTolerancesPiece() {
difference(){
NeckFragment(2, 3, test_tolerances_piece=true);
translate([-20,0,-1]) rotate([-90,180,180]) linear_extrude(3, center=true) text("PETG", size=3.5, halign="center", valign="center");
translate([-20,0,-6]) rotate([-90,180,180]) linear_extrude(3, center=true) text("1α", size=3.5, halign="center", valign="center");
translate([-20,0,-1]) rotate([-90,180,180]) linear_extrude(3, center=true) text(id_line_0, size=3.5, halign="center", valign="center");
translate([-20,0,-6]) rotate([-90,180,180]) linear_extrude(3, center=true) text(id_line_1, size=3.5, halign="center", valign="center");
}
}
// TestTolerancesPiece();
module RealPiece(from_fret, to_fret, include_from_fret=false) {
midpoint = (fret_scale_length(from_fret) - fret_scale_length(to_fret) + (include_from_fret ? fret_width : 0))/2;
module IDText(thickness = 0.2, inset = 0) {
for (ra = [[0,0,0], [0,0,180]]) rotate_around(ra, [0,midpoint,0])
translate([0,0,-9]) rotate([-90,180,180]) translate([0,0,-thickness-inset]) linear_extrude(thickness) text(str(id_line_0, id_line_1), size=2.5, halign="center", valign="center", $fn=100);
}
render() difference(){
NeckFragment(from_fret, to_fret, include_from_fret=include_from_fret);
color("red") for (ra = [[0,0,0], [0,0,180]]) rotate_around(ra, [0,midpoint,0])
translate([0,0,-9]) rotate([-90,180,180]) linear_extrude(3, center=true) text("PETG1α", size=2.5, halign="center", valign="center");
color("red") IDText();
}
color("red") IDText(inset=0.0001);
}
// RealPiece(0, 8, include_from_fret=true);
RealPiece(8, 21);
RealPiece(0, 8, include_from_fret=true);
// RealPiece(8, 21);
%translate([100, 0, 0]) RealPiece(8, 21);
%translate([-100,0,0]) union() {
if ($preview) {
translate([-100,0,0]) union() {
c_cf = [0.4, 0.5, 0.5];
%MyNeck();
// CF square stacks
@ -478,10 +516,11 @@ module Nylon6String() {
translate([(num_strings-i-1)*string_spacing - neck_width/2 + string_margin,0,5]) rotate([-90,0,0]) translate([0,0,-string_excess/2]) cylinder(h=fsl_mm+string_excess, d=string_diameters_mm[i], $fn=cyl_ld_fn);
}
}
}
// Debug markers to aid part slicing eyeballing
// %for (i = [150:250:1000]) {
%for (i = [0:250:1000]) {
translate([50,i,0]) union() {text(str(i, "mm")); cube([50, 1, 1], center=true);}
translate([50,i,0]) union() {linear_extrude(1) text(str(i, "mm")); cube([50, 1, 1], center=true);}
}
}