Skip to content

Commit cfb6e2c

Browse files
committed
foo
1 parent c449309 commit cfb6e2c

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

cookiecutter.inx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
3+
<_name>OpenSCAD Cookie Cutter Export</_name>
4+
<id>mobi.omegacentauri.cookiecutter</id>
5+
<dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
6+
<dependency type="executable" location="extensions">svg2cookiecutter.py</dependency>
7+
<output>
8+
<extension>.scad</extension>
9+
<mimetype>text/plain</mimetype>
10+
<_filetypename>OpenSCAD cookie cutter file (*.scad)</_filetypename>
11+
<_filetypetooltip>Export an OpenSCAD cookie cutter file</_filetypetooltip>
12+
<dataloss>true</dataloss>
13+
</output>
14+
<script>
15+
<command reldir="extensions" interpreter="python">svg2cookiecutter.py</command>
16+
</script>
17+
</inkscape-extension>

svg2cookiecutter.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
PRELIM = """// OpenSCAD file automatically generated by svg2cookiercutter.py
55
wallHeight = 10;
6-
wallBaseWidth = 3;
7-
wallBaseThickness = 1.5;
8-
minWallThickness = 1;
9-
maxWallThickness = 3;
10-
insideWallBaseWidth = 2;
11-
insideWallBaseThickness = 1.5;
12-
minInsideWallThickness = 1;
13-
maxInsideWallThickness = 3;
6+
wallFlareWidth = 3;
7+
wallFlareThickness = 1.5;
8+
minWallWidth = 1;
9+
maxWallWidth = 3;
10+
insideWallFlareWidth = 2;
11+
insideWallFlareThickness = 1.5;
12+
minInsideWallWidth = 1;
13+
maxInsideWallWidth = 3;
1414
featureHeight = 6;
1515
minFeatureThickness = 0.8;
1616
maxFeatureThickness = 3;
17-
featureHolderThickness = 1;
17+
connectorThickness = 1;
1818
size = $OVERALL_SIZE$;
1919
2020
module dummy() {}
@@ -53,19 +53,19 @@ def toCode(self, pathCount):
5353
if not self.base:
5454
code.append('render(convexity=10) linear_extrude(height=('+self.height+')) ribbon('+path+',thickness='+self.width+');')
5555
if self.wall:
56-
baseRibbon = 'render(convexity=10) linear_extrude(height=wallBaseThickness) ribbon('+path+',thickness=wallBaseWidth);'
56+
baseRibbon = 'render(convexity=10) linear_extrude(height=wallFlareThickness) ribbon('+path+',thickness=wallFlareWidth);'
5757
code.append('difference() {')
5858
code.append(' ' + baseRibbon);
59-
code.append(' translate([0,0,-0.01]) linear_extrude(height=wallBaseThickness+0.02) polygon(points='+path+');')
59+
code.append(' translate([0,0,-0.01]) linear_extrude(height=wallFlareThickness+0.02) polygon(points='+path+');')
6060
code.append('}')
6161
elif self.insideWall:
62-
baseRibbon = 'render(convexity=10) linear_extrude(height=insideWallBaseThickness) ribbon('+path+',thickness=insideWallBaseWidth);'
62+
baseRibbon = 'render(convexity=10) linear_extrude(height=insideWallFlareThickness) ribbon('+path+',thickness=insideWallFlareWidth);'
6363
code.append('intersection() {')
6464
code.append(' ' + baseRibbon);
65-
code.append(' translate([0,0,-0.01]) linear_extrude(height=insideWallBaseThickness+0.02) polygon(points='+path+');')
65+
code.append(' translate([0,0,-0.01]) linear_extrude(height=insideWallFlareThickness+0.02) polygon(points='+path+');')
6666
code.append('}')
6767
else:
68-
code.append('render(convexity=10) linear_extrude(height=featureHolderThickness) polygon(points='+path+');')
68+
code.append('render(convexity=10) linear_extrude(height=connectorThickness) polygon(points='+path+');')
6969
return code
7070

7171
def isRed(rgb):
@@ -89,11 +89,11 @@ def svgToCookieCutter(filename, tolerance=0.1, strokeAll = False):
8989
elif strokeAll or path.svgState.stroke is not None:
9090
line.base = False
9191
if isRed(path.svgState.stroke):
92-
line.width = "min(maxWallThickness,max(%.3f,minWallThickness))" % path.svgState.strokeWidth
92+
line.width = "min(maxWallWidth,max(%.3f,minWallWidth))" % path.svgState.strokeWidth
9393
line.height = "wallHeight"
9494
line.wall = True
9595
elif isGreen(path.svgState.stroke):
96-
line.width = "min(maxInsideWallThickness,max(%.3f,minInsideWallThickness))" % path.svgState.strokeWidth
96+
line.width = "min(maxInsideWallWidth,max(%.3f,minInsideWallWidth))" % path.svgState.strokeWidth
9797
line.height = "wallHeight"
9898
line.insideWall = True
9999
else:

0 commit comments

Comments
 (0)