Replaced grey constants with a function grey().

Done to reduced the number of global constants.
This commit is contained in:
Chris Palmer 2020-06-20 10:17:29 +01:00
parent c88472121e
commit 184f19ef04
38 changed files with 71 additions and 78 deletions

View File

@ -52,14 +52,7 @@ $fs = extrusion_width / 2;
function round_to_layer(z) = ceil(z / layer_height) * layer_height;
// Some additional named colours
grey20 = [0.2, 0.2, 0.2];
grey30 = [0.3, 0.3, 0.3];
grey40 = [0.4, 0.4, 0.4];
grey50 = [0.5, 0.5, 0.5];
grey60 = [0.6, 0.6, 0.6];
grey70 = [0.7, 0.7, 0.7];
grey80 = [0.8, 0.8, 0.8];
grey90 = [0.9, 0.9, 0.9];
function grey(n) = [0.01, 0.01, 0.01] * n; //! Generate a shade of grey to pass to color().
gold = [255/255, 215/255, 0/255];
brass = [255/255, 220/255, 100/255];
silver = [0.75, 0.75, 0.75];

View File

@ -135,7 +135,7 @@ module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly
*translate_z(cable_d / 2)
rotate([90, 0, 0])
stl_colour(grey20)
stl_colour(grey(20))
cylinder(d = cable_d, h = 20, center = true);
}
}

View File

