Revising metric_bolts to be centered
This commit is contained in:
parent
9d7a52b24d
commit
0ed0f10a81
1 changed files with 39 additions and 18 deletions
|
@ -1,17 +1,26 @@
|
||||||
|
capSizeMSizeMultiplier = 1.66*1.01;
|
||||||
|
printingKerfMM = 0.6;
|
||||||
|
circleFacets = 60;
|
||||||
|
boltColour = "LightSkyBlue";
|
||||||
|
boltClearanceColour = "LightSteelBlue";
|
||||||
|
|
||||||
module metricBoltHex(mSize, structural=false, recessNut=0, chamfer=false){
|
module metricBoltHex(mSize, structural=false, recessNut=0, chamfer=false){
|
||||||
// Hex diameter = mSize * 1.8, (or 2.0 if structural
|
// Hex diameter = mSize * 1.8, (or 2.0 if structural
|
||||||
// We add 1% to make the hex slip in better
|
// We add 1% to make the hex slip in better
|
||||||
hexDiameter = mSize * (structural?2.0:1.8) * 1.01;
|
hexDiameter = (mSize * (structural?2.0:1.8) * 1.01) + printingKerfMM;
|
||||||
|
|
||||||
|
color(boltColour)
|
||||||
translate([0,0,(mSize*0.7)/2])
|
translate([0,0,(mSize*0.7)/2])
|
||||||
cylinder(d=hexDiameter,h=mSize * 0.7, $fn=6, center=true);
|
cylinder(d=hexDiameter,h=mSize * 0.7, $fn=6, center=true);
|
||||||
|
|
||||||
if(recessNut > 0){
|
if(recessNut > 0){
|
||||||
|
color(boltClearanceColour)
|
||||||
translate([0,0,(recessNut/2)*-1])
|
translate([0,0,(recessNut/2)*-1])
|
||||||
cylinder(d=mSize * (structural?2.0:1.8),h=recessNut, $fn=6, center=true);
|
cylinder(d=hexDiameter,h=recessNut, $fn=6, center=true);
|
||||||
}
|
}
|
||||||
if(chamfer){
|
if(chamfer){
|
||||||
chamferHeight = mSize*1.5*0.595;
|
chamferHeight = mSize*1.5*0.595;
|
||||||
|
color(boltClearanceColour)
|
||||||
translate([0,0,(mSize * 0.7)+(chamferHeight/2)])
|
translate([0,0,(mSize * 0.7)+(chamferHeight/2)])
|
||||||
cylinder(d1=hexDiameter,d2=0,h=chamferHeight, center=true, $fn=6);
|
cylinder(d1=hexDiameter,d2=0,h=chamferHeight, center=true, $fn=6);
|
||||||
}
|
}
|
||||||
|
@ -20,23 +29,28 @@ module metricBoltHex(mSize, structural=false, recessNut=0, chamfer=false){
|
||||||
module metricSocketCap(mSize, length, structural=false,recessCap=0, chamfer=false){
|
module metricSocketCap(mSize, length, structural=false,recessCap=0, chamfer=false){
|
||||||
//cap size = M number * 1.5.
|
//cap size = M number * 1.5.
|
||||||
// We add 1% to make the cap head spin nicely in the hole.
|
// We add 1% to make the cap head spin nicely in the hole.
|
||||||
capSize = mSize * 1.5 * 1.01;
|
capSize = (mSize * capSizeMSizeMultiplier) + printingKerfMM;
|
||||||
|
|
||||||
translate([0,0,(length + ((mSize*1.25)/2))])
|
color(boltColour)
|
||||||
cylinder(d=capSize,h=mSize*1.25, center=true, $fn=360);
|
translate([0,0,(length + ((mSize*1.25)/2))])
|
||||||
|
cylinder(d=capSize,h=mSize*1.25, center=true, $fn=circleFacets);
|
||||||
|
echo (str("cap size is ", capSize));
|
||||||
if(recessCap > 0){
|
if(recessCap > 0){
|
||||||
|
color(boltClearanceColour)
|
||||||
translate([0,0,(length + ((recessCap/2)+(mSize*1.25)))])
|
translate([0,0,(length + ((recessCap/2)+(mSize*1.25)))])
|
||||||
cylinder(d=mSize*1.5,h=recessCap, center=true, $fn=360);
|
cylinder(d=capSize,h=recessCap, center=true, $fn=circleFacets);
|
||||||
}
|
}
|
||||||
if(chamfer){
|
if(chamfer){
|
||||||
|
color(boltClearanceColour)
|
||||||
translate([0,0,(length-((mSize*1.5*0.595)/2))])
|
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);
|
cylinder(d2=capSize,d1=0,h=mSize*1.5*0.595, center=true, $fn=circleFacets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module metricShaft(mSize, length, structural=false){
|
module metricShaft(mSize, length, structural=false){
|
||||||
translate([0,0,(length/2)])
|
color(boltColour)
|
||||||
cylinder(d=mSize, h=length+0.01, center=true, $fn=360);
|
translate([0,0,(length/2)])
|
||||||
|
cylinder(d=mSize+printingKerfMM, h=length+0.01, center=true, $fn=circleFacets);
|
||||||
}
|
}
|
||||||
|
|
||||||
module metricSocketScrew(mSize, length, structural=false, recessCap=0, chamfer=false){
|
module metricSocketScrew(mSize, length, structural=false, recessCap=0, chamfer=false){
|
||||||
|
@ -45,23 +59,30 @@ module metricSocketScrew(mSize, length, structural=false, recessCap=0, chamfer=f
|
||||||
}
|
}
|
||||||
|
|
||||||
module metricCapheadAndBolt(mSize, length=40, structural=false, recessCap=0, recessNut=0, chamfer=false){
|
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."));
|
capSize = (mSize * capSizeMSizeMultiplier) + printingKerfMM;
|
||||||
|
|
||||||
|
echo (str("Creating a M",mSize, " size, ", length, "mm long bolt with a ", capSize, "mm wide caphead and bolt ", chamfer?"with":"without", " chamfering."));
|
||||||
if(recessCap){
|
if(recessCap){
|
||||||
echo (str("It has a ", recessCap, "mm recessed cap"));
|
echo (str("It has a ", recessCap, "mm recessed cap"));
|
||||||
}
|
}
|
||||||
if(recessNut){
|
if(recessNut){
|
||||||
echo (str("It has a ", recessCap, "mm recessed nut"));
|
echo (str("It has a ", recessCap, "mm recessed nut"));
|
||||||
}
|
}
|
||||||
translate([0, 0, 0])
|
translate([0,0,((length/2)+((mSize*1.25)/2))*-1])
|
||||||
metricSocketScrew(mSize, length, structural=structural, recessCap=recessCap, chamfer=chamfer);
|
union(){
|
||||||
metricBoltHex(mSize,structural, recessNut=recessNut, chamfer=chamfer);
|
translate([0, 0, 0])
|
||||||
|
metricSocketScrew(mSize, length, structural=structural, recessCap=recessCap, chamfer=chamfer);
|
||||||
|
metricBoltHex(mSize,structural, recessNut=recessNut, chamfer=chamfer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**/
|
||||||
|
translate([0,10,0])
|
||||||
|
metricCapheadAndBolt(6, 40);
|
||||||
|
|
||||||
translate([0,0,0])
|
translate([20,10,0])
|
||||||
metricCapheadAndBolt(8, 40);
|
metricCapheadAndBolt(6, 40, recessNut=1, recessCap=1, chamfer=true);
|
||||||
translate([10,0,0])
|
/**/
|
||||||
cylinder(h=40,d=1);
|
|
||||||
/*
|
/*
|
||||||
translate([0,10,0])
|
translate([0,10,0])
|
||||||
metricCapheadAndBolt(6, 20, recessNut=10, recessCap=10);
|
metricCapheadAndBolt(6, 20, recessNut=10, recessCap=10);
|
||||||
|
|
Loading…
Reference in a new issue