forked from GillesBouissac/agentscad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmx-thread.scad
More file actions
133 lines (122 loc) · 3.98 KB
/
mx-thread.scad
File metadata and controls
133 lines (122 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright (c) 2019, Gilles Bouissac
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* Description: Metric screw thread modelisation
* Author: Gilles Bouissac
*/
use <agentscad/lib-screw.scad>
use <agentscad/mx-screw.scad>
// ----------------------------------------
//
// API
//
// ----------------------------------------
// Renders an external thread (for bolts)
module mxThreadExternal ( screw, l=undef, f=true ) { libThreadExternal(screw,l,f); }
// Renders an internal thread (for nuts)
module mxThreadInternal ( screw, l=undef, f=true, t=undef ) { libThreadInternal(screw,l,f,t); }
// Nut with Hexagonal head
module mxNutHexagonalThreaded( screw, bt=true, bb=true ) { libNutHexagonalThreaded(screw,bt,bb); }
// Nut with Square head
module mxNutSquareThreaded( screw, bt=true, bb=true ) { libNutSquareThreaded(screw,bt,bb); }
// Bolt with Hexagonal head
module mxBoltHexagonalThreaded( screw, bt=true, bb=true ) { libBoltHexagonalThreaded(screw,bt,bb); }
// Bolt with Allen head
module mxBoltAllenThreaded( screw, bt=true ) { libBoltAllenThreaded(screw,bt); }
// ----------------------------------------
//
// Showcase
//
// ----------------------------------------
module showName( d, z ) {
%color( "gold" )
translate( [0,-7,z] )
rotate( [90,0,0] )
linear_extrude(0.1)
text( screwGetName(d), halign="center", valign="center", size=2, $fn=100 );
}
module showParts( part=0 ) {
IX=20;
color( "DodgerBlue" )
translate( [50,7,-20] )
rotate( [90,0,0] )
linear_extrude(0.1)
text( "MC MF",halign="center",valign="center",size=10,$fn=100 );
if ( part==0 ) {
s1 = M1_6();
s2 = M5();
s3 = M6(tl=20);
s4 = M10(tl=30);
s5 = M12();
s6 = M22();
translate([0,0,0]) {
mxNutHexagonalThreaded(s1, $fn=50);
showName(s1, -2);
}
translate([15,0,0]) {
mxNutSquareThreaded(s2, $fn=50);
showName(s2, -2);
}
translate([30,0,0]) {
mxBoltHexagonalThreaded(s3, $fn=50);
showName(s3, -7);
}
translate([50,0,0]) {
mxBoltAllenThreaded(s4, $fn=50);
showName(s4, -11);
}
translate([70,0,0]) {
mxThreadInternal(s5, $fn=50);
showName(s5, -2);
}
translate([90,0,0]) {
mxThreadExternal(mxClone(s6,16),$fn=50);
showName(s6, -4);
}
}
if ( part==1 ) {
s1 = M5(tl=20);
translate([0*IX,0,0]) {
mxNutHexagonalThreaded(s1, $fn=100);
showName(s1, -2);
}
translate([1*IX,0,0]) {
mxNutSquareThreaded(s1, $fn=100);
showName(s1, -2);
}
translate([2*IX,0,0]) {
mxBoltHexagonalThreaded(s1, $fn=100);
showName(s1, -7);
}
translate([3*IX,0,0]) {
mxBoltAllenThreaded(s1, $fn=100);
showName(s1, -9);
}
}
if ( part==2 ) {
s1 = M6(tl=20);
translate([0*IX,0,0]) {
mxNutHexagonalThreaded(s1, $fn=100);
showName(s1, -2);
}
translate([1*IX,0,0]) {
mxNutSquareThreaded(s1, $fn=100);
showName(s1, -2);
}
translate([2*IX,0,0]) {
mxBoltHexagonalThreaded(s1, $fn=100);
showName(s1, -9);
}
translate([3*IX,0,0]) {
mxBoltAllenThreaded(s1, $fn=100);
showName(s1, -11);
}
}
}
*
showParts(0);