I'm running into trouble writing my modified svg back for inkscape to use. I've tried writing the svg to stdout (using Console.Write) and also back to the original tmp-file, but neither has any effect on what I see inside Inkscape.
I have a couple of suspicions so far, but am interested in any other ideas about what might be wrong here:
1) I haven't correctly linked inkscape to my program with the .inx file: I have a program element with no interpreter attribute (this element contains my executable's name). I've also tried declaring the interpreter as powershell, which didn't seem to help.
2) Inkscape is looking for some specific formatting on the output before it is accepted. Can't find whether there is any important header or trailing data to add, or if the svg should be different in any other way from what I'm reading in.
In case this helps, here's my .inx file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>spPart</_name>
<id>com.sugarpillstudios.spPart</id>
<param name="number" type="int" min="1" max="1000" _gui-text="Number of copies:">2</param>
<param name="horizontal" type="float" min="-10000.0" max="10000.0" _gui-text="X Offset:">0.0</param>
<param name="vertical" type="float" min="-10000.0" max="10000.0" _gui-text="Y Offset:">0.0</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="SugarPills"/>
</effects-menu>
</effect>
<script>
<command reldir="extensions" interpreter="powershell">./spPartInkExt.exe</command>
</script>
</inkscape-extension>
and here's a log of what my program is reading and writing (it's just removing the rectangle at the end):
Code: Select all
ARGS:
--number=2
--horizontal=100
--vertical=0
C:\Users\Gary\AppData\Local\Temp\ink_ext_XXXXXX.svg7GKO4V
INPUT:
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="C:\Users\Gary\AppData\Local\Temp\ink_ext_XXXXXX.svgN29T4V" inkscape:version="0.48.1 " version="1.1" id="svg2" height="1052.3622047" width="744.09448819">
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="375" inkscape:cy="520" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="469" inkscape:window-height="485" inkscape:window-x="175" inkscape:window-y="175" inkscape:window-maximized="0" />
<defs id="defs4" />
<metadata id="metadata7">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
<rect y="289.50504" x="88.571426" height="105.71429" width="80" id="rect2985" style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.5, 0.5;stroke-dashoffset:0" />
<path inkscape:transform-center-y="-14.319871" inkscape:transform-center-x="-1.0149688" d="m 451.42857,652.36216 -93.07083,-51.39441 -95.10075,47.53324 20.11852,-104.39736 -74.59455,-75.75762 105.50476,-13.1267 48.99879,-94.35403 45.087,96.28462 104.87747,17.44362 -77.63946,72.63387 z" inkscape:randomized="0" inkscape:rounded="0" inkscape:flatsided="false" sodipodi:arg2="1.5913129" sodipodi:arg1="0.96299433" sodipodi:r2="80.051003" sodipodi:r1="160.10201" sodipodi:cy="520.93359" sodipodi:cx="360" sodipodi:sides="5" id="path2987" style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.5, 0.5;stroke-dashoffset:0" sodipodi:type="star" transform="translate(97.142857,-8.5714286)" />
</g>
</svg>
OUTPUT:
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="C:\Users\Gary\AppData\Local\Temp\ink_ext_XXXXXX.svgN29T4V" inkscape:version="0.48.1 " version="1.1" id="svg2" height="1052.3622047" width="744.09448819">
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="375" inkscape:cy="520" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="469" inkscape:window-height="485" inkscape:window-x="175" inkscape:window-y="175" inkscape:window-maximized="0" />
<defs id="defs4" />
<metadata id="metadata7">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
<path inkscape:transform-center-y="-14.319871" inkscape:transform-center-x="-1.0149688" d="m 451.42857,652.36216 -93.07083,-51.39441 -95.10075,47.53324 20.11852,-104.39736 -74.59455,-75.75762 105.50476,-13.1267 48.99879,-94.35403 45.087,96.28462 104.87747,17.44362 -77.63946,72.63387 z" inkscape:randomized="0" inkscape:rounded="0" inkscape:flatsided="false" sodipodi:arg2="1.5913129" sodipodi:arg1="0.96299433" sodipodi:r2="80.051003" sodipodi:r1="160.10201" sodipodi:cy="520.93359" sodipodi:cx="360" sodipodi:sides="5" id="path2987" style="fill:none;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.5, 0.5;stroke-dashoffset:0" sodipodi:type="star" transform="translate(97.142857,-8.5714286)" />
</g>
</svg>
Let me know, if you have any ideas or suggestion for how I might fix or further inspect what is happening here. Thanks in advance.