Skip to content

Commit 88fce3b

Browse files
Add files via upload
1 parent 8429cdc commit 88fce3b

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

SCAD/InDrvTriThBolt.scad

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//This is too complex to preview, must full render.
22

3+
//This script creates inside drive triangular thread bolts,
4+
//with simple parameters.
5+
36
//Change the detail based on size as needed. 128 is
47
//good for up to 10mm diameter threads in most cases,
58
//if a bit tighter tolarance is needed go to 256.
@@ -8,28 +11,47 @@
811
detail=128;
912
$fn=detail;
1013

14+
//Some constants used later.
15+
sqrDrive = 4;
16+
triDrive = 3;
17+
hexDrive = 6;
1118

12-
SqrHead(3,3,3);
13-
difference(){
14-
triBolt(13,2.5,0.5);
15-
cylinder(3,r=2.5);
16-
}
17-
//
1819

20+
//Either triDrive (triangle drive) or sqrDrive (square drive)
21+
//is recommended for the drive type, as hex may not hold up
22+
//depending on material and size of bolt.
1923

20-
module SqrHead(h,r,s){
21-
difference(){
22-
ccyl(h,r,0.5);
23-
translate([0,0,h/2])cube([s,s,h], center=true);
24+
//Parameters, set to your bolt:
25+
tol = 0.1; //Spacing tolarance for your printer.
26+
drive = sqrDrive; //Type of drive (inside drive only).
27+
DrvSize = 4; //Size of drive hole in mm.
28+
HeadSz = 4; //Radius of head in mm.
29+
HeadHt = 3; //Height of head.
30+
ThPitch = 0.5; //Thread pitch in mm per thread.
31+
32+
33+
34+
35+
Head(HeadHt,HeadSz,DrvSize);
36+
translate([0,0,HeadHt]) triBolt(10,2.5,ThPitch);
37+
38+
39+
module Head(h,r,s){
40+
difference(){
41+
ccyl(h,r,0.5);
42+
cylinder(h,r=s*cos(180/drive),center=true, $fn=drive);
2443
}
2544
}
2645
//
2746

2847

2948
module triBolt(h,r,tp){
3049
difference(){
31-
ccyl(h,r,0.5);
32-
triThread(h,r,tp);
50+
difference(){
51+
cylinder(h,r=r);
52+
triThread(h,r,tp);
53+
}
54+
cylcamfer(0.5,r,0.5,0,0,h-0.5);
3355
}
3456
}
3557
//
@@ -38,9 +60,10 @@ module triBolt(h,r,tp){
3860
module triThread(h,r,p){
3961
for(hi=[0:p:h]) for(rot= [0:360/detail:360]) {
4062
rotate([0,0,rot])
41-
translate([0,r,(hi-p/2)+((rot%360)/360*p)])
63+
translate([0,r-(p/(1/(tol/2))),(hi-p/2)+((rot%360)/360*p)])
4264
rotate([45,0,0])
43-
cube([r/(detail*0.7),p*0.71,p*0.71], center=true);
65+
//cube([r*0.12,p*0.71,p*0.71], center=true);
66+
cube([r/(detail*0.15),p*0.71,p*0.71], center=true);
4467
}
4568
}
4669
//
@@ -65,4 +88,4 @@ module cylcamfer(h,r,c,px,py,pz){
6588
cylinder(h=h,r1=r,r2=r-c);
6689
}
6790
}
68-
}
91+
}

0 commit comments

Comments
 (0)