use ; use ; // Width in increments of 15mm width = 60; // [15:15:1500] // Length in increments of 15mm length = 45; // [15:15:1500] // Add holes holes = true; // Align holes X alignX = "center"; // [center, start, end] // Align holes Y alignY = "center"; // [center, start, end] // Height in mm (4 = standard rail) height = 4; // [1:0.5:60] // Flip nut and screw head sides flip = false; // Rotate screw holes (nut pockets) by 30° rotate = false; rail(width, length, h=height, holes=holes, alignX=alignX, alignY=alignY, flip=flip, rotate=rotate); module rail( w = 15, l = 15, h = 4, supports = false, supportWidth = 2, supportHeight = 4, flip = false, // screwGrid holes = false, alignX = "center", alignY = "center", glitch = false, // screw via screwGrid screw, nut1 = true, nut2 = false, rotate = false, screwDiameter = 3.5, nutDiameter = 6.5, nutHeight = 3, taper = 1, // roundcube parameters leftFront, rightFront, rightRear, leftRear, frontBottom, frontTop, rearTop, rearBottom, leftBottom, leftTop, rightTop, rightBottom, left, right, front, rear, bottom, top ) { $fn = 32; e = 0.01; railHeight = 4; holeDistance = 15; screwHoleHeight = 1; cr = 1; // Corner radius for roundcube nutHeight = h - screwHoleHeight; difference() { union() { roundcube( [w, l, h], cr, leftFront=leftFront, rightFront=rightFront, rightRear=rightRear, leftRear=leftRear, frontBottom=frontBottom, frontTop=frontTop, rearTop=rearTop, rearBottom=rearBottom, leftBottom=leftBottom, leftTop=leftTop, rightTop=rightTop, rightBottom=rightBottom, left=left, right=right, front=front, rear=rear, bottom=bottom, top=top ); if (supports) { translate([0, 0, railHeight - cr]) roundcube([supportWidth, l, supportHeight + cr], cr, bottom=false); translate([w - supportWidth, 0, railHeight - cr]) roundcube([supportWidth, l, supportHeight + cr], cr, bottom=false); } } screwGrid( x=w, y=l, holes=holes, alignX=alignX, alignY=alignY, glitch=false, // All following options get passed straight to screw() h=h, screw=screw, nut1=flip ? nut2 : nut1, nut2=flip ? nut1 : nut2, rotate=rotate, screwDiameter=screwDiameter, nutDiameter=nutDiameter, nutHeight=nutHeight, taper=taper ); } }