Skip to content

Commit 6f2bd0f

Browse files
committed
bug fixes and cleanup
1 parent 6a811ad commit 6f2bd0f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

svg2cookiecutter.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import sys
22
import svgpath.parser as parser
33

4+
# colors: RED = outer wall
5+
# GREEN = inner wall
6+
# BLACK = inside feature (not cutting all the way)
7+
48
PRELIM = """// OpenSCAD file automatically generated by svg2cookiercutter.py
59
// parameters tunable by user
610
wallHeight = 12;
@@ -18,16 +22,18 @@
1822
minFeatureThickness = 1;
1923
maxFeatureThickness = 3;
2024
21-
connectorThickness = 3;
25+
connectorThickness = 1.75;
2226
cuttingTaperHeight = 2.5;
2327
cuttingEdgeThickness = 1.25;
24-
demouldingPlateHeight = 0; // default off
28+
// set to non-zero value to generate a demoulding plate
29+
demouldingPlateHeight = 0;
2530
demouldingPlateSlack = 1.5;
2631
2732
// 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);
3137
3238
size = $OVERALL_SIZE$;
3339
scale = size/$OVERALL_SIZE$;
@@ -52,7 +58,7 @@
5258
translate([0,0,height-cuttingTaperHeight]) cylinder(h=cuttingTaperHeight,d1=thickness,d2=cuttingEdgeThickness);
5359
}
5460
else {
55-
cylinder(h=height,$fn=8);
61+
cylinder(h=height,d=thickness,$fn=8);
5662
}
5763
}
5864
for (i=[1:len(points)-1]) {
@@ -113,7 +119,7 @@ def shapesCode(self):
113119
elif self.hasInnerFlare:
114120
code.append(' innerFlare('+self.pathName+');')
115121
if self.fill:
116-
code.append('fill('+self.pathName+','+self.fillHeight+');')
122+
code.append(' fill('+self.pathName+','+self.fillHeight+');')
117123
return '\n'.join(code) # + '\n'
118124

119125
class OuterWall(Line):

0 commit comments

Comments
 (0)