extension: save as SVG
extension: save as SVG
I am trying to write an extension that will save the selected as an SVG. I have been trying to find an example of scripting a "save as" call. I have had little luck. does anyone have an example of doing a save as svg with python?
Re: extension: save as SVG
There is some documentation on the website, and you can email the developers mailing list or come chat on IRC for help. Forum users aren't usually developers so I don't know har far you can get here with this.
just hand over the chocolate and nobody gets hurt
Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download
Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download
Re: extension: save as SVG
You can export to plain SVG ( -l, --export-plain-svg=FILENAME, see https://inkscape.org/en/doc/inkscape-man.html), or use the development version that supports saving as Inkscape SVG also (see http://wiki.inkscape.org/wiki/index.php ... mmand_Line).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: extension: save as SVG
Or you can use Xverbs in current Inkscape: http://wiki.inkscape.org/wiki/index.php/Using_xverbs
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: extension: save as SVG
I want to do the save while the file is open. is that possible with xverb? I thought it was a command line utility. this is what I have so far but it does not create a working svg file.
Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import inkex # Required
class MyExtensionName(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option('-x', '--something', action='store', type='string', dest='optionName',
default='defaultvalue', help='Helper text for this option')
def effect(self):
option = self.options.optionName
self._main_function(option)
def _main_function(self, option):
svg = self.document.getroot()
f=open("C:\Users\casey\export.svg","w+")
f.write(str(svg))
if __name__ == '__main__':
MyExtension = MyExtensionName()
MyExtension.affect()
Re: extension: save as SVG
Via extensions, it's possible to call a second Inkscape instance that works on the open file. You can do anything with it that you can do with Inkscape command line.
See for example https://gitlab.com/su-v/inx-pathops/blo ... ps.py#L178 .
See for example https://gitlab.com/su-v/inx-pathops/blo ... ps.py#L178 .
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)