mirror of
https://github.com/nophead/Mendel90.git
synced 2025-08-09 23:06:30 +02:00
Reworking color usage to support a "realistic" render mode, and a "design" render mode.
This commit is contained in:
@@ -8,26 +8,22 @@
|
|||||||
// Reusable color definitions
|
// Reusable color definitions
|
||||||
//
|
//
|
||||||
|
|
||||||
// Named colors
|
// OpenSCAD v2011.12 and later support named colors
|
||||||
white = [1, 1, 1];
|
// http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#color
|
||||||
black = [0, 0, 0];
|
//
|
||||||
red = [1, 0, 0];
|
// The available color names are taken from the World Wide Web consortium's SVG color list.
|
||||||
dark_red = [0.7, 0, 0];
|
// http://www.w3.org/TR/css3-color/#svg-color
|
||||||
green = [0, 1, 0];
|
|
||||||
yellow = [1, 1, 0];
|
// Some additional named colors
|
||||||
fuchsia = [1, 0, 1];
|
|
||||||
orange = [1, 0.7, 0];
|
|
||||||
grey20 = [0.2, 0.2, 0.2];
|
grey20 = [0.2, 0.2, 0.2];
|
||||||
grey50 = [0.5, 0.5, 0.5];
|
grey50 = [0.5, 0.5, 0.5];
|
||||||
grey70 = [0.7, 0.7, 0.7];
|
grey70 = [0.7, 0.7, 0.7];
|
||||||
grey80 = [0.8, 0.8, 0.8];
|
grey80 = [0.8, 0.8, 0.8];
|
||||||
grey90 = [0.9, 0.9, 0.9];
|
grey90 = [0.9, 0.9, 0.9];
|
||||||
|
brass = [0.8, 0.8, 0.4];
|
||||||
|
|
||||||
// Material colors
|
// use_realistic_colors is defined in config.scad
|
||||||
MDF_brown = [0.4, 0.4, 0.2, 1 ];
|
function plastic_part_color(color) = use_realistic_colors ? printed_plastic_color : color;
|
||||||
acrylic_clear = [1, 1, 1, 0.5 ];
|
|
||||||
glass_clear = [1, 1, 1, 0.25 ];
|
|
||||||
dibond_grey = [0.5, 0.5, 0.5, 1 ];
|
|
||||||
|
|
||||||
// Object colors
|
// Object colors
|
||||||
rod_color = grey80;
|
rod_color = grey80;
|
||||||
@@ -36,58 +32,61 @@ tubing_color = [0.8, 0.8, 0.8, 0.75 ];
|
|||||||
nut_color = grey70;
|
nut_color = grey70;
|
||||||
soft_washer_color = grey20;
|
soft_washer_color = grey20;
|
||||||
hard_washer_color = grey80;
|
hard_washer_color = grey80;
|
||||||
star_washer_color = [0.8, 0.8, 0.4];
|
star_washer_color = brass;
|
||||||
screw_cap_color = grey20;
|
screw_cap_color = grey20;
|
||||||
screw_grub_color = grey20;
|
screw_grub_color = grey20;
|
||||||
screw_hex_color = grey80;
|
screw_hex_color = grey80;
|
||||||
screw_pan_color = [0.8, 0.8, 0.4];
|
screw_pan_color = brass;
|
||||||
screw_cs_color = [0.8, 0.8, 0.4];
|
screw_cs_color = brass;
|
||||||
spring_color = grey20;
|
spring_color = grey20;
|
||||||
pillar_color = grey90;
|
pillar_color = grey90;
|
||||||
pillar_liner_color = yellow;
|
pillar_liner_color = "yellow";
|
||||||
bearing_color = grey70;
|
bearing_color = grey70;
|
||||||
psu_color = grey80;
|
psu_color = grey80;
|
||||||
fan_color = grey20;
|
fan_color = grey20;
|
||||||
microswitch_color = black;
|
microswitch_color = "black";
|
||||||
microswitch_button_color = orange;
|
microswitch_button_color = "orange";
|
||||||
microswitch_contact_color = yellow;
|
microswitch_contact_color = "yellow";
|
||||||
sanguinololu_color = red;
|
sanguinololu_color = "red";
|
||||||
stepper_body_color = black;
|
stepper_body_color = "black";
|
||||||
stepper_cap_color = grey50;
|
stepper_cap_color = grey50;
|
||||||
small_ziptie_color = white;
|
small_ziptie_color = "white";
|
||||||
|
bed_color = "firebrick";
|
||||||
// Assembly colors
|
|
||||||
clamp_color = green;
|
|
||||||
bed_color = dark_red;
|
|
||||||
clip_color = red;
|
|
||||||
d_shell_color = green;
|
|
||||||
d_shell_lid_color = red;
|
|
||||||
d_motor_bracket_color = green;
|
|
||||||
d_motor_bracket_lid_color = red;
|
|
||||||
d_pillar_color = grey90;
|
d_pillar_color = grey90;
|
||||||
d_plug_shell_color = grey80;
|
d_plug_shell_color = grey80;
|
||||||
d_plug_insulator_color = grey20;
|
d_plug_insulator_color = grey20;
|
||||||
fixing_block_color = green;
|
extruder_insulator_color = "goldenrod"
|
||||||
ribbon_clamp_color = red;
|
extruder_nozzle_color = "yellow";
|
||||||
fan_guard_color = green;
|
cable_strip_color = use_realistic_colors ? cable_strip_real_color : "fuchsia";
|
||||||
pcb_spacer_color = green;
|
belt_color = use_realistic_colors ? belt_real_color : "yellow";
|
||||||
pulley_color = red;
|
bulldog_color = use_realistic_colors ? bulldog_real_color : "yellow";
|
||||||
ribbon_clamp_color = red;
|
|
||||||
wades_big_gear_color = green;
|
// Assembly colors
|
||||||
wades_small_gear_color = red;
|
clamp_color = plastic_part_color("lime");
|
||||||
wades_idler_block_color = green;
|
clip_color = plastic_part_color("red");
|
||||||
wades_gear_spacer_color = red;
|
d_shell_color = plastic_part_color("lime");
|
||||||
filament_viz_color = [0.6, 0.5, 0.2];
|
d_shell_lid_color = plastic_part_color("red");
|
||||||
extruder_nozzle_color = yellow;
|
d_motor_bracket_color = plastic_part_color("lime");
|
||||||
x_carriage_color = red;
|
d_motor_bracket_lid_color = plastic_part_color("red");
|
||||||
x_belt_clamp_color = green;
|
fixing_block_color = plastic_part_color("lime");
|
||||||
x_end_bracket_color = green;
|
ribbon_clamp_color = plastic_part_color("red");
|
||||||
y_bearing_mount_color = red;
|
fan_guard_color = plastic_part_color("lime");
|
||||||
y_belt_anchor_color = green;
|
pcb_spacer_color = plastic_part_color("lime");
|
||||||
y_belt_clip_color = red;
|
pulley_color = plastic_part_color("red");
|
||||||
y_idler_bracket_color = green;
|
ribbon_clamp_color = plastic_part_color("red");
|
||||||
y_motor_bracket_color = green;
|
wades_block_color = plastic_part_color("yellow");
|
||||||
z_coupling_color = red;
|
wades_big_gear_color = plastic_part_color("lime");
|
||||||
z_limit_switch_bracket_color = green;
|
wades_small_gear_color = plastic_part_color("red");
|
||||||
z_motor_bracket_color = green;
|
wades_idler_block_color = plastic_part_color("lime");
|
||||||
cable_strip_color = fuchsia;
|
wades_gear_spacer_color = plastic_part_color("red");
|
||||||
|
x_carriage_color = plastic_part_color("red");
|
||||||
|
x_belt_clamp_color = plastic_part_color("lime");
|
||||||
|
x_end_bracket_color = plastic_part_color("lime");
|
||||||
|
y_bearing_mount_color = plastic_part_color("red");
|
||||||
|
y_belt_anchor_color = plastic_part_color("lime");
|
||||||
|
y_belt_clip_color = plastic_part_color("red");
|
||||||
|
y_idler_bracket_color = plastic_part_color("lime");
|
||||||
|
y_motor_bracket_color = plastic_part_color("lime");
|
||||||
|
z_coupling_color = plastic_part_color("red");
|
||||||
|
z_limit_switch_bracket_color = plastic_part_color("lime");
|
||||||
|
z_motor_bracket_color = plastic_part_color("lime");
|
||||||
|
@@ -8,10 +8,9 @@
|
|||||||
// Configuration file
|
// Configuration file
|
||||||
//
|
//
|
||||||
|
|
||||||
include <colors.scad>
|
|
||||||
|
|
||||||
bom = 2; // 0 no bom, 1 assemblies and stls, 2 vitamins as well
|
bom = 2; // 0 no bom, 1 assemblies and stls, 2 vitamins as well
|
||||||
exploded = false; // true for exploded view
|
exploded = false; // true for exploded view
|
||||||
|
use_realistic_colors = true; // true for "real" colors, false for "distinct" colors (useful during design)
|
||||||
eta = 0.01; // small fudge factor to stop CSG barfing on coincident faces.
|
eta = 0.01; // small fudge factor to stop CSG barfing on coincident faces.
|
||||||
$fa = 5;
|
$fa = 5;
|
||||||
$fs = 0.5;
|
$fs = 0.5;
|
||||||
@@ -56,6 +55,7 @@ min_wall = 2 * filament_width + eta;
|
|||||||
|
|
||||||
pcb_thickness = 1.6;
|
pcb_thickness = 1.6;
|
||||||
|
|
||||||
|
include <colors.scad>
|
||||||
include <utils.scad>
|
include <utils.scad>
|
||||||
include <vitamins.scad>
|
include <vitamins.scad>
|
||||||
|
|
||||||
|
@@ -8,6 +8,13 @@
|
|||||||
// Configuration file
|
// Configuration file
|
||||||
//
|
//
|
||||||
echo("Huxley:");
|
echo("Huxley:");
|
||||||
|
|
||||||
|
// Real-world colors for various parts & vitamins
|
||||||
|
printed_plastic_color = "blue";
|
||||||
|
cable_strip_real_color = "fuchsia";
|
||||||
|
belt_real_color = "yellow";
|
||||||
|
bulldog_real_color ="black";
|
||||||
|
|
||||||
Z_bearings = LM6UU;
|
Z_bearings = LM6UU;
|
||||||
Y_bearings = LM6UU;
|
Y_bearings = LM6UU;
|
||||||
X_bearings = LM6UU;
|
X_bearings = LM6UU;
|
||||||
|
@@ -8,6 +8,13 @@
|
|||||||
// Configuration file
|
// Configuration file
|
||||||
//
|
//
|
||||||
echo("Mendel:");
|
echo("Mendel:");
|
||||||
|
|
||||||
|
// Real-world colors for various parts & vitamins
|
||||||
|
printed_plastic_color = "blue";
|
||||||
|
cable_strip_real_color = "fuchsia";
|
||||||
|
belt_real_color = "yellow";
|
||||||
|
bulldog_real_color ="black";
|
||||||
|
|
||||||
Z_bearings = LM8UU;
|
Z_bearings = LM8UU;
|
||||||
Y_bearings = LM8UU;
|
Y_bearings = LM8UU;
|
||||||
X_bearings = LM8UU;
|
X_bearings = LM8UU;
|
||||||
|
@@ -8,6 +8,13 @@
|
|||||||
// Configuration file
|
// Configuration file
|
||||||
//
|
//
|
||||||
echo("Sturdy:");
|
echo("Sturdy:");
|
||||||
|
|
||||||
|
// Real-world colors for various parts & vitamins
|
||||||
|
printed_plastic_color = "blue";
|
||||||
|
cable_strip_real_color = "fuchsia";
|
||||||
|
belt_real_color = "yellow";
|
||||||
|
bulldog_real_color ="black";
|
||||||
|
|
||||||
Z_bearings = LM10UU;
|
Z_bearings = LM10UU;
|
||||||
Y_bearings = LM10UU;
|
Y_bearings = LM10UU;
|
||||||
X_bearings = LM10UU;
|
X_bearings = LM10UU;
|
||||||
|
@@ -49,6 +49,7 @@ module x_axis_assembly(show_extruder) {
|
|||||||
rotate([180, 0, 180])
|
rotate([180, 0, 180])
|
||||||
x_carriage_assembly(show_extruder);
|
x_carriage_assembly(show_extruder);
|
||||||
|
|
||||||
|
color(belt_color)
|
||||||
translate([0, -gantry_setback - belt_width(X_belt) / 2, Z + Z0])
|
translate([0, -gantry_setback - belt_width(X_belt) / 2, Z + Z0])
|
||||||
rotate([90, 0, 0]) render()
|
rotate([90, 0, 0]) render()
|
||||||
union() {
|
union() {
|
||||||
@@ -228,6 +229,7 @@ module y_axis_assembly(show_bed) {
|
|||||||
y_rails();
|
y_rails();
|
||||||
|
|
||||||
translate([Y_belt_line - X_origin, Y_motor_end, y_motor_height()]) rotate([90,0,-90]) {
|
translate([Y_belt_line - X_origin, Y_motor_end, y_motor_height()]) rotate([90,0,-90]) {
|
||||||
|
color(belt_color)
|
||||||
render() difference() {
|
render() difference() {
|
||||||
twisted_belt(Y_belt,
|
twisted_belt(Y_belt,
|
||||||
Y_motor_end - Y_idler_end,
|
Y_motor_end - Y_idler_end,
|
||||||
|
@@ -25,6 +25,7 @@ module belt(type, x1, y1, r1, x2, y2, r2, gap = 0) {
|
|||||||
length = pi * (r1 + r2) + 2 * sqrt(dx * dx + dy * dy) - gap;
|
length = pi * (r1 + r2) + 2 * sqrt(dx * dx + dy * dy) - gap;
|
||||||
vitamin(str("BT", belt_pitch(type),width, round(length), ": Belt T", belt_pitch(type)," x ", width, " x ", round(length)));
|
vitamin(str("BT", belt_pitch(type),width, round(length), ": Belt T", belt_pitch(type)," x ", width, " x ", round(length)));
|
||||||
|
|
||||||
|
color(belt_color)
|
||||||
linear_extrude(height = width, center = true, convexity = 6) {
|
linear_extrude(height = width, center = true, convexity = 6) {
|
||||||
difference() {
|
difference() {
|
||||||
hull() { // outside of belt
|
hull() { // outside of belt
|
||||||
@@ -49,6 +50,7 @@ module twisted_belt(type, x1, y1, r1, x2, y2, r2, gap = 0) {
|
|||||||
|
|
||||||
angle = atan2(dy, dx) - atan2((r2 - r1), dx);
|
angle = atan2(dy, dx) - atan2((r2 - r1), dx);
|
||||||
|
|
||||||
|
color(belt_color)
|
||||||
union() {
|
union() {
|
||||||
difference() {
|
difference() {
|
||||||
belt(type, x1, y1, r1, x2, y2, r2, gap);
|
belt(type, x1, y1, r1, x2, y2, r2, gap);
|
||||||
|
@@ -54,6 +54,7 @@ module bulldog(type, open = 4) {
|
|||||||
|
|
||||||
vitamin(str("BD00", bulldog_length(type), ": ", bulldog_length(type), "mm bulldog clip"));
|
vitamin(str("BD00", bulldog_length(type), ": ", bulldog_length(type), "mm bulldog clip"));
|
||||||
|
|
||||||
|
color(bulldog_color)
|
||||||
render() translate([depth / 2 - thickness - eta, 0, 0])
|
render() translate([depth / 2 - thickness - eta, 0, 0])
|
||||||
union() {
|
union() {
|
||||||
difference() {
|
difference() {
|
||||||
|
@@ -8,21 +8,26 @@
|
|||||||
// Flat sheets
|
// Flat sheets
|
||||||
//
|
//
|
||||||
|
|
||||||
// The "Soft" parameter determines if the sheet material will hold threads.
|
// If you'd like to add a new material type, or a different color of an existing material type
|
||||||
// If not, nuts will be used to retain screws.
|
// simply add a new line here (or in your machine config file).
|
||||||
|
//
|
||||||
// The "Color" parameter is a quad-array: [R, G, B, Alpha]
|
// The "Soft" parameter determines if the sheet material needs machine screws or wood screws
|
||||||
|
// if "soft", wood screws will be used, with a pilot hole.
|
||||||
|
// If "not soft", either tapped holes or a clearance hole and nuts will be used to retain screws.
|
||||||
|
//
|
||||||
|
// The "Color" parameter is a quad-array: [R, G, B, Alpha], or can be a named color
|
||||||
|
// see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#color
|
||||||
|
//
|
||||||
// [ Code, Description, Thickness, Color, Soft]
|
// [ Code, Description, Thickness, Color, Soft]
|
||||||
|
//
|
||||||
MDF6 = [ "MD", "MDF sheet", 6, MDF_brown, true]; // ~1/4"
|
MDF6 = [ "MD", "MDF sheet", 6, [0.4, 0.4, 0.2, 1 ], true]; // ~1/4"
|
||||||
MDF10 = [ "MD", "MDF sheet", 10, MDF_brown, true]; // ~3/8"
|
MDF10 = [ "MD", "MDF sheet", 10, [0.4, 0.4, 0.2, 1 ], true]; // ~3/8"
|
||||||
MDF12 = [ "MD", "MDF sheet", 12, MDF_brown, true]; // ~1/2"
|
MDF12 = [ "MD", "MDF sheet", 12, [0.4, 0.4, 0.2, 1 ], true]; // ~1/2"
|
||||||
PMMA6 = [ "AC", "Acrylic sheet", 6, acrylic_clear, false]; // ~1/4"
|
PMMA6 = [ "AC", "Acrylic sheet", 6, [1, 1, 1, 0.5 ], false]; // ~1/4"
|
||||||
PMMA8 = [ "AC", "Acrylic sheet", 8, acrylic_clear, false]; // ~5/16"
|
PMMA8 = [ "AC", "Acrylic sheet", 8, [1, 1, 1, 0.5 ], false]; // ~5/16"
|
||||||
PMMA10 = [ "AC", "Acrylic sheet",10, acrylic_clear, false]; // ~3/8"
|
PMMA10 = [ "AC", "Acrylic sheet",10, [1, 1, 1, 0.5 ], false]; // ~3/8"
|
||||||
glass2 = [ "GL", "Glass sheet", 2, glass_clear, false];
|
glass2 = [ "GL", "Glass sheet", 2, [1, 1, 1, 0.25 ], false];
|
||||||
DiBond = [ "DB", "Dibond sheet", 3, dibond_grey, false];
|
DiBond = [ "DB", "Dibond sheet", 3, [0.7, 0.7, 0.7, 1 ], false];
|
||||||
|
|
||||||
function sheet_thickness(type) = type[2];
|
function sheet_thickness(type) = type[2];
|
||||||
function sheet_is_soft(type) = type[4];
|
function sheet_is_soft(type) = type[4];
|
||||||
|
@@ -69,6 +69,7 @@ module wades_block_stl() {
|
|||||||
insulator_depth = insulator_depth(hot_end);
|
insulator_depth = insulator_depth(hot_end);
|
||||||
|
|
||||||
|
|
||||||
|
color(wades_block_color)
|
||||||
difference(){
|
difference(){
|
||||||
union(){
|
union(){
|
||||||
cube([81, 52, thickness]); // motor plate
|
cube([81, 52, thickness]); // motor plate
|
||||||
@@ -250,7 +251,7 @@ module wade_idler_assembly() {
|
|||||||
module wades_assembly() {
|
module wades_assembly() {
|
||||||
assembly("wades_assembly");
|
assembly("wades_assembly");
|
||||||
|
|
||||||
render() wades_block_stl();
|
color(wades_block_color) render() wades_block_stl();
|
||||||
|
|
||||||
// idler screws, washers and springs
|
// idler screws, washers and springs
|
||||||
for(i = [0,1])
|
for(i = [0,1])
|
||||||
@@ -330,7 +331,7 @@ module wades_assembly() {
|
|||||||
|
|
||||||
translate([75, 5 - nozzle_length / 4, 15])
|
translate([75, 5 - nozzle_length / 4, 15])
|
||||||
rotate([-90, 0, 0]) {
|
rotate([-90, 0, 0]) {
|
||||||
color(filament_viz_color) cylinder(h = nozzle_length / 2 + 10, r = insulator_diameter(hot_end) / 2, center = true);
|
color(extruder_insulator_color) cylinder(h = nozzle_length / 2 + 10, r = insulator_diameter(hot_end) / 2, center = true);
|
||||||
translate([0, 0, -nozzle_length /2 - 5])
|
translate([0, 0, -nozzle_length /2 - 5])
|
||||||
color(extruder_nozzle_color) cylinder(h = nozzle_length / 2, r = 3, center = true);
|
color(extruder_nozzle_color) cylinder(h = nozzle_length / 2, r = 3, center = true);
|
||||||
}
|
}
|
||||||
|
@@ -117,6 +117,8 @@ module belt_loop() {
|
|||||||
d = x_carriage_offset() - pulley_inner_radius - belt_thickness(X_belt);
|
d = x_carriage_offset() - pulley_inner_radius - belt_thickness(X_belt);
|
||||||
height = d + 2 * belt_thickness(X_belt);
|
height = d + 2 * belt_thickness(X_belt);
|
||||||
length = lug_width + 12.5;
|
length = lug_width + 12.5;
|
||||||
|
|
||||||
|
color(belt_color)
|
||||||
translate([d / 2, 0, 0])
|
translate([d / 2, 0, 0])
|
||||||
linear_extrude(height = belt_width(X_belt), convexity = 5, center = true)
|
linear_extrude(height = belt_width(X_belt), convexity = 5, center = true)
|
||||||
difference() {
|
difference() {
|
||||||
|
Reference in New Issue
Block a user