forked from josefprusa/PrusaMendel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
frame-vertex.scad
177 lines (150 loc) · 4.42 KB
/
frame-vertex.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
// PRUSA Mendel
// Frame vertex
// GNU GPL v2
// Greg Frost
// http://www.reprap.org/wiki/Prusa_Mendel
// http://github.com/prusajr/PrusaMendel
// Based on http://www.thingiverse.com/thing:2003 aka Viks footed
// frame vertex, which is based on http://www.thingiverse.com/thing:1780
// aka Tonokps parametric frame vertex
// Thank you guys for your great work
include <configuration.scad>
basefoot=true;
vertex(with_foot=basefoot);
%import_stl("frame-vertex.stl");
//teardrop();
module teardrop (r=8,h=20)
{
rotate([-270,0,90])
linear_extrude(height=h)
{
circle(r=r);
polygon(points=[[0,0],[r*cos(30),r*sin(30)],[0.5*r,r],[-0.5*r,r],[-r*cos(30),r*sin(30)]],
paths=[[0,1,2,3,4]]);
}
}
vfvertex_height=m8_diameter+4.5;
/**
* @id frame-vertex
* @name Frame vertex
* @category Printed
* @link frame-vertex
* @using 8 m8nut
* @using 8 m8washer
*/
/**
* @id frame-vertex-foot
* @name Frame vertex with foot
* @category Printed
* @link frame-vertex-foot
* @using 8 m8nut
* @using 8 m8washer
*/
hole_separation=58.5;
vertex_end_major_d=30.15;
vertex_end_minor_d=18.5;
vertex_horizontal_hole_offset=11.75;
hole_flat_radius=8.5; // flat surface around holes.
foot_depth=26.25;
end_round_translation=vertex_horizontal_hole_offset-hole_flat_radius;
module vertex(with_foot=true)
{
peg_r=12;
peg1=[hole_separation+vertex_end_major_d/2-peg_r,
vertex_horizontal_hole_offset+hole_flat_radius];
peg2=rotate_vec([hole_separation+vertex_end_major_d/2-peg_r,
-vertex_horizontal_hole_offset-hole_flat_radius],60);
inner_peg_r=12;
peg3=[hole_separation-vertex_end_major_d/2+inner_peg_r,
vertex_horizontal_hole_offset+hole_flat_radius];
peg4=rotate_vec([hole_separation-vertex_end_major_d/2+inner_peg_r,
-vertex_horizontal_hole_offset-hole_flat_radius],60);
a1_r=11;
a2_r=11;
a3_r=3;
a4_r=3;
a1=[hole_separation-vertex_end_major_d/2+a1_r,
vertex_horizontal_hole_offset-hole_flat_radius];
a2=[hole_separation+vertex_end_major_d/2-a2_r,
vertex_horizontal_hole_offset-hole_flat_radius];
a3=[hole_separation-vertex_end_major_d/2+a1_r,-foot_depth+a3_r];
a4=[hole_separation+vertex_end_major_d/2-a2_r,-foot_depth+a4_r];
// translate([-hole_separation-vertex_end_major_d/2,-vertex_horizontal_hole_offset,-vfvertex_height/2])
translate([-18.5,9,0])
difference ()
{
union ()
{
for (hole=[(with_foot?1:0):1])
rotate(hole*60)
translate([hole_separation,end_round_translation-hole*2*end_round_translation,0])
scale([1,(vertex_end_minor_d+2*end_round_translation)/vertex_end_major_d,1])
cylinder(r=vertex_end_major_d/2,h=vfvertex_height);
for (block=[0:1])
rotate(block*60)
translate([hole_separation,
vertex_horizontal_hole_offset-block*2*vertex_horizontal_hole_offset,
vfvertex_height/2])
cube([vertex_end_major_d,
2*hole_flat_radius,vfvertex_height],center=true);
linear_extrude(height=vfvertex_height)
{
// The outer curve.
barbell(peg1,peg2,peg_r,peg_r,200,30);
// The inner curve.
barbell(peg3,peg4,inner_peg_r,inner_peg_r,20,200);
if (with_foot)
{
// Curves for the feet
barbell(a1,a3,a1_r,a3_r,200,20);
barbell(a2,a4,a2_r,a4_r,20,200);
// The flat bit on the bottom of the foot.
polygon(points=[a3+[0,-a3_r],a4+[0,-a4_r],(a3+a4)/2+[0,5]],
paths=[[0,1,2]]);
}
}
}
for (hole=[0:1])
rotate(hole*60)
translate([hole_separation,0,-1])
cylinder(h=vfvertex_height+2,r=(m8_diameter/2));
for (block=[0:1])
rotate(block*60)
translate([hole_separation-vertex_end_major_d/2-1,
vertex_horizontal_hole_offset-2*block*vertex_horizontal_hole_offset,
vfvertex_height/2])
teardrop(r=m8_diameter/2,h=vertex_end_major_d+2);
}
}
module barbell (x1,x2,r1,r2,r3,r4)
{
x3=triangulate (x1,x2,r1+r3,r2+r3);
x4=triangulate (x2,x1,r2+r4,r1+r4);
render()
difference ()
{
union()
{
translate(x1)
circle (r=r1);
translate(x2)
circle(r=r2);
polygon (points=[x1,x3,x2,x4]);
}
translate(x3)
circle(r=r3,$fa=5);
translate(x4)
circle(r=r4,$fa=5);
}
}
function triangulate (point1, point2, length1, length2) =
point1 +
length1*rotated(
atan2(point2[1]-point1[1],point2[0]-point1[0])+
angle(distance(point1,point2),length1,length2));
function distance(point1,point2)=
sqrt((point1[0]-point2[0])*(point1[0]-point2[0])+
(point1[1]-point2[1])*(point1[1]-point2[1]));
function angle(a,b,c) = acos((a*a+b*b-c*c)/(2*a*b));
function rotated(a)=[cos(a),sin(a),0];
function rotate_vec(v,a)=[cos(a)*v[0]-sin(a)*v[1],sin(a)*v[0]+cos(a)*v[1]];