@@ -12,6 +12,10 @@ basicPolyRoundExample();
12
12
// radiusExtrudeExample();
13
13
// polyRoundExtrudeExample();
14
14
15
+
16
+ // testing
17
+ // testGeometries();
18
+
15
19
module basicPolyRoundExample(){
16
20
// polyLine is a dev helper. Aim is to show the points of the polygon and their order before
17
21
// you're ready to move on to polyRound and a polygon
@@ -122,8 +126,8 @@ module translateRadiiPointsExample() {
122
126
123
127
module 2dShellExample(){
124
128
radiiPoints= [[- 4 ,0 ,1 ],[5 ,3 ,1.5 ],[0 ,7 ,0.1 ],[8 ,7 ,10 ],[20 ,20 ,0.8 ],[10 ,0 ,10 ]];
125
- shell2d(- 0.5 )polygon(polyRound(radiiPoints,30 ));
126
- translate ([0 ,- 10 ,0 ])shell2d(- 0.5 ){
129
+ linear_extrude( 1 ) shell2d(- 0.5 )polygon(polyRound(radiiPoints,30 ));
130
+ translate ([0 ,- 10 ,0 ])linear_extrude( 1 ) shell2d(- 0.5 ){
127
131
polygon(polyRound(radiiPoints,30 ));
128
132
translate ([8 ,8 ])gridpattern(memberW = 0.3 , sqW = 1 , iter = 17 , r = 0.2 );
129
133
}
@@ -136,40 +140,40 @@ module beamChainExample(){
136
140
translate ([0 ,0 ,0 ]){
137
141
radiiPoints= beamPoints(0 ,0 );
138
142
for (i= [0 : len(radiiPoints)- 1 ]){color ("red" )translate ([radiiPoints[i].x,radiiPoints[i].y,0 ])cylinder (d= 0.2 , h= 1 );}
139
- polygon(polyRound(beamChain(radiiPoints,offset1= 0.02 , offset2=- 0.02 ),20 ));
143
+ linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1= 0.02 , offset2=- 0.02 ),20 ));
140
144
}
141
145
142
146
143
147
// Add some radii to the line transitions
144
148
translate ([0 ,- 7 ,0 ]){
145
149
radiiPoints= beamPoints(2 ,1 );
146
150
for (i= [0 : len(radiiPoints)- 1 ]){color ("red" )translate ([radiiPoints[i].x,radiiPoints[i].y,0 ])cylinder (d= 0.2 , h= 1 );}
147
- polygon(polyRound(beamChain(radiiPoints,offset1= 0.02 , offset2=- 0.02 ),20 ));
151
+ linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1= 0.02 , offset2=- 0.02 ),20 ));
148
152
}
149
153
150
154
// Give make the lines beams with some thickness
151
155
translate ([0 ,- 7 * 2 ,0 ]){
152
156
radiiPoints= beamPoints(2 ,1 );
153
- polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 ),20 ));
157
+ linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 ),20 ));
154
158
}
155
159
156
160
// Add an angle to the start of the beam
157
161
translate ([0 ,- 7 * 3 ,0 ]){
158
162
radiiPoints= beamPoints(2 ,1 );
159
- polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 , startAngle= 45 ),20 ));
163
+ linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 , startAngle= 45 ),20 ));
160
164
}
161
165
162
166
// Put a negative radius at the start for transationing to a flat surface
163
167
translate ([0 ,- 7 * 4 ,0 ]){
164
168
radiiPoints= beamPoints(2 ,1 ,rStart=- 0.7 );
165
- polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 , startAngle= 45 ),20 ));
169
+ linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1= 0.5 , offset2=- 0.5 , startAngle= 45 ),20 ));
166
170
}
167
171
168
172
// Define more points for a polygon to be atteched to the end of the beam chain
169
173
clipP= [[16 ,1.2 ,0 ],[16 ,0 ,0 ],[16.5 ,0 ,0 ],[16.5 ,1 ,0.2 ],[17.5 ,1 ,0.2 ],[17.5 ,0 ,0 ],[18 ,0 ,0 ],[18 ,1.2 ,0 ]];
170
174
translate ([- 15 ,- 7 * 5 + 3 ,0 ]){
171
175
for (i= [0 :len(clipP)- 1 ]){color ("red" )translate ([clipP[i].x,clipP[i].y,0 ])cylinder (d= 0.2 , h= 1 );}
172
- polygon(polyRound(clipP,20 ));
176
+ linear_extrude( 1 ) polygon(polyRound(clipP,20 ));
173
177
}
174
178
175
179
// Attached to the end of the beam chain by dividing the beam paths in forward and return and
@@ -179,7 +183,7 @@ module beamChainExample(){
179
183
forwardPath= beamChain(radiiPoints,offset1= 0.5 ,startAngle=- 15 ,mode= 2 );
180
184
returnPath= revList(beamChain(radiiPoints,offset1=- 0.5 ,startAngle=- 15 ,mode= 2 ));
181
185
entirePath= concat(forwardPath,clipP,returnPath);
182
- polygon(polyRound(entirePath,20 ));
186
+ linear_extrude( 1 ) polygon(polyRound(entirePath,20 ));
183
187
}
184
188
185
189
// Add transitioning radii into the end polygong
@@ -188,13 +192,13 @@ module beamChainExample(){
188
192
forwardPath= beamChain(radiiPoints,offset1= 0.5 ,startAngle=- 15 ,mode= 2 );
189
193
returnPath= revList(beamChain(radiiPoints,offset1=- 0.5 ,startAngle=- 15 ,mode= 2 ));
190
194
entirePath= concat(forwardPath,clipP,returnPath);
191
- polygon(polyRound(entirePath,20 ));
195
+ linear_extrude( 1 ) polygon(polyRound(entirePath,20 ));
192
196
}
193
197
194
198
// Define multiple shells from the the one set of points
195
199
translate ([0 ,- 7 * 9 ,0 ]){
196
200
radiiPoints= beamPoints(2 ,1 ,rEnd= 3 );
197
- for (i= [0 :2 ]){polygon(polyRound(beamChain(radiiPoints,offset1=- 1 + i* 0.4 , offset2=- 1 + i* 0.4 + 0.25 ),20 ));}
201
+ for (i= [0 :2 ]){linear_extrude( 1 ) polygon(polyRound(beamChain(radiiPoints,offset1=- 1 + i* 0.4 , offset2=- 1 + i* 0.4 + 0.25 ),20 ));}
198
202
}
199
203
}
200
204
@@ -225,3 +229,32 @@ module gridpattern(memberW = 4, sqW = 12, iter = 5, r = 3){
225
229
}
226
230
}
227
231
}
232
+
233
+
234
+ module testGeometries() {
235
+ // Check these shapen preview (plus "thrown together") and render correctly with each PR
236
+ points = [
237
+ [0 , 10 , 5 ],
238
+ [10 , 0 , 5 ],
239
+ [0 , - 10 , 5 ],
240
+ [- 10 , 0 , 5 ],
241
+ ];
242
+ reversedPoints = [
243
+ [- 10 , 0 , 5 ],
244
+ [0 , - 10 , 5 ],
245
+ [10 , 0 , 5 ],
246
+ [0 , 10 , 5 ],
247
+ ];
248
+ polyRoundExtrudeTestShape(points);
249
+ translate ([0 ,20 ,0 ])polyRoundExtrudeTestShape(reversedPoints);
250
+
251
+ }
252
+
253
+ module polyRoundExtrudeTestShape(points) {
254
+ // make sure no faces are inverted
255
+ difference () {
256
+ translate ([0 , 0 , - 2.5 ]) polyRoundExtrude(points,r1=- 1 ,r2= 1 );
257
+ sphere (d= 9 );
258
+ translate ([0 ,0 ,7 ])sphere (d= 9 );
259
+ }
260
+ }
0 commit comments