Skip to content

Commit

Permalink
material() markup and better rendering controls
Browse files Browse the repository at this point in the history
  • Loading branch information
felipesanches committed May 23, 2013
1 parent 080b0b3 commit a928086
Show file tree
Hide file tree
Showing 26 changed files with 358 additions and 440 deletions.
5 changes: 3 additions & 2 deletions 608zz_bearing.scad
Expand Up @@ -19,6 +19,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

include <BillOfMaterials.h>;
include <render.h>;

module 608zz_bearing(details=false){
BillOfMaterials("608zz bearing");
Expand All @@ -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);
Expand All @@ -41,7 +42,7 @@ module 608zz_bearing_simple(){
}

module 608zz_bearing_detailed(){
color("silver"){
material("metal"){
//inner disc
linear_extrude(height=7)
difference(){
Expand Down
1 change: 0 additions & 1 deletion Metamaquina2.h
Expand Up @@ -18,7 +18,6 @@

use <Metamaquina2.scad>;
include <render.h>;
include <colors.h>;

/*Thickness of acrylic or plywood sheets to use.*/
thickness = 6; //millimiters
Expand Down
2 changes: 0 additions & 2 deletions Metamaquina2.scad
Expand Up @@ -22,7 +22,6 @@ include <BillOfMaterials.h>;
extruder_wiring_radius = 6;

//utils
include <colors.h>;
use <utils.scad>;
use <mm2logo.scad>;
use <rounded_square.scad>;
Expand Down Expand Up @@ -2114,7 +2113,6 @@ module XEndIdler(){
}

module BuildPlatform_pcb(){
material("pcb")
translate([0,0,pcb_height])
heated_bed();
}
Expand Down
57 changes: 27 additions & 30 deletions NEMA.scad
Expand Up @@ -22,47 +22,44 @@ include <NEMA.h>;
include <bolts.h>;
include <washers.h>;
use <rounded_square.scad>;
include <render.h>;

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])
Expand All @@ -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])
Expand Down
144 changes: 61 additions & 83 deletions PowerSupply.scad
Expand Up @@ -22,7 +22,6 @@ include <PowerSupply.h>;
include <bolts.h>;
include <washers.h>;
include <render.h>;
include <colors.h>;
include <rounded_square.scad>;
include <tslot.scad>;

Expand Down Expand Up @@ -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;
Expand All @@ -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]);
}
}

Expand Down Expand Up @@ -257,47 +249,35 @@ 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();
}

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)
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit a928086

Please sign in to comment.