|
1 | 1 | import sys |
2 | 2 | import svgpath.parser as parser |
3 | 3 |
|
| 4 | +# colors: RED = outer wall |
| 5 | +# GREEN = inner wall |
| 6 | +# BLACK = inside feature (not cutting all the way) |
| 7 | + |
4 | 8 | PRELIM = """// OpenSCAD file automatically generated by svg2cookiercutter.py |
5 | 9 | // parameters tunable by user |
6 | 10 | wallHeight = 12; |
|
18 | 22 | minFeatureThickness = 1; |
19 | 23 | maxFeatureThickness = 3; |
20 | 24 |
|
21 | | -connectorThickness = 3; |
| 25 | +connectorThickness = 1.75; |
22 | 26 | cuttingTaperHeight = 2.5; |
23 | 27 | cuttingEdgeThickness = 1.25; |
24 | | -demouldingPlateHeight = 0; // default off |
| 28 | +// set to non-zero value to generate a demoulding plate |
| 29 | +demouldingPlateHeight = 0; |
25 | 30 | demouldingPlateSlack = 1.5; |
26 | 31 |
|
27 | 32 | // sizing |
28 | | -function featureThickness(t) = min(maxFeatureThickness, max(t,minFeatureThickness)) ; |
29 | | -function wallThickness(t) = min(maxWallThickness, max(t,minWallThickness)) ; |
30 | | -function insideWallThickness(t) = min(maxInsideWallThickness,max(t,minInsideWallThickness)) ; |
| 33 | +function clamp(t,minimum,maximum) = min(maximum,max(t,minimum)); |
| 34 | +function featureThickness(t) = clamp(t,minFeatureThickness,maxFeatureThickness); |
| 35 | +function wallThickness(t) = clamp(t,minWallThickness,maxWallThickness); |
| 36 | +function insideWallThickness(t) = clamp(t,minInsideWallThickness,maxInsideWallThickness); |
31 | 37 |
|
32 | 38 | size = $OVERALL_SIZE$; |
33 | 39 | scale = size/$OVERALL_SIZE$; |
|
52 | 58 | translate([0,0,height-cuttingTaperHeight]) cylinder(h=cuttingTaperHeight,d1=thickness,d2=cuttingEdgeThickness); |
53 | 59 | } |
54 | 60 | else { |
55 | | - cylinder(h=height,$fn=8); |
| 61 | + cylinder(h=height,d=thickness,$fn=8); |
56 | 62 | } |
57 | 63 | } |
58 | 64 | for (i=[1:len(points)-1]) { |
@@ -113,7 +119,7 @@ def shapesCode(self): |
113 | 119 | elif self.hasInnerFlare: |
114 | 120 | code.append(' innerFlare('+self.pathName+');') |
115 | 121 | if self.fill: |
116 | | - code.append('fill('+self.pathName+','+self.fillHeight+');') |
| 122 | + code.append(' fill('+self.pathName+','+self.fillHeight+');') |
117 | 123 | return '\n'.join(code) # + '\n' |
118 | 124 |
|
119 | 125 | class OuterWall(Line): |
|
0 commit comments