some more code "vpypetools"

This commit is contained in:
leyghisbb 2021-04-03 18:34:01 +02:00
parent f504fbfa80
commit 20dac613d3
8 changed files with 291 additions and 48 deletions

View File

@ -37,10 +37,11 @@ Extension for InkScape 1.X
Author: Mario Voigt / FabLab Chemnitz
Mail: mario.voigt@stadtfabrikanten.org
Date: 02.04.2021
Last patch: 02.04.2021
Last patch: 03.04.2021
License: GNU GPL v3
Used version of vpype: commit id https://github.com/abey79/vpype/commit/0b0dc8dd7e32998dbef639f9db578c3bff02690b
Used (tested) version of vpype: commit id https://github.com/abey79/vpype/commit/0b0dc8dd7e32998dbef639f9db578c3bff02690b (29.03.2021)
Used (tested) version of vpype occult: commit id https://github.com/LoicGoulefert/occult/commit/2d04ca57d69078755c340066c226fd6cd927d41e (04.02.2021)
CLI / API docs:
- https://vpype.readthedocs.io/en/stable/api/vpype_cli.html#module-vpype_cli
@ -55,6 +56,7 @@ Todo's
- https://github.com/abey79/vpype/issues/243
- command chain is slow on Windows
- add some debugging options to remove deprecation warnings
- allow to select other units than mm for tolerance, trimming, ...
"""
class vpypetools (inkex.EffectExtension):
@ -63,14 +65,41 @@ class vpypetools (inkex.EffectExtension):
inkex.Effect.__init__(self)
# Line Sorting
self.arg_parser.add_argument("--linesort", default=False, type=inkex.Boolean)
self.arg_parser.add_argument("--linesort", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--linesort_no_flip", type=inkex.Boolean, default=False, help="Disable reversing stroke direction for optimization")
# Line Merging
self.arg_parser.add_argument("--linemerge", default=False, type=inkex.Boolean)
self.arg_parser.add_argument("--linemerge_tolerance", type=float, default=False, help="Maximum distance between two line endings that should be merged (default 0.5 mm)")
self.arg_parser.add_argument("--linemerge_no_flip", type=inkex.Boolean, default=False, help="Disable reversing stroke direction for merging")
self.arg_parser.add_argument("--linemerge", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--linemerge_tolerance", type=float, default=0.500, help="Maximum distance between two line endings that should be merged (default 0.500 mm)")
self.arg_parser.add_argument("--linemerge_no_flip", type=inkex.Boolean, default=False, help="Disable reversing stroke direction for merging")
# Trimming
self.arg_parser.add_argument("--trim", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--trim_x_margin", type=float, default=0.000, help="trim margin - x direction (mm)") # keep default at 0.000 to keep clean bbox
self.arg_parser.add_argument("--trim_y_margin", type=float, default=0.000, help="trim margin - y direction (mm)") # keep default at 0.000 to keep clean bbox
# Relooping
self.arg_parser.add_argument("--reloop", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--reloop_tolerance", type=float, default=0.500, help="Controls how close the path beginning and end must be to consider it closed (default 0.500 mm)")
# Multipass
self.arg_parser.add_argument("--multipass", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--multipass_count", type=int, default=2, help="How many passes for each line (default 2)")
# Filter
self.arg_parser.add_argument("--filter", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--filter_tolerance", type=float, default=0.050, help="Tolerance used to determined if a line is closed or not (default 0.050 mm)")
self.arg_parser.add_argument("--filter_closed", type=inkex.Boolean, default=False, help="Keep closed lines")
self.arg_parser.add_argument("--filter_not_closed", type=inkex.Boolean, default=False, help="Keep open lines")
self.arg_parser.add_argument("--filter_min_length_enabled", type=inkex.Boolean, default=False, help="filter by min length")
self.arg_parser.add_argument("--filter_min_length", type=float, default=0.000, help="Keep lines whose length isn't shorter than value")
self.arg_parser.add_argument("--filter_max_length_enabled", type=inkex.Boolean, default=False, help="filter by max length")
self.arg_parser.add_argument("--filter_max_length", type=float, default=0.000, help="Keep lines whose length isn't greater than value")
# Plugin Occult
self.arg_parser.add_argument("--plugin_occult", type=inkex.Boolean, default=False)
self.arg_parser.add_argument("--plugin_occult_tolerance", type=float, default=0.01, help="Max distance between start and end point to consider a path closed (default 0.01 mm)")
# General Settings
self.arg_parser.add_argument("--flattenbezier", type=inkex.Boolean, default=False, help="Flatten bezier curves to polylines")
self.arg_parser.add_argument("--flatness", type=float, default=0.1, help="Minimum flatness = 0.1. The smaller the value the more fine segments you will get.")
@ -132,19 +161,19 @@ class vpypetools (inkex.EffectExtension):
applytransform.ApplyTransform().recursiveFuseTransform(self.document.getroot())
# getting the bounding box of the current selection. We use to calculate the offset XY from top-left corner of the canvas. This helps us placing back the elements
bbox = None
input_bbox = None
if len(self.svg.selected) == 0:
convertPath(self.document.getroot())
for element in nodesToConvert:
bbox += element.bounding_box()
input_bbox += element.bounding_box()
else:
for id, item in self.svg.selected.items():
convertPath(item)
bbox = inkex.elements._selected.ElementList.bounding_box(self.svg.selected) # get BoundingBox for selection
input_bbox = inkex.elements._selected.ElementList.bounding_box(self.svg.selected) # get BoundingBox for selection
# inkex.utils.debug(bbox)
# inkex.utils.debug(input_bbox)
#l c.as_mls() #cast LineString array to MultiLineString
# lc.as_mls() #cast LineString array to MultiLineString
if len(lc) == 0:
inkex.errormsg('Selection appears to be empty or does not contain any valid svg:path nodes. Try to cast your objects to paths using CTRL + SHIFT + C or strokes to paths using CTRL + ALT+ C')
@ -155,11 +184,11 @@ class vpypetools (inkex.EffectExtension):
# we add the lineCollection (converted selection) to the vpype document
doc.add(lc, layer_id=None)
if self.options.output_stats is True:
tooling_length_before = doc.length()
traveling_length_before = doc.pen_up_length()
tooling_length_before = doc.length()
traveling_length_before = doc.pen_up_length()
# build and execute the conversion command
# the following code block is not intended to sum up the commands to build a series (pipe) of commands!
##########################################
# Line Sort
@ -172,35 +201,70 @@ class vpypetools (inkex.EffectExtension):
if self.options.linemerge is True:
command = "linemerge --tolerance " + str(self.options.linemerge_tolerance)
if self.options.linemerge_no_flip is True:
command += " --no-flip"
#inkex.utils.debug(command)
command += " --no-flip"
# Trimming
if self.options.trim is True:
command = "trim " + str(self.options.trim_x_margin) + " " + str(self.options.trim_y_margin)
# Relooping
if self.options.reloop is True:
command = "reloop --tolerance " + str(self.options.reloop_tolerance)
# Multipass
if self.options.multipass is True:
command = "multipass --count " + str(self.options.multipass_count)
# Filter
if self.options.filter is True:
command = "filter --tolerance " + str(self.options.filter_tolerance)
if self.options.filter_min_length_enabled is True:
command += " --min-length " + str(self.options.filter_min_length)
if self.options.filter_max_length_enabled is True:
command += " --max-length " + str(self.options.filter_max_length)
if self.options.filter_closed is True:
command += " --closed"
if self.options.filter_not_closed is True:
command += " --not-closed"
if self.options.filter_closed is False and self.options.filter_not_closed is False and self.options.filter_min_length_enabled is False and self.options.filter_max_length_enabled is False:
inkex.errormsg('No filters to apply. Please select at least one filter.')
return
# Plugin Occult
if self.options.plugin_occult is True:
command = "occult --tolerance " + str(self.options.plugin_occult_tolerance)
# inkex.utils.debug(command)
doc = execute(command, doc)
##########################################
# show the vpype document visually
# there are missing options to set pen_width and pen_opacity. This is anchored in "Engine" class
if self.options.output_show:
vpype_viewer.show(doc, view_mode=ViewMode.PREVIEW, show_pen_up=self.options.output_trajectories, show_points=False, argv=None) # https://vpype.readthedocs.io/en/stable/api/vpype_viewer.ViewMode.html
tooling_length_after = doc.length()
traveling_length_after = doc.pen_up_length()
if tooling_length_before > 0:
tooling_length_saving = (1.0 - tooling_length_after / tooling_length_before) * 100.0
else:
tooling_length_saving = 0.0
if traveling_length_before > 0:
traveling_length_saving = (1.0 - traveling_length_after / traveling_length_before) * 100.0
else:
traveling_length_saving = 0.0
if self.options.output_stats is True:
tooling_length_after = doc.length()
traveling_length_after = doc.pen_up_length()
if tooling_length_before > 0:
tooling_length_saving = (1.0 - tooling_length_after / tooling_length_before) * 100.0
else:
tooling_length_saving = 0.0
if traveling_length_before > 0:
traveling_length_saving = (1.0 - traveling_length_after / traveling_length_before) * 100.0
else:
traveling_length_saving = 0.0
inkex.utils.debug('Total tooling length before vpype conversion: ' + str('{:0.2f}'.format(tooling_length_before)) + ' mm')
inkex.utils.debug('Total traveling length before vpype conversion: ' + str('{:0.2f}'.format(traveling_length_before)) + ' mm')
inkex.utils.debug('Total tooling length after vpype conversion: ' + str('{:0.2f}'.format(tooling_length_after)) + ' mm')
inkex.utils.debug('Total traveling length after vpype conversion: ' + str('{:0.2f}'.format(traveling_length_after)) + ' mm')
inkex.utils.debug('Total tooling length optimized: ' + str('{:0.2f}'.format(tooling_length_saving)) + ' %')
inkex.utils.debug('Total traveling length optimized: ' + str('{:0.2f}'.format(traveling_length_saving)) + ' %')
if tooling_length_after == 0:
inkex.errormsg('No lines left after vpype conversion. Conversion result is empty. Cannot continue')
return
# show the vpype document visually
# there are missing options to set pen_width and pen_opacity. This is anchored in "Engine" class
if self.options.output_show:
vpype_viewer.show(doc, view_mode=ViewMode.PREVIEW, show_pen_up=self.options.output_trajectories, show_points=False, argv=None) # https://vpype.readthedocs.io/en/stable/api/vpype_viewer.ViewMode.html
# save the vpype document to new svg file and close it afterwards
output_file = self.options.input_file + ".vpype.svg"
@ -216,7 +280,10 @@ class vpypetools (inkex.EffectExtension):
self.debug(cli_output)
# new parse the SVG file and insert it as new group into the current document tree
#vpype_svg = etree.parse(output_file).getroot().xpath("//svg:g", namespaces=inkex.NSS)
# vpype_svg = etree.parse(output_file).getroot().xpath("//svg:g", namespaces=inkex.NSS)
# when using the trim function the bounding box of the original elements will not match the vpype'd ones. So we need to do some calculation for exact placement
# the label id is the number of layer_id=None (will start with 1)
lines = etree.parse(output_file).getroot().xpath("//svg:g[@inkscape:label='1']",namespaces=inkex.NSS)
@ -225,10 +292,17 @@ class vpypetools (inkex.EffectExtension):
for item in lines:
for child in item.getchildren():
vpypeLinesGroup.append(child)
vpypeLinesGroup.attrib['transform'] = 'translate(' + str(bbox.left) + ',' + str(bbox.top) + ')'
# get the output's bounding box size (which might be other size than previous input bounding box, e.g. when using trim feature)
# output_bbox = vpypeLinesGroup.bounding_box()
translation = 'translate(' + str(input_bbox.left + self.options.trim_x_margin) + ',' + str(input_bbox.top + self.options.trim_y_margin) + ')' # we use the same translation for trajectory lines
vpypeLinesGroup.attrib['transform'] = translation
vpypeLinesGroupId = self.svg.get_unique_id('vpypetools-lines-')
vpypeLinesGroup.set('id', vpypeLinesGroupId)
# inkex.utils.debug(self.svg.selection.first()) # get the first selected element. Chould be None
self.svg.selection.set(vpypeLinesGroupId)
# inkex.utils.debug(self.svg.selection.first()) # get the first selected element again to check if changing selection has worked
if self.options.output_trajectories is True:
trajectories = etree.parse(output_file).getroot().xpath("//svg:g[@id='pen_up_trajectories']",namespaces=inkex.NSS)
vpypeTrajectoriesGroup = self.document.getroot().add(inkex.Group())
@ -236,14 +310,11 @@ class vpypetools (inkex.EffectExtension):
for item in trajectories:
for child in item.getchildren():
vpypeTrajectoriesGroup.append(child)
vpypeTrajectoriesGroup.attrib['transform'] = 'translate(' + str(bbox.left) + ',' + str(bbox.top) + ')'
vpypeTrajectoriesGroup.attrib['transform'] = translation
vpypeTrajectoriesId = self.svg.get_unique_id('vpypetools-trajectories-')
vpypeTrajectoriesGroup.set('id', vpypeTrajectoriesId)
# inkex.utils.debug(self.svg.selection.first()) # get the first selected element. Chould be None
self.svg.selection.set(vpypeLinesGroupId)
#inkex.utils.debug(self.svg.selection.first()) # get the first selected element again to check if changing selection has worked
self.svg.selection.add(vpypeTrajectoriesId) # we also add trajectories to selection to remove translations in following step
# we apply transformations also for new group to remove the "translate()" again
if self.options.apply_transformations and applyTransformAvailable:
for node in self.svg.selection:

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Filter</name>
<id>fablabchemnitz.de.vpype_filter</id>
<label appearance="header">Filter</label>
<label>Filter paths according to specified criterion. When an option is provided the corresponding criterion is applied and paths which do not respect the criterion are rejected.</label>
<param name="filter" type="bool" gui-hidden="true">true</param>
<param name="filter_tolerance" type="float" min="0.000" max="99999.000" precision="3" gui-text="tolerance (mm)" gui-description="Tolerance used to determined if a line is closed or not (default 0.050 mm)">0.050</param>
<param name="filter_closed" type="bool" gui-text="Keep closed lines">false</param>
<param name="filter_not_closed" type="bool" gui-text="Keep open lines">false</param>
<param name="filter_min_length_enabled" type="bool" gui-text="filter by min length">false</param>
<param name="filter_min_length" type="float" min="0.000" max="99999.000" precision="3" gui-text="minimum length (mm)" gui-description="Keep lines whose length isn't shorter than value">0.000</param>
<param name="filter_max_length_enabled" type="bool" gui-text="filter by max length">false</param>
<param name="filter_max_length" type="float" min="0.000" max="99999.000" precision="3" gui-text="maximum length (mm)" gui-description="Keep lines whose length isn't greater than value">0.000</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" precision="3" max="99999.000" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
<param name="output_trajectories" type="bool" gui-text="Import travel trajectories" gui-description="Add paths for the travel trajectories">false</param>
<param name="keep_selection" type="bool" gui-text="Keep selected paths" gui-description="If false, selected paths (original objects) will be removed">false</param>
<param name="strokes_to_paths" type="bool" gui-text="Auto-convert low-level strokes to paths" gui-description="Recommended option. Performs 'Path' > 'Stroke to Path' (CTRL + ALT + C) to convert vpype converted lines back to regular path objects">true</param>
<label appearance="header">About</label>
<separator/>
<label appearance="url">https://fablabchemnitz.de</label>
<label>License: GNU GPL v3</label>
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">vpypetools.py</command>
</script>
</inkscape-extension>

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Line Merging (vpype)</name>
<name>Line Merging</name>
<id>fablabchemnitz.de.vpype_linemerging</id>
<label appearance="header">Line Merging</label>
<label>Merge lines whose endings and starts overlap or are very close.</label>
<param name="linemerge" type="bool" gui-hidden="true">true</param>
<param name="linemerge_tolerance" type="float" min="0.0" gui-text="tolerance (mm)" gui-description="Maximum distance between two line endings that should be merged (default 0.5 mm)">0.5</param>
<param name="linemerge_tolerance" type="float" min="0.000" max="99999.000" precision="3" gui-text="tolerance (mm)" gui-description="Maximum distance between two line endings that should be merged (default 0.500 mm)">0.500</param>
<param name="linemerge_no_flip" type="bool" gui-text="no flip" gui-description="Disable reversing stroke direction for merging">false</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.1</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
@ -24,7 +24,7 @@
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Modify existing Path(s)"/>
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Optimize Sequence: Line Sorting (vpype)</name>
<name>Line Sorting</name>
<id>fablabchemnitz.de.vpype_linesorting</id>
<label appearance="header">Line Sorting</label>
<label>Sort lines to minimize travel distances.</label>
@ -9,7 +9,7 @@
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.1</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
@ -23,7 +23,7 @@
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Nesting/Cut Optimization"/>
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Multipass</name>
<id>fablabchemnitz.de.vpype_multipass</id>
<label appearance="header">Multipass</label>
<label>Add multiple passes to each line. Each line is extended with a mirrored copy of itself, optionally multiple times. This is useful for pens that need several passes to ensure a good quality.</label>
<param name="multipass" type="bool" gui-hidden="true">true</param>
<param name="multipass_count" type="int" min="2" max="9999" gui-text="count" gui-description="How many passes for each line (default 2)">2</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
<param name="output_trajectories" type="bool" gui-text="Import travel trajectories" gui-description="Add paths for the travel trajectories">false</param>
<param name="keep_selection" type="bool" gui-text="Keep selected paths" gui-description="If false, selected paths (original objects) will be removed">false</param>
<param name="strokes_to_paths" type="bool" gui-text="Auto-convert low-level strokes to paths" gui-description="Recommended option. Performs 'Path' > 'Stroke to Path' (CTRL + ALT + C) to convert vpype converted lines back to regular path objects">true</param>
<label appearance="header">About</label>
<separator/>
<label appearance="url">https://fablabchemnitz.de</label>
<label>License: GNU GPL v3</label>
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">vpypetools.py</command>
</script>
</inkscape-extension>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Occult Plugin (HLR)</name>
<id>fablabchemnitz.de.vpype_plugin_occult</id>
<label appearance="header">Occult Plugin (Concealed / Hidden Line Removal)</label>
<label>This plugin command removes duplicated lines. It acts like a trimmer to receive a clean set of visible paths only. You need to install occult plugin for vpype and a working pygeos library.</label>
<param name="plugin_occult" type="bool" gui-hidden="true">true</param>
<param name="plugin_occult_tolerance" type="float" min="0.000" max="99999.000" precision="3" gui-text="tolerance (mm)" gui-description="Max distance between start and end point to consider a path closed (default 0.01 mm)">0.01</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
<param name="output_trajectories" type="bool" gui-text="Import travel trajectories" gui-description="Add paths for the travel trajectories">false</param>
<param name="keep_selection" type="bool" gui-text="Keep selected paths" gui-description="If false, selected paths (original objects) will be removed">false</param>
<param name="strokes_to_paths" type="bool" gui-text="Auto-convert low-level strokes to paths" gui-description="Recommended option. Performs 'Path' > 'Stroke to Path' (CTRL + ALT + C) to convert vpype converted lines back to regular path objects">true</param>
<label appearance="header">About</label>
<separator/>
<label appearance="url">https://fablabchemnitz.de</label>
<label>License: GNU GPL v3</label>
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">vpypetools.py</command>
</script>
</inkscape-extension>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Relooping</name>
<id>fablabchemnitz.de.vpype_relooping</id>
<label appearance="header">Relooping</label>
<label>Randomize the seam location of closed paths.</label>
<param name="reloop" type="bool" gui-hidden="true">true</param>
<param name="reloop_tolerance" type="float" min="0.000" max="99999.000" precision="3" gui-text="tolerance (mm)" gui-description="Controls how close the path beginning and end must be to consider it closed (default 0.500 mm)">0.500</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
<param name="output_trajectories" type="bool" gui-text="Import travel trajectories" gui-description="Add paths for the travel trajectories">false</param>
<param name="keep_selection" type="bool" gui-text="Keep selected paths" gui-description="If false, selected paths (original objects) will be removed">false</param>
<param name="strokes_to_paths" type="bool" gui-text="Auto-convert low-level strokes to paths" gui-description="Recommended option. Performs 'Path' > 'Stroke to Path' (CTRL + ALT + C) to convert vpype converted lines back to regular path objects">true</param>
<label appearance="header">About</label>
<separator/>
<label appearance="url">https://fablabchemnitz.de</label>
<label>License: GNU GPL v3</label>
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">vpypetools.py</command>
</script>
</inkscape-extension>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Trimming</name>
<id>fablabchemnitz.de.vpype_trimming</id>
<label appearance="header">Trimming</label>
<label>This command trims the geometries by the provided X and Y margins with respect to the current bounding box.</label>
<param name="trim" type="bool" gui-hidden="true">true</param>
<param name="trim_x_margin" type="float" min="0.000" max="99999.000" precision="3" gui-text="trim margin - x direction (mm)">0.000</param>
<param name="trim_y_margin" type="float" min="0.000" max="99999.000" precision="3" gui-text="trim margin - y direction (mm)">0.000</param>
<spacer/>
<label appearance="header">General Settings</label>
<param name="flattenbezier" type="bool" gui-text="Flatten bezier curves to polylines" gui-description="Converts bezier curves to polylines.">true</param>
<param name="flatness" type="float" min="0.001" max="99999.000" precision="3" gui-text="flatness" gui-description="Minimum flatness = 0.001. The smaller the value the more fine segments you will get.">0.100</param>
<param name="apply_transformations" type="bool" gui-text="Use 'Apply Transformations' extension" gui-description="Run 'Apply Transformations' extension before running vpype. Helps avoiding geometry shifting">false</param>
<param name="output_show" type="bool" gui-text="Show debug output" gui-description="This will open a new matplotlib window showing modified SVG data">false</param>
<param name="output_stats" type="bool" gui-text="Show conversion statistics" gui-description="Show output statistics before/after conversion">false</param>
<param name="output_trajectories" type="bool" gui-text="Import travel trajectories" gui-description="Add paths for the travel trajectories">false</param>
<param name="keep_selection" type="bool" gui-text="Keep selected paths" gui-description="If false, selected paths (original objects) will be removed">false</param>
<param name="strokes_to_paths" type="bool" gui-text="Auto-convert low-level strokes to paths" gui-description="Recommended option. Performs 'Path' > 'Stroke to Path' (CTRL + ALT + C) to convert vpype converted lines back to regular path objects">true</param>
<label appearance="header">About</label>
<separator/>
<label appearance="url">https://fablabchemnitz.de</label>
<label>License: GNU GPL v3</label>
<effect needs-live-preview="true">
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="vpype Tools"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">vpypetools.py</command>
</script>
</inkscape-extension>