// How to use this file // ==================== // This file contains modules for drawing the base parts of the construction kit: // - connector() draws a round connector (length 0) // - straight(length) makes a straight, longer piece (length to be configured) // - curve() draws a bent piece // // There are commands to actually draw using them at the bottom of the file, but right now // all but the to-be-lasered batch of round pieces is commented out. // If you want to draw other pieces, change that. // GLOBAL PARAMETERS // ================= material_thickness = 2.6; // not much to say about that? system_length = 25.4; // this is the base length of the system, the distance between the theoretical center points of two pieces system_width = 12.7; // width of the "long" pieces system_tipreduction = 3.5; // the tip of pieces has to be reduced to allow multiple pieces to fit into a connector, this is the amount of reduction for that system_sides = 6; // the number of sides of the base polygon // ========================================================= // Module for slot generation // must be subtracted from the part that is supposed to be slotted // lives in the [X,Y]-plane on X and extends to positive Y module slot() { // Local Parameters inlet_depth = 2; inlet_width = 1; union() { translate(v=[(-0.5*material_thickness), -0.1, 0]) { square([material_thickness, (0.5 * system_length) - system_tipreduction + 0.1]); polygon(points=[[0, inlet_depth],[-inlet_width, 0],[material_thickness + inlet_width, 0],[material_thickness, inlet_depth]]); } } } // ========================================================= // Module for generating a connector piece // lives on the [X,Y]-plane at [0,0] and extends roughly system_length in every direction module connector() { difference() { circle(((system_length)-system_tipreduction), $fn=1024); for(sidecounter=[0:system_sides]) { rotate(a=[0,0,(360/system_sides)*sidecounter]) { translate(v=[0,-(system_length - system_tipreduction),0]) slot(); } } circle(system_tipreduction, $fn=1024); } } // ========================================================= // Module for generating longer straight pieces // length_in_units is the length of the piece (difference to a connector piece) // and is expressed in units if system_length // put in a length of 0 to get a small, straight connector module straight(length_in_units) { difference() { union() { translate(v=[-(system_length - system_tipreduction - (system_width/2) + ((system_length * length_in_units)/2)),0,0]) circle(system_width / 2, $fn=1024); square([(system_length - 2 * system_tipreduction) + (length_in_units * system_length) + system_width, system_width], center=true); translate(v=[(system_length - system_tipreduction - (system_width/2) + ((system_length * length_in_units)/2)),0,0]) circle(system_width / 2, $fn=1024); } // here there be slots! translate(v=[-(system_length - system_tipreduction + ((system_length * length_in_units)/2)),0,0]) rotate(a=[0,0,-90]) slot(); translate(v=[(system_length - system_tipreduction + ((system_length * length_in_units)/2)),0,0]) rotate(a=[0,0,90]) slot(); } } // ========================================================= // Module for generating curved pieces // lives on the [X,Y]-plane with the center point at [0,0] // angle is given in units of the inside angle of the selected system polygon // minus_angle is subtracted from the calculated angle for special pieces module curve(angle_in_units, minus_angle) { calc_angle = (angle_in_units * (180 - (360 / system_sides))) - minus_angle; color("white") { difference() { union() { rotate(a=[0,0,-asin((system_width / 2 - system_tipreduction) / system_length)]) translate(v=[system_length,0,0]) circle(system_width / 2, $fn=1024); rotate(a=[0,0,calc_angle + asin((system_width / 2 - system_tipreduction) / system_length)]) translate(v=[system_length,0,0]) circle(system_width / 2, $fn=1024); difference() // this is the inside segment of the curve { circle(system_length + (system_width / 2), $fn=1024); circle(system_length - (system_width / 2), $fn=1024); rotate(a=[0,0,-asin(system_tipreduction / system_length)]) translate(v=[0,-system_length, 0]) square([3 * system_length, 2 * system_length], center = true); rotate(a=[0,0,calc_angle + asin(system_tipreduction / system_length)]) translate(v=[0,system_length, 0]) square([3 * system_length, 2 * system_length], center = true); } } // here there be slots! translate(v=[system_length,-(system_width/2 + system_tipreduction) ,0]) slot(); rotate(a=[0,0,calc_angle]) translate(v=[system_length,(system_width / 2 + system_tipreduction),0]) rotate(a=[0,0,180]) slot(); } } } // ========================================================= // Actually drawing pieces for(con_counter=[0:4]) { translate(v=[30 + (con_counter * 60), 30, 0]) connector(); translate(v=[30 + (con_counter * 60), 90, 0]) connector(); } /*for(str_counter=[0:9]) { translate(v=[15 + (str_counter * 20), 40, 0]) rotate(a=[0,0,90]) straight(1); translate(v=[15 + (str_counter * 20), 120, 0]) rotate(a=[0,0,90]) straight(1); }*/ /*for(cur_counter=[0:4]) { translate(v=[(cur_counter * 30), 20, 0]) curve(1,60); translate(v=[(cur_counter * 30), 60, 0]) curve(1,60); }*/ //connector(); //straight(1); //curve(1,60);