Improve colour handling
This commit is contained in:
parent
74c8206207
commit
4a5fc2e9f1
29
CFTubes.scad
29
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 scheme is 0 Orange/1 White/2-4 Black
|
||||
fc0 = 4;
|
||||
fc1 = 1;
|
||||
$fret_colours = [
|
||||
1, 4, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, // 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, // 0-11
|
||||
fc0, fc1, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc0, fc1, fc1, // 12-23
|
||||
];
|
||||
|
||||
|
||||
|
@ -929,9 +931,14 @@ module Steel6String(include_colours=[0,1], segment=-1, reference=false) {
|
|||
}
|
||||
|
||||
module Full() {
|
||||
difference() {
|
||||
union() {
|
||||
MyNeck();
|
||||
HeadPiece();
|
||||
}
|
||||
Reinforcements();
|
||||
}
|
||||
}
|
||||
|
||||
bridge_channel_width = 5;
|
||||
bridge_channel_depth = 7;
|
||||
|
@ -953,16 +960,14 @@ module Steel6String(include_colours=[0,1], segment=-1, reference=false) {
|
|||
}
|
||||
%HeadPiece();
|
||||
} else if (segment >= 0) {
|
||||
intersection() {
|
||||
Full();
|
||||
y0 = $segment_cuts[segment];
|
||||
y1 = $segment_cuts[segment+1];
|
||||
translate([-500, y0, -500]) cube([1000, y1-y0, 1000]);
|
||||
}
|
||||
} else if (segment == -1) {
|
||||
// String holding headpiece
|
||||
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) {
|
||||
echo("Making a bridge");
|
||||
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_BLUE;
|
||||
segment = -1;
|
||||
segment = 4;
|
||||
color(colour_scheme[0]) Steel6String(segment=segment, include_colours=[0]);
|
||||
color(colour_scheme[1]) Steel6String(segment=segment, include_colours=[1]);
|
||||
color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[2]);
|
||||
color(colour_scheme[3]) Steel6String(segment=segment, include_colours=[3]);
|
||||
// color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[2]);
|
||||
// color(colour_scheme[3]) Steel6String(segment=segment, include_colours=[3]);
|
||||
color(colour_scheme[2]) Steel6String(segment=segment, include_colours=[4]);
|
||||
// rotate([90,0,0])
|
||||
// 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_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_() = $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 behind_fret(fret) = fret_scale_length(fret) + get_fret_width(fret)/2;
|
||||
|
@ -252,12 +253,16 @@ module TaperNeck(
|
|||
translate([0, fret_scale_length(fret), z1])
|
||||
fret_bump(get_fret_width(fret));
|
||||
}
|
||||
module intersect_fret_layers() {
|
||||
module intersect_fret_layers(all=true) {
|
||||
for (fret = [0:$num_frets]) {
|
||||
colour = is_undef($fret_colours) ? 1 : (len($fret_colours) > fret) ? $fret_colours[fret] : 1;
|
||||
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 :/
|
||||
colour = is_undef($fret_colours) ? 1 : (len($fret_colours) > 0) ? $fret_colours[0] : 1;
|
||||
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]);
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
} else {
|
||||
has0 = list_has($include_colours, 0);
|
||||
has1 = list_has($include_colours, 1);
|
||||
has2 = list_has($include_colours, 2);
|
||||
has3 = list_has($include_colours, 3);
|
||||
if (has0) {
|
||||
render() difference() {
|
||||
if (list_has($include_colours, 0)) render() difference() {
|
||||
carved_stock() children();
|
||||
if (!has1) intersect_fret_layers();
|
||||
if (!has2) fret_inlays();
|
||||
if (!has3) fret_side_markers();
|
||||
intersect_fret_layers();
|
||||
fret_inlays();
|
||||
fret_side_markers();
|
||||
}
|
||||
} else render() intersection() {
|
||||
difference() {
|
||||
if (list_has($include_colours, 1)) render() intersection() {
|
||||
carved_stock() children();
|
||||
if (!has1) intersect_fret_layers();
|
||||
if (!has2) fret_inlays();
|
||||
if (!has3) fret_side_markers();
|
||||
intersect_fret_layers(false);
|
||||
}
|
||||
if (has1 || has2 || has3) union() {
|
||||
if (has1) intersect_fret_layers();
|
||||
if (has2) fret_inlays();
|
||||
if (has3) fret_side_markers();
|
||||
if (list_has($include_colours, 2)) render() intersection() {
|
||||
carved_stock() children();
|
||||
fret_inlays();
|
||||
}
|
||||
if (list_has($include_colours, 3)) render() intersection() {
|
||||
carved_stock() children();
|
||||
fret_side_markers();
|
||||
}
|
||||
if (list_has($include_colours, 4)) render() intersection() {
|
||||
carved_stock() children();
|
||||
intersect_fret_layers(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue