diff --git a/608zz_bearing.scad b/608zz_bearing.scad index 8056a49..c16f075 100644 --- a/608zz_bearing.scad +++ b/608zz_bearing.scad @@ -19,6 +19,7 @@ // along with this program. If not, see . include ; +include ; module 608zz_bearing(details=false){ BillOfMaterials("608zz bearing"); @@ -31,7 +32,7 @@ module 608zz_bearing(details=false){ } module 608zz_bearing_simple(){ - color("silver"){ + material("metal"){ linear_extrude(height=7) difference(){ circle(r=22/2, $fn=40); @@ -41,7 +42,7 @@ module 608zz_bearing_simple(){ } module 608zz_bearing_detailed(){ - color("silver"){ + material("metal"){ //inner disc linear_extrude(height=7) difference(){ diff --git a/Metamaquina2.h b/Metamaquina2.h index f43b02a..dccc3a0 100644 --- a/Metamaquina2.h +++ b/Metamaquina2.h @@ -18,7 +18,6 @@ use ; include ; -include ; /*Thickness of acrylic or plywood sheets to use.*/ thickness = 6; //millimiters diff --git a/Metamaquina2.scad b/Metamaquina2.scad index 119173f..38e8fca 100644 --- a/Metamaquina2.scad +++ b/Metamaquina2.scad @@ -22,7 +22,6 @@ include ; extruder_wiring_radius = 6; //utils -include ; use ; use ; use ; @@ -2114,7 +2113,6 @@ module XEndIdler(){ } module BuildPlatform_pcb(){ - material("pcb") translate([0,0,pcb_height]) heated_bed(); } diff --git a/NEMA.scad b/NEMA.scad index 692c492..f66b83b 100644 --- a/NEMA.scad +++ b/NEMA.scad @@ -22,47 +22,44 @@ include ; include ; include ; use ; +include ; module NEMA17(){ BillOfMaterials("NEMA17 stepper motor"); - if (render_rubber){ - color(rubber_color){ - translate([-NEMA17_width/2, -NEMA17_height/2, -0.1]) - intersection(){ - cube([NEMA17_width, NEMA17_height, NEMA17_length]); - translate ([NEMA17_width/2, NEMA17_height/2]) cylinder(r=0.87*NEMA17_width*sqrt(2)/2, h=100); - } + material("rubber"){ + translate([-NEMA17_width/2, -NEMA17_height/2, -0.1]) + intersection(){ + cube([NEMA17_width, NEMA17_height, NEMA17_length]); + translate ([NEMA17_width/2, NEMA17_height/2]) cylinder(r=0.87*NEMA17_width*sqrt(2)/2, h=100); } } - if (render_metal){ - color(metal_color){ - translate([0, 0, -motor_shaft_length]) - cylinder(r=motor_shaft_diameter/2, h=motor_shaft_length); - - translate([0,0,-3]) - cylinder(r1=6, r2=8, h=2); + material("metal"){ + translate([0, 0, -motor_shaft_length]) + cylinder(r=motor_shaft_diameter/2, h=motor_shaft_length); - translate([0,0,-0.2]){ - difference(){ - linear_extrude(height=NEMA17_length/5) - rounded_square([NEMA17_width+2, NEMA17_height+2], center=true, corners= [5,5,5,5]); + translate([0,0,-3]) + cylinder(r1=6, r2=8, h=2); - translate([0,0,-0.2]) - linear_extrude(height=1) - NEMA17_holes(central_hole=false); - } + translate([0,0,-0.2]){ + difference(){ + linear_extrude(height=NEMA17_length/5) + rounded_square([NEMA17_width+2, NEMA17_height+2], center=true, corners= [5,5,5,5]); - //connector detail - translate([-15.6/2,NEMA17_width/2 + 1, NEMA17_length - 4]) - cube([15.6, 4.6, 4]); + translate([0,0,-0.2]) + linear_extrude(height=1) + NEMA17_holes(central_hole=false); } - translate([0,0,NEMA17_length - NEMA17_length/5]) - linear_extrude(height=NEMA17_length/5) - rounded_square([NEMA17_width+2, NEMA17_height+2], center=true, corners=[5,5,5,5]); + //connector detail + translate([-15.6/2,NEMA17_width/2 + 1, NEMA17_length - 4]) + cube([15.6, 4.6, 4]); } + + translate([0,0,NEMA17_length - NEMA17_length/5]) + linear_extrude(height=NEMA17_length/5) + rounded_square([NEMA17_width+2, NEMA17_height+2], center=true, corners=[5,5,5,5]); } translate([0,0, NEMA17_length - 12.5]) @@ -73,14 +70,14 @@ module connector(){ //This is very hacky and someone should clean it up translate([-15/2,NEMA17_width/2 + 1, 4]){ - color("white") + material("nylon") difference(){ cube([15, 6, 4]); translate([1,1,0.5]) cube([13, 6, 3]); translate([3.5,4,-1]) cube([8, 10, 3]); } - color("grey") + material("metal") for (i=[0:3]){ translate([4+i*2.3,6, 2]) rotate([90,0]) diff --git a/PowerSupply.scad b/PowerSupply.scad index d15ea38..b72710f 100644 --- a/PowerSupply.scad +++ b/PowerSupply.scad @@ -22,7 +22,6 @@ include ; include ; include ; include ; -include ; include ; include ; @@ -68,11 +67,8 @@ module oldHiquaPowerSupply(){ BillOfMaterials("Power Supply cable"); } - if (render_metal){ - color(metal_color){ - cube([PowerSupply_thickness, PowerSupply_width, PowerSupply_height]); - } - } + material("metal") + cube([PowerSupply_thickness, PowerSupply_width, PowerSupply_height]); } metal_sheet_thickness = 1; @@ -99,35 +95,31 @@ module HiquaPowerSupply(){ BillOfMaterials("Power Supply cable"); } - if (render_metal){ - color(metal_color){ - cube([PowerSupply_width, PowerSupply_height, metal_sheet_thickness]); + material("metal"){ + cube([PowerSupply_width, PowerSupply_height, metal_sheet_thickness]); - translate([PowerSupply_width - metal_sheet_thickness, 0]) - cube([metal_sheet_thickness, PowerSupply_height, PowerSupply_thickness]); + translate([PowerSupply_width - metal_sheet_thickness, 0]) + cube([metal_sheet_thickness, PowerSupply_height, PowerSupply_thickness]); - translate([0,bottom_offset]) - difference(){ - cube([PowerSupply_width, PowerSupply_height - bottom_offset - top_offset, PowerSupply_thickness]); + translate([0,bottom_offset]) + difference(){ + cube([PowerSupply_width, PowerSupply_height - bottom_offset - top_offset, PowerSupply_thickness]); - translate([metal_sheet_thickness, metal_sheet_thickness]) - cube([PowerSupply_width - 2*metal_sheet_thickness, PowerSupply_height - bottom_offset - top_offset - 2*metal_sheet_thickness, PowerSupply_thickness - metal_sheet_thickness]); + translate([metal_sheet_thickness, metal_sheet_thickness]) + cube([PowerSupply_width - 2*metal_sheet_thickness, PowerSupply_height - bottom_offset - top_offset - 2*metal_sheet_thickness, PowerSupply_thickness - metal_sheet_thickness]); - if (detail){ - translate([-23.5, 7, PowerSupply_thickness - 1.5*metal_sheet_thickness]){ - linear_extrude(height=2*metal_sheet_thickness) - circle_pattern(r=4.6/2, spacing_x=6, spacing_y = 5, x=21,y=34); - } + if (detail){ + translate([-23.5, 7, PowerSupply_thickness - 1.5*metal_sheet_thickness]){ + linear_extrude(height=2*metal_sheet_thickness) + circle_pattern(r=4.6/2, spacing_x=6, spacing_y = 5, x=21,y=34); } } } } - if (render_pcb){ - color(pcb_color){ - translate([metal_sheet_thickness, -pcb_bottom_advance, pcb_height]) - cube([PowerSupply_width - 2*metal_sheet_thickness, PowerSupply_height - top_offset, pcb_thickness]); - } + material("pcb"){ + translate([metal_sheet_thickness, -pcb_bottom_advance, pcb_height]) + cube([PowerSupply_width - 2*metal_sheet_thickness, PowerSupply_height - top_offset, pcb_thickness]); } } @@ -257,34 +249,25 @@ module PowerSupplyBox_back_face(){ module PowerSupplyBox_side_sheet(){ BillOfMaterials(category="Lasercut wood", partname="Power Supply Box side sheet"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=thickness) - PowerSupplyBox_side_face(); - } - } + material("lasercut") + linear_extrude(height=thickness) + PowerSupplyBox_side_face(); } module PowerSupplyBox_bottom_sheet(){ BillOfMaterials(category="Lasercut wood", partname="Power Supply Box bottom sheet"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=thickness) - PowerSupplyBox_bottom_face(); - } - } + material("lasercut") + linear_extrude(height=thickness) + PowerSupplyBox_bottom_face(); } module PowerSupplyBox_front_sheet(){ BillOfMaterials(category="Lasercut wood", partname="Power Supply Box front sheet"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=thickness) - PowerSupplyBox_front_face(); - } - } + material("lasercut") + linear_extrude(height=thickness) + PowerSupplyBox_front_face(); ONOFF_Switch(); } @@ -292,12 +275,9 @@ module PowerSupplyBox_front_sheet(){ module PowerSupplyBox_back_sheet(){ BillOfMaterials(category="Lasercut wood", partname="Power Supply Box back sheet"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=thickness) - PowerSupplyBox_back_face(); - } - } + material("lasercut") + linear_extrude(height=thickness) + PowerSupplyBox_back_face(); translate([PowerSupply_thickness-thickness-PSU_Female_border_height/2, (box_height - bottom_offset)/2]) rotate(90) @@ -346,45 +326,43 @@ module PowerSupply_FemaleConnector(){ border_thickness = 6.1; depth = 13.1; - if (render_ABS){ - color(ABS_color){ - difference(){ - union(){ - translate([0,0,-depth]) - linear_extrude(height=depth) - PowerSupply_FemaleConnector_large_hole(); + material("ABS"){ + difference(){ + union(){ + translate([0,0,-depth]) + linear_extrude(height=depth) + PowerSupply_FemaleConnector_large_hole(); + + linear_extrude(height=border_thickness) + translate([-border_width/2,-border_height/2]) + rounded_square([border_width, border_height], corners=[2,2,2,2]); - linear_extrude(height=border_thickness) + linear_extrude(height=3.9) + hull(){ translate([-border_width/2,-border_height/2]) rounded_square([border_width, border_height], corners=[2,2,2,2]); - linear_extrude(height=3.9) - hull(){ - translate([-border_width/2,-border_height/2]) - rounded_square([border_width, border_height], corners=[2,2,2,2]); - - for (i=[-1,1]) - translate([i*power_supply_bolts_distance/2, 0]) - circle(r=6); - } + for (i=[-1,1]) + translate([i*power_supply_bolts_distance/2, 0]) + circle(r=6); } + } - translate([0,0,border_thickness+0.1-depth]) - linear_extrude(height=depth) - power_supply_generic_connector_shape( - width=24.6, - height=16.4, - bevel=4.2, - r1=1, - r2=2); - - for (i=[-1,1]){ - translate([i*power_supply_bolts_distance/2,0,-0.1]) - cylinder(r=m3_diameter/2, h=10); - - translate([i*power_supply_bolts_distance/2,0,2]) - cylinder(r1=m3_diameter/2, r2=m3_diameter, h=3.9 - 2 + 0.1); - } + translate([0,0,border_thickness+0.1-depth]) + linear_extrude(height=depth) + power_supply_generic_connector_shape( + width=24.6, + height=16.4, + bevel=4.2, + r1=1, + r2=2); + + for (i=[-1,1]){ + translate([i*power_supply_bolts_distance/2,0,-0.1]) + cylinder(r=m3_diameter/2, h=10); + + translate([i*power_supply_bolts_distance/2,0,2]) + cylinder(r1=m3_diameter/2, r2=m3_diameter, h=3.9 - 2 + 0.1); } } } diff --git a/RAMBo.scad b/RAMBo.scad index 9fb6033..fcd658e 100644 --- a/RAMBo.scad +++ b/RAMBo.scad @@ -21,6 +21,7 @@ include ; include ; use ; include ; +include ; RAMBo_pcb_thickness = 2; M3_bolt_head = 3; @@ -46,8 +47,7 @@ module PSU_connector(){ bolt_diameter = 3.5; bolts_offset = -2.3; - if (render_rubber) - color(rubber_color) + material("rubber") difference() { cube([conn_thickness, conn_width, conn_height]); @@ -59,7 +59,6 @@ module PSU_connector(){ } } -acrylic_color = [1, 0.5, 0.5, 0.7];//red-transparent module RAMBo_cover_curves(border=0){ difference(){ translate([-border,-border]) @@ -70,12 +69,11 @@ module RAMBo_cover_curves(border=0){ } module RAMBo_cover(){ - BillOfMaterials("Lasercut acrylic RAMBo cover"); - if (render_acrylic){ - color(acrylic_color) - linear_extrude(height=RAMBo_cover_thickness) - RAMBo_cover_curves(); - } + BillOfMaterials("Lasercut acrylic RAMBo cover"); + + material("acrylic") + linear_extrude(height=RAMBo_cover_thickness) + RAMBo_cover_curves(); } module RAMBo(){ @@ -95,8 +93,7 @@ module RAMBo(){ hexspacer_38mm(); translate([0,0,hexspacer_length+RAMBo_cover_thickness]){ //bolt head - if (render_metal) - color(metal_color) + material("metal") cylinder(r=3, h=M3_bolt_head, $fn=20); } } @@ -200,13 +197,11 @@ module RAMBo_holes(){ } module RAMBo_pcb(){ - if (render_pcb){ - color(pcb_color){ - linear_extrude(height=RAMBo_pcb_thickness){ - difference(){ - square([RAMBo_width, RAMBo_height]); - RAMBo_holes(); - } + material("pcb"){ + linear_extrude(height=RAMBo_pcb_thickness){ + difference(){ + square([RAMBo_width, RAMBo_height]); + RAMBo_holes(); } } } diff --git a/ZLink.scad b/ZLink.scad index ef9e890..323213e 100644 --- a/ZLink.scad +++ b/ZLink.scad @@ -24,52 +24,51 @@ include ; include ; include ; +include ; module ZLink(clearance = 0.2, hull_size=0){ BillOfMaterials(category="3D Printed", partname="ZLink"); - if (render_ABS){ - color(ABS_color){ - difference(){ - union(){ - linear_extrude(height=2.6){ - difference(){ - hull(){ - for (i=[-1,1]) - translate([i*dx_z_threaded, 0]) - circle(r=6); - } + material("ABS"){ + difference(){ + union(){ + linear_extrude(height=2.6){ + difference(){ + hull(){ for (i=[-1,1]) - translate([i*dx_z_threaded, 0]) - circle(r=m3_diameter/2, $fn=20); + translate([i*dx_z_threaded, 0]) + circle(r=6); } + for (i=[-1,1]) + translate([i*dx_z_threaded, 0]) + circle(r=m3_diameter/2, $fn=20); } - for (i=[-1,1]) - translate([i*dx_z_threaded, 0, 2.6]) cylinder(r=5, h=2, $fn=6); } - for (i=[-1,1]) - translate([i*dx_z_threaded, 0, 2]) cylinder(r=3, h=5, $fn=6); + translate([i*dx_z_threaded, 0, 2.6]) cylinder(r=5, h=2, $fn=6); } - translate([0,Zlink_hole_height, ZLink_rod_height]) - rotate([90, 0, 0]){ - linear_extrude(height=XPlatform_height - thickness) - difference(){ - circle($fn=6, r=11); - circle($fn=6, r=8); - } + for (i=[-1,1]) + translate([i*dx_z_threaded, 0, 2]) cylinder(r=3, h=5, $fn=6); + } - translate([0,0,7]){ - linear_extrude(height=4) - difference(){ - circle($fn=6, r=10); - hull(){ - for (i=[-1,1]) - translate([0,i*hull_size/2]) - circle($fn=20, r=(8+clearance)/2); - } - } + translate([0,Zlink_hole_height, ZLink_rod_height]) + rotate([90, 0, 0]){ + linear_extrude(height=XPlatform_height - thickness) + difference(){ + circle($fn=6, r=11); + circle($fn=6, r=8); + } + + translate([0,0,7]){ + linear_extrude(height=4) + difference(){ + circle($fn=6, r=10); + hull(){ + for (i=[-1,1]) + translate([0,i*hull_size/2]) + circle($fn=20, r=(8+clearance)/2); + } } } } diff --git a/bar-clamp.scad b/bar-clamp.scad index c9921fe..f069cf9 100644 --- a/bar-clamp.scad +++ b/bar-clamp.scad @@ -29,38 +29,35 @@ include include ; include -include module barclamp(){ BillOfMaterials(category="3D Printed", partname="Bar Clamp"); outer_diameter = threaded_rod_diameter/2 + 2.4; - if (render_ABS){ - color(ABS_color){ - difference(){ - union(){ - translate([outer_diameter, outer_diameter, 0]) - cylinder(h =outer_diameter*2, r = outer_diameter, $fn = 100); + material("ABS"){ + difference(){ + union(){ + translate([outer_diameter, outer_diameter, 0]) + cylinder(h =outer_diameter*2, r = outer_diameter, $fn = 100); - translate([outer_diameter, 0, 0]) - cube([outer_diameter+1.5,outer_diameter*2,outer_diameter*2]); + translate([outer_diameter, 0, 0]) + cube([outer_diameter+1.5,outer_diameter*2,outer_diameter*2]); - translate([18, 2*outer_diameter, outer_diameter]) - rotate([90, 0, 0]) - nut(outer_diameter*2, outer_diameter*2, false); - } + translate([18, 2*outer_diameter, outer_diameter]) + rotate([90, 0, 0]) + nut(outer_diameter*2, outer_diameter*2, false); + } - translate([18, outer_diameter, 9]) - cube([18,05,20], center=true); + translate([18, outer_diameter, 9]) + cube([18,05,20], center=true); - translate([outer_diameter, outer_diameter, -1]) - cylinder(h = 20, r = threaded_rod_diameter/2, $fn = 80); + translate([outer_diameter, outer_diameter, -1]) + cylinder(h = 20, r = threaded_rod_diameter/2, $fn = 80); - translate([17, 17, outer_diameter]) - rotate([90, 00, 00]) - cylinder(h = 20, r = threaded_rod_diameter/2, $fn = 80); - } + translate([17, 17, outer_diameter]) + rotate([90, 00, 00]) + cylinder(h = 20, r = threaded_rod_diameter/2, $fn = 80); } } } diff --git a/belt-clamp.scad b/belt-clamp.scad index 7f65587..dcf1e8d 100644 --- a/belt-clamp.scad +++ b/belt-clamp.scad @@ -21,7 +21,6 @@ include ; include ; -include ; module belt_clamp_holder(){ r = 5; @@ -81,17 +80,15 @@ module teeth_for_belt(belt_width=6){ module beltclamp(width=28, height=6, r=5, teeth_depth=0.5){ BillOfMaterials(category="3D Printed", partname="Belt Clamp"); - if (render_ABS){ - color(ABS_color){ - render() - difference(){ - linear_extrude(height=height) - beltclamp_curves(width, r); + material("ABS"){ + render() + difference(){ + linear_extrude(height=height) + beltclamp_curves(width, r); - translate([0, 0, height-teeth_depth]){ - linear_extrude(height = teeth_depth+1) - teeth_for_belt(); - } + translate([0, 0, height-teeth_depth]){ + linear_extrude(height = teeth_depth+1) + teeth_for_belt(); } } } @@ -100,23 +97,17 @@ module beltclamp(width=28, height=6, r=5, teeth_depth=0.5){ module x_carriage_beltclamp(width=28, height=6, r=5){ BillOfMaterials(category="Lasercut wood", partname="X Carriage Belt Clamp"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=height) - beltclamp_curves(width, r, for_x_carriage=true); - } - } + material("lasercut") + linear_extrude(height=height) + beltclamp_curves(width, r, for_x_carriage=true); } module y_platform_beltclamp(width=28, height=6, r=5){ BillOfMaterials(category="Lasercut wood", partname="Y Platform Belt Clamp"); - if (render_lasercut){ - color(sheet_color){ - linear_extrude(height=height) - beltclamp_curves(width, r, for_y_platform=true); - } - } + material("lasercut") + linear_extrude(height=height) + beltclamp_curves(width, r, for_y_platform=true); } beltclamp(); //for 3d printing diff --git a/bolts.scad b/bolts.scad index f324515..d71329a 100644 --- a/bolts.scad +++ b/bolts.scad @@ -19,7 +19,6 @@ include ; include ; include ; -include ; module M3x10(){ bolt(3,10); @@ -37,12 +36,11 @@ module bolt_head(r, h){ module bolt(dia, length){ BillOfMaterials(str("M",dia,"x",length," bolt")); - if (render_metal) - color(metal_color){ + material("metal"){ bolt_head(r=dia, h=dia); - translate([0,0,-length]){ - cylinder(r=dia/2, h=length, $fn=60); - } + + translate([0,0,-length]) + cylinder(r=dia/2, h=length, $fn=60); } } diff --git a/cable_clips.scad b/cable_clips.scad index 3ac00cb..841377a 100644 --- a/cable_clips.scad +++ b/cable_clips.scad @@ -17,6 +17,7 @@ // along with this program. If not, see . include ; +include ; module ring(r, R, start=0, end=360){ N=200; @@ -95,11 +96,11 @@ module cable_clip_model(D, H, L, W, W2, clip_thickness){ } module hellerman_cable_clip_with_sticker(D, H, L, W, W2, sticker_thickness=1, clip_thickness){ - color("grey") + material("rubber") translate([-L/2, -W/2]) cube([L, W, sticker_thickness]); - color("white") + material("nylon") translate([0,0,sticker_thickness]) cable_clip_model(D=D, H=H, L=L, W=W, W2=W2, clip_thickness=clip_thickness); } @@ -180,4 +181,3 @@ translate([43,0]) RA9_cable_clip(); translate([70,0]) RA13_cable_clip(); translate([103,0]) RA18_cable_clip(); - diff --git a/colors.h b/colors.h deleted file mode 100644 index ea29123..0000000 --- a/colors.h +++ /dev/null @@ -1,35 +0,0 @@ -// (c) 2013 Metamáquina -// -// Author: -// * Felipe C. da S. Sanches -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -dark_green = [0,0.2,0]; -rubber_color = [0.1, 0.1, 0.1]; -nozzle_color = "gold"; -pcb_color = [1.0, 0.0, 0.0]; -glass_color = [0.6, 0.6, 1, 0.4]; -threaded_metal_color = [0.6, 0.6, 0.6]; -metal_color = [0.7, 0.7, 0.7]; -powersupply_color = metal_color; -PLA_color = [0.95, 0.35, 0.35]; -ABS_color = [0.35, 0.35, 0.35]; -sheet_color = [227/230, 190/230, 151/230]; -peek_color = "beige"; -dark_grey = [0.3, 0.3, 0.3]; -green_plastic_color = [0.7,0.8,0,7]; -black_plastic_color = [0.3,0.3,0.3]; -white_nylon_color = [1, 1, 0.8]; - diff --git a/coupling.scad b/coupling.scad index 2dbc291..5db7c92 100644 --- a/coupling.scad +++ b/coupling.scad @@ -18,13 +18,13 @@ // along with this program. If not, see . include ; -include ; +include ; include ; module coupling(shaft_diameter=5, rod_diameter=8){ BillOfMaterials("Coupling for the Z axis"); - color(metal_color) + material("metal") difference(){ cylinder(r=coupling_diameter/2, h=coupling_length, $fn=60); diff --git a/detailed_608zz_bearing.scad b/detailed_608zz_bearing.scad index 3e042d1..cbdd21b 100644 --- a/detailed_608zz_bearing.scad +++ b/detailed_608zz_bearing.scad @@ -21,7 +21,7 @@ // along with this program. If not, see . use ; -include ; +include ; //include ; $fa=0.01; @@ -73,7 +73,7 @@ module bearing_internal_cut(){ } module detailed_608zz_bearing_body(){ - color(metal_color) + material("metal") rotate_extrude() detailed_608zz_bearing_2d(); } @@ -94,7 +94,7 @@ module detailed_608zz_bearing() { } module detailed_608zz_balls(){ - color(metal_color) + material("metal") for (i=[1:608zz_num_balls]) rotate(i*360/608zz_num_balls) translate([608zz_race_radius, 0]) @@ -112,7 +112,8 @@ module detailed_608zz_ball_cage2(){ module detailed_608zz_ball_cage(){ translate([0,0,608zz_cage_clearance]) - color("brown")render(){ + material("metal") + render(){ linear_extrude(height=608zz_cage_thickness) difference(){ diff --git a/endstop.scad b/endstop.scad index 3103be8..b7c4e6e 100644 --- a/endstop.scad +++ b/endstop.scad @@ -21,6 +21,7 @@ include ; include ; use ; use ; +include ; m3_diameter=3; //TODO: move-me to a header file @@ -114,10 +115,10 @@ module simples_mechanical_endstop(){ thickness = 5;//TODO if (render_rubber) - color(rubber_color) + material("rubber") cube([microswitch_width, microswitch_height, thickness]); - color(metal_color){ + material("metal"){ translate([2, microswitch_height+3]) rotate(10) cube([microswitch_width-2, 1, thickness]); @@ -164,7 +165,7 @@ module ymax_endstop_subassembly(){ } module YMIN_endstop_spacer_sheet(){ - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) endstop_spacer_face2(); } @@ -320,8 +321,7 @@ module mechanical_switch(bom=true){ metal_thickness = 1; - if (render_rubber) - color(rubber_color) + material("rubber") linear_extrude(height=microswitch_thickness){ difference(){ square([microswitch_width, microswitch_height]); @@ -332,8 +332,7 @@ module mechanical_switch(bom=true){ } } - if (render_metal) - color(metal_color) + material("metal") translate([2, microswitch_height+3, 1]){ linear_extrude(height=microswitch_thickness-2){ hull(){ @@ -359,7 +358,7 @@ module optical_endstop(){ module ymin_endstop_spacer_sheet(){ BillOfMaterials(category="Lasercut wood", partname="YMIN Spacer"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) ymin_endstop_spacer_face(); } @@ -367,7 +366,7 @@ module ymin_endstop_spacer_sheet(){ module ymax_endstop_spacer_sheet(){ BillOfMaterials(category="Lasercut wood", partname="YMAX Spacer"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) ymax_endstop_spacer_face(); } @@ -375,23 +374,23 @@ module ymax_endstop_spacer_sheet(){ module zmax_endstop_spacer_sheet1(){ BillOfMaterials(category="Lasercut wood", partname="ZMAX Spacer #1"); - color(sheet_color) - linear_extrude(height=thickness) - zmax_endstop_spacer_face1(); + material("lasercut") + linear_extrude(height=thickness) + zmax_endstop_spacer_face1(); } module zmax_endstop_spacer_sheet2(){ BillOfMaterials(category="Lasercut wood", partname="ZMAX Spacer #2"); - color(sheet_color) - linear_extrude(height=thickness) - zmax_endstop_spacer_face2(); + material("lasercut") + linear_extrude(height=thickness) + zmax_endstop_spacer_face2(); } module zmin_endstop_spacer_sheet1(){ BillOfMaterials(category="Lasercut wood", partname="ZMIN Spacer #1"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) zmin_endstop_spacer_face1(); } @@ -399,7 +398,7 @@ module zmin_endstop_spacer_sheet1(){ module zmin_endstop_spacer_sheet2(){ BillOfMaterials(category="Lasercut wood", partname="ZMIN Spacer #2"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) zmin_endstop_spacer_face2(); } diff --git a/heated_bed.scad b/heated_bed.scad index 89b0938..ab3e974 100644 --- a/heated_bed.scad +++ b/heated_bed.scad @@ -19,15 +19,15 @@ include ; include ; include ; -include ; +include ; use ; module heated_bed_pcb(width = heated_bed_pcb_width, height = heated_bed_pcb_height){ - BillOfMaterials("Heated bed PCB"); + BillOfMaterials("Heated bed PCB"); - color(pcb_color) - linear_extrude(height=heated_bed_pcb_thickness) - heated_bed_pcb_curves(width=width, height=height); + material("pcb") + linear_extrude(height=heated_bed_pcb_thickness) +heated_bed_pcb_curves(width=width, height=height); } module heated_bed_pcb_curves(width = heated_bed_pcb_width, height = heated_bed_pcb_height, connector_holes=true){ @@ -61,21 +61,20 @@ module heated_bed_pcb_curves(width = heated_bed_pcb_width, height = heated_bed_p } module heated_bed_silk(width = heated_bed_pcb_width, height = heated_bed_pcb_height){ - line_thickness = 1; - color("white"){ - translate([0,0,heated_bed_pcb_thickness+0.1]) - difference(){ - square([200,200], center=true); - square([200-2*line_thickness,200-2*line_thickness], center=true); - } + line_thickness = 1; + material("silk"){ + translate([0,0,heated_bed_pcb_thickness+0.1]) + difference(){ + square([200,200], center=true); + square([200-2*line_thickness,200-2*line_thickness], center=true); } + } } module heated_bed_glass(){ BillOfMaterials(str(heated_bed_glass_thickness, "mm glass for the build platform (",glass_w,"mm x ",glass_h,"mm)")); - if(render_glass) - color(glass_color) + material("glass") translate([-glass_w/2, -glass_h/2, heated_bed_pcb_thickness]) cube([glass_w, glass_h, heated_bed_glass_thickness]); } diff --git a/jhead.scad b/jhead.scad index d9a8f07..968541e 100644 --- a/jhead.scad +++ b/jhead.scad @@ -19,6 +19,7 @@ include ; include ; include ; +include ; use ; module J_head_assembly(){ @@ -36,14 +37,12 @@ module J_head_body(){ BillOfMaterials("PTFE liner"); } - if (render_peek){ - color(peek_color){ - translate([0,0,-50+4.76+4.64]){ - cylinder(h=50,r=6); - cylinder(h=50-4.76-4.64,r=(5/8)*inch/2); - translate([0,0,50-4.76]) - cylinder(h=4.64,r=(5/8)*inch/2); - } + material("peek"){ + translate([0,0,-50+4.76+4.64]){ + cylinder(h=50,r=6); + cylinder(h=50-4.76-4.64,r=(5/8)*inch/2); + translate([0,0,50-4.76]) + cylinder(h=4.64,r=(5/8)*inch/2); } } } diff --git a/large_extruder_gear.scad b/large_extruder_gear.scad index 1e2c931..8e81a57 100644 --- a/large_extruder_gear.scad +++ b/large_extruder_gear.scad @@ -22,6 +22,7 @@ use ; include ; include ; +include ; module extruder_gear(teeth=37, circles=12, shaft=8.6){ BillOfMaterials(category="3D Printed", partname="Large Extruder Gear"); @@ -29,6 +30,7 @@ module extruder_gear(teeth=37, circles=12, shaft=8.6){ body_thickness = 4; hub_thickness = 8; + material("ABS") difference(){ union() { //hub diff --git a/lasercut_extruder.scad b/lasercut_extruder.scad index ec3af44..38c9c9f 100644 --- a/lasercut_extruder.scad +++ b/lasercut_extruder.scad @@ -76,11 +76,9 @@ module handle_face(r=5, width=HandleWidth, height=HandleHeight){ module handle_sheet(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Handle"); - color(sheet_color){ - linear_extrude(height=thickness){ - handle_face(); - } - } + material("lasercut") + linear_extrude(height=thickness) + handle_face(); } //!idler_side_face(); @@ -146,7 +144,7 @@ module idler_back_face(){ module idler_back_sheet(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Idler Back"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) idler_back_face(); } @@ -154,7 +152,7 @@ module idler_back_sheet(){ module idler_side_sheet(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Idler Side"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) idler_side_face(); } @@ -162,7 +160,7 @@ module idler_side_sheet(){ module idler_spacer_sheet(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Idler Spacer"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) idler_spacer_face(); } @@ -412,7 +410,7 @@ module extruder_slice(motor_holder=false, bearing_slot=false, filament_channel=f module slice1(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Slice #1"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) slice1_face(); } @@ -420,7 +418,7 @@ module slice1(){ module slice2(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Slice #2"); - color(sheet_color) + material("lasercut") translate([0,0,1*thickness]) linear_extrude(height=thickness) slice2_face(); @@ -430,7 +428,7 @@ module slice2(){ module slice3(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Slice #3"); - color(sheet_color) + material("lasercut") translate([0,0,2*thickness]) linear_extrude(height=thickness) slice3_face(); @@ -439,7 +437,7 @@ module slice3(){ module slice4(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Slice #4"); - color(sheet_color) + material("lasercut") translate([0,0,3*thickness]) linear_extrude(height=thickness) slice4_face(); @@ -448,7 +446,7 @@ module slice4(){ module slice5(){ BillOfMaterials(category="Lasercut wood", partname="LCExtruder Slice #5"); - color(sheet_color) + material("lasercut") translate([0,0,4*thickness]) linear_extrude(height=thickness) slice5_face(); @@ -481,6 +479,7 @@ module idler_bolt_subassembly(){ BillOfMaterials(str("M8x", length, "mm Threaded Rod")); //bolt body + material("threaded metal") translate([0,0,-length]) cylinder(r=7.3/2, h=length); } @@ -495,8 +494,6 @@ module idler(){ R=23; bearing_thickness = 7; - if (render_metal) - color(metal_color) rotate([90,0]) translate([0,0,5*thickness]) translate(idler_bearing_position) @@ -562,8 +559,7 @@ module extruder_block(){ //JHead MKIV nozzle module nozzle(length=50){ - if (render_rubber) - color(rubber_color){ + material("rubber"){ difference(){ union(){ translate([0,0,5]) @@ -582,6 +578,8 @@ module nozzle(length=50){ module hobbed_bolt(){ BillOfMaterials("Hobbed bolt"); + + material("metal") rotate([90,0]) cylinder(r=7.2/2, h=5*thickness); } @@ -605,26 +603,20 @@ module lasercut_extruder(){ nozzle(); - if (render_ABS){ - color(ABS_color) - translate([hobbed_bolt_position[0], -5*thickness/2 - 2*washer_thickness, hobbed_bolt_position[1]]) - rotate([0,extruder_gear_angle]) - rotate([90,0]) - extruder_gear(teeth=37); - } + translate([hobbed_bolt_position[0], -5*thickness/2 - 2*washer_thickness, hobbed_bolt_position[1]]) + rotate([0,extruder_gear_angle]) + rotate([90,0]) + extruder_gear(teeth=37); - if (render_metal){ - color(metal_color) - translate([hobbed_bolt_position[0], 5*thickness/2, hobbed_bolt_position[1]]) hobbed_bolt(); + translate([hobbed_bolt_position[0], 5*thickness/2, hobbed_bolt_position[1]]) hobbed_bolt(); - translate([hobbed_bolt_position[0], -3*thickness/2, hobbed_bolt_position[1]]) - rotate([90,0]) - 608zz_bearing(true); + translate([hobbed_bolt_position[0], -3*thickness/2, hobbed_bolt_position[1]]) + rotate([90,0]) + 608zz_bearing(true); - translate([hobbed_bolt_position[0], 3*thickness/2+7, hobbed_bolt_position[1]]) - rotate([90,0]) - 608zz_bearing(true); - } + translate([hobbed_bolt_position[0], 3*thickness/2+7, hobbed_bolt_position[1]]) + rotate([90,0]) + 608zz_bearing(true); translate([motor_position[0], -thickness/2, motor_position[1]]) rotate([-90,0]) @@ -633,11 +625,8 @@ module lasercut_extruder(){ NEMA17_subassembly(); translate([0,0,-2*thickness - 2*washer_thickness]) - if (render_ABS){ - color(ABS_color) - rotate([180,0]) - motor_gear(teeth=11); - } + rotate([180,0]) + motor_gear(teeth=11); } } } diff --git a/lm8uu_bearing.scad b/lm8uu_bearing.scad index 8581682..4f8442a 100644 --- a/lm8uu_bearing.scad +++ b/lm8uu_bearing.scad @@ -17,7 +17,6 @@ // along with this program. If not, see . include ; -include ; include ; include ; @@ -25,16 +24,13 @@ module LM8UU(bom=true){ if (bom) BillOfMaterials("LM8UU linear bearing"); - if (render_metal){ - color(metal_color){ - translate([0,lm8uu_length/2]) - rotate([90,0]) - linear_extrude(height=lm8uu_length) - difference(){ - circle(r=lm8uu_diameter/2); - circle(r=lm8uu_internal_diameter/2); - } - } + material("metal") + translate([0,lm8uu_length/2]) + rotate([90,0]) + linear_extrude(height=lm8uu_length) + difference(){ + circle(r=lm8uu_diameter/2); + circle(r=lm8uu_internal_diameter/2); } } diff --git a/nozzle.scad b/nozzle.scad index 66d4084..37c8071 100644 --- a/nozzle.scad +++ b/nozzle.scad @@ -2,6 +2,7 @@ include ; include ; +include ; module v4nozzle(){ BillOfMaterials("JHead nozzle"); @@ -13,7 +14,7 @@ module v4nozzle(){ } if (render_nozzle){ - color (nozzle_color){ + material("golden"){ scale(25.4) difference() { union() { diff --git a/nuts.scad b/nuts.scad index 331d333..59c9df1 100644 --- a/nuts.scad +++ b/nuts.scad @@ -19,7 +19,7 @@ include ; include ; -include ; +include ; module M25_nut(){ BillOfMaterials("M2.5 nut"); @@ -67,7 +67,7 @@ epsilon = 0.05; // Commented lines are not working for all sizes module nut(r, R, H){ - color(metal_color) + material("metal") difference(){ //hexagon intersection(){ diff --git a/render.h b/render.h index 8d860e5..82e46ba 100644 --- a/render.h +++ b/render.h @@ -22,7 +22,23 @@ // $fs is the minimum size of a fragment. Because of this variable very small circles have a smaller number of fragments than specified using $fa. The default value is 2. The minimum allowed value is 0.01. $fs = 0.5; -include ; +dark_green = [0,0.2,0]; +rubber_color = [0.1, 0.1, 0.1]; +nozzle_color = "gold"; +pcb_color = [1.0, 0.0, 0.0]; +glass_color = [0.6, 0.6, 1, 0.4]; +threaded_metal_color = [0.6, 0.6, 0.6]; +metal_color = [0.7, 0.7, 0.7]; +powersupply_color = metal_color; +PLA_color = [0.95, 0.35, 0.35]; +ABS_color = [0.35, 0.35, 0.35]; +sheet_color = [227/230, 190/230, 151/230]; +peek_color = "beige"; +dark_grey = [0.3, 0.3, 0.3]; +green_plastic_color = [0.7,0.8,0,7]; +black_plastic_color = [0.3,0.3,0.3]; +nylon_color = [1, 1, 0.8]; +acrylic_color = [1, 0.6, 0.6, 0.4]; render_materials = [ "lasercut", @@ -31,69 +47,73 @@ render_materials = [ "ABS", "PLA", "metal", - "threaded_metal", + "threaded metal", "rubber", "peek", "nylon", - "acrylic"]; - -//rendering configs: -render_lasercut=true; -render_pcb=true; -render_glass=true; -render_ABS=true; -render_PLA=true; -render_metal=true; -render_threaded_metal=true; -render_rubber=true; -render_peek=true; -render_nylon=true; -render_acrylic=true; + "acrylic", + "silk", + "golden"]; -module material(id){ - if (id=="lasercut") - for (i=[0:$children-1]) - color(sheet_color) child(i); - - if (id=="pcb") - for (i=[0:$children-1]) - color(pcb_color) child(i); - - if (id=="glass") - for (i=[0:$children-1]) - color(glass_color) child(i); - - if (id=="ABS") - for (i=[0:$children-1]) - color(ABS_color) child(i); - - if (id=="PLA") - for (i=[0:$children-1]) - color(PLA_color) child(i); - - if (id=="metal") - for (i=[0:$children-1]) - color(metal_color) child(i); - - if (id=="threaded metal") - for (i=[0:$children-1]) - color(threaded_metal_color) child(i); - - if (id=="rubber") - for (i=[0:$children-1]) - color(rubber_color) child(i); - - if (id=="peek") - for (i=[0:$children-1]) - color(peek_color) child(i); - - if (id=="nylon") - for (i=[0:$children-1]) - color(nylon_color) child(i); +render_materials = [ + "lasercut"]; - if (id=="acrylic") - for (i=[0:$children-1]) - color(acrylic_color) child(i); +module material(id){ + for (m=render_materials){ + if (id==m){ + if (id=="lasercut") + for (i=[0:$children-1]) + color(sheet_color) child(i); + + if (id=="pcb") + for (i=[0:$children-1]) + color(pcb_color) child(i); + + if (id=="glass") + for (i=[0:$children-1]) + color(glass_color) child(i); + + if (id=="ABS") + for (i=[0:$children-1]) + color(ABS_color) child(i); + + if (id=="PLA") + for (i=[0:$children-1]) + color(PLA_color) child(i); + + if (id=="metal") + for (i=[0:$children-1]) + color(metal_color) child(i); + + if (id=="threaded metal") + for (i=[0:$children-1]) + color(threaded_metal_color) child(i); + + if (id=="rubber") + for (i=[0:$children-1]) + color(rubber_color) child(i); + + if (id=="peek") + for (i=[0:$children-1]) + color(peek_color) child(i); + + if (id=="nylon") + for (i=[0:$children-1]) + color(nylon_color) child(i); + + if (id=="acrylic") + for (i=[0:$children-1]) + color(acrylic_color) child(i); + + if (id=="silk") + for (i=[0:$children-1]) + color("white") child(i); + + if (id=="golden") + for (i=[0:$children-1]) + color("gold") child(i); + } + } } //subassembly rendering switches: diff --git a/small_extruder_gear.scad b/small_extruder_gear.scad index 0f050ad..8800c6a 100644 --- a/small_extruder_gear.scad +++ b/small_extruder_gear.scad @@ -21,6 +21,7 @@ use ; include ; +include ; module motor_gear(teeth=11, shaft_diameter=5){ BillOfMaterials(category="3D Printed", partname="Small Extruder Gear"); @@ -29,6 +30,7 @@ module motor_gear(teeth=11, shaft_diameter=5){ BillOfMaterials("M3x8 grubscrew - TODO"); } + material("ABS") render() translate([0,0,5]) difference() { diff --git a/spacer.scad b/spacer.scad index 4078e0b..4b5cb96 100644 --- a/spacer.scad +++ b/spacer.scad @@ -17,7 +17,6 @@ // along with this program. If not, see . include ; -include ; include ; include ; @@ -33,7 +32,7 @@ module double_M3_lasercut_spacer(){ module M3_spacer(){ BillOfMaterials("M3 Lasercut spacer"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) M3_spacer_face(); } @@ -57,7 +56,7 @@ module set_of_M3_spacers(w=4, h=4){ module M4_spacer(){ BillOfMaterials("M4 Lasercut spacer"); - color(sheet_color) + material("lasercut") linear_extrude(height=thickness) M4_spacer_face(); } @@ -91,24 +90,20 @@ module hexspacer_32mm(){ } module generic_hexspacer(D=8, d=m3_diameter, h=hexspacer_length){ - if (render_metal){ - color(metal_color) - linear_extrude(height=h) - difference(){ - circle(r=D/2, $fn=6); - circle(r=d/2, $fn=20); - } + material("metal") + linear_extrude(height=h) + difference(){ + circle(r=D/2, $fn=6); + circle(r=d/2, $fn=20); } } module generic_nylonspacer(D=8, d=m4_diameter, h=nylonspacer_length){ - if (render_nylon){ - color(white_nylon_color) - linear_extrude(height=h) - difference(){ - circle(r=D/2, $fn=20); - circle(r=d/2, $fn=20); - } + material("nylon") + linear_extrude(height=h) + difference(){ + circle(r=D/2, $fn=20); + circle(r=d/2, $fn=20); } } diff --git a/washers.scad b/washers.scad index fdc8aed..ad89dfd 100644 --- a/washers.scad +++ b/washers.scad @@ -20,7 +20,6 @@ include ; include ; include ; -include ; module M3_washer(){ BillOfMaterials("M3 washer"); @@ -51,13 +50,11 @@ module M8_mudguard_washer(){ } module washer(washer_thickness, external_diameter, internal_diameter){ - if (render_metal){ - color(metal_color){ - linear_extrude(height=washer_thickness) - difference(){ - circle(r=external_diameter/2); - circle(r=internal_diameter/2); - } + material("metal"){ + linear_extrude(height=washer_thickness) + difference(){ + circle(r=external_diameter/2); + circle(r=internal_diameter/2); } } }