abey79 / vpype

The Swiss-Army-knife command-line tool for plotter vector graphics.
https://vpype.readthedocs.io/
MIT License
699 stars 61 forks source link

Sorting by "-a id -a stroke" gives each unique id it's own layer/color on output #582

Open lewi0622 opened 1 year ago

lewi0622 commented 1 year ago

Expectation: Keep stroke colors, but order the layers by "id" so that I can use occult across layers in the draw order of the original.

Issue: Order is preserved, but for each unique "id" a unique layer and color are generated, original stroke colors are overwritten.

Exact command executed as follows: vpype read -a id -a stroke --no-crop "Line_Interrupted_seed_646429_colors_10_scale_2_346.svg" scaleto 10in 8in occult -i layout -l letter linemerge linesort reloop linesimplify write --color-mode layer "Line_Interrupted_seed_646429_colors_10_scale_2_346_PROCESSED.svg"

Line_Interrupted_seed_646429_colors_10_scale_2_346 Line_Interrupted_seed_646429_colors_10_scale_2_346_PROCESSED

abey79 commented 1 year ago

This will be addressed by vpype 2.0's path-level metadata support.

lewi0622 commented 11 months ago

To correct my original issue. The stroke colors are only being overwritten because of "--color-mode layer". If that isn't used, it works fine.

My workflow for occulting overlapping colors is to assign id's to each line in the order it's drawn and process the file in two steps, the first just does occult using the id's layers, the second performs all other postprocessing using the stroke colors as layers.

  1. read -a id input.svg occult -i write input_PROCESSED.svg
  2. read -a stroke input_PROCESSED.svg scaleto 3.5in 3.5in layout -l 8.5x11in linemerge linesort reloop linesimplify write input_PROCESSED.svg

Would still look forward to being able to do it in just one step, where draw order could be maintained, even when parsing the stroke colors into layers.

Simple example files processed using this method: Hex_Gone_seed_25099_colors_10_scale_1 Hex_Gone_seed_25099_colors_10_scale_1_PROCESSED