Comments (11)
I just pushed b1b4ab7 to better visualise what happens.
from vpype.
The root cause is the fact that your SVG paths are made of (straight) curves instead of lines:
(Notice the "c" in the d
attribute.)
vpype converts everything to poly lines on input, and will quantise curves based on the --quantization
parameter. Apparently, the implicit linesimplify
of the read
command is not able to completely cope with it It does, to some extend, eg. compare:
vpype read blockhouse.svg show -d
vpype read -s blockhouse.svg show -d
(You'll need to update vpype before, I just added -d
.)
I suggest you look at whatever generated the file to see if you can have it generate lines instead of curves. It may very well be that the situation will improve when #31 is fixed too.
from vpype.
That - d is very useful. I can not use the -s , I am getting an "not valid integer' error, but still i get the idea, the lines are not lines, but curves and that is not great for optimization.
from vpype.
Sorry the -s was meant to be after the read, not before. I fixed it up there.
from vpype.
Hey @ithinkido, I revisited this following the resolution of #34, and although the implicit simplify in read
still has issues (#31), an explicit linesimplify
now cleans your example file nicely:
from vpype.
Super clean !! Thanks
from vpype.
sorry to open and old topic, but since my issue is identical to the one initially reported here by @ithinkido , I decided writing a comment instead of opening a new issue. I read @abey79 comment and while I understand that "vpype converts everything to poly lines on input" I still would like to know if there is a way to prevent that, when my primary goal is to use only linemerge
.
In other words, I would like to use the power of linemerge
and leave the rest intact. The reason for that is what the initial post mentioned, it affects the plot results.
Here is an example, on the right the result after linemerge
The SVG is created using Processing and its arc()
command (using bezier()
has the same effect).
I am using vpype 1.9.0, the entire command is:
vpype read --single-layer 20220329174853.svg linemerge write out.svg
For reference purposes only, Adobe Illustrator's simplify
command "recreates" the curves, while vpype's linesimplify
would, as described, reduce the number of line segments.
from vpype.
Hello @haschdl. No, there is currently no way around the linearisation at all. I'm kind of thinking of getting there, but it'll take an entire rewrite of pretty much everything, so it could be years until that happens (if at all).
As a side note, a "line-merge-only" Python script could conceivably be hacked without much hassle using svgelements to extract path elements and using the same merging algorithm as vpype, since it only considers end points. But that would be just a script. There is currently no way to fit this into vpype.
from vpype.
@haschdl take a look at this. It should do what you are looking for. https://github.com/fablabnbg/inkscape-chain-paths
from vpype.
@abey79 thank you, I understand it now. I will check the alternatives.
@ithinkido thanks for the tip! inkscape-chain-paths
looks like the right solution, but unfortunately it didn't work in Inskcape 1.1 with my drawing. It could be a good starting point to get hands-on, as it is just one script. Are you using the extension?
from vpype.
Yes, I used it an hour ago in 1.1. Still seems to work for me.
from vpype.
Related Issues (20)
- `read` entirely discards file containing NaN
- Is there a way to use vpype to count the number of lines/paths in an svg file? HOT 1
- Pyside 6.5.0 breaking changes (Linux) HOT 1
- Enhancement suggestion -- allow getting document width/height in non-pixel units HOT 2
- Change the layer ID interpretation to match EMSL standard HOT 1
- `--fit-to-margins` adds boarder around margin HOT 1
- Curved Line Spacing Problem HOT 4
- Allow for `layout` arg to maintain size of svg element
- Output error messages when using `execute` from vpype API HOT 4
- Cursive font glyphs are split in multiple strokes HOT 2
- Examples in `lreverse`'help are wrong
- Add support for various stroke font format
- Remove mentions of `--page-size` in `layout` help
- Extra layer when running two read/writes within one pipeline HOT 1
- Color overwritten using dipping pattern recipe
- Request: linemerge option to only merge when turn angle is small HOT 1
- Is there a way to tostring() a Document? HOT 1
- Simplification fails in my installation (vpype read -s <svg_file>) HOT 1
- VirusTotal
- Site-packages pollution from README
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vpype.