Package: vpype-occult
occultvpypeplug-in to remove lines occulted by polygons from SVG files.ExamplesBasic usageDraw a line, then a square:vpype line 0 0 5cm 5cm rect 2cm 2cm 1cm 1cm showSame drawing, after applyingoccult:vpype line 0 0 5cm 5cm rect 2cm 2cm 1cm 1cm occult showOrder of path is important:occultwill consider the last geometry in a SVG file to be "on top" of all other geometries,
the last but one is above every other geometries except the last one.
For instance, usingvpype rect 2cm 2cm 1cm 1cm occult showwill not modify geometries.Working with multiple layersBy default,occultperforms occlusion layer by layer. For instance, applying occlusion
on the image below will not change anything:occult -iignores layers, so that occlusion is performed on all objects, regardless of their layer.
Geometries in layers with a larger ID number are considered to be "on top" of geometries in layers
with a smaller ID number.Without-iflagWith-iflagoccult -aonly performs occlusions across layers, ignoring occlusions that occur within a layer. As inoccult -i,
geometries in layers with a larger ID number are considered to be "on top" of geometries in layers with a smaller ID
number. This option overrides-i.Without-aor-iflagsWith-iflagWith-aflagSave occulted linesoccult -kkeeps occulted lines in a separate layers.Without-kflagWith-kflagUsing vpype's viewer (showcommand), you can visualize occulted lines and remaining lines separately.Using occult with Vsketchoccultcan be invoked from aVksetchsketch, usingvsk.vpype("occult"). When using the GUI, callingoccultwithin the sketchdraw()method will display occulted geometries at each code save / seed change. For sketches with lots of geometries, occlusion can take a significant amount of time. Invokeoccultwithin thefinalize()method of a sketch to perform occlusion only when saving a specific output.importvsketchclassSketch(vsketch.SketchClass):defdraw(self,vsk:vsketch.Vsketch):vsk.size('10x10cm')vsk.scale('mm')vsk.line(-5,-5,5,5)vsk.circle(0,0,3)# Uncomment to perform occlusion at every GUI reload# vsk.vpype("occult")deffinalize(self,vsk:vsketch.Vsketch)->None:# Occlusion (and other vpype commands) invoked only when savingvsk.vpype("linesimplify occult linemerge linesort")if__name__=="__main__":Sketch.display()InstallationSee theinstallation instructionsfor information on how
to installvpype.ExistingvpypeinstallationIfvpypewas installed using pipx, use the following command:$pipxinjectvpypevpype-occultIfvpypewas installed using pip in a virtual environment, activate the virtual environment and use the following command:$pipinstallvpype-occultCheck that your install is successful:$ vpype --help
Usage: vpype [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Options:
  -v, --verbose
  -I, --include PATH  Load commands from a command file.
  --help              Show this message and exit.

Commands:
[...]
  Plugins:
    occult
[...]Stand-alone installationUse this method if you need to edit this project. First, clone the project:$gitclonehttps://github.com/LoicGoulefert/occult.git
$cdoccultCreate a virtual environment:$python3-mvenvvenv
$sourcevenv/bin/activate
$pipinstall--upgradepipInstalloccultand its dependencies (includingvpype):$pipinstall-e.Check that your install is successful:$ vpype --help
Usage: vpype [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

Options:
  -v, --verbose
  -I, --include PATH  Load commands from a command file.
  --help              Show this message and exit.

Commands:
[...]
  Plugins:
    occult
[...]DocumentationThe complete plug-in documentation is available directly in the CLI help:$vpypeoccult--helpLicenseSee theLICENSEfile for details.