Inkscape.org
Beginners' Questions Convert to shape
  1. #1
    Yossi D Yossi D @YossiD

    The attached file is extracted from a PDF. I want to convert the two outlines to solid shapes so I can subtract the inner one from the outer one and apply a fill.

    Is there a convenient way to do that in Inkscape?

    Thanks

    Groove
  2. #2
    Aero Aero @Aero◻️
    *

    Select all nodes (n, Ctrl+a, Ctrl+a)
    Join selected nodes (Shift+J)
    Combine (Ctrl+k)

  3. #3
    Polygon Polygon @Polygon🌶

    If you want to apply a fill after Path->Combine select one node from one outline and go Path->Reverse.

  4. #4
    David248 David248 @David248
    *

    In my case (Linux, Inkscape 1.4-dev), the two subpaths created by join / combine step have already the same orientation, and fill displays normally after combining.

    The "spell" described by Aero works like magic :

    n > ctrl+a > ctrl+a > shift+J > ctrl + K

    That's really a smart way to do !

  5. #5
    Polygon Polygon @Polygon🌶
    *

    Then most like you have the cosmetic fill rule "even odd" in the game. Otherwise the two shapes have the same path direction and one need the opposite direction to make the "hole" happen.

    What works here out of the box: Rectangle select with Node tool around everything - Path->Combine - Rectangle select with Node tool around everything again - hit "Join end nodes" - Fill color will be applied automatically - done.

  6. #6
    Aero Aero @Aero◻️

    Either way, join selected nodes seems random :)

  7. #7
    David248 David248 @David248
    *
    Polygon

    Then most like you have the cosmetic fill rule "even odd" in the game. Otherwise the two shapes have the same path direction and one need the opposite direction to make the "hole" happen.

    No : before writting my post, I took time to try the two fill rules (no visual change) and also tried to revert the inner subpath, this results I an entirely filled area within the outer subpath.

    Here, with another OS (Windows) and Inkscape 1.3, it works the same way, which looks quite random, as says Aero.

  8. #8
    Yossi D Yossi D @YossiD

    Works a treat!

    Now I just need to go through the sequence to understand why/how it works, so maybe next time I won't have to ask.

    Thanks one and all.

  9. #9
    Yossi D Yossi D @YossiD

    And a follow-up.

    Considering the simplicity of this shape, and the low number of nodes, I'm wondering why the file is relatively large at >1.5 MB. any way to reduce the file size?

  10. #10
    David248 David248 @David248

    Once Aero's spell done, you can delete all groups (they don't contain anything).

    Then do File>Clean Up Document (size shrinks to 3 Ko...)

  11. #11
    Yossi D Yossi D @YossiD

    I could not find any groups to delete, but Clean Up Document reduced the file to 5.8 kB, which is much more reasonable. do you know where I can find an explanation about what Clean Up Document does?

    Thanks much.

     

  12. #12
    David248 David248 @David248
    *

    1 . Before cleanup, take a look a the document using xml editor (press ctrl+ shift + X) : if you expand defs section, you find the defs of unused filters, unused groups containing glyphs, images, masks....

    When cleaning up, inkscape removes all theses unecessary defs elements.

    2 . The groups I was refering to are visible in Layers and Object's Panel (ctrl+ shift + L). If you click on one group and type 3 with numpad, view should be displayed on it (try with the path you've created, you'll understand what I mean). Here, nothing happens. If you expand the group in object panel, there is a clone ("use1234" or something alike), if you select it via object panel, status bar (bottom right), says it's "Clone of group of 0 object in group1234" or something alike) a clone of an empty group : briefly a clone nothing), what I call a ghost.

    As theses ghosts are not in defs (see xml editor) but in layers section, they are not removed by clean up, despite they correspond to nothing. I manually remove them (select them via Layers and object's panel and press delete key).

    @Polygon : you'll be pleased to read that, perhaps depending on zooming or something alike, sometimes the results are two subpath with same orientation, sometimes two different orientations.😅

  13. #13
    Polygon Polygon @Polygon🌶
    *👍

    Have an eye at the Status bar when "Clean Up Document" is called as it will give you a hint for what it does.

    @David248 thanks for the reminder; never occurred to me honestly - maybe a macOS version thingy. For whatever reason when I select all elements from the just opened example file the inner and outer path show already different directions. cmd+K for combining leave the directions untouched but joining end nodes will synchronise the direction every time. And when you select elements one by one you´ll notice that the directions are not in synch. Which is another mystery.

     Can´t tell why that is

  14. #14
    Yossi D Yossi D @YossiD
    *

    Wow, so much going on under the hood. Another case of the more I know the less I know.

    Thanks everyone for taking the time to educate me.

  15. #15
    Aero Aero @Aero◻️
    Polygon

    For whatever reason when I select all elements from the just opened example file the inner and outer path show already different directions.

    Did you take a closer look at the corners?

  16. #16
    Polygon Polygon @Polygon🌶

    Yes: