5

I would really appreciate some help with this little problem I have, it may only be a click away somewhere in a menu - perhaps someone can help. The application I'm using is Inkscape and I'm trying to find a way to quickly merge the overlapping nodes of a single object. Because the shape's nodes have been randomly jittered they are now overlapping each other - which is exactly what I want but not the white 'negative' spaces. I would like to achieve the result shown on the right of the picture (this was done outside Inkscape using Photoshop) perhaps you can help?

enter image description here

1
  • 1
    Have you tried the fill-rule nonzero (see also here)? Feb 26, 2015 at 12:18

2 Answers 2

4

Here is a simplified example of what we're trying to do:

enter image description here

Note that changing the fill rule will not give the desired results.

enter image description here

How to do it:

  1. Make sure all objects in your design are paths.
  2. If you have multiple objects in your design, choose "Path" > "Union" to merge them into one object.
  3. Draw a filled rectangle entirely around your entire design path and choose "Object" > "Lower to bottom" to put the rectangle below your design path.

enter image description here

  1. Select both the rectangle and your design path and choose "Path" > "Difference".

enter image description here

  1. Select the resulting path object and choose "Path" > "Break Apart" to produce multiple path objects for each region of the design.

enter image description here

  1. Using the select tool, click near the corner of the whole rectangle to select the rectangle object.
  2. Delete the outer rectangle you just selected.

enter image description here

  1. Select all the objects that are left over and choose "Path" > "Union".

enter image description here

Tested using Inkscape 0.48.4

Very cool question, by the way!

6
  • It seems so complicate: why not just apply the non zero fill-rule using the proper button? Feb 27, 2015 at 10:18
  • @PaoloGibellini I added some screenshots to explain why changing the fill-rule is not a viable solution in this case.
    – Sean
    Feb 27, 2015 at 13:06
  • Your solution allows to have a border of a different color. Feb 27, 2015 at 13:44
  • @PaoloGibellini I added the border only to better illustrate the solution process. If you are implying that (besides the border issue) you still think a non-zero fill rule would be able to accomplish this task, I'd love to see you demonstrate it by adding an alternate answer to this question. I'm genuinely curious. Fill rule was my first thought too, but I couldn't get it to work for a case like this.
    – Sean
    Feb 27, 2015 at 14:13
  • I have interpreted the question as the wish to have the object uniformly filled, and a fast way to achieve this result is changing the fill rule. Your solution is more complicate but also more comprehensive, because it leads to a new and more flexible object (and probably with less nodes). Which version of Inkscape have you used? Feb 27, 2015 at 17:41
3

   0.  Initial path

enter image description here

  1. Fill-rule: nonzero

enter image description here

  1. Path union (Ctrl +, it works for one path as well)

enter image description here

  1. Break apart (Ctrl Shift K)

enter image description here

  1. Path union one more time (Ctrl +)

enter image description here

3
  • I like this approach, and I am able to replicate this solution process by drawing a path like yours. BUT this solution only removed 1 of the 3 holes in the path from my example solution. Your solution seems better for your example case because it is fewer steps. But it does not appear to remove all holes in all cases.
    – Sean
    Feb 27, 2015 at 20:39
  • @SeanMadsen Indeed, my random path is not so random. In general case your surrounding rectangle helps a lot.
    – ybeltukov
    Feb 27, 2015 at 20:57
  • This solution seems faster, but doesn't work in some conditions, e.g. when the "hole" has at least two nodes in the external path. In this case after breaking apart you have "filled" paths connected by vertex, and no "not filled" path to merge using the union. For this case you can use @SeanMadsen method, with a few variants. Mar 1, 2015 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.