94 lines
2.8 KiB
OpenSCAD
94 lines
2.8 KiB
OpenSCAD
include <./measurements.scad>;
|
|
$fn=50;
|
|
|
|
//konstrukt_beam_base_L(4,3);
|
|
|
|
//konstrukt_beam_p(konstrukt_beam_arc(3,3,180));
|
|
//konstrukt_beam_p(konstrukt_beam_circle(6,3));
|
|
|
|
//konstrukt_beam_p([[25,0]]);
|
|
|
|
function konstrukt_beam_L(len1=4,len2=3)=[[len1,90],[len2,0]];
|
|
function konstrukt_beam_arc(segments=3,length=2,angle=90) = [ for (i= [1:1:segments]) [length,angle/(segments) ]];
|
|
function konstrukt_beam_circle(segments=3,length=2) = [ for (i= [1:1:segments]) [length,360/segments] ];
|
|
|
|
module konstrukt_beam_p(components=[[5,0]],height=KB_BEAM_HEIGHT) {
|
|
konstrukt_beam_base(components, height);
|
|
konstrukt_beam_holes(components, height);
|
|
}
|
|
|
|
module konstrukt_beam(components=[[5,0]],height=KB_BEAM_HEIGHT) {
|
|
difference() {
|
|
konstrukt_beam_base(components, height);
|
|
konstrukt_beam_holes(components, height);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
module konstrukt_beam_base(subs=[[5,0]],height=KB_BEAM_HEIGHT,num=0) {
|
|
length = subs[num][0];
|
|
angle = subs[num][1];
|
|
konstrukt_beam_base_straight(length);
|
|
next = num+1;
|
|
if(next < len(subs)) {
|
|
translate(konstrukt_beam_move_holes(length)) {
|
|
rotate([0,0,angle]) {
|
|
konstrukt_beam_base(subs,height,next);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
module konstrukt_beam_holes(subs=[[5,0]],height=KB_BEAM_HEIGHT,num=0) {
|
|
length = subs[num][0];
|
|
angle = subs[num][1];
|
|
|
|
next = num+1;
|
|
if(next < len(subs)) {
|
|
konstrukt_beam_holes_straight(length-1);
|
|
translate(konstrukt_beam_move_holes(length)) {
|
|
rotate([0,0,angle]) {
|
|
konstrukt_beam_holes(subs,height,next);
|
|
}
|
|
}
|
|
}
|
|
konstrukt_beam_holes_straight(length);
|
|
}
|
|
|
|
module konstrukt_beam_base_straight(l=2,h=KB_BEAM_HEIGHT) {
|
|
cube_length= (l-1)*KB_HOLE_SPACING;
|
|
union() {
|
|
cylinder(d=KB_BEAM_WIDTH, h=h);
|
|
translate([0,-KB_BEAM_WIDTH/2]) {
|
|
cube([cube_length, KB_BEAM_WIDTH, h]);
|
|
}
|
|
translate([cube_length,0]) {
|
|
cylinder(d=KB_BEAM_WIDTH, h=h);
|
|
}
|
|
}
|
|
}
|
|
|
|
function konstrukt_beam_move_holes(len)=[(len-1)*KB_HOLE_SPACING,0];
|
|
|
|
/**
|
|
* Construct object to be substracted from base bean
|
|
* in order to create LEGO Technic compatible hole
|
|
*
|
|
* @param h Height of beam
|
|
**/
|
|
module konstrukt_beam_hole(h=KB_BEAM_HEIGHT) {
|
|
union() {
|
|
cylinder(d=KB_HOLE_RING_DIAMETER, h=KB_HOLE_RING_DEPTH);
|
|
cylinder(d=KB_HOLE_INSIDE_DIAMETER, h=h );
|
|
translate([0,0,h-KB_HOLE_RING_DEPTH])
|
|
cylinder(d=KB_HOLE_RING_DIAMETER, h=KB_HOLE_RING_DEPTH);
|
|
}
|
|
}
|
|
|
|
module konstrukt_beam_holes_straight(n=1,h=KB_BEAM_HEIGHT) {
|
|
for(i=[0:n-1])
|
|
translate([i*KB_HOLE_SPACING,0])
|
|
konstrukt_beam_hole(h);
|
|
}
|