# vpypetools Intro

[![grafik.png](https://wiki.stadtfabrikanten.org/uploads/images/gallery/2025-05/scaled-1680-/CMcAojYfIVDjjwYa-grafik.png)](https://wiki.stadtfabrikanten.org/uploads/images/gallery/2025-05/CMcAojYfIVDjjwYa-grafik.png)

## 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&amp;t=32562](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

**![(Info)](https://old.stadtfabrikanten.org/s/-6fzg5h/9012/tu5x00/_/images/icons/emoticons/information.svg) Source code → [https://github.com/abey79/vpype](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](https://vpype.readthedocs.io/en/stable/CHANGELOG.html)

## Linux / Windows Python modules

```bash
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](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/join-paths-create-tabs-and-dimples), [Close Paths](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/close-paths) and [Chain Paths](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/chain-paths)
- linesort: [Optimize Sequence: Travel Distances](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/optimize-sequence-travel-distances) and [Optimize Sequence: Small Holes First](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/optimize-sequence-small-holes-first)
- linesimplify: native function "Path → Simplify"
- filter: [Contour Scanner And Trimmer](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/contour-scanner-and-trimmer)
- multipass: none
- occult: [Purge Duplicate Path Nodes](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/purge-duplicate-path-nodes) and [Purge Duplicate Path Segments](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/purge-duplicate-path-segments)
- trim: [Destructive Clip](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/destructive-clip)

**Overview by docs**

- [Deduplicate Plugin](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/deduplicate-plugin)
- [Filter](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/filter)
- [Line Merging (Combine Paths)](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/line-merging-combine-paths)
- [Line Sorting](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/line-sorting)
- [Multipass](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/multipass)
- [Occult Plugin (Hidden / Superimposed Line Removal)](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/occult-plugin-hidden-superimposed-line-removal)
- [Relooping](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/relooping)
- [Split All](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/split-all)
- [Trimming](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/trimming)
- [vpype Free Mode](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/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](https://old.stadtfabrikanten.org/display/IFM/vpype+Free+Mode) to use these.

<table border="1" id="bkmrk-category-comments-pr" style="border-collapse: collapse; width: 99.9734%; height: 419.284px;"><colgroup><col style="width: 12.2597%;"></col><col style="width: 87.7414%;"></col></colgroup><thead><tr style="height: 38.1167px;"><td style="height: 38.1167px;">**category**</td><td style="height: 38.1167px;">**comments**</td></tr></thead><tbody><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Primitives</td><td style="height: 38.1167px;">```bash
arc, circle, ellipse, line, rect
```

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Block control</td><td style="height: 38.1167px;">```bash
begin, end
```

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Operation</td><td style="height: 38.1167px;">```bash
crop         # we use trim feature instead 
layout       #Inkscape:  CTRL + SHIFT + D 
pagesize     #Inkscape:  CTRL + SHIFT + D
reverse      #Inkscape:  Path > Reverse
```

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Generators</td><td style="height: 38.1167px;">```bash
frame  #see "Bounding Box" extension
random
```

See [Bounding Box](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/bounding-box)

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Block processors</td><td style="height: 38.1167px;">```bash
grid, repeat
```

Native functions inside Inkscape

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Layers</td><td style="height: 38.1167px;">```bash
lcopy, ldelete, lmove
```

This is too generic to make use inside Inkscape

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Input</td><td style="height: 38.1167px;">```bash
script
```

This is too generic to make use inside Inkscape

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Transforms</td><td style="height: 38.1167px;">```bash
rotate, scale, scaleto, skew, translate
```

See [Scale To Path Length](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/scale-to-path-length), [Scale To Real](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/scale-to-real), [Scale To Size (Replaced by default transform scale)](https://wiki.stadtfabrikanten.org/books/fablab-chemnitz/page/scale-to-size-replaced-by-default-transform-scale) and native functions like path effects and transformations

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Filters</td><td style="height: 38.1167px;">```bash
squiggles
```

</td></tr><tr style="height: 38.1167px;"><td style="height: 38.1167px;">Text</td><td style="height: 38.1167px;">```bash
text
```

See [Hershey Text Alternative](https://old.stadtfabrikanten.org/display/IFM/Hershey+Text+Alternative)

</td></tr></tbody></table>

## Troubleshooting

Problem:

```bash
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:

```bash
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'
```