From f2816b7ca91eda60c264c478a72f836325ad521d Mon Sep 17 00:00:00 2001 From: David Carley Date: Tue, 13 Mar 2012 10:02:35 -0500 Subject: [PATCH] Extracted all color resources into a common file. --- openscad.pyc | Bin 0 -> 555 bytes scad/bar-clamp.scad | 4 +- scad/bed.scad | 2 +- scad/cable_clip.scad | 2 +- scad/conf/carley_mendel_config.scad | 76 +++++++++++++++++++++++ scad/conf/colors.scad | 93 ++++++++++++++++++++++++++++ scad/conf/config.scad | 6 ++ scad/conf/machine.scad | 1 + scad/conf/vitamins.scad | 6 +- scad/d-motor_bracket.scad | 8 +-- scad/fixing-block.scad | 2 +- scad/main.scad | 4 +- scad/pcb_spacer.scad | 2 +- scad/prusa-z-motor-bracket.scad | 2 +- scad/pulley.scad | 4 +- scad/ribbon_clamp.scad | 2 +- scad/stl.scad | 2 + scad/vitamins/ball-bearings.scad | 2 +- scad/vitamins/cable_strip.scad | 4 +- scad/vitamins/d-connectors.scad | 6 +- scad/vitamins/electronics.scad | 4 +- scad/vitamins/fans.scad | 2 +- scad/vitamins/linear-bearings.scad | 2 +- scad/vitamins/microswitch.scad | 6 +- scad/vitamins/nuts.scad | 4 +- scad/vitamins/pillars.scad | 6 +- scad/vitamins/screws.scad | 10 +-- scad/vitamins/sheet.scad | 24 ++++--- scad/vitamins/springs.scad | 2 +- scad/vitamins/stepper-motors.scad | 4 +- scad/vitamins/washers.scad | 5 +- scad/vitamins/ziptie.scad | 4 +- scad/wade.scad | 12 ++-- scad/x-carriage.scad | 8 +-- scad/x-end.scad | 2 +- scad/y-bearing-mount.scad | 6 +- scad/y-belt-anchor.scad | 8 +-- scad/y-idler-bracket.scad | 4 +- scad/y-motor-bracket.scad | 4 +- scad/z-coupling.scad | 4 +- scad/z-limit-switch-bracket.scad | 2 +- scad/z-motor-bracket.scad | 4 +- 42 files changed, 273 insertions(+), 82 deletions(-) create mode 100644 openscad.pyc create mode 100644 scad/conf/carley_mendel_config.scad create mode 100644 scad/conf/colors.scad create mode 100644 scad/conf/machine.scad create mode 100644 scad/stl.scad diff --git a/openscad.pyc b/openscad.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2361704f9f9c7d9cf83af7e152a0379b3c3eb71 GIT binary patch literal 555 zcma)3J4*vW5dLQKk{C&8A(qM&5^NPw!NMvLk}d@0yj?=#<~H2!AwsOqe`MwF@(1Y5 z#`x%5ZXP#}Z@$^Bz3;T&UT<$Qd>zI1lEoje()W2D5-Jf?1RrB zq6k8h<(kDiRsooE58*+fI6_dE*92lp2z9K0im=N<`2|7)nv-=@3eTKh*Easv>LykU z*b-flA~y3TDu9^qDB0qf1MUR!5VqO4rOADk>buPP&aeNTb<;o`cns3BDGS2h2kpwR zaZOPqEsjQ1=b1KxrwbF>Qd-_G3zr$cj%TU0vB1uJh>igBVnAk{H;FKd@wAxwAh*Xn z5;lm+@3D7vI`Ks|>6=^|dvZM4aO*9fVnqmkudD#ZYz`$_~RWs~_P1 Up-cDK!s*hQbGaKYb2`*fpImZk_y7O^ literal 0 HcmV?d00001 diff --git a/scad/bar-clamp.scad b/scad/bar-clamp.scad index 50f4aba..afe168f 100644 --- a/scad/bar-clamp.scad +++ b/scad/bar-clamp.scad @@ -51,7 +51,7 @@ module bar_clamp(d, h, w, switch = false, yaxis = false) { sbracket_thickness = 7; sbracket_height = microswitch_length(); - color([0,1,0]) { + color(clamp_color) { translate([0, rail_offset, 0]) { union() { difference() { @@ -141,7 +141,7 @@ module bar_clamp_assembly(d, h, w, name, switch = false, yaxis = true) { //assembly(name); stl(str(name, switch ? "_switch" : "")); - color([0,1,0]) render() bar_clamp(d, h, w, switch, yaxis); + color(clamp_color) render() bar_clamp(d, h, w, switch, yaxis); // // screw and washer for clamp // diff --git a/scad/bed.scad b/scad/bed.scad index 2d77444..8475842 100644 --- a/scad/bed.scad +++ b/scad/bed.scad @@ -32,7 +32,7 @@ module bed_assembly() { translate([0, 0, washer_thickness(M3_washer)]) { vitamin(str("BED", bed_width, bed_depth,": PCB bed ", bed_width, " x ", bed_depth)); translate([0,0, pillar_height(bed_pillars) + pcb_thickness / 2]) - color([0.7,0,0]) cube([bed_width, bed_depth, pcb_thickness], center = true); + color(bed_color) cube([bed_width, bed_depth, pcb_thickness], center = true); translate([0,0, pillar_height(bed_pillars) + pcb_thickness + sheet_thickness(glass) / 2 + eta * 3]) sheet(glass, bed_width, bed_depth - 12); diff --git a/scad/cable_clip.scad b/scad/cable_clip.scad index 590512d..0954250 100644 --- a/scad/cable_clip.scad +++ b/scad/cable_clip.scad @@ -65,7 +65,7 @@ module cable_clip(screw, cable1, cable2 = 0) { } module cable_clip_assembly(screw, screw_length, cable1, cable2 = 0) { - color([1,0,0]) render() translate([0, cable_clip_width(screw) / 2, 0]) rotate([90, 0, 0]) + color(clip_color) render() translate([0, cable_clip_width(screw) / 2, 0]) rotate([90, 0, 0]) cable_clip(screw, cable1, cable2); translate([0, 0, max(cable_clip_height(cable1), cable_clip_height(cable2))]) diff --git a/scad/conf/carley_mendel_config.scad b/scad/conf/carley_mendel_config.scad new file mode 100644 index 0000000..52082bc --- /dev/null +++ b/scad/conf/carley_mendel_config.scad @@ -0,0 +1,76 @@ +// +// Mendel90 +// +// GNU GPL v2 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// Configuration file +// +echo("Carley Mendel:"); +Z_bearings = LM8UU; +Y_bearings = LM8UU; +X_bearings = LM8UU; + +X_motor = NEMA17; +Y_motor = NEMA17; +Z_motor = NEMA17; + +X_travel = 200; +Y_travel = 200; +Z_travel = 140; + +bed_depth = 214; +bed_width = 214; +bed_pillars = M3x20_pillar; +bed_thickness = 1.6 + sheet_thickness(glass); // PCB heater plus glass sheet +bed_holes = 209; + +base = PMMA10; // Sheet material used for the base. Needs to be thick enough to screw into. +base_corners = 50; + +frame = PMMA6; +frame_corners = 25; +frame_nuts = false; + +case_fan = fan80x38; +psu = KY240W; + +single_piece_frame = true; +stays_from_window = false; + +Y_carriage = PMMA6; + +extruder_width = 30; // actually 28 but offset +nozzle_x_offset = 16; // offset from centre of the extruder +nozzle_length = 50; // from base of extruder to nozzle tip + +X_belt = T5x6; +Y_belt = T5x6; + +motor_shaft = 5; +Z_screw_dia = 8; // Studding for Z axis + +Y_carriage_depth = bed_depth + 10; +Y_carriage_width = bed_width + 10; + +Z_nut_radius = M8_nut_radius; +Z_nut_depth = M8_nut_depth; +Z_nut = M8_nut; + +// +// Default screw use where size doesn't matter +// +cap_screw = M3_cap_screw; +hex_screw = M3_hex_screw; +// +// Screw for the frame and base +// +frame_soft_screw = No6_screw; // Used when sheet material is soft, e.g. wood +frame_thin_screw = M4_cap_screw; // Used with nuts when sheets are thin +frame_thick_screw = M4_pan_screw; // Used with tapped holes when sheets are thick and hard, e.g. plastic or metal +// +// Feature sizes +// +default_wall = 3; +thick_wall = 4; diff --git a/scad/conf/colors.scad b/scad/conf/colors.scad new file mode 100644 index 0000000..957d172 --- /dev/null +++ b/scad/conf/colors.scad @@ -0,0 +1,93 @@ +// +// Mendel90 +// +// GNU GPL v2 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// 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]; +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]; + +// 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 ]; + +// Object colors +rod_color = grey80; +studding_color = grey50; +tubing_color = [0.8, 0.8, 0.8, 0.75 ]; +nut_grey = grey70; +soft_washer_color = grey20; +hard_washer_color = grey80; +star_washer_color = [0.8, 0.8, 0.4]; +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]; +spring_color = grey20; +pillar_color = grey90; +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; +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; +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; diff --git a/scad/conf/config.scad b/scad/conf/config.scad index d7bc387..a8bf8dc 100644 --- a/scad/conf/config.scad +++ b/scad/conf/config.scad @@ -7,11 +7,17 @@ // // Configuration file // + +include + bom = 2; // 0 no bom, 1 assemblies and stls, 2 vitamins as well exploded = false; // true for exploded view eta = 0.01; // small fudge factor to stop CSG barfing on coincident faces. $fa = 5; $fs = 0.5; + +glass_thickness = 2; + // // Hole sizes // diff --git a/scad/conf/machine.scad b/scad/conf/machine.scad new file mode 100644 index 0000000..0469072 --- /dev/null +++ b/scad/conf/machine.scad @@ -0,0 +1 @@ +include diff --git a/scad/conf/vitamins.scad b/scad/conf/vitamins.scad index 5e817f1..05ab2ec 100644 --- a/scad/conf/vitamins.scad +++ b/scad/conf/vitamins.scad @@ -28,20 +28,20 @@ include <../vitamins/electronics.scad> module rod(d , l) { vitamin(str("RD", d, round(l), ": Smooth rod ", d, " x ", round(l))); - color([0.8,0.8,0.8]) + color(rod_color) cylinder(r = d / 2, h = l, center = true); } module studding(d , l) { vitamin(str("ST", d, round(l),": Threaded rod ", d, " x ", round(l))); - color([0.5,0.5,0.5]) + color(studding_color) cylinder(r = d / 2, h = l, center = true); } module tubing(od, id, length) { vitamin(str("TB", od, id, length,": Tubing OD ",od, " ID ", id," x ",length)); - color([0.8, 0.8, 0.8, 0.75]) render() difference() { + color(tubing_color) render() difference() { cylinder(r = od / 2, h = length, center = true); cylinder(r = id / 2, h = length + 1, center = true); } diff --git a/scad/d-motor_bracket.scad b/scad/d-motor_bracket.scad index c03bc4b..61899fe 100644 --- a/scad/d-motor_bracket.scad +++ b/scad/d-motor_bracket.scad @@ -251,12 +251,12 @@ module d_shell_assembly(motor) { d_width / 2 + d_motor_bracket_offset(motor), -NEMA_length(NEMA17) - length - shell_length - d_mate_distance(connector) + overlap]) rotate([0, -90, 180]) { - color([0,1,0]) render() d_shell_stl(); + color(d_shell_color) render() d_shell_stl(); translate([0, d_width / 2, height + lid_thickness]) translate([length, 0, 0]) explode([0, 0, 40]) translate([-length, 0, 0]) - color([1,0,0]) render() rotate([180, 0, 0]) d_shell_lid_stl(motor); + color(d_shell_lid_color) render() rotate([180, 0, 0]) d_shell_lid_stl(motor); for(side = [-1, 1]) { translate([shell_length - shell_front, d_width / 2 - side * pitch / 2, thickness + slot_height / 2]) //connector screws @@ -277,12 +277,12 @@ module d_shell_assembly(motor) { module d_motor_bracket_assembly(motor) { rotate([0, 90, 0]) translate([NEMA_length(NEMA17) - overlap, -NEMA_width(NEMA17) / 2 - thickness, -NEMA_width(NEMA17) / 2 - thickness]) { - color([0,1,0]) render() d_motor_bracket_stl(NEMA17); + color(d_motor_bracket_color) render() d_motor_bracket_stl(NEMA17); translate([0, NEMA_width(NEMA17) / 2 + d_motor_bracket_offset(NEMA17) + thickness, height + lid_thickness]) translate([length, 0, 0]) explode([0, 0, 40]) translate([-length, 0, 0]) - color([1,0,0]) render() rotate([180, 0, 0]) d_motor_bracket_lid_stl(motor); + color(d_motor_bracket_lid_color) render() rotate([180, 0, 0]) d_motor_bracket_lid_stl(motor); } translate([-NEMA_width(motor) / 2 + slot_height / 2, d_motor_bracket_offset(motor), -NEMA_length(motor) + overlap]) { diff --git a/scad/fixing-block.scad b/scad/fixing-block.scad index d4a7d30..0ea9604 100644 --- a/scad/fixing-block.scad +++ b/scad/fixing-block.scad @@ -86,7 +86,7 @@ module fixing_block_stl() { } module fixing_block_assembly(front = false) { - color([0,1,0]) render() fixing_block_stl(); + color(fixing_block_color) render() fixing_block_stl(); fixing_block_v_hole(height - counter_bore_depth) if(front) frame_screw(thickness); diff --git a/scad/main.scad b/scad/main.scad index 4beffb7..2b7e536 100644 --- a/scad/main.scad +++ b/scad/main.scad @@ -267,7 +267,7 @@ module y_axis_assembly(show_bed) { translate([0, cable_clamp_y, carriage_top]) rotate([180, 0, 0]) - color([1,0,0]) render() ribbon_clamp(bed_ways, cap_screw); + color(ribbon_clamp_color) render() ribbon_clamp(bed_ways, cap_screw); translate([0, cable_clamp_y, carriage_bottom]) rotate([180, 0, 0]) @@ -608,7 +608,7 @@ module bed_fan_assembly() { fan_assembly(case_fan, sheet_thickness(frame) + fan_guard_thickness()); translate([0, 0, sheet_thickness(frame) / 2]) - color([0,1,0]) render() fan_guard(case_fan); + color(fan_guard_color) render() fan_guard(case_fan); } end("bed_fan_assembly"); } diff --git a/scad/pcb_spacer.scad b/scad/pcb_spacer.scad index e01476c..9c9bd3f 100644 --- a/scad/pcb_spacer.scad +++ b/scad/pcb_spacer.scad @@ -25,7 +25,7 @@ module pcb_spacer_stl(screw = M3_cap_screw, h = pcb_spacer_height()) { } module pcb_spacer_assembly() { - color([0,1,0]) render() pcb_spacer_stl(); + color(pcb_spacer_color) render() pcb_spacer_stl(); translate([0,0, pcb_spacer_height() + pcb_thickness]) screw_and_washer(M3_cap_screw, pcb_screw_length, !frame_nuts); diff --git a/scad/prusa-z-motor-bracket.scad b/scad/prusa-z-motor-bracket.scad index 1c519f9..cac5091 100644 --- a/scad/prusa-z-motor-bracket.scad +++ b/scad/prusa-z-motor-bracket.scad @@ -103,7 +103,7 @@ module z_motor_bracket_stl() { module z_motor_assembly() { assembly("z-motor-assembly"); - color([0,1,0]) render() z_motor_bracket_stl(); + color(z_motor_bracket_color) render() z_motor_bracket_stl(); // // Clamp screw and washer // diff --git a/scad/pulley.scad b/scad/pulley.scad index 6d27d37..6ebf90c 100644 --- a/scad/pulley.scad +++ b/scad/pulley.scad @@ -9,13 +9,13 @@ include module pulley_stl() { stl("pulley"); - color([1,0,0]) + color(pulley_color) translate([-10, -10, 0]) import("../imported_stls/pulley.stl"); } module pulley_assembly() { - color([1,0,0]) render() pulley_stl(); + color(pulley_color) render() pulley_stl(); rotate([90, 0, 0]) { translate([0, 4, -5/2 - 6]) screw(M3_grub_screw, 6); diff --git a/scad/ribbon_clamp.scad b/scad/ribbon_clamp.scad index 8c741c3..b6a05d5 100644 --- a/scad/ribbon_clamp.scad +++ b/scad/ribbon_clamp.scad @@ -51,7 +51,7 @@ module ribbon_clamp(ways, screw_type) { } module ribbon_clamp_assembly(ways, screw_type, screw_length, panel_thickness = 0, vertical = false, washer = false) { - color([1,0,0]) + color(ribbon_clamp_color) render() rotate([180, 0, 0]) ribbon_clamp(ways, screw_type); diff --git a/scad/stl.scad b/scad/stl.scad new file mode 100644 index 0000000..d2055b0 --- /dev/null +++ b/scad/stl.scad @@ -0,0 +1,2 @@ +use +z_screw_pointer_stl(); diff --git a/scad/vitamins/ball-bearings.scad b/scad/vitamins/ball-bearings.scad index d9e0eb2..43fc401 100644 --- a/scad/vitamins/ball-bearings.scad +++ b/scad/vitamins/ball-bearings.scad @@ -17,7 +17,7 @@ module ball_bearing(type) { vitamin(str("BB",type[3],": Ball bearing ",type[3]," ",type[0], " x ", type[1], " x ", type[2])); rim = type[1] / 10; - color([0.7,0.7,0.7]) render() difference() { + color(bearing_color) render() difference() { cylinder(r = type[1] / 2, h = type[2], center = true); cylinder(r = type[0] / 2, h = type[2] + 1, center = true); for(z = [-type[2] / 2, type[2] / 2]) diff --git a/scad/vitamins/cable_strip.scad b/scad/vitamins/cable_strip.scad index a764934..d922914 100644 --- a/scad/vitamins/cable_strip.scad +++ b/scad/vitamins/cable_strip.scad @@ -23,7 +23,7 @@ module cable_strip(width, depth, travel, x, extra = 15) { vitamin(str("PP", thickness * 10, w, total,": Polypropylene strip ", total, "mm x ", w, "mm x ", thickness, "mm")); - color([1,0,1]) render() linear_extrude(height = w, center = true, convexity = 4) + color(cable_strip_color) render() linear_extrude(height = w, center = true, convexity = 4) difference() { union() { translate([-bottom, radius]) @@ -79,7 +79,7 @@ module elliptical_cable_strip(width, p1, p2, pmax, extra = 15) { [delta[2] / delta[0], 0, 1, delta[2] / 2], [0, 0, 0, 1] ]) - color([1,0,1]) render() linear_extrude(height = w, center = true, convexity = 4) + color(cable_strip_color) render() linear_extrude(height = w, center = true, convexity = 4) difference() { union() { square([(a + thickness) * 2, extra * 2], center = true); diff --git a/scad/vitamins/d-connectors.scad b/scad/vitamins/d-connectors.scad index 1c07a98..5a4ddc3 100644 --- a/scad/vitamins/d-connectors.scad +++ b/scad/vitamins/d-connectors.scad @@ -21,7 +21,7 @@ module d_pillar(type) { height = 4.5; screw = 2.5; screw_length = 8; - color([0.9,0.9,0.9]) render() translate([0,0, d_flange_thickness(type)]) difference() { + color(d_pillar_color) render() translate([0,0, d_flange_thickness(type)]) difference() { union() { cylinder(r = rad, h = height, $fn = 6); translate([0,0, - screw_length + eta]) @@ -73,7 +73,7 @@ module d_plug(type, socket = false) { // // Shell // - color([0.8, 0.8, 0.8]) render() difference() { + color(d_plug_shell_color) render() difference() { union() { rounded_rectangle([flange_length, flange_width, d_flange_thickness(type)], 2, center = false); linear_extrude(height = d_height, convexity = 5) @@ -93,7 +93,7 @@ module d_plug(type, socket = false) { // // Insulator // - color([0.2,0.2,0.2]) render() { + color(d_plug_insulator_color) render() { translate([0,0, d_flange_thickness(type) + eta]) rotate([0, 180, 0]) linear_extrude(height = back_height + 1 + d_flange_thickness(type), convexity = 5) diff --git a/scad/vitamins/electronics.scad b/scad/vitamins/electronics.scad index 4b857da..0dd1f6a 100644 --- a/scad/vitamins/electronics.scad +++ b/scad/vitamins/electronics.scad @@ -13,6 +13,8 @@ function sanguinololu_length() = 4 * 25.4; module sanguinololu() { vitamin("SANGUINOL: Electronics e.g. Sanguinolou"); + + color(sanguinololu_color) import("../imported_stls/sanguinololu.stl"); } @@ -38,7 +40,7 @@ function psu_hole_list(type) = type[4]; module psu(type) { vitamin(str(psu_name(type),": PSU e.g. ", psu_name(type))); - color([0.8, 0.8, 0.8]) + color(psu_color) translate([0,0, psu_height(type) / 2]) cube([psu_length(type), psu_width(type), psu_height(type)], center = true); diff --git a/scad/vitamins/fans.scad b/scad/vitamins/fans.scad index 0aecfdd..9b9fad0 100644 --- a/scad/vitamins/fans.scad +++ b/scad/vitamins/fans.scad @@ -78,7 +78,7 @@ module fan_holes(type, poly = false) { } module fan_assembly(type, thickness) { - color([0.2, 0.2, 0.2]) + color(fan_color) render() fan(type); diff --git a/scad/vitamins/linear-bearings.scad b/scad/vitamins/linear-bearings.scad index 743ac4d..7fdab63 100644 --- a/scad/vitamins/linear-bearings.scad +++ b/scad/vitamins/linear-bearings.scad @@ -14,7 +14,7 @@ LM4UU = [12, 8, 4]; module linear_bearing(type) { vitamin(str("LM",type[2],"UU: ","LM",type[2],"UU linear bearing")); - color([0.7,0.7,0.7]) rotate([0,90,0]) difference() { + color(bearing_color) rotate([0,90,0]) difference() { cylinder(r = type[1] / 2, h = type[0], center = true); cylinder(r = type[2] / 2, h = type[0] + 1, center = true); } diff --git a/scad/vitamins/microswitch.scad b/scad/vitamins/microswitch.scad index 880f145..d3cfbe9 100644 --- a/scad/vitamins/microswitch.scad +++ b/scad/vitamins/microswitch.scad @@ -39,7 +39,7 @@ module microswitch_contact_space() { module microswitch() { vitamin("SMMICRO: Microswitch"); translate([-(5.1 + 9.5 - 7.5), -(8.4 + 2.5), -3.2 + (exploded ? 5 : 0)]) { // put operating point of button at the origin - color([0,0,0]) render() difference() { // main body + color(microswitch_color) render() difference() { // main body cube([19.8, 10.2, 6.4]); translate([10, 9.5, -1]) cube([19.8, 10.2, 8]); // lower half of top @@ -48,7 +48,7 @@ module microswitch() { translate([5.1 + 9.5, 2.5, -1]) cylinder(r = 2.35 / 2, h = 8); } - color([1,0.7,0]) render() // orange button + color(microswitch_button_color) render() // orange button translate([5.1 + 9.5 - 7.5,8.4 + 2.5 - 0.5,1.6]) linear_extrude(height = 3.2) hull() { @@ -56,7 +56,7 @@ module microswitch() { translate([0,-4]) circle(r = 1); } - color([1,1,0]) render() // yellow contacts + color(microswitch_contact_color) render() // yellow contacts for(x = [1.6, 1.6 + 8.8, 1.6 + 8.8 + 7.3]) translate([x, 2.5 - 6.4, 1.6]) difference() { diff --git a/scad/vitamins/nuts.scad b/scad/vitamins/nuts.scad index 1f656f0..7baf058 100644 --- a/scad/vitamins/nuts.scad +++ b/scad/vitamins/nuts.scad @@ -32,7 +32,7 @@ module nut(type, nyloc = false) { if(exploded && nyloc) cylinder(r = 0.2, h = 10); - color([0.7, 0.7, 0.7]) render() translate([0, 0, (exploded && nyloc) ? 10 : 0]) difference() { + color(nut_color) render() translate([0, 0, (exploded && nyloc) ? 10 : 0]) difference() { union() { cylinder(r = outer_rad, h = thickness, $fn = 6); if(nyloc) @@ -71,7 +71,7 @@ module wingnut(type) { if(exploded) cylinder(r = 0.2, h = 10); - color([0.7,0.7,0.7]) render() translate([0, 0, exploded ? 10 : 0]) difference() { + color(nut_color) render() translate([0, 0, exploded ? 10 : 0]) difference() { union() { cylinder(r1 = bottom_rad, r2 = top_rad, h = thickness); for(rot = [0, 180]) diff --git a/scad/vitamins/pillars.scad b/scad/vitamins/pillars.scad index 6007e5d..9ec50ff 100644 --- a/scad/vitamins/pillars.scad +++ b/scad/vitamins/pillars.scad @@ -16,12 +16,12 @@ module pillar(type) { height = pillar_height(type); vitamin(str("pillar M", type[0], "x", height)); - color([0.9,0.9,0.9]) render() difference() { + color(pillar_color) render() difference() { cylinder(h = height, r = type[2] / 2); translate([0,0, height]) cylinder(h = type[3] * 2, r = type[0] / 2, center = true); } - color([1,1,0]) render() cylinder(h = type[3] * 2, r = type[0] / 2, center = true); + color(pillar_liner_color) render() cylinder(h = type[3] * 2, r = type[0] / 2, center = true); } @@ -29,7 +29,7 @@ module hex_pillar(type) { height = pillar_height(type); vitamin(str("HP0", type[0], height, " : Hex pillar M", type[0], " x ", height)); - color([0.9,0.9,0.9]) render() difference() { + color(pillar_color) render() difference() { union() { cylinder(h = height, r = type[2] / 2, $fn = 6); cylinder(h = type[3] * 2, r = type[0] / 2, center = true); diff --git a/scad/vitamins/screws.scad b/scad/vitamins/screws.scad index 07011b8..8897c6e 100644 --- a/scad/vitamins/screws.scad +++ b/scad/vitamins/screws.scad @@ -66,7 +66,7 @@ module screw(type, length) { assign(head_height = rad * 2, socket_rad = type[5] / cos(30) / 2, socket_depth = 2 * rad / 3) - color([0.2,0.2,0.2]) render() difference() { + color(screw_cap_color) render() difference() { union() { cylinder(r = head_rad, h = head_height); translate([0,0, - length + eta]) @@ -79,14 +79,14 @@ module screw(type, length) { if(head_type == hs_grub) { assign(socket_rad = type[4] / 2, socket_depth = type[5]) - color([0.2,0.2,0.2]) render() difference() { + color(screw_grub_color) render() difference() { cylinder(r = rad, h = length); cylinder(r = socket_rad, h = socket_depth * 2, $fn = 6, center = true); } } if(head_type == hs_hex) { assign(head_height =type[5]) - color([0.8,0.8,0.8]) render() union() { + color(screw_hex_color) render() union() { cylinder(r = head_rad, h = head_height, $fn = 6); translate([0,0, - length + eta]) cylinder(r = rad, h = length); @@ -96,7 +96,7 @@ module screw(type, length) { assign(head_height = type[5], socket_rad = 0.6 * head_rad, socket_depth = 0.5 * type[5]) - color([0.8,0.8,0.4]) render() difference() { + color(screw_pan_color) render() difference() { union() { rounded_cylinder(r = head_rad, h = head_height, r2 = head_height / 2); translate([0,0, - length + eta]) @@ -113,7 +113,7 @@ module screw(type, length) { socket_rad = 0.6 * head_rad, socket_depth = 0.3 * head_rad, socket_width = 1) - color([0.8,0.8,0.4]) render() difference() { + color(screw_cs_color) render() difference() { union() { translate([0,0, -head_height]) cylinder(h = head_height, r1 = 0, r2 = head_rad); diff --git a/scad/vitamins/sheet.scad b/scad/vitamins/sheet.scad index 4c780d2..fda19c6 100644 --- a/scad/vitamins/sheet.scad +++ b/scad/vitamins/sheet.scad @@ -7,14 +7,22 @@ // // Flat sheets // -MDF6 = [ "MD", "MDF sheet", 6, [0.4, 0.4, 0.2, 1 ], true]; -MDF10 = [ "MD", "MDF sheet", 10, [0.4, 0.4, 0.2, 1 ], true]; -MDF12 = [ "MD", "MDF sheet", 12, [0.4, 0.4, 0.2, 1 ], true]; -PMMA6 = [ "AC", "Acrylic sheet", 6, [1, 1, 1, 0.5 ], false]; -PMMA8 = [ "AC", "Acrylic sheet", 8, [1, 1, 1, 0.2 ], false]; -PMMA10 = [ "AC", "Acrylic sheet",10, [1, 1, 1, 0.2 ], false]; -glass = [ "GL", "Glass sheet", 2, [1, 1, 1, 0.25 ], false]; -DiBond = [ "DB", "Dibond sheet", 3, [0.5, 0.5, 0.5, 1 ], false]; + +// 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] + +// [ 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" +glass = [ "GL", "Glass sheet", glass_thickness, glass_clear, false]; +DiBond = [ "DB", "Dibond sheet", 3, dibond_grey, false]; function sheet_thickness(type) = type[2]; function sheet_is_soft(type) = type[4]; diff --git a/scad/vitamins/springs.scad b/scad/vitamins/springs.scad index 6b8c719..f33adfd 100644 --- a/scad/vitamins/springs.scad +++ b/scad/vitamins/springs.scad @@ -54,7 +54,7 @@ module comp_spring(spring, l = 0) { vitamin(str("SPR", spring[0], spring[1] * 100, spring[2], ": Spring ", spring[0], " x ", spring[1], " x ", spring[2] )); - color([0.2, 0.2, 0.2]) render() coil(r1 = (spring[0] - spring[1])/ 2, r2 = spring[1] / 2, h = l, twists = spring[3]); + color(spring_color) render() coil(r1 = (spring[0] - spring[1])/ 2, r2 = spring[1] / 2, h = l, twists = spring[3]); } diff --git a/scad/vitamins/stepper-motors.scad b/scad/vitamins/stepper-motors.scad index b73f2fd..20a0bb4 100644 --- a/scad/vitamins/stepper-motors.scad +++ b/scad/vitamins/stepper-motors.scad @@ -31,13 +31,13 @@ module NEMA(motor) { cap = 8; vitamin(str("NEMA", round(motor[0] / 2.54), length * 10, ": NEMA", round(motor[0] / 2.54), " x ", length, " stepper motor")); union() { - color([0,0,0]) render() // black laminations + color(stepper_body_color) render() // black laminations translate([0,0, -length / 2]) intersection() { cube([side, side, length - cap * 2],center = true); cylinder(r = body_rad, h = 2 * length, center = true); } - color([0.5,0.5,0.5]) render() { // aluminium end caps + color(stepper_cap_color) render() { // aluminium end caps difference() { union() { intersection() { diff --git a/scad/vitamins/washers.scad b/scad/vitamins/washers.scad index b5d9853..d381c4b 100644 --- a/scad/vitamins/washers.scad +++ b/scad/vitamins/washers.scad @@ -20,13 +20,14 @@ M3_rubber_washer= [3, 10, 1.5, true]; function washer_diameter(type) = type[1]; function washer_thickness(type) = type[2]; function washer_soft(type) = type[3]; +function washer_color(type) = washer_soft(type) ? soft_washer_color : hard_washer_color; module washer(type) { if(washer_soft(type)) vitamin(str("WR", type[0] * 10, type[1], type[2] * 10, ": Rubber washer M",type[0], " x ", type[1], " x ", type[2])); else vitamin(str("WA", type[0] * 10, type[1], type[2] * 10, ": Washer M",type[0], " x ", type[1], " x ", type[2])); - color(washer_soft(type) ? [0.2,0.2,0.2] : [0.8,0.8,0.8]) render() difference() { + color(washer_color(type)) render() difference() { cylinder(r = washer_diameter(type) / 2, h = washer_thickness(type)); cylinder(r = type[0] / 2, h = 2 * washer_thickness(type) + 1, center = true); } @@ -38,7 +39,7 @@ module star_washer(type) { inner = (hole + rad) / 2; spoke = rad - hole; vitamin(str("WS", type[0] * 10, type[1], type[2] * 10, ": Star washer M",type[0], " x ", type[1], " x ", type[2])); - color([0.8,0.8,0.4]) render() difference() { + color(star_washer_color) render() difference() { cylinder(r = rad, h = washer_thickness(type)); cylinder(r = hole, h = 2 * washer_thickness(type) + 1, center = true); for(a = [0:30:360]) diff --git a/scad/vitamins/ziptie.scad b/scad/vitamins/ziptie.scad index 4182f12..4174a8b 100644 --- a/scad/vitamins/ziptie.scad +++ b/scad/vitamins/ziptie.scad @@ -7,7 +7,9 @@ // // Zipties // -small_ziptie = [2.3, 1, [4.7, 4.25, 3], [1,1,1], 20]; + +// [width, thickness, [latch_x, latch_y, latch_z], color, length] +small_ziptie = [2.3, 1, [4.7, 4.25, 3], small_ziptie_color, 20]; function ziptie_width(type) = type[0]; function ziptie_thickness(type) = type[1]; diff --git a/scad/wade.scad b/scad/wade.scad index b4b270d..0d4bc5b 100644 --- a/scad/wade.scad +++ b/scad/wade.scad @@ -181,12 +181,12 @@ function extruder_connector_height() = motor_y - d_motor_bracket_offset(NEMA17); module wades_big_gear_stl() { stl("wades_big_gear"); - color([0,1,0]) import("../imported_stls/39t17p.stl"); + color(wades_big_gear_color) import("../imported_stls/39t17p.stl"); } module wades_small_gear_stl() { stl("wades_small_gear"); - color([1,0,0]) + color(wades_small_gear_color) translate([-10, -10, 0]) import("../imported_stls/wades_gear.stl"); } @@ -238,7 +238,7 @@ module wades_idler_block_stl() { module wade_idler_assembly() { - color([0,1,0]) render() wades_idler_block_stl(); + color(wades_idler_block_color) render() wades_idler_block_stl(); translate([0, 0, idler_height - 2]) rotate([90, 0, 0]) { @@ -307,7 +307,7 @@ module wades_assembly() { ball_bearing(BB608); rotate([180, 0, 0]) - color([1,0,0]) render() wades_gear_spacer_stl(); + color(wades_gear_spacer_color) render() wades_gear_spacer_stl(); translate([0, 0, -7.5]) rotate([180, 0, 0]) @@ -330,9 +330,9 @@ module wades_assembly() { translate([75, 5 - nozzle_length / 4, 15]) rotate([-90, 0, 0]) { - color([0.6, 0.5, 0.2]) cylinder(h = nozzle_length / 2 + 10, r = insulator_diameter(hot_end) / 2, center = true); + color(filament_viz_color) cylinder(h = nozzle_length / 2 + 10, r = insulator_diameter(hot_end) / 2, center = true); translate([0, 0, -nozzle_length /2 - 5]) - color([1, 1, 0]) cylinder(h = nozzle_length / 2, r = 3, center = true); + color(extruder_nozzle_color) cylinder(h = nozzle_length / 2, r = 3, center = true); } for(side = [-1, 1]) diff --git a/scad/x-carriage.scad b/scad/x-carriage.scad index 1c0f0b6..64f055f 100644 --- a/scad/x-carriage.scad +++ b/scad/x-carriage.scad @@ -376,7 +376,7 @@ module x_carriage_stl(){ module x_carriage_assembly(show_extruder = false) { assembly("x_carriage_assembly"); - color([1,0,0]) render() x_carriage_stl(); + color(x_carriage_color) render() x_carriage_stl(); if(show_extruder) translate([75, 15, eta]) @@ -404,7 +404,7 @@ module x_carriage_assembly(show_extruder = false) { // translate([length / 2 + base_offset, -width / 2, x_carriage_offset() - ball_bearing_diameter(X_idler_bearing) / 2]) { mirror([1,0,0]) - color([0,1,0]) render() x_belt_clamp_stl(); + color(x_belt_clamp_color) render() x_belt_clamp_stl(); translate([-lug_width / 2, lug_screw, clamp_thickness]) nut(M3_nut, true); } @@ -420,7 +420,7 @@ module x_carriage_assembly(show_extruder = false) { nut(M3_nut, true); translate([-length / 2 + base_offset, -width / 2, -(clamp_thickness + belt_thickness(X_belt))]) { - color([0,1,0]) render() x_belt_grip_stl(); + color(x_belt_clamp_color) render() x_belt_grip_stl(); translate([lug_width / 2, lug_screw, 0]) rotate([180, 0, 0]) screw_and_washer(M3_cap_screw, 25); @@ -432,7 +432,7 @@ module x_carriage_assembly(show_extruder = false) { translate([25 + wall, belt_tensioner_height / 2, 0]) rotate([90, 180, 0]) - color([0,1,0]) render() x_belt_tensioner_stl(); + color(x_belt_clamp_color) render() x_belt_tensioner_stl(); translate([25 + wall, 0, 0]) rotate([90, 180, 0]) diff --git a/scad/x-end.scad b/scad/x-end.scad index 00019d8..a71a3cf 100644 --- a/scad/x-end.scad +++ b/scad/x-end.scad @@ -460,7 +460,7 @@ module x_end_assembly(motor_end) { // // RP bit // - color([0,1,0]) render() x_end_bracket(motor_end, true); + color(x_end_bracket_color) render() x_end_bracket(motor_end, true); // // bearings // diff --git a/scad/y-bearing-mount.scad b/scad/y-bearing-mount.scad index 0243c6d..0196fe6 100644 --- a/scad/y-bearing-mount.scad +++ b/scad/y-bearing-mount.scad @@ -44,7 +44,7 @@ module bearing_mount(bearing, height, endstop) { endstop_h = height - bar_clamp_switch_z_offset() + microswitch_thickness() / 4; stl(str("y_bearing_mount", endstop ? "_switch" : "")); - color([1,0,0]) union() { + color(y_bearing_mount_color) union() { bearing_holder(bearing, height); for(end = [-1, 1]) translate([end * (bearing_holder_width(bearing) / 2 - eta), -end * (bearing_holder_length(bearing) - bearing_clamp_tab)/2, -height]) @@ -62,13 +62,13 @@ module bearing_mount_holes(height) for(end = [-1, 1]) translate([end * (bearing_holder_width(Y_bearings) / 2 + tab_length / 2), -end * (bearing_holder_length(Y_bearings) - bearing_clamp_tab) / 2, 0]) - cylinder(r = screw_clearance_radius, h = 100, center = true);; + cylinder(r = screw_clearance_radius, h = 100, center = true); module y_bearing_assembly(height, endstop = false) { //assembly("y_bearing_assembly"); - color([1,0,0]) render() bearing_mount(Y_bearings, height, endstop); + color(y_bearing_mount_color) render() bearing_mount(Y_bearings, height, endstop); rotate([0,0,90]) { linear_bearing(Y_bearings); diff --git a/scad/y-belt-anchor.scad b/scad/y-belt-anchor.scad index 5c97472..a76735d 100644 --- a/scad/y-belt-anchor.scad +++ b/scad/y-belt-anchor.scad @@ -40,7 +40,7 @@ module y_belt_anchor(height, toothed) { recess = length - depth; stl(str("y_belt_anchor", toothed ? "_toothed" : "")); - color([0,1,0]) union() { + color(y_belt_anchor_color) union() { difference() { union() { translate([0, depth / 2, h / 2]) // tall bit @@ -86,7 +86,7 @@ module y_belt_anchor(height, toothed) { module y_belt_clip(toothed) { stl(str("y_belt_clip", toothed ? "_toothed" : "")); - color([1, 0, 0]) union() { + color(y_belt_clip_color) union() { translate([0, 0, clamp_thickness / 2]) difference() { rounded_rectangle([width, depth, clamp_thickness], r = rad); @@ -104,11 +104,11 @@ module y_belt_clip(toothed) { module y_belt_anchor_assembly(height, toothed) { //assembly("y_belt_anchor_assembly"); - color([0, 1, 0]) render() y_belt_anchor(height, toothed); + color(y_belt_anchor_color) render() y_belt_anchor(height, toothed); translate([0, depth / 2, height + belt_thickness(Y_belt) + clamp_thickness]) { rotate([180, 0, 0]) - color([1, 0, 0]) render() y_belt_clip(!toothed); + color(y_belt_clip_color) render() y_belt_clip(!toothed); // // Clamp screws // diff --git a/scad/y-idler-bracket.scad b/scad/y-idler-bracket.scad index d16a628..5f12e1a 100644 --- a/scad/y-idler-bracket.scad +++ b/scad/y-idler-bracket.scad @@ -31,7 +31,7 @@ height = axel_height + dia / 2; module y_idler_bracket_stl() { stl("y_idler_bracket"); - color([0,1,0]) intersection() { + color(y_idler_bracket_color) intersection() { difference() { rotate([90, 0, 90]) linear_extrude(height = width, center = true) //side profile @@ -79,7 +79,7 @@ module y_idler_screw_hole() module y_idler_assembly() { assembly("y_idler_assembly"); - color([0,1,0]) render() y_idler_bracket_stl(); + color(y_idler_bracket_color) render() y_idler_bracket_stl(); translate([0, 0, axel_height]) rotate([0, -90, 0]) { diff --git a/scad/y-motor-bracket.scad b/scad/y-motor-bracket.scad index f8766a1..303ef4e 100644 --- a/scad/y-motor-bracket.scad +++ b/scad/y-motor-bracket.scad @@ -27,7 +27,7 @@ module y_motor_bracket() { width = y_motor_bracket_width(); stl("y_motor_bracket"); - color([0,1,0]) { + color(y_motor_bracket_color) { difference() { translate([0, 0, thickness - depth / 2]) // main body cube([width, height, depth], center = true); @@ -75,7 +75,7 @@ module y_motor_bracket_holes() module y_motor_assembly() { assembly("y_motor_assembly"); - color([0,1,0]) render() y_motor_bracket(); + color(y_motor_bracket_color) render() y_motor_bracket(); // // Mounting screws and washers // diff --git a/scad/z-coupling.scad b/scad/z-coupling.scad index 47d39b8..681b0e5 100644 --- a/scad/z-coupling.scad +++ b/scad/z-coupling.scad @@ -35,7 +35,7 @@ rad = M3_nut_radius + wall; module z_coupling_stl(){ stl("z_coupling"); - color([1,0,0]) translate([0, 0, depth / 2]) union() { + color(z_coupling_color) translate([0, 0, depth / 2]) union() { difference(){ linear_extrude(height = depth, center = true) hull() { @@ -89,7 +89,7 @@ module z_coupler_assembly() { explode([10 * side, 0, 0]) translate([centre_line * side, 0, 0]) rotate([0, 90, 90 * side + 90]) { - color([1,0,0]) render() translate([0, 0, -depth/2]) z_coupling_stl(); + color(z_coupling_color) render() translate([0, 0, -depth/2]) z_coupling_stl(); for(pos = [[holeX, -holeY1], [-holeX, -holeY2]]) translate([pos[0], pos[1], -depth/2]) rotate([180, 0, 0]) diff --git a/scad/z-limit-switch-bracket.scad b/scad/z-limit-switch-bracket.scad index 6ea8e23..bb0a969 100644 --- a/scad/z-limit-switch-bracket.scad +++ b/scad/z-limit-switch-bracket.scad @@ -129,7 +129,7 @@ module z_limit_switch_assembly() { translate([0, 0, pos]) { rotate([90, 0, 0]) - color([0, 1, 0]) render() + color(z_limit_switch_bracket_color) render() z_limit_switch_bracket_stl(); translate([screw_x - screw_head_height(M3_hex_screw), -screw_y, screw_z]) diff --git a/scad/z-motor-bracket.scad b/scad/z-motor-bracket.scad index 0d5e778..e32409d 100644 --- a/scad/z-motor-bracket.scad +++ b/scad/z-motor-bracket.scad @@ -36,7 +36,7 @@ module z_motor_bracket(y_offset, rhs) { cutout = y_offset - length / 2 - back_thickness; stl(rhs? "z_motor_bracket_rhs" : "z_motor_bracket_lhs"); - color([0,1,0]) { + color(z_motor_bracket_color) { difference() { union() { // @@ -132,7 +132,7 @@ module z_motor_bracket_holes(gantry_setback) module z_motor_assembly(gantry_setback, rhs, standalone = false) { assembly("z_motor_assembly"); - color([0,1,0]) render() z_motor_bracket(gantry_setback, rhs); + color(z_motor_bracket_color) render() z_motor_bracket(gantry_setback, rhs); // // Clamp screw and washer //