This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz_next_gen.inx

63 lines
4.5 KiB
Plaintext
Raw Normal View History

2020-07-30 01:16:18 +02:00
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>NextGenerator</name>
<id>fablabchemnitz.de.nextgenerator</id>
<param name="tab" type="notebook">
<page name="config" gui-text="Options">
<label appearance="header">Input options</label>
<param gui-text="CSV file:" gui-description="A file with comma-separated values, one line per exported file. The first line contains the column names. Put quotation marks around your variables if they contain a comma." name="csv_file" type="path" mode="file" filetypes="csv">/path/to/file.csv</param>
2020-08-07 20:19:46 +02:00
<spacer/>
2020-07-30 01:16:18 +02:00
<label>Non-text values to replace (see Help tab):</label>
2020-08-07 20:19:46 +02:00
<param name="extra-vars" type="string" gui-text=""/>
<spacer/>
<separator/>
<spacer/>
2020-07-30 01:16:18 +02:00
<label appearance="header">Output options</label>
<param name="format" type="optiongroup" appearance="combo" gui-text="Export file format:">
<option value="png">PNG</option>
<option value="pdf">PDF</option>
<option value="svg">SVG</option>
<option value="ps">PS</option>
<option value="eps">EPS</option>
</param>
<param gui-text="DPI (for PNG and filters):" gui-description="The resolution for your exported raster images" name="dpi" type="int" min="1" max="10000">300</param>
2020-08-07 20:19:46 +02:00
<param gui-text="File name pattern:" gui-description="The pattern for the names of the generated files. It should contain at least one unique column variable (in the form of '%VAR_my_variablename%'), or a unique combination of column variables, so new files won't overwrite those that have already been generated. Do not include the file extension, it will be added automatically." name="file_pattern" type="string">%VAR_my_variablename%</param>
2020-07-30 01:16:18 +02:00
<param gui-text="Save in:" gui-description="The name of the folder where the generated images should be saved" name="output_folder" type="path" mode="folders">/tmp</param>
</page>
<page name="help" gui-text="Help">
<label appearance="header">Replacing text</label>
<label xml:space="preserve">
In your SVG file, create any texts that you want to replace by clicking (not clicking and dragging) on the canvas. If you want to limit the width of the text, use the diamond-shaped handle at the end of the first line to indicate a maximum width. The text will auto-flow into the next line if it is longer. Make sure there is enough space for your texts.
2020-08-07 20:19:46 +02:00
As (or into) the text, type '%VAR_my_variablename%' (without the quotes) as a placeholder, where 'my_variablename' is the title of the corresponding column in your CSV data file.
2020-07-30 01:16:18 +02:00
</label>
<label appearance="header">Replacing attributes</label>
<label xml:space="preserve">If you want to replace attribute values in your SVG file (e.g. a color, or the name of a linked image file), you can assign them to columns in the field labeled "Non-text values to replace" in JSON format like this (no linebreaks allowed):
{"background_color":"#ff0000", "photo":"image.png"}
All objects that use the red color (#ff0000) will then be exported using the colors in the column 'background_color'. The linked image 'image.png' will be replaced by the image files listed in the column 'photo' (make sure to replace the complete image path).
</label>
</page>
<page name="about" gui-text="About">
<label appearance="header">NextGenerator</label>
<label indent="1">Version 0.8</label>
2020-08-07 20:19:46 +02:00
<spacer/>
2020-07-30 01:16:18 +02:00
<label xml:space="preserve">An Inkscape extension to automatically replace values (text, attribute values) in an SVG file and to then export the result to various file formats. This is useful e.g. for generating images for name badges and other similar items.
This extension is a Python rewrite of the Generator bash script extension by Aurélio A. Heckert. It is compatible with Inkscape starting from version 1.0 and requires Python 3.</label>
</page>
</param>
<effect needs-live-preview="false">
<object-type>all</object-type>
<menu-tip>Automatically replace values and export the result.</menu-tip>
<effects-menu>
2020-08-07 20:19:46 +02:00
<submenu name="FabLab Chemnitz">
<submenu name="Import/Export/Transfer"/>
2020-07-30 01:16:18 +02:00
</submenu>
</effects-menu>
</effect>
<script>
2020-08-13 14:51:38 +02:00
<command location="inx" interpreter="python">fablabchemnitz_next_gen.py</command>
2020-07-30 01:16:18 +02:00
</script>
</inkscape-extension>