$fn= 64; // // Convert Inches to Millimeters function Inch(value) = value*25.4; // // Convert Thousenths of an inch to Millimeters function Mil(value) = (value/100)*2.54; // // draw points from the given 3D array // v, the given 3D Array // r, the rotation vector of the font module showPoints(v, fontSize=1.5, r=[0,0,0], extrude=false) { ��������for (i = [0: len(v)-1]) { if (extrude) { ����������������translate(v[i]) color("red") rotate(r) linear_extrude(height=0.01) ����������������text(str(i), font = "Courier New", size=fontSize, halign="center", valign="center"); } else { ����������������translate(v[i]) color("red") rotate(r) ����������������text(str(i), font = "Courier New", size=fontSize, halign="center", valign="center"); } ��������} } // inverted cylinder module cylinderI(r, h) { difference() { translate([-r-0.1, -r-0.1, 0]) cube([r*2+0.2, r*2+0.2, h]); translate([0, 0, -0.1]) cylinder(r=r, h=h+0.2); } } module cylinder90i(r, h, tol=0.01) { difference() { translate([-r-tol, -r-tol, 0]) cube([r+tol+tol, r+tol+tol, h]); translate([0, 0, -tol]) cylinder(r=r, h=h+tol+tol); } } //cylinder90i(1, 10); // module cubeR(args, tol=0.01, FT1=false, FT2=false, FT3=false, FT4=false, BK1=false, BK2=false, BK3=false, BK4=false, L1 =false, L2 =false, L3 =false, L4=false, R1 =false, R2 =false, R3 =false, R4=false, TP1=false, TP2=false, TP3=false, TP4=false, BT1=false, BT2=false, BT3=false, BT4=false) { width = args[0]; height = args[1]; depth = args[2]; rad = args[3]; c = tol; difference() { cube([width, height, depth]); union() { // Front if (FT1||TP3) { translate([0, rad, depth-rad]) rotate([0, 90, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=width+c+c); } if (FT2||R4) { translate([width, 0, 0]) rotate([0, 180, 0]) translate([0, 0, -depth]) translate([rad, rad, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=depth+c+c); } if (FT3||BT1) { translate([0, rad, 0]) rotate([0, 90, 0]) translate([-rad, 0, 0]) rotate([0, 0, 90]) translate([0, 0, -c]) cylinder90i(r=rad, h=width+c+c); } if (FT4||L2) { translate([rad, rad, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=depth+c+c); } // Back if (BK1||TP1) { translate([0, 0, 0]) translate([0, height-rad, depth-rad]) rotate([270, 0, 0]) rotate([0, 90, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=width+c+c); } if (BK2||L4) { translate([0, height, 0]) translate([rad, -rad, 0]) rotate([0, 0, 270]) translate([0, 0, -c]) cylinder90i(r=rad, h=depth+c+c); } if (BK3||BT3) { translate([0, height-rad, 0]) translate([0, 0, rad]) rotate([180, 0, 0]) rotate([0, 90, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=width+c+c); } if (BK4||R2) { translate([width-rad, height-rad, 0]) rotate([0, 0, 180]) translate([0, 0, -c]) cylinder90i(r=rad, h=depth+c+c); } // left if (L1||TP4) { translate([rad, rad, depth-rad]) rotate([0, 90, 0]) translate([0, height-rad, 0]) rotate([90, 0, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=height+c+c); } if (L3||BT4) { translate([rad, rad, rad]) translate([0, height-rad, 0]) rotate([90, 0, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=height+c+c); } // right if (R1||TP2) { translate([width-rad, 0, depth-rad]) rotate([270, 90, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=height+c+c); } if (R3||BT2) { translate([width-rad, 0]) rotate([270, 90, 0]) rotate([0, 0, 90]) translate([0, rad, 0]) translate([0, 0, -c]) cylinder90i(r=rad, h=height+c+c); } } } } // cubeR([10, 10, 10, 1]);