I am working with Inkscape to finalise some vector art for a laser cutter to produce an effect like...
http://www.instructables.com/id/True-to ... er-Cutter/
...and I need to be able to clip multiple paths to select a specific square of the terrain contour data.
Unfortunately, "Cut Path" warns me it only works with two paths at a time - one being the victim path, and the other being the cutting path. I need to cut roughly 4000 paths at once with a single rectangular clipping path. So I need one rectangle path cutter and 4000-ish contour path victims!
Unfortunately, though there are workarounds which would _look like_ the paths have been clipped, I need the actual paths to be cut, as the laser cutter needs clean path information (I can't just mask them, or select a square for raster export or change the page dimensions for pdf export, I need to cut the paths).
I'm happy to consider writing an extension or scripting it somehow if I can figure out where the cut-path operation is available in python (it's only a for-loop after all).
DETAIL: The file I've generated is based on free OpenDEM contour information, exported to SVG from Thuban, and I've written a python script to separate out the contours based on their elevation against the OpenDEM dbf elevation table (I'm using only every fourth contour). I'm then alternating the colours of each retained contour, so the laser cutter can cut and etch correspondingly to make the layered landscape. Unfortunately, the OpenDEM information comes in chunks of roughly 100 km, and I need only a 25km square of this file to send to the laser cutter, else it'll be 3 metres across!
Cut multiple paths with a clipping path
Re: Cut multiple paths with a clipping path
Knowing these are isolines, there is a workaround that might work -or might crash inkscape with the enermous data.
I was thinking of selecting every second isoline and changing the path direction on them,
then selecting all the lines, and combining them together.
After that, if things turn out right, you can intersect that path with any clipping path for the right result.
Good luck!
I was thinking of selecting every second isoline and changing the path direction on them,
then selecting all the lines, and combining them together.
After that, if things turn out right, you can intersect that path with any clipping path for the right result.
Good luck!
Re: Cut multiple paths with a clipping path
Hello:
There is no python extension capable to do that (at the moment)
You could try a shell script/ command line script, as is mentioned here:
http://tavmjong.free.fr/INKSCAPE/MANUAL ... dLine.html
You can check the verb-list here:
http://how-to.wikia.com/wiki/How_to_use ... t_of_verbs
At first sight a command like:
inkscape --select= ???? --verb SelectionIntersect ??? ...
MAY work, but it's not sure (I'm not sure of this).
There is no python extension capable to do that (at the moment)
You could try a shell script/ command line script, as is mentioned here:
http://tavmjong.free.fr/INKSCAPE/MANUAL ... dLine.html
You can check the verb-list here:
http://how-to.wikia.com/wiki/How_to_use ... t_of_verbs
At first sight a command like:
inkscape --select= ???? --verb SelectionIntersect ??? ...
MAY work, but it's not sure (I'm not sure of this).
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.
Re: Cut multiple paths with a clipping path
Thanks everyone. I'd already made quite a bit of progress on this, but my post was approved and made visible quite a few days later. Sorry I couldn't extend it further to reflect my progress.
I think the suggestion by Lazur URH is fairly close to how I solved it, although I don't know why I would need to change direction of individual lines.
I made up a file which covers a whole degree latitude and longitude, then grouped the two sets of lines into different layers with different colors (to suit the laser-cutting job). Then one layer (color) at a time, I chose to Combine the Paths, so that even if there's 2000 red lines, it's considered to be a single path. Then the Cut logic of Inkscape will accept using a rectangular clip to cut through all the lines. After this, I can break up the lines if I want, to make them separate paths again.
Of course this approach only works if you're happy having features combined into a single path before doing the cut (single color, single style I guess) and this was fine in my case, though I had to do two cuts for the two different colors. If you had to retain different style information through the cut operation, then it's still very hard to do.
I think the suggestion by Lazur URH is fairly close to how I solved it, although I don't know why I would need to change direction of individual lines.
I made up a file which covers a whole degree latitude and longitude, then grouped the two sets of lines into different layers with different colors (to suit the laser-cutting job). Then one layer (color) at a time, I chose to Combine the Paths, so that even if there's 2000 red lines, it's considered to be a single path. Then the Cut logic of Inkscape will accept using a rectangular clip to cut through all the lines. After this, I can break up the lines if I want, to make them separate paths again.
Of course this approach only works if you're happy having features combined into a single path before doing the cut (single color, single style I guess) and this was fine in my case, though I had to do two cuts for the two different colors. If you had to retain different style information through the cut operation, then it's still very hard to do.