mirror of
https://github.com/nophead/Mendel90.git
synced 2025-08-01 11:00:16 +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
|
||||
//
|
||||
|
||||
// Named colors
|
||||
white = [1, 1, 1];
|
||||
black = [0, 0, 0];
|
||||
red = [1, 0, 0];
|
||||
dark_red = [0.7, 0, 0];
|
||||
green = [0, 1, 0];
|
||||
yellow = [1, 1, 0];
|
||||
fuchsia = [1, 0, 1];
|
||||
orange = [1, 0.7, 0];
|
||||
// OpenSCAD v2011.12 and later support named colors
|
||||
// http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#color
|
||||
//
|
||||
// The available color names are taken from the World Wide Web consortium's SVG color list.
|
||||
// http://www.w3.org/TR/css3-color/#svg-color
|
||||
|
||||
// Some additional named colors
|
||||
grey20 = [0.2, 0.2, 0.2];
|
||||
grey50 = [0.5, 0.5, 0.5];
|
||||
grey70 = [0.7, 0.7, 0.7];
|
||||
grey80 = [0.8, 0.8, 0.8];
|
||||
grey90 = [0.9, 0.9, 0.9];
|
||||
brass = [0.8, 0.8, 0.4];
|
||||
|
||||
// Material colors
|
||||
MDF_brown = [0.4, 0.4, 0.2, 1 ];
|
||||
acrylic_clear = [1, 1, 1, 0.5 ];
|
||||
glass_clear = [1, 1, 1, 0.25 ];
|
||||
dibond_grey = [0.5, 0.5, 0.5, 1 ];
|
||||
// use_realistic_colors is defined in config.scad
|
||||
function plastic_part_color(color) = use_realistic_colors ? printed_plastic_color : color;
|
||||
|
||||
// Object colors
|
||||
rod_color = grey80;
|
||||
@@ -36,58 +32,61 @@ tubing_color = [0.8, 0.8, 0.8, 0.75 ];
|
||||
nut_color = grey70;
|
||||
soft_washer_color = grey20;
|
||||
hard_washer_color = grey80;
|
||||
star_washer_color = [0.8, 0.8, 0.4];
|
||||
star_washer_color = brass;
|
||||
screw_cap_color = grey20;
|
||||
screw_grub_color = grey20;
|
||||
screw_hex_color = grey80;
|
||||
screw_pan_color = [0.8, 0.8, 0.4];
|
||||
screw_cs_color = [0.8, 0.8, 0.4];
|
||||
screw_pan_color = brass;
|
||||
screw_cs_color = brass;
|
||||
spring_color = grey20;
|
||||
pillar_color = grey90;
|
||||
pillar_liner_color = yellow;
|
||||
pillar_liner_color = "yellow";
|
||||
bearing_color = grey70;
|
||||
psu_color = grey80;
|
||||
fan_color = grey20;
|
||||
microswitch_color = black;
|
||||
microswitch_button_color = orange;
|
||||
microswitch_contact_color = yellow;
|
||||
sanguinololu_color = red;
|
||||
stepper_body_color = black;
|
||||
microswitch_color = "black";
|
||||
microswitch_button_color = "orange";
|
||||
microswitch_contact_color = "yellow";
|
||||
sanguinololu_color = "red";
|
||||
stepper_body_color = "black";
|
||||
stepper_cap_color = grey50;
|
||||
small_ziptie_color = white;
|
||||
|
||||
// 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;
|
||||
small_ziptie_color = "white";
|
||||
bed_color = "firebrick";
|
||||
d_pillar_color = grey90;
|
||||
d_plug_shell_color = grey80;
|
||||
d_plug_insulator_color = grey20;
|
||||
fixing_block_color = green;
|
||||
ribbon_clamp_color = red;
|
||||
fan_guard_color = green;
|
||||
pcb_spacer_color = green;
|
||||
pulley_color = red;
|
||||
ribbon_clamp_color = red;
|
||||
wades_big_gear_color = green;
|
||||
wades_small_gear_color = red;
|
||||
wades_idler_block_color = green;
|
||||
wades_gear_spacer_color = red;
|
||||
filament_viz_color = [0.6, 0.5, 0.2];
|
||||
extruder_nozzle_color = yellow;
|
||||
x_carriage_color = red;
|
||||
x_belt_clamp_color = green;
|
||||
x_end_bracket_color = green;
|
||||
y_bearing_mount_color = red;
|
||||
y_belt_anchor_color = green;
|
||||
y_belt_clip_color = red;
|
||||
y_idler_bracket_color = green;
|
||||
y_motor_bracket_color = green;
|
||||
z_coupling_color = red;
|
||||
z_limit_switch_bracket_color = green;
|
||||
z_motor_bracket_color = green;
|
||||
cable_strip_color = fuchsia;
|
||||
extruder_insulator_color = "goldenrod"
|
||||
extruder_nozzle_color = "yellow";
|
||||
cable_strip_color = use_realistic_colors ? cable_strip_real_color : "fuchsia";
|
||||
belt_color = use_realistic_colors ? belt_real_color : "yellow";
|
||||
bulldog_color = use_realistic_colors ? bulldog_real_color : "yellow";
|
||||
|
||||
// Assembly colors
|
||||
clamp_color = plastic_part_color("lime");
|
||||
clip_color = plastic_part_color("red");
|
||||
d_shell_color = plastic_part_color("lime");
|
||||
d_shell_lid_color = plastic_part_color("red");
|
||||
d_motor_bracket_color = plastic_part_color("lime");
|
||||
d_motor_bracket_lid_color = plastic_part_color("red");
|
||||
fixing_block_color = plastic_part_color("lime");
|
||||
ribbon_clamp_color = plastic_part_color("red");
|
||||
fan_guard_color = plastic_part_color("lime");
|
||||
pcb_spacer_color = plastic_part_color("lime");
|
||||
pulley_color = plastic_part_color("red");
|
||||
ribbon_clamp_color = plastic_part_color("red");
|
||||
wades_block_color = plastic_part_color("yellow");
|
||||
wades_big_gear_color = plastic_part_color("lime");
|
||||
wades_small_gear_color = plastic_part_color("red");
|
||||
wades_idler_block_color = plastic_part_color("lime");
|
||||
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
|
||||
//
|
||||
|
||||
include <colors.scad>
|
||||
|
||||
bom = 2; // 0 no bom, 1 assemblies and stls, 2 vitamins as well
|
||||
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.
|
||||
$fa = 5;
|
||||
$fs = 0.5;
|
||||
@@ -56,6 +55,7 @@ min_wall = 2 * filament_width + eta;
|
||||
|
||||
pcb_thickness = 1.6;
|
||||
|
||||
include <colors.scad>
|
||||
include <utils.scad>
|
||||
include <vitamins.scad>
|
||||
|
||||
|
@@ -8,6 +8,13 @@
|
||||
// Configuration file
|
||||
//
|
||||
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;
|
||||
Y_bearings = LM6UU;
|
||||
X_bearings = LM6UU;
|
||||
|
@@ -8,6 +8,13 @@
|
||||
// Configuration file
|
||||
//
|
||||
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;
|
||||
Y_bearings = LM8UU;
|
||||
X_bearings = LM8UU;
|
||||
|
@@ -8,6 +8,13 @@
|
||||
// Configuration file
|
||||
//
|
||||
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;
|
||||
Y_bearings = LM10UU;
|
||||
X_bearings = LM10UU;
|
||||
|
@@ -49,6 +49,7 @@ module x_axis_assembly(show_extruder) {
|
||||
rotate([180, 0, 180])
|
||||
x_carriage_assembly(show_extruder);
|
||||
|
||||
color(belt_color)
|
||||
translate([0, -gantry_setback - belt_width(X_belt) / 2, Z + Z0])
|
||||
rotate([90, 0, 0]) render()
|
||||
union() {
|
||||
@@ -228,6 +229,7 @@ module y_axis_assembly(show_bed) {
|
||||
y_rails();
|
||||
|
||||
translate([Y_belt_line - X_origin, Y_motor_end, y_motor_height()]) rotate([90,0,-90]) {
|
||||
color(belt_color)
|
||||
render() difference() {
|
||||
twisted_belt(Y_belt,
|
||||
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;
|
||||
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) {
|
||||
difference() {
|
||||
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);
|
||||
|
||||
color(belt_color)
|
||||
union() {
|
||||
difference() {
|
||||
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"));
|
||||
|
||||
color(bulldog_color)
|
||||
render() translate([depth / 2 - thickness - eta, 0, 0])
|
||||
union() {
|
||||
difference() {
|
||||
|
@@ -8,21 +8,26 @@
|
||||
// Flat sheets
|
||||
//
|
||||
|
||||
// The "Soft" parameter determines if the sheet material will hold threads.
|
||||
// If not, nuts will be used to retain screws.
|
||||
|
||||
// The "Color" parameter is a quad-array: [R, G, B, Alpha]
|
||||
|
||||
// If you'd like to add a new material type, or a different color of an existing material type
|
||||
// simply add a new line here (or in your machine config file).
|
||||
//
|
||||
// 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]
|
||||
|
||||
MDF6 = [ "MD", "MDF sheet", 6, MDF_brown, true]; // ~1/4"
|
||||
MDF10 = [ "MD", "MDF sheet", 10, MDF_brown, true]; // ~3/8"
|
||||
MDF12 = [ "MD", "MDF sheet", 12, MDF_brown, true]; // ~1/2"
|
||||
PMMA6 = [ "AC", "Acrylic sheet", 6, acrylic_clear, false]; // ~1/4"
|
||||
PMMA8 = [ "AC", "Acrylic sheet", 8, acrylic_clear, false]; // ~5/16"
|
||||
PMMA10 = [ "AC", "Acrylic sheet",10, acrylic_clear, false]; // ~3/8"
|
||||
glass2 = [ "GL", "Glass sheet", 2, glass_clear, false];
|
||||
DiBond = [ "DB", "Dibond sheet", 3, dibond_grey, false];
|
||||
//
|
||||
MDF6 = [ "MD", "MDF sheet", 6, [0.4, 0.4, 0.2, 1 ], true]; // ~1/4"
|
||||
MDF10 = [ "MD", "MDF sheet", 10, [0.4, 0.4, 0.2, 1 ], true]; // ~3/8"
|
||||
MDF12 = [ "MD", "MDF sheet", 12, [0.4, 0.4, 0.2, 1 ], true]; // ~1/2"
|
||||
PMMA6 = [ "AC", "Acrylic sheet", 6, [1, 1, 1, 0.5 ], false]; // ~1/4"
|
||||
PMMA8 = [ "AC", "Acrylic sheet", 8, [1, 1, 1, 0.5 ], false]; // ~5/16"
|
||||
PMMA10 = [ "AC", "Acrylic sheet",10, [1, 1, 1, 0.5 ], false]; // ~3/8"
|
||||
glass2 = [ "GL", "Glass sheet", 2, [1, 1, 1, 0.25 ], false];
|
||||
DiBond = [ "DB", "Dibond sheet", 3, [0.7, 0.7, 0.7, 1 ], false];
|
||||
|
||||
function sheet_thickness(type) = type[2];
|
||||
function sheet_is_soft(type) = type[4];
|
||||
|
@@ -69,6 +69,7 @@ module wades_block_stl() {
|
||||
insulator_depth = insulator_depth(hot_end);
|
||||
|
||||
|
||||
color(wades_block_color)
|
||||
difference(){
|
||||
union(){
|
||||
cube([81, 52, thickness]); // motor plate
|
||||
@@ -250,7 +251,7 @@ module wade_idler_assembly() {
|
||||
module wades_assembly() {
|
||||
assembly("wades_assembly");
|
||||
|
||||
render() wades_block_stl();
|
||||
color(wades_block_color) render() wades_block_stl();
|
||||
|
||||
// idler screws, washers and springs
|
||||
for(i = [0,1])
|
||||
@@ -330,7 +331,7 @@ module wades_assembly() {
|
||||
|
||||
translate([75, 5 - nozzle_length / 4, 15])
|
||||
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])
|
||||
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);
|
||||
height = d + 2 * belt_thickness(X_belt);
|
||||
length = lug_width + 12.5;
|
||||
|
||||
color(belt_color)
|
||||
translate([d / 2, 0, 0])
|
||||
linear_extrude(height = belt_width(X_belt), convexity = 5, center = true)
|
||||
difference() {
|
||||
|
Reference in New Issue
Block a user