-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil.scad
187 lines (174 loc) · 4.71 KB
/
util.scad
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
include <Measured_numbers.scad>
// Threadless M3 screw with hex head
// h: height (length) of the screw
// head_height: for custom head heights. Doesn't affect overall height
// updown: put head at other end
// center: translate cylinder so that mass centrum is in origo
module M3_screw(h, head_height=M3_head_height,
updown=false, center=false){
color("grey"){
if(center){
translate([0,0,-h/2])
cylinder(r=M3_diameter/2, h=h);
if(updown){
translate([0,0,h/2-head_height])
cylinder(r=M3_head_diameter/2, h=head_height, $fn=6);
}else{
translate([0,0,-h/2])
cylinder(r=M3_head_diameter/2, h=head_height, $fn=6);
}
}else{
cylinder(r=M3_diameter/2, h=h);
if(updown){
translate([0,0,h-head_height])
cylinder(r=M3_head_diameter/2, h=head_height, $fn=6);
}else{
cylinder(r=M3_head_diameter/2, h=head_height, $fn=6);
}
}
}// end of color
}
//M3_screw(10, center=true, updown=true);
module Nema17_screw_translate(){
for (i=[0:90:359]){
rotate([0,0,i+45]) translate([Nema17_screw_hole_width/2,0,0]) children();
}
}
module Nema17_screw_holes(r, h){
Nema17_screw_translate() cylinder(r=r, h=h);
}
//Nema17_screw_holes(M3_diameter/2, 15);
module Nema17_screw_holes_2d(r=1.5){
Nema17_screw_translate() circle(r=r);
}
//Nema17_screw_holes(M3_diameter, 15);
module Nema17(){
cw = Nema17_cube_width;
ch = Nema17_cube_height;
sh = Nema17_shaft_height;
union(){
color("black")
difference(){
translate([-(cw-0.1)/2,-(cw-0.1)/2,1]) cube([cw-0.1,cw-0.1,ch-2]);
for (i=[0:90:359]){ // Corner cuts black cube
rotate([0,0,i+45]) translate([50.36/2,-cw/2,-1]) cube([cw,cw,ch+2]);
}
}
color("silver")
difference(){
translate([-cw/2,-cw/2,0]) cube([cw,cw,ch]);
for (i=[0:90:359]){ // Corner cuts silver cube
rotate([0,0,i+45]) translate([53.36/2,-cw/2,-1]) cube([cw,cw,ch+2]);
}
translate([0,0,ch-5]) Nema17_screw_holes(M3_diameter/2, h=10);
translate([0,0,-5]) Nema17_screw_holes(M3_diameter/2, h=10);
translate([-cw,-cw,9]) cube([2*cw,2*cw,ch-18]);
}
color("silver")
difference(){
cylinder(r=Nema17_ring_radius, h=ch+Nema17_ring_height);
translate([0,0,1]) cylinder(r=8.76/2, h=ch+Nema17_ring_height);
}
color("silver")
cylinder(r=5/2, h=sh);
}
}
//Nema17();
module Bearing(outer_r, inner_r, h, center=false){
color("blue")
difference(){
cylinder(r=outer_r, h=h, center=center);
translate([0,0,-3])
cylinder(r=inner_r, h=h+6, center=center);
}
}
module Bearing_608(center=false){
Bearing(Bearing_608_outer_radius, Bearing_608_bore_radius, Bearing_608_width, center=center);
}
//Bearing_608();
module Bearing_623(center=false){
Bearing(Bearing_623_outer_radius, Bearing_623_bore_radius, Bearing_623_width, center=center);
}
//Bearing_623();
// Used for rendering a shadow of printers outer dimensions
module Meas_cube(){
translate([-Cube_X_length/2,0,0])
%cube([Cube_X_length, Cube_Y_length, Cube_Z_length]);
}
//Meas_cube();
// Works with both vector[2] and scalar type of s
module Rounded_square(s, r){
if(len(s) == undef){
// The circles
for(k = [[r,r],[s-r,r],[s-r,s-r],[r,s-r]])
translate(k)
circle(r);
// The squares
translate([r,0])
square([s-2*r, s]);
translate([0,r])
square([s, s-2*r]);
}else if(len(s) ==2){
// The circles
for(k = [[r,r],[s[0]-r,r],[s[0]-r,s[1]-r],[r,s[1]-r]])
translate(k)
circle(r);
// The squares
translate([r,0])
square([s[0]-2*r, s[1]]);
translate([0,r])
square([s[0], s[1]-2*r]);
}
}
module LM8UU(){
color("grey")
difference(){
cylinder(r = LM8UU_big_r, h = LM8UU_length);
translate([0,0,-1])
cylinder(r = LM8UU_small_r, h = LM8UU_length+2);
}
}
//LM8UU();
module Hose_clamp1(h, r){
big = 100;
difference(){
union(){
cylinder(r = r, h = h);
translate([0,-2,0])
cube([r+3, 4, h]);
}
translate([0,0,-1])
cylinder(r = r-0.8, h = h+2);
translate([0,-1,-1])
cube([big, 2, h+2]);
}
}
//Hose_clamp1();
module Hose_clamp(h, r, th=0.8, jacks=true){
big = 100;
flerp = 10;
color("lightgrey")
difference(){
union(){
cylinder(r = r, h = h);
translate([0,-2,0])
cube([r+5, 4, h]);
rotate([0,0,-15])
translate([r-th,-flerp,0])
cube([th, flerp, h]);
}
translate([0,0,-1])
cylinder(r = r-th, h = h+2);
if(jacks){
for(i=[0:100/r:360]){
rotate([0,0,i])
translate([0,0,h/4])
cube([r+3,0.5,h/2]);
}
}
translate([r+1, 5, h/2])
rotate([90,0,0])
M3_screw(16, updown=true);
}
}
//Hose_clamp(h=8, r=LM8UU_big_r+2);