Hi,
When drawing stuff I usually have a lot of overlapping areas. Sometimes I use a vinyl cutter to cut adhesive foil. Then I need to select the topmost object and subtract it from every object which i (partially) covered by the topmost object. Next, I need to repeat the process with the second-to-topmost object etc. I also need to convert all strokes etc. to paths to actually get paths plotted with non-zero width, otherwise it's just one cut along the path which is useless. I also need to intersect all objects with their respective clip or mask, if they are clipped or masked. For complex drawings this process takes a lot of time.
I wondered if there's a plugin or something for "flattening" an image like that, essentially converting it to a set of non-overlapping closed paths without stroke.
If there isn't such a functionality I'd like to program it. In which way should this be done?
Regards Alexander
Hi,
I divided the problem into smaller parts:
1. Make a function that gets rid of all the strokes without changing what the user sees. That means, iterate over each objects, check if they have a visible stroke (width > 0 and not fully transparent), duplicate it if it has a visible fill and finally convert the stroke to a path.
2. Get rid of all clipping and masking. Identify every object which has a clip or mask set and replace the object by the intersection of the clip (mask) and the original object.
3. Remove all overlap by removing the shape of the topmost object from all underlying objects and so on.
Can I do these tasks via an extension without having to re-program intersection calculation, stroke-to-path etc?
Is this just a very special case or does it have wider use than vinyl cutting (and embroidery)?
Regards, Alexander
2014-03-10 0:06 GMT+01:00 Alexander Brock <a.brock@...2965...>:
Hi,
I divided the problem into smaller parts:
- Make a function that gets rid of all the strokes without changing
what the user sees. That means, iterate over each objects, check if they have a visible stroke (width > 0 and not fully transparent), duplicate it if it has a visible fill and finally convert the stroke to a path.
- Get rid of all clipping and masking. Identify every object which has
a clip or mask set and replace the object by the intersection of the clip (mask) and the original object.
- Remove all overlap by removing the shape of the topmost object from
all underlying objects and so on.
Can I do these tasks via an extension without having to re-program intersection calculation, stroke-to-path etc?
Is this just a very special case or does it have wider use than vinyl cutting (and embroidery)?
This kind of operation has a lot of use cases besides vinyl cutting, but right now there is no code to do this reliably. The existing boolean operations code is rather fragile and doesn't work for some corner cases.
During this summer I'll be doing a GSoC project which should address this.
Regards, Krzysztof
On 10/03/14 00:17, Krzysztof Kosiński wrote:
This kind of operation has a lot of use cases besides vinyl cutting, but right now there is no code to do this reliably.
I currently do it by hand and it never failed me.
The existing boolean operations code is rather fragile and doesn't work for some corner cases.
Is there a bug report for these corner cases? https://bugs.launchpad.net/inkscape/+bug/168158 seems to be fixed in trunk, at least precision is better than 0.001% when I try the provided example.
Besides, the code for glueing all the steps I make by hand at the moment into a bigger algorithm seems independent from the implementation of the boolean operations, so I could do that first and later see if I run into problems due to corner cases.
I suggest the following tools: 1. Object ->Clip (/Mask) -> Replace by intersection
Check each selected object for clipping (masking), release the clip and replace the object by the intersection with the clip
2. Path -> All strokes / objects to path
Apply stroke to path to all selected stroked objects. Duplicate them before, if they have a visible fill.
3. Path -> Flatten selection
Use the difference function to remove the shape of the topmost object from all underlying objects.
I'm not a native English speaker, so I have no idea if the names sound strange.
Regards, Alexander
Hello Krzysztof,
Monday, March 10, 2014, 12:17:34 AM, you wrote:
2014-03-10 0:06 GMT+01:00 Alexander Brock <a.brock@...2965...>:
Is this just a very special case or does it have wider use than vinyl cutting (and embroidery)?
This kind of operation has a lot of use cases besides vinyl cutting,
I was reading about a similar use case over the weekend - vector art for printed circuit board (PCB) fabrication, avoiding having to go to raster artwork. PCB CAM processes can handle very limited vector artwork - solid filled non-hollow polygons.
(For an easy overview, see http://www.arachnidlabs.com/blog/2013/02/07/importing-polygons-into-eagle/ )
Here is a git repo for an svg to eagle converter (the limitation comes from the CAM process so is not specific to eagle): https://github.com/cmonr/Eagle-ULPs a similar procedure (with a different import script) could be used to import suitable SVG into KiCAD. The common factor is the need to manipulate graphics in Inkscape so that they only contain the right sort of flattened, non-hollow polygons.
Notice (in the readme) the big set of steps for "what to do in Inkscape before exporting the svg for this"
In Inkscape 0.47 or newer, Preferences > SVG output > Path data, untick "Allow relative coordinates" Type out the text that you want. Format it and such. Lock the height/width ratio Change height to 100 (this helps with changing the ratio) Ctrl-Shift-C (Object to Path) Select all (w/ Node Cursor) Extensions > Modify Path > Add Nodes (Default settings are alright) Extensions > Modify Path > Flatten Beziers (Default settings are alright) For the closed loop letters O,o,D,d,etc... Draw a rectangle dividing the letter ( O => ([)] ) Select the rectangle and the letter Ctrl-/ (Division) Repeat with all closed letters Select all (w/ Node Cursor) Ctrl-Shift-K (Break Apart) Save As > Plain SVG
Those instructions are focused on vector text, but the same set of operations applies to other graphics (such as the hollow shapes in the spider logo on the first link).
but right now there is no code to do this reliably. The existing boolean operations code is rather fragile and doesn't work for some corner cases.
During this summer I'll be doing a GSoC project which should address this.
Perhaps that use case could be covered as well?
participants (3)
-
Alexander Brock
-
Chris Lilley
-
Krzysztof Kosiński