cyclone-pcb-factory/Hardware/Development/Cyclone_Template/template.scad

277 lines
8.4 KiB
OpenSCAD
Raw Normal View History

// Cyclone PCB Factory: a 3D printable CNC machine for PCB manufacture
// Created by Carlosgs (http://carlosgs.es)
// License: Attribution - Share Alike - Creative Commons (http://creativecommons.org/licenses/by-sa/3.0/)
use <../libs/Write/Write.scad>
use <../libs/build_plate.scad>
use <../main_frame/frame.scad>
use <../Y_axis/Y_rod_idler.scad>
use <../Y_axis/motor_stand.scad>
use <../Y_axis/linear_bearing_holder.scad>
use <../Y_axis/Y_nut_holder.scad>
use <../XZ_axis/X_carriage.scad>
use <../XZ_axis/Z_carriage.scad>
X_axis_sep = 210;
Y_axis_sep = 210;
Y_threaded_rod_length = (Y_axis_sep/2)+40;
Y_linear_bearing_dist = Y_axis_sep/2-25-20;
Y_rod_height = 40;
Y_rod_dist_from_workbed = 12.5;
Y_threaded_rod_height = Y_rod_height-8.218; // Obtained "by sight"
Y_threaded_rod_dist_from_workbed = (Y_rod_height-Y_threaded_rod_height)+Y_rod_dist_from_workbed;
workbed_X = X_axis_sep+20;
workbed_Y = 122;//Y_linear_bearing_dist+25+20-3;
workbed_thickness = 10;
X_threaded_rod_height = 99.65;
X_smooth_rods_sep = 50;
X_smooth_rods_sep_projected = sqrt((X_smooth_rods_sep*X_smooth_rods_sep)/2); // Be careful with this measure, it is not properly named since it is used with the following offset:
smooth_rod_margin = 1;
X_Final_Threaded_Rod_Length = X_axis_sep+80;
X_Final_Smooth_Rod_Length = X_axis_sep+60;
Y_Final_Threaded_Rod_Length = Y_threaded_rod_length+60;
Y_Final_Smooth_Rod_Length = Y_axis_sep+15;
X_Wood_Base = X_axis_sep+70;
Y_Wood_Base = Y_axis_sep+30;
Z_Wood_Base = 15;
X_PCB_BOARD = 150;
Y_PCB_BOARD = 100;
Z_PCB_BOARD = 1.5;
X_Spindle_Bit_Offset = 0;
Y_Spindle_Bit_Offset = 0;
// Display steppers, bearings, washers, nuts
Display_Extra_Parts = true;
X_rod_sep_real = X_smooth_rods_sep_projected+smooth_rod_margin;
2013-10-14 22:58:47 +07:00
module frame_right(with_extra_parts = false) {
if(with_extra_parts)
rotate([0,0,90]) scale([-1,1,1]) translate([-85,-23,135]) rotate([-90,0,0]) frame(with_motor = 0, with_extra_parts=with_extra_parts);
else
color([1,0.8,0]) rotate([0,0,90]) scale([-1,1,1]) translate([-85,-23,135]) rotate([-90,0,0]) frame(with_motor = 0, with_extra_parts=with_extra_parts);
}
2013-10-14 22:58:47 +07:00
module frame_left(with_extra_parts = false) {
if(with_extra_parts)
rotate([0,0,90]) scale([-1,-1,1]) translate([-85,-23,135]) rotate([-90,0,0]) frame(with_motor = 1, with_extra_parts=with_extra_parts);
else
color([1,1,0]) rotate([0,0,90]) scale([-1,-1,1]) translate([-85,-23,135]) rotate([-90,0,0]) frame(with_motor = 1, with_extra_parts=with_extra_parts);
}
module Y_rod_idler_left() {
color([0.8,1,1]) rotate([0,0,90]) scale([1,-1,1]) translate([-26,-17,39]) rotate([-90,0,0]) Y_rod_idler();
}
module Y_rod_idler_right() {
color([1,1,1]) rotate([0,0,90]) translate([-26,-17,39]) rotate([-90,0,0]) Y_rod_idler();
}
module Y_motor_stand() {
rotate([0,90,0]) translate([-45,0,52.4]) rotate([-90,0,0]) {
if(Display_Extra_Parts)
motor_stand(with_extra_parts=Display_Extra_Parts);
else
color([0,1,1]) motor_stand();
}
}
module Y_idle_stand() {
rotate([0,90,180]) translate([-45,0,52.4]) rotate([-90,0,0])
if(Display_Extra_Parts)
idle_stand(with_extra_parts=Display_Extra_Parts);
else
color([0,1,0.8]) idle_stand();
}
module linear_bearing_holder() {
color([1,0.5,0])
rotate([0,-90,-90]) translate([3,0,0]) lm8uu_bearing_holder();
}
module Y_nut_holder() {
color([0.5,0.5,0])
nut_holder_positioned();
}
module cnc_workbed() {
// ---- work bed ----
translate([0,0,-workbed_thickness/2+1]) {
color([0.5,1,0.5,0.5]) { // Transparent color
%cube([workbed_X,workbed_Y,workbed_thickness],center=true);
difference() {
cube([workbed_X,workbed_Y,workbed_thickness],center=true);
cube([workbed_X-1,workbed_Y-1,workbed_thickness+1],center=true);
}
// --- PCB Board ---
translate([0,0,-(workbed_thickness+Z_PCB_BOARD)/2])
cube([X_PCB_BOARD,Y_PCB_BOARD,Z_PCB_BOARD],center=true);
}
}
// --- Y axis nut holder
rotate([0,0,180])
Y_nut_holder();
// ---- work bed linear bearing position ----
translate([-X_axis_sep/2,-Y_linear_bearing_dist/2,0])
rotate([0,0,180])
linear_bearing_holder();
translate([-X_axis_sep/2,Y_linear_bearing_dist/2,0])
rotate([0,0,180])
linear_bearing_holder();
translate([X_axis_sep/2,-Y_linear_bearing_dist/2,0])
linear_bearing_holder();
translate([X_axis_sep/2,Y_linear_bearing_dist/2,0])
linear_bearing_holder();
}
module X_carriage() {
translate([0,X_rod_sep_real/2,0])
rotate([0,0,90])
X_carriage_assembled(show_printbed = 0, show_Xrods = 0, show_Zrods = 1);
}
module Z_carriage_piece() {
2013-06-02 20:30:29 +07:00
translate([0,0,41])
rotate([0,0,90])
Z_carriage_assembled();
}
module cnc(show_printbed = 1) {
// ---- build plate ----
if(show_printbed) {
//for display only, doesn't contribute to final object
translate([X_axis_sep/2,Y_axis_sep/2,0])
build_plate(3,297,210); // A4
}
// ---- main frames ----
2013-10-14 22:58:47 +07:00
frame_left(with_extra_parts=Display_Extra_Parts);
translate([X_axis_sep,0,0])
2013-10-14 22:58:47 +07:00
frame_right(with_extra_parts=Display_Extra_Parts);
// ---- Y rod idlers ----
translate([0,Y_axis_sep,0]) {
Y_rod_idler_left();
translate([X_axis_sep,0,0])
Y_rod_idler_right();
}
// ---- Y threaded rod motor and idler ----
translate([X_axis_sep/2,Y_axis_sep/2,0]) {
translate([0,Y_threaded_rod_length/2,0]) Y_motor_stand();
translate([0,-Y_threaded_rod_length/2,0]) Y_idle_stand();
}
}
module reference(dist=200,offset=0) {
lineWidth = 0.5;
thickness = 5;
textSize = 5;
translate([offset,0,0]) write(str(dist," mm"),t=thickness,h=textSize,center=true);
translate([0,textSize,0]) {
cube([dist,lineWidth,thickness],center=true);
translate([dist/2,0,0]) cube([lineWidth,5,thickness],center=true);
translate([-dist/2,0,0]) cube([lineWidth,5,thickness],center=true);
}
}
module cnc_base_template() {
projection(cut=true) translate([0,0,-1]) {
cnc(); // Main structure
translate([X_axis_sep/2,Y_axis_sep/2,0]) { // Reference rulers
reference(X_axis_sep,60);
translate([-20,0,0])
rotate([0,0,90])
reference(Y_threaded_rod_length,40);
}
}
}
module cnc_workbed_template() {
projection(cut=true) translate([0,0,-1]) {
cnc_workbed(); // Main structure
translate([0,-20,0])
reference(workbed_X,60);
translate([-20,0,0])
rotate([0,0,90])
reference(workbed_Y,40);
}
}
module rod(len=100) {
color([0.8,0.8,0.8])
rotate([90,0,0])
cylinder(r=8/2,h=len,center=true,$fn=30);
}
module cnc_assembled(Y_offset=0,X_offset=0,Z_offset=0) {
translate([-X_axis_sep/2,-Y_axis_sep/2])
cnc();
translate([0,0,Y_rod_height]) { // Y rod height, centered
// --- workbed ---
translate([0,Y_offset+Y_Spindle_Bit_Offset,12.5])
rotate([0,180,0])
cnc_workbed();
// --- Y threaded rod ---
translate([0,0,Y_threaded_rod_height-Y_rod_height])
color([0.5,0.5,0.5]) rod(Y_Final_Threaded_Rod_Length);
// --- Y smooth rods ---
translate([X_axis_sep/2,0,0])
rod(Y_Final_Smooth_Rod_Length);
translate([-X_axis_sep/2,0,0])
rod(Y_Final_Smooth_Rod_Length);
}
translate([0,-19,99.65]) { // X threaded rod height, centered over SMOOTH rod
// --- X axis ---
translate([0,-X_rod_sep_real,0]) {
translate([-X_offset+X_Spindle_Bit_Offset,0,0]) {
X_carriage();
translate([0,X_rod_sep_real/2,Z_offset])
Z_carriage_piece();
}
rotate([0,0,90])
color([0.5,0.5,0.5]) rod(X_Final_Threaded_Rod_Length);
translate([0,0,X_rod_sep_real])
rotate([0,0,90])
rod(X_Final_Smooth_Rod_Length);
}
rotate([0,0,90])
rod(X_Final_Smooth_Rod_Length);/// WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/// INCOHERENT X_axis_sep!!!!!!!!!!!
}
// --- Wood base ---
translate([0,0,-15/2-0.1])
color([0.7,0.6,0.4])
cube([X_Wood_Base,Y_Wood_Base,Z_Wood_Base],center=true);
}
2013-06-02 20:30:29 +07:00
rotate([0,0,90])cnc_assembled(Y_offset=30,X_offset=-50,Z_offset=10);
//rotate([0,0,90]) cnc_base_template(); // So the generated dxf matches inkscape's default orientation
// cnc_workbed_template();
echo("Wood base = ", X_Wood_Base, " x ", Y_Wood_Base, " x ", Z_Wood_Base);
2013-10-10 23:36:18 +07:00
echo("Work bed = ", workbed_X, " x ", workbed_Y, " x ", workbed_thickness);
echo("X smooth rod length = ", X_Final_Smooth_Rod_Length);
echo("X threaded rod length = ", X_Final_Threaded_Rod_Length);
echo("Y smooth rod length = ", Y_Final_Smooth_Rod_Length);
echo("Y threaded rod length = ", Y_Final_Threaded_Rod_Length);