Improve colour handling
This commit is contained in:
parent
74c8206207
commit
4a5fc2e9f1
35
CFTubes.scad
35
CFTubes.scad
|
@ -741,9 +741,11 @@ module Steel6String(include_colours=[0,1], segment=-1, reference=false) {
|
||||||
|
|
||||||
// Clownfish idea: make inlay-marked frets a different colour
|
// Clownfish idea: make inlay-marked frets a different colour
|
||||||
// Clownfish scheme is 0 Orange/1 White/2-4 Black
|
// Clownfish scheme is 0 Orange/1 White/2-4 Black
|
||||||
|
fc0 = 4;
|
||||||
|
fc1 = 1;
|
||||||
$fret_colours = [
|
$fret_colours = [
|
||||||
1, 4, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, // 0-11
|
fc0, fc1, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc1, // 0-11
|
||||||
1, 4, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, // 12-23
|
fc0, fc1, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc1, // 12-23
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -929,8 +931,13 @@ module Steel6String(include_colours=[0,1], segment=-1, reference=false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
module Full() {
|
module Full() {
|
||||||
MyNeck();
|
difference() {
|
||||||
HeadPiece();
|
union() {
|
||||||
|
MyNeck();
|
||||||
|
HeadPiece();
|
||||||
|
}
|
||||||
|
Reinforcements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge_channel_width = 5;
|
bridge_channel_width = 5;
|
||||||
|
@ -953,16 +960,14 @@ module Steel6String(include_colours=[0,1], segment=-1, reference=false) {
|
||||||
}
|
}
|
||||||
%HeadPiece();
|
%HeadPiece();
|
||||||
} else if (segment >= 0) {
|
} else if (segment >= 0) {
|
||||||
Full();
|
intersection() {
|
||||||
|
Full();
|
||||||
|
y0 = $segment_cuts[segment];
|
||||||
|
y1 = $segment_cuts[segment+1];
|
||||||
|
translate([-500, y0, -500]) cube([1000, y1-y0, 1000]);
|
||||||
|
}
|
||||||
} else if (segment == -1) {
|
} else if (segment == -1) {
|
||||||
// String holding headpiece
|
|
||||||
Full();
|
Full();
|
||||||
} else if (segment == -2) {
|
|
||||||
echo("Making a filler belt loop");
|
|
||||||
LoopOrTunerBlock(false);
|
|
||||||
} else if (segment == -3) {
|
|
||||||
echo("Making a tuner block");
|
|
||||||
LoopOrTunerBlock(true);
|
|
||||||
} else if (segment == -4) {
|
} else if (segment == -4) {
|
||||||
echo("Making a bridge");
|
echo("Making a bridge");
|
||||||
y_len = 9;
|
y_len = 9;
|
||||||
|
@ -1070,11 +1075,11 @@ COLOURSCHEME_PETGHF_BLUE = [BAMBU_PETGHF_LAKE_BLUE, BAMBU_PETGHF_LAKE_BLUE, "",
|
||||||
|
|
||||||
colour_scheme = COLOURSCHEME_ABS_CLOWNFISH;
|
colour_scheme = COLOURSCHEME_ABS_CLOWNFISH;
|
||||||
// colour_scheme = COLOURSCHEME_ABS_BLUE;
|
// colour_scheme = COLOURSCHEME_ABS_BLUE;
|
||||||
segment = -1;
|
segment = 4;
|
||||||
color(colour_scheme[0]) Steel6String(segment=segment, include_colours=[0]);
|
color(colour_scheme[0]) Steel6String(segment=segment, include_colours=[0]);
|
||||||
color(colour_scheme[1]) Steel6String(segment=segment, include_colours=[1]);
|
color(colour_scheme[1]) Steel6String(segment=segment, include_colours=[1]);
|
||||||
color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[2]);
|
// color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[2]);
|
||||||
color(colour_scheme[3]) Steel6String(segment=segment, include_colours=[3]);
|
// color(colour_scheme[3]) Steel6String(segment=segment, include_colours=[3]);
|
||||||
color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[4]);
|
color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[4]);
|
||||||
// rotate([90,0,0])
|
// rotate([90,0,0])
|
||||||
// Steel6String(reference=true);
|
// Steel6String(reference=true);
|
||||||
|
|
|
@ -13,6 +13,7 @@ function arc_starting_angle_to_height_ratio(angle) = ((1-cos(angle))/(sin(angle)
|
||||||
function get_max_fret_height() = arc_starting_angle_to_height_ratio($fret_angle) * get_max_fret_width()/2;
|
function get_max_fret_height() = arc_starting_angle_to_height_ratio($fret_angle) * get_max_fret_width()/2;
|
||||||
function get_max_scallop_angle() = (is_undef($max_scallop_angle) || $max_scallop_angle <= 0) ? $fret_angle : $max_scallop_angle;
|
function get_max_scallop_angle() = (is_undef($max_scallop_angle) || $max_scallop_angle <= 0) ? $fret_angle : $max_scallop_angle;
|
||||||
function get_final_scallop_length() = $scallop_depth / arc_starting_angle_to_height_ratio(get_max_scallop_angle());
|
function get_final_scallop_length() = $scallop_depth / arc_starting_angle_to_height_ratio(get_max_scallop_angle());
|
||||||
|
function get_final_scallop_() = $scallop_depth / arc_starting_angle_to_height_ratio(get_max_scallop_angle());
|
||||||
function get_end_of_fretboard() = after_fret($num_frets) - get_final_scallop_length();
|
function get_end_of_fretboard() = after_fret($num_frets) - get_final_scallop_length();
|
||||||
|
|
||||||
function behind_fret(fret) = fret_scale_length(fret) + get_fret_width(fret)/2;
|
function behind_fret(fret) = fret_scale_length(fret) + get_fret_width(fret)/2;
|
||||||
|
@ -252,14 +253,18 @@ module TaperNeck(
|
||||||
translate([0, fret_scale_length(fret), z1])
|
translate([0, fret_scale_length(fret), z1])
|
||||||
fret_bump(get_fret_width(fret));
|
fret_bump(get_fret_width(fret));
|
||||||
}
|
}
|
||||||
module intersect_fret_layers() {
|
module intersect_fret_layers(all=true) {
|
||||||
for (fret = [0:$num_frets]) {
|
for (fret = [0:$num_frets]) {
|
||||||
translate([-500, fret_scale_length(fret)-get_fret_width(fret)/2, -500])
|
colour = is_undef($fret_colours) ? 1 : (len($fret_colours) > fret) ? $fret_colours[fret] : 1;
|
||||||
cube([1000, get_fret_width(fret), 1000]);
|
if (all || list_has($include_colours, colour))
|
||||||
|
translate([-500, fret_scale_length(fret)-get_fret_width(fret)/2, -500])
|
||||||
|
cube([1000, get_fret_width(fret), 1000]);
|
||||||
}
|
}
|
||||||
// Some precision error with fret 0 :/
|
// Some precision error with fret 0 :/
|
||||||
translate([-500, fret_scale_length(0)-get_fret_width(0)/2+0.0006, -500])
|
colour = is_undef($fret_colours) ? 1 : (len($fret_colours) > 0) ? $fret_colours[0] : 1;
|
||||||
cube([1000, get_fret_width(0), 1000]);
|
if (all || list_has($include_colours, colour))
|
||||||
|
translate([-500, fret_scale_length(0)-get_fret_width(0)/2+0.0006, -500])
|
||||||
|
cube([1000, get_fret_width(0), 1000]);
|
||||||
}
|
}
|
||||||
module fret_inlays() {
|
module fret_inlays() {
|
||||||
for (num_text = fret_inlays) {
|
for (num_text = fret_inlays) {
|
||||||
|
@ -329,29 +334,30 @@ module TaperNeck(
|
||||||
translate([-$neck_width_bridge, 0, 0]) cube([$neck_width_bridge*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
|
translate([-$neck_width_bridge, 0, 0]) cube([$neck_width_bridge*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
has0 = list_has($include_colours, 0);
|
|
||||||
has1 = list_has($include_colours, 1);
|
has1 = list_has($include_colours, 1);
|
||||||
has2 = list_has($include_colours, 2);
|
has2 = list_has($include_colours, 2);
|
||||||
has3 = list_has($include_colours, 3);
|
has3 = list_has($include_colours, 3);
|
||||||
if (has0) {
|
if (list_has($include_colours, 0)) render() difference() {
|
||||||
render() difference() {
|
carved_stock() children();
|
||||||
carved_stock() children();
|
intersect_fret_layers();
|
||||||
if (!has1) intersect_fret_layers();
|
fret_inlays();
|
||||||
if (!has2) fret_inlays();
|
fret_side_markers();
|
||||||
if (!has3) fret_side_markers();
|
}
|
||||||
}
|
if (list_has($include_colours, 1)) render() intersection() {
|
||||||
} else render() intersection() {
|
carved_stock() children();
|
||||||
difference() {
|
intersect_fret_layers(false);
|
||||||
carved_stock() children();
|
}
|
||||||
if (!has1) intersect_fret_layers();
|
if (list_has($include_colours, 2)) render() intersection() {
|
||||||
if (!has2) fret_inlays();
|
carved_stock() children();
|
||||||
if (!has3) fret_side_markers();
|
fret_inlays();
|
||||||
}
|
}
|
||||||
if (has1 || has2 || has3) union() {
|
if (list_has($include_colours, 3)) render() intersection() {
|
||||||
if (has1) intersect_fret_layers();
|
carved_stock() children();
|
||||||
if (has2) fret_inlays();
|
fret_side_markers();
|
||||||
if (has3) fret_side_markers();
|
}
|
||||||
}
|
if (list_has($include_colours, 4)) render() intersection() {
|
||||||
|
carved_stock() children();
|
||||||
|
intersect_fret_layers(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue