commit 91714c81567d9a92abd5c03b4cb07856ec35e65a Author: Matthew Baggett Date: Thu Aug 19 01:45:53 2021 +0200 Initial commit diff --git a/corner_radiuser.scad b/corner_radiuser.scad new file mode 100644 index 0000000..c9bccbb --- /dev/null +++ b/corner_radiuser.scad @@ -0,0 +1,8 @@ + +module cornerRadiuser(radius=6){ + difference(){ + translate([radius/2,radius/2,0]) + cube([radius,radius,radius*2], center=true); + cylinder(h=(radius*2)+2,r=radius, center=true); + } +} diff --git a/extrusion.scad b/extrusion.scad new file mode 100644 index 0000000..3a41284 --- /dev/null +++ b/extrusion.scad @@ -0,0 +1,100 @@ + +module doubleExtrusion(width,length){ + extraWallWidth = width*0.09; + mirrorCopy([0,1,0]){ + color("orange") + translate([0,(width - extraWallWidth)/2,length/2]) + cube([width/2,extraWallWidth,length], center=true); + } + translate([(width/2),0,0]) + children(); + translate([(width/2)*-1,0,0]) + children(); + +} + + +module extrusion(length=10, outer=40, tSlot=8, gusset=4.5, bore=7){ + translate([0,0,length/2]) + difference(){ + color("orange") + union(){ + // Corners + mirrorCopy([1,0,0]){ + mirrorCopy([0,1,0]){ + difference(){ + union(){ + translate([((outer-(outer-tSlot)/2)/2),(outer-(gusset))/2,0]) + cube([(outer-tSlot)/2, (gusset),length], center=true); + mirror([-1,1,0]) + translate([((outer-(outer-tSlot)/2)/2),(outer-(gusset))/2,0]) + cube([(outer-tSlot)/2, (gusset),length], center=true); + } + difference(){ + translate([((outer-(gusset))/2)+1,((outer-(gusset))/2)+1,0]) + cube([gusset+1,gusset+1,length+2], center=true); + translate([(outer-(gusset*2))/2,(outer-(gusset*2))/2,0]) + cylinder(r=gusset,h=length+4, center=true); + } + + } + + + } + } + + // Crossbar + mirrorCopy(){ + rotate(45) + cube([outer*1.3, gusset, length], center=true); + } + + // Core + cube([bore*2,bore*2,length], center=true); + }; + + union(){ + // Tappable Bore + cylinder(d=bore, h=length+2, center=true); + } + + } +} + +module extrusion80x40(length){ + doubleExtrusion(40,length) + extrusion40x40(length); +} +module extrusion60x30(length){ + doubleExtrusion(30,length) + extrusion30x30(length); +} +module extrusion40x20(length){ + doubleExtrusion(20,length) + extrusion20x20(length); +} + +module extrusion20x20(length) +{ + extrusion(length=length, outer=20,tSlot=5, gusset=1.8, bore=4); +} + +module extrusion30x30(length) +{ + extrusion(length=length, outer=30,tSlot=8, gusset=2.5, bore=7); +} + +module extrusion40x40(length) +{ + extrusion(length=length, outer=40,tSlot=8, gusset=4.5, bore=7); +} +/* +translate([0,0,0])extrusion20x20(10); +translate([0,30,0])extrusion30x30(10); +translate([0,30+40,0])extrusion40x40(10); + +translate([40,0,0])extrusion40x20(10); +translate([60,30,0])extrusion60x30(10); +translate([80,30+40,0])extrusion80x40(10); + +*/ \ No newline at end of file diff --git a/mattlib.scad b/mattlib.scad new file mode 100644 index 0000000..8925596 --- /dev/null +++ b/mattlib.scad @@ -0,0 +1,6 @@ +$fn=360; +include <../Lib/mirrorcopy.scad>; +include <../Lib/extrusion.scad>; +include <../Lib/pcd.scad>; +include <../Lib/metric_bolts.scad>; +include <../Lib/corner_radiuser.scad>; \ No newline at end of file diff --git a/metric_bolts.scad b/metric_bolts.scad new file mode 100644 index 0000000..44a2887 --- /dev/null +++ b/metric_bolts.scad @@ -0,0 +1,71 @@ +module metricBoltHex(mSize, structural=false, recessNut=0, chamfer=false){ + hexDiameter = mSize * (structural?2.0:1.8); + translate([0,0,(mSize*0.7)/2]) + cylinder(d=hexDiameter,h=mSize * 0.7, $fn=6, center=true); + + if(recessNut > 0){ + #translate([0,0,(recessNut/2)*-1]) + cylinder(d=mSize * (structural?2.0:1.8),h=recessNut, $fn=6, center=true); + } + if(chamfer){ + chamferHeight = mSize*1.5*0.595; + translate([0,0,(mSize * 0.7)+(chamferHeight/2)]) + #cylinder(d1=hexDiameter,d2=0,h=chamferHeight, center=true, $fn=6); + } +} + +module metricSocketCap(mSize, length, structural=false,recessCap=0, chamfer=false){ + translate([0,0,(length + ((mSize*1.25)/2))]) + cylinder(d=mSize*1.5,h=mSize*1.25, center=true, $fn=360); + if(recessCap > 0){ + translate([0,0,(length + ((recessCap/2)+(mSize*1.25)))]) + #cylinder(d=mSize*1.5,h=recessCap, center=true, $fn=360); + } + if(chamfer){ + translate([0,0,(length-((mSize*1.5*0.595)/2))]) + #cylinder(d2=mSize*1.5,d1=0,h=mSize*1.5*0.595, center=true, $fn=360); + } +} + +module metricShaft(mSize, length, structural=false){ + translate([0,0,(length/2)]) + cylinder(d=mSize, h=length, center=true, $fn=360); +} + +module metricSocketScrew(mSize, length, structural=false, recessCap=0, chamfer=false){ + metricSocketCap(mSize, length, structural=structural, recessCap=recessCap, chamfer=chamfer); + metricShaft(mSize, length, structural=structural); +} + +module metricCapheadAndBolt(mSize, length=40, structural=false, recessCap=0, recessNut=0, chamfer=false){ + echo (str("Creating a M",mSize, " size, ", length, "mm long caphead and bolt ", chamfer?"with":"without", " chamfering.")); + if(recessCap){ + echo (str("It has a ", recessCap, "mm recessed cap")); + } + if(recessNut){ + echo (str("It has a ", recessCap, "mm recessed nut")); + } + translate([0, 0, mSize * 0.7]) + metricSocketScrew(mSize, length, structural=structural, recessCap=recessCap, chamfer=chamfer); + metricBoltHex(mSize,structural, recessNut=recessNut, chamfer=chamfer); +} + +/* +translate([0,0,0]) +metricCapheadAndBolt(6, 20); + +translate([0,10,0]) +metricCapheadAndBolt(6, 20, recessNut=10, recessCap=10); + +translate([0,20,0]) +metricCapheadAndBolt(6, 20, chamfer=true); + +translate([20,0,0]) +metricCapheadAndBolt(10, 40); + +translate([20,20,0]) +metricCapheadAndBolt(10, 40, recessNut=10, recessCap=10); + +translate([20,40,0]) +metricCapheadAndBolt(10, 40, chamfer=true); +*/ \ No newline at end of file diff --git a/mirrorcopy.scad b/mirrorcopy.scad new file mode 100644 index 0000000..e6d87c2 --- /dev/null +++ b/mirrorcopy.scad @@ -0,0 +1,5 @@ + +module mirrorCopy(vec=[1,0,0]){ + children(); + mirror(vec) children(); +} \ No newline at end of file diff --git a/pcd.scad b/pcd.scad new file mode 100644 index 0000000..725d9d7 --- /dev/null +++ b/pcd.scad @@ -0,0 +1,14 @@ +module pcd(degrees){ + count=360/degrees; + for(i=[1 : count]){ + rotate(degrees*i) + children(); + } +} + +module pcdAtFixedDegrees(degrees){ + for(degree=degrees){ + rotate(degree) + children(); + } +} \ No newline at end of file