@ -34,7 +34,7 @@ TMC2130 = ["TMC2130", "TMC2130",
[
[ 10, 1, 0, "-2p54header", 8, 1 ,undef, "blue" ],
[ 10, 13, 0, "-2p54header", 8, 1],
[ 12, 7, 0, "-chip", 6, 4, 1, grey20 ],
[ 12, 7, 0, "-chip", 6, 4, 1, grey(20) ],
// mock up a heat sink
[ 10, 7, 0, "block", 9, 9, 2, TMC2130HeatSinkColor ],
[ 10, 11, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ],
@ -65,7 +65,7 @@ test_pcb = ["TestPCB", "Test PCB",
[ 10, 20, 0, "2p54boxhdr", 4, 2],
[ 10, 30, 0, "2p54socket", 6, 1],
[ 25, 30, 0, "2p54socket", 4, 1, false, 0, false, "red" ],
[ 10, 40, 0, "chip", 10, 5, 1, grey20],
[ 10, 40, 0, "chip", 10, 5, 1, grey(20)],
[ 5, 50, 0, "led", LED3mm, "red"],
[ 12, 50, 0, "led", LED5mm, "orange"],
[ 25, 50, 0, "led", LED10mm, "yellow"],
@ -97,7 +97,7 @@ test_pcb = ["TestPCB", "Test PCB",
[ 50, 50, 0, "molex_hdr", 2],
[ 50, 60, 0, "jst_xh", 2],
[ 50, 70, 180, "term254", 3],
[ 63, 70, 180, "term254", 3, undef, grey20],
[ 63, 70, 180, "term254", 3, undef, grey(20)],
[ 75, 70, 180, "gterm508",2, undef, "blue"],
[ 50, 90, 180, "gterm35", 4, [1,2]],
@ -107,7 +107,7 @@ test_pcb = ["TestPCB", "Test PCB",
[ 55, 110, 180, "gterm635", 2],
[ 75, 110, 180, "gterm635", 2, undef, "blue"],
[ 90, 110, 180, "gterm", gt_5x17, 2, undef, grey20],
[ 90, 110, 180, "gterm", gt_5x17, 2, undef, grey(20)],
[ 50, 130, 180, "term35", 4],
[ 70, 130, 180, "term35", 3, "lime"],

View File

@ -65,7 +65,7 @@ module belt_test() {
translate([-25, 0])
layout([for(b = belts) belt_width(b)], 10)
rotate([0, 90, 0])
belt(belts[$i], [[0, 0, 20], [0, 1, 20]], belt_colour = $i%2==0 ? grey90 : grey20, tooth_colour = $i%2==0 ? grey70 : grey50);
belt(belts[$i], [[0, 0, 20], [0, 1, 20]], belt_colour = $i%2==0 ? grey(90) : grey(20), tooth_colour = $i%2==0 ? grey(70) : grey(50));
}
if($preview)

View File

@ -33,7 +33,7 @@ module rails()
nut = screw_nut(screw);
washer = screw_washer(screw);
rail_assembly(rail, length, rail_travel(rail, length) / 2, $i<2 ? grey20 : "green", $i<2 ? grey20 : "red");
rail_assembly(rail, length, rail_travel(rail, length) / 2, $i<2 ? grey(20) : "green", $i<2 ? grey(20) : "red");
rail_screws(rail, length, sheet + nut_thickness(nut, true) + washer_thickness(washer));

View File

@ -41,7 +41,7 @@ function no_point(str) = chr([for(c = str) if(c == ".") ord("p") else ord(c)]);
// We model the belt path at the pitch radius of the pulleys and the pitch line of the belt to get an accurate length.
// The belt is then drawn by offseting each side from the pitch line.
//
module belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey20, tooth_colour = grey50) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified
module belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey(20), tooth_colour = grey(50)) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified
width = belt_width(type);
pitch = belt_pitch(type);
thickness = belt_thickness(type);

View File

@ -39,7 +39,7 @@ function blower_top(type) = type[14]; //! Thickness of the top
function blower_wall(type) = type[15]; //! Side wall thickness
function blower_lug(type) = type[16]; //! Height of the lugs
fan_colour = grey20;
fan_colour = grey(20);
module blower(type) { //! Draw specified blower
length = blower_length(type);

View File

@ -46,7 +46,7 @@ module square_button(type, colour = "yellow") { //! Draw square button with spec
pitch = (w/ 2 - wall - rivit * 0.75);
stem = square_button_cap_stem(type);
color(grey20) {
color(grey(20)) {
rounded_rectangle([w, w, h - 0.5], r = wall, center = false);
for(x = [-1, 1], y = [-1, 1])

View File

@ -33,7 +33,7 @@ function circlip_a(type) = type[5]; //! Size of the lugs
function circlip_b(type) = type[6]; //! Widest part of the taper
function circlip_d5(type) = type[7]; //! Plier hole diameter
circlip_colour = grey20;
circlip_colour = grey(20);
closed_angle = 25;
module internal_circlip(type, open = 0) { //! Draw specified internal circlip, open = 0, for nominal size installed, 1 for relaxed uninstalled, -1 for squeezed to install

View File

@ -23,9 +23,9 @@
include <../utils/core/core.scad>
use <../utils/thread.scad>
d_pillar_colour = grey90;
d_plug_shell_colour = grey80;
d_plug_insulator_colour = grey20;
d_pillar_colour = grey(90);
d_plug_shell_colour = grey(80);
d_plug_insulator_colour = grey(20);
function d_flange_length(type) = type[1]; //! Length of the flange
function d_lengths(type) = type[2]; //! Lengths of the D for plug and socket

View File

@ -91,7 +91,7 @@ module dil_socket(rows, w, pitch = inch(0.1)) {
hole = [0.8, 0.5];
pin_l = 3;
color(grey20) {
color(grey(20)) {
linear_extrude(h)
difference() {
square([width, length], center = true);
@ -129,7 +129,7 @@ module dip(n, part, size, w, pitch, pin) { //! Draw DIP package
D = [3, 0.6];
translate_z(pdip_pin_s(pin)) {
color(grey20) {
color(grey(20)) {
rotate([90, 0, 0])
linear_extrude(size.x, center = true)
difference() {

View File

@ -122,7 +122,7 @@ module extrusion(type, length, center = true, cornerHole = false) { //! Draw the
vitamin(str("extrusion(", type[0], ", ", length, arg(cornerHole, false, "cornerHole"), "): Extrusion ", type[0], " x ", length, "mm"));
color(grey90)
color(grey(90))
linear_extrude(length, center = center)
extrusion_cross_section(type, cornerHole);
}

View File

@ -28,7 +28,7 @@ use <nut.scad>
use <washer.scad>
use <../utils/tube.scad>
fan_colour = grey20;
fan_colour = grey(20);
function fan_width(type) = type[0]; //! Width of square
function fan_depth(type) = type[1]; //! Depth of fan

View File

@ -61,7 +61,7 @@ module fuseholder(thickness) { //! Fuseholder with nut in place for specified pa
//
// Nut
//
colour = grey40;
colour = grey(40);
vflip()
translate_z(thickness)
explode(height) {

View File

@ -33,8 +33,8 @@
// h t s t t t
// h
//
JHeadMk4 = ["JHeadMk4", jhead, "JHead MK4", 64, 5.1, 16, 50, grey20, 12, 4.64, 14, [0, 2.94, -5], 20, 20];
JHeadMk5 = ["JHeadMk5", jhead, "JHead MK5", 51.2, 5.1, 16, 40, grey20, 12, 4.64, 13, [0, 2.38, -5], 20, 20];
JHeadMk4 = ["JHeadMk4", jhead, "JHead MK4", 64, 5.1, 16, 50, grey(20), 12, 4.64, 14, [0, 2.94, -5], 20, 20];
JHeadMk5 = ["JHeadMk5", jhead, "JHead MK5", 51.2, 5.1, 16, 40, grey(20), 12, 4.64, 13, [0, 2.38, -5], 20, 20];
E3Dv5 = ["E3Dv5", e3d, "E3D V5 direct", 70, 3.7, 16, 50.1, "silver", 12, 6, 15, [1, 5, -4.5], 14.5, 28];
E3Dv6 = ["E3Dv6", e3d, "E3D V6 direct", 62, 3.7, 16, 42.7, "silver", 12, 6, 15, [1, 5, -4.5], 14, 21];
E3D_clone = ["E3D_clone", e3d, "E3D clone aliexpress",66, 6.8, 16, 46, "silver", 12, 5.6, 15, [1, 5, -4.5], 14.5, 21];

View File

@ -51,7 +51,7 @@ module hygrometer() { //! Draw a hygrometer
vitamin("hygrometer(): Mini LCD Digital Thermometer / Hygrometer");
explode(40) {
color(grey30)
color(grey(30))
rotate_extrude()
polygon([
[0, 0],

View File

@ -134,7 +134,7 @@ module iec(type) { //! Draw specified IEC connector
}
}
color(grey20) {
color(grey(20)) {
// Flange
flange_t = iec_flange_t(type);
linear_extrude(flange_t)

View File

@ -25,7 +25,7 @@ use <../utils/tube.scad>
use <washer.scad>
use <ball_bearing.scad>
kp_pillow_block_colour = grey70;
kp_pillow_block_colour = grey(70);
function kp_diameter(type) = type[1]; //! Rod hole diameter
function kp_hole_offset(type) = type[2]; //! Rod hole offset

View File

@ -24,9 +24,9 @@ include <../utils/core/core.scad>
use <../utils/tube.scad>
bearing_colour = grey70;
groove_colour = grey60;
seal_colour = grey30;
bearing_colour = grey(70);
groove_colour = grey(60);
seal_colour = grey(30);
function bearing_length(type) = type[1]; //! Total length

View File

@ -24,8 +24,8 @@ small_leg = [0.9, 3.3, 0.4, 0];
medium_leg = [0.5, 3.9, 3.2, 1.6, [0, -0.5]];
large_leg = [11.4, 0.8, 6.3, 1.8, [1.7, 0]];
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey20, "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey20, "burlywood" ];
small_microswitch = ["small_microswitch", "DM1-00P-110-3", 5.8, 6.5, 12.8, 0, 2, [[-3.25, -1.65], [3.25, -1.65]], 2.9, 1.2, [-1.95, 3.75], [[-5.08, -4.95], [0, -4.9], [5.08, -4.9] ], small_leg, grey(20), "white" ];
medium_microswitch = ["medium_microswitch","SS-01 or SS-5GL", 6.4, 10.2, 19.8, 1, 2.35, [[-4.8, -2.6 ], [4.7, -2.6 ]], 3.2, 2, [-2.8, 5.8 ], [[-8.05, -7.05], [0.75, -7.05], [8.05, -7.05] ], medium_leg, grey(20), "burlywood" ];
large_microswitch = ["large_microswitch", "Saia G3 low force", 10.4, 15.9, 28.0, 2, 3.1, [[-11.1, -5.15], [11.2, 5.15]], 4, 2.75,[-9.1, 9.55], [[19.7, 2.19], [19.7, -3.45], [8.3, -10.45] ], large_leg, "ivory", "white" ];
microswitches = [small_microswitch, medium_microswitch, large_microswitch];

View File

@ -87,7 +87,7 @@ module mod(type) { //! Draw specified module
linear_extrude(body_l, center = true)
profile();
color(grey20)
color(grey(20))
for(end = [-1, 1])
translate([end * body_l / 2, 0, 0])
rotate([90, 0, end * 90])

View File

@ -55,7 +55,7 @@ module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specifi
vitamin(str("nut(", type[0], arg(nyloc, false, "nyloc"), arg(brass, false, "brass"), arg(nylon, false, "nylon"),
"): Nut M", nut_size(type), " x ", thickness, "mm ", desc));
colour = brass ? brass_colour : nylon ? grey30: grey70;
colour = brass ? brass_colour : nylon ? grey(30): grey(70);
explode(nyloc ? 10 : 0) {
color(colour) {
linear_extrude(thickness)
@ -147,7 +147,7 @@ module sliding_t_nut(type) {
tabSizeZ = nut_thickness(type);
holeRadius = nut_size(type) / 2;
color(grey80)
color(grey(80))
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, 0, hammerNut);
}
@ -204,7 +204,7 @@ module nut_square(type, brass = false, nylon = false) { //! Draw specified squar
vitamin(str("nut(", type[0], arg(brass, false, "brass"), arg(nylon, false, "nylon"),
"): Nut M", nut_size(type), "nS ", width, " x ", thickness, "mm ", desc));
colour = brass ? brass_colour : nylon ? grey30 : grey70;
colour = brass ? brass_colour : nylon ? grey(30) : grey(70);
color(colour)
difference() {
linear_extrude(thickness) {

View File

@ -53,7 +53,7 @@ module opengrab() { //! Draw OpenGrab module
translate_z(magnet / 2 + eps)
cube([width, width, magnet - eps], center = true);
color(grey80) {
color(grey(80)) {
gap = (width - poles * pole_w + 3 * eps) / (poles - 1);
pitch = pole_w + gap;
for(i = [0 : poles - 1])
@ -84,7 +84,7 @@ module opengrab() { //! Draw OpenGrab module
module opengrab_target() { //! Draw OpenGrab target
vitamin("opengrab_target(): OpenGrab silicon steel target plate");
color(grey80)
color(grey(80))
linear_extrude(target)
difference() {
square([width, width], center = true);

View File

@ -87,7 +87,7 @@ module panel_meter(type) { //! Draw panel mounted LCD meter module
translate([x * (bezel.x / 2 - bevel), y * (bezel.y / 2 - bevel)])
rounded_cylinder(r = r, r2 = bevel, h = bezel.z);
color(grey30) union() {
color(grey(30)) union() {
//
// Bezel and aperture
//

View File

@ -25,8 +25,8 @@
PZEM021 = ["PZEM021", "Peacefair PZEM-021 AC digital multi-function meter", [84.6, 44.7, 24.4], [89.6, 49.6, 2.3], 1.5, [1, 1], [51, 30, 5], [1.3, 10, 6], 15.5, 0];
PZEM001 = ["PZEM001", "Peacefair PZEM-001 AC digital multi-function meter", [62 , 52.5, 24.4], [67, 57.5, 2.0], 2.0, [1, 1], [61, 46,-3], [1.2, 10, 6], 15.5, 0,
[36, 36, 1.9], [0, 0], false, 0, 0, [
[[25, 8, 0], [0, 0, 2], 4, grey90],
[[25, -8, 0], [0, 0, 2], 4, grey90],
[[25, 8, 0], [0, 0, 2], 4, grey(90)],
[[25, -8, 0], [0, 0, 2], 4, grey(90)],
]];

View File

@ -248,7 +248,7 @@ module rj45(cutout = false) { //! Draw RJ45 Ethernet connector
cube([h, w, eps], center = true);
}
color(grey30) {
color(grey(30)) {
linear_extrude(l - 0.2, center = true)
difference() {
square([h - 0.1, w - 0.1], center = true);
@ -279,7 +279,7 @@ module jack(cutout = false) { //! Draw 3.5mm jack
rotate([0, 90, 0])
cylinder(d = d + 2 * panel_clearance, h = 100);
else
color(grey20)
color(grey(20))
rotate([0, 90, 0]) {
linear_extrude(l / 2)
difference() {
@ -508,7 +508,7 @@ module barrel_jack(cutout = false) { //! Draw barrel power jack
if(cutout)
;
else {
color(grey20) rotate([0, 90, 0]) {
color(grey(20)) rotate([0, 90, 0]) {
linear_extrude(l, center = true) {
difference() {
translate([-h / 2, 0])
@ -580,7 +580,7 @@ module uSD(size, cutout = false) { //! Draw uSD socket
cube([size.x, size.z, t], center = true);
}
if(w > 0)
color(grey20)
color(grey(20))
rotate([90, 0, 90])
translate_z(t)
linear_extrude(size.y - t, center = true)
@ -608,7 +608,7 @@ module flex(cutout = false) { //! Draw flexistrip connector
if(cutout)
;
else {
color(grey30) {
color(grey(30)) {
translate_z(0.5)
cube([l, w, 1], center = true);
@ -664,7 +664,7 @@ module flat_flex(cutout = false) { //! Draw flat flexistrip connector as used on
if(cutout)
;
else {
color(grey30) {
color(grey(30)) {
translate([w / 2 - w1, 0, h1 / 2])
rotate([90, 0, 90])
linear_extrude(w1)
@ -676,7 +676,7 @@ module flat_flex(cutout = false) { //! Draw flat flexistrip connector as used on
}
}
color(grey90) {
color(grey(90)) {
translate([-w / 2 + w3 / 2, 0, h3 / 2])
cube([w3, l3, h3], center = true);
@ -886,7 +886,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6, false), false, cutouts, colour = param(7, undef));
if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6, false), cutouts);
if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7, 0), param(8, false), cutouts, param(9, undef));
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts);
if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey(30)), cutouts);
if(show(comp, "rj45")) rj45(cutouts);
if(show(comp, "usb_A")) usb_Ax1(cutouts);
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);
@ -923,7 +923,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "molex_hdr")) molex_254(comp[4]);
if(show(comp, "jst_xh")) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef));
if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9));
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey20));
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey(20)));
}
}
}

View File

@ -112,7 +112,7 @@ DuetE = ["DuetE", "Duet 2 Ethernet electronics",
[109.8, -58.8, 0, "chip", inch(0.03), inch(0.06), 1, "red"], // Bed heater
[ 2.3, -37.2, 0, "chip", 3.6, 4.8, 2.0, "silver"], // Reset switch
[ 0.0, -37.2, 0, "chip", 2.0, 2.6, 1.4, grey20], // Reset button
[ 0.0, -37.2, 0, "chip", 2.0, 2.6, 1.4, grey(20)], // Reset button
],
[": Micro SD card", ": Cat 5 patch cable 300mm"]];

View File

@ -34,8 +34,8 @@ M3x13_hex_pillar = ["M3x13_hex_pillar", "hex", 3, 13, 5/cos(30
M3x20_hex_pillar = ["M3x20_hex_pillar", "hex", 3, 20, 5/cos(30), 5/cos(30), 6, 6, "silver", silver, -8, 8];
M3x20_nylon_pillar = ["M3x20_nylon_pillar", "nylon", 3, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6];
M4x17_nylon_pillar = ["M4x17_nylon_pillar", "nylon", 4, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6];
M3x20_nylon_hex_pillar = ["M3x20_nylon_hex_pillar", "hex nylon", 3, 20, 8/cos(30), 8/cos(30), 6, 6, grey20, grey20, -6, 6];
M3x10_nylon_hex_pillar = ["M3x10_nylon_hex_pillar", "hex nylon", 3, 10,5.5/cos(30),5.5/cos(30),6, 6, grey20, grey20, -6, 6];
M3x20_nylon_hex_pillar = ["M3x20_nylon_hex_pillar", "hex nylon", 3, 20, 8/cos(30), 8/cos(30), 6, 6, grey(20), grey(20), -6, 6];
M3x10_nylon_hex_pillar = ["M3x10_nylon_hex_pillar", "hex nylon", 3, 10,5.5/cos(30),5.5/cos(30),6, 6, grey(20), grey(20), -6, 6];
pillars = [M2x16_brass_pillar, M3x13_hex_pillar, M3x20_hex_pillar, M3x20_nylon_pillar, M4x17_nylon_pillar, M3x10_nylon_hex_pillar, M3x20_nylon_hex_pillar];

View File

@ -24,8 +24,8 @@
// h l w w c
// c
//
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey20, 8.5];
jst_xh_header = ["JST XH header",2.5,10,3.4, 0.64, "gold", grey90, 7];
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey(20), 8.5];
jst_xh_header = ["JST XH header",2.5,10,3.4, 0.64, "gold", grey(90), 7];
pin_headers = [ 2p54header ];

View File

@ -76,7 +76,7 @@ module terminal_block(type, ways) { //! Draw a power supply terminal block
contact_h = 0.4;
washer_t = 1.2;
translate([0, -tl]) {
color(grey20) {
color(grey(20)) {
cube([depth, tl, h2]);
translate([depth2, 0])

View File

@ -65,7 +65,7 @@ module carriage_hole_positions(type) { //! Position children over screw holes
children();
}
module carriage(type, rail, end_colour = grey20, wiper_colour = grey20) { //! Draw the specified carriage
module carriage(type, rail, end_colour = grey(20), wiper_colour = grey(20)) { //! Draw the specified carriage
total_l = carriage_length(type);
block_l = carriage_block_length(type);
block_w = carriage_width(type);
@ -82,7 +82,7 @@ module carriage(type, rail, end_colour = grey20, wiper_colour = grey20) { //! Dr
square([w , rail_height(rail) + 0.2]);
}
color(grey90) {
color(grey(90)) {
rotate([90, 0, 90])
linear_extrude(block_l, center = true)
difference() {
@ -132,7 +132,7 @@ module rail(type, length) { //! Draw the specified rail
vitamin(str("rail(", type[0], ", ", length, "): Linear rail ", type[0], " x ", length, "mm"));
color(grey90) {
color(grey(90)) {
linear_extrude(height - rail_bore_depth(type)) difference() {
square([length, width], center = true);
rail_hole_positions(type, length)
@ -166,7 +166,7 @@ module rail(type, length) { //! Draw the specified rail
}
}
module rail_assembly(type, length, pos, carriage_end_colour = grey20, carriage_wiper_colour = grey20) { //! Rail and carriage assembly
module rail_assembly(type, length, pos, carriage_end_colour = grey(20), carriage_wiper_colour = grey(20)) { //! Rail and carriage assembly
rail(type, length);
translate([pos, 0])

View File

@ -53,7 +53,7 @@ module rocker(type, colour) { //! Draw the specified rocker switch
rocker_r2 = (sqr(x2) + sqr(y2)) / (2 * y2);
explode(30) {
color(grey20) {
color(grey(20)) {
linear_extrude(rocker_flange_t(type))
difference() {
rounded_square([rocker_flange_w(type), rocker_flange_h(type)], 0.5);
@ -65,7 +65,7 @@ module rocker(type, colour) { //! Draw the specified rocker switch
rounded_rectangle([rocker_width(type), rocker_height(type), rocker_depth(type) + eps], 0.5, center = false);
}
if(rocker_pivot(type))
color(colour ? colour : grey30)
color(colour ? colour : grey(30))
translate_z(rocker_pivot(type))
rotate([90, 0, 90])
linear_extrude(rocker_w, center = true)

View File

@ -25,9 +25,9 @@
include <../utils/core/core.scad>
use <../utils/thread.scad>
rod_colour = grey80;
studding_colour = grey70;
leadscrew_colour = grey70;
rod_colour = grey(80);
studding_colour = grey(70);
leadscrew_colour = grey(70);
module rod(d , l, center = true) { //! Draw a smooth rod with specified diameter and length
vitamin(str("rod(", d, ", ", l, "): Smooth rod ", d, "mm x ", l, "mm"));

View File

@ -82,7 +82,7 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
: length;
d = 2 * screw_radius(type);
pitch = metric_coarse_pitch(d);
colour = nylon || head_type == hs_grub ? grey40 : grey80;
colour = nylon || head_type == hs_grub ? grey(40) : grey(80);
module shaft(socket = 0, headless = false) {
point = screw_nut(type) ? 0 : 3 * rad;

View File

@ -41,7 +41,7 @@ function scs_circlip(type) = type[15]; //! Circlip used
function scs_spacer(type) = type[16]; //! Spacer used in long bearings
sks_bearing_block_colour = grey90;
sks_bearing_block_colour = grey(90);
module scs_bearing_block(type) { //! Draw the specified SCS bearing block
vitamin(str("scs_bearing_block(", type[0], "): ", type[0], " bearing block"));

View File

@ -24,7 +24,7 @@ include <../utils/fillet.scad>
use <washer.scad>
sk_bracket_colour = grey70;
sk_bracket_colour = grey(70);
function sk_diameter(type) = type[1]; //! Rod hole diameter
function sk_hole_offset(type) = type[2]; //! Rod hole offset
@ -85,7 +85,7 @@ module sk_bracket(type) { //! SK shaft support bracket
}
}
// Add the retaining bolt. No hole was cut, since it is only for display.
color(grey20)
color(grey(20))
translate([P / 2 - screw_head_height(M3_cap_screw) / 2, (F - h + d / 2) / 2, 0])
rotate([0,90,0])
not_on_bom() no_explode()

View File

@ -41,8 +41,8 @@ function NEMA_holes(type) = [-NEMA_hole_pitch(type) / 2, NEMA_hole_pitch(t
function NEMA_big_hole(type) = NEMA_boss_radius(type) + 0.2; //! Clearance hole for the big boss
stepper_body_colour = "black";
stepper_cap_colour = grey50;
stepper_machined_colour = grey90;
stepper_cap_colour = grey(50);
stepper_machined_colour = grey(90);
module NEMA_outline(type) //! 2D outline
intersection() {

View File

@ -25,8 +25,8 @@
include <../utils/core/core.scad>
include <../utils/sweep.scad>
soft_washer_colour = grey20;
hard_washer_colour = grey80;
soft_washer_colour = grey(20);
hard_washer_colour = grey(80);
star_washer_colour = brass;
function washer_size(type) = type[1]; //! Noiminal size