vpypetools Intro
About vpype and this extension
vpype is a command processor working with SVG files. It can do a lot of productive steps to optimize files for different purposes like pen plotting, laser cutting or the generation of creative artwork. vpype is really powerful and helps to extend Inkscape feature capability. vpype contains a lot of functionality which is included natively within Inkscape. The extension "vpype for Inkscape" does not deal with all features but with a set of important commands like linemerge, linesort, linesimplify, occult, etc. We can use it to shorten tool path lengths, remove hidden lines and so on.
vpype converts all elements into simple SVG elements like svg:line, svg:polyline and svg:polygon. They can be displayed properly in Inkscape, but they have no knot handles to edit (see https://alpha.inkscape.org/vectors/www.inkscapeforum.com/viewtopicb51d.html?f=16&t=32562). We need to convert those elements to svg:path using key combination CTRL + SHIFT + C ("object to path"; do not use "stroke to path" because it will duplicate your outline with inset and outset contours). Our extension allows to do this conversion automatically.
Caveats of vpype
- requires to simplify bezier curves to polylines (reduces quality)
- does not honor the individual line styles (like width, color, miter, ...) - the output lines all will have the same style. We can work with vpype layerwise to distinguish between different styles
- output is done in svg:line, svg:polyline and svg:polygon. Converting them back in Inkscape (we need paths) is really slow. Native svg:path output would be great
Source code → https://github.com/abey79/vpype
Preparations (Installation of vpype)
At first we need to install vpype and occult extension. It was tested successfully...
- with Python 3.8.5 on Ubuntu 20 LTS (Python 3.9 failed to install vpype and occult)
- with Python 3.9 on Windows 10
We use vpype 1.7 (2021-06-10)
vpype Changelog: https://vpype.readthedocs.io/en/stable/CHANGELOG.html
Linux / Windows Python modules
pip install vpype
#pip install git+https://github.com/abey79/vpype.git
#or by using pipx
pip uninstall vpype
pip install pipx
pipx ensurepath
# restart your shell
pipx install "vpype[all]"
#extra module occult
pip install git+https://github.com/LoicGoulefert/occult.git#egg=occult
#or
pip install vpype-occult
#extra module deduplicate
pip install git+https://github.com/LoicGoulefert/deduplicate.git#egg=deduplicate
Special inclusions and similarities to existing Inkscape extensions
- linemerge: Join Paths / Create Tabs And Dimples, Close Paths and Chain Paths
- linesort: Optimize Sequence: Travel Distances and Optimize Sequence: Small Holes First
- linesimplify: native function "Path → Simplify"
- filter: Contour Scanner And Trimmer
- multipass: none
- occult: Purge Duplicate Path Nodes and Purge Duplicate Path Segments
- trim: Destructive Clip
Overview by docs
- Deduplicate Plugin
- Filter
- Line Merging (Combine Paths)
- Line Sorting
- Multipass
- Occult Plugin (Hidden / Superimposed Line Removal)
- Relooping
- Split All
- Trimming
- vpype Free Mode
Feature exclusions
As mentioned vpype has a lot of features, but we do not need all of them. We decided to exclude or handle the following functions more strictly because a lot of stuff is integrated in Inkscape natively. You can try to use vpype Free Mode to use these.
category | comments |
Primitives |
|
Block control |
|
Operation |
|
Generators |
See Bounding Box |
Block processors |
Native functions inside Inkscape |
Layers |
This is too generic to make use inside Inkscape |
Input |
This is too generic to make use inside Inkscape |
Transforms |
See Scale To Path Length, Scale To Real, Scale To Size (Replaced by default transform scale) and native functions like path effects and transformations |
Filters |
|
Text |
|
Troubleshooting
Problem:
Traceback (most recent call last):
File "C:\Users\tomate\AppData\Roaming\inkscape\extensions\mightyscape-1.2\extensions\fablabchemnitz\vpypetools\vpypetools.py", line 17, in <module>
import vpype_viewer
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\__init__.py", line 6, in <module>
from .engine import *
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\engine.py", line 13, in <module>
from ._painters import (
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\_painters.py", line 9, in <module>
from ._utils import ColorType, load_program, load_texture_array
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\_utils.py", line 9, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
Solution:
Traceback (most recent call last):
File "C:\Users\tomate\AppData\Roaming\inkscape\extensions\mightyscape-1.2\extensions\fablabchemnitz\vpypetools\vpypetools.py", line 17, in <module>
import vpype_viewer
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\__init__.py", line 6, in <module>
from .engine import *
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\engine.py", line 13, in <module>
from ._painters import (
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\_painters.py", line 9, in <module>
from ._utils import ColorType, load_program, load_texture_array
File "C:\Users\tomate\AppData\Local\Programs\Python\Python39\lib\site-packages\vpype_viewer\_utils.py", line 9, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
Keine Kommentare