Sometimes several objects need to be manipulated together in a group rather than separately. For example, if you want to keep the position of several objects relative to each other but still be able to grab and move those objects around the canvas quickly and easily. You might also want to adjust one setting for several objects at the same time, such as fill or transparency. A group is treated as a single object, and for most operations it can be manipulated as such. For example, groups can be "stacked", meaning that you can create groups made of groups or groups other objects. This can be helpful, but it can also be very confusing if it becomes complicated.
|Published (Last):||19 June 2008|
|PDF File Size:||3.39 Mb|
|ePub File Size:||8.11 Mb|
|Price:||Free* [*Free Regsitration Required]|
I just realized while drawing a set of icons in Inkscape that there is a funtion that could be and I think should be added: "Ungroup all". There is such a function in Corel Draw. It is actually the same as Ungroup, but the main and only difference is the following:. Let's say that you work with an objects group, consisting of other groups that consist of other groups If you want to ungroup all the object's groups, you will have to ungroup the 1st group, then ungroup the secondary groups etc It is time consuming or i'd better say "click consuming".
By adding an "Ungroup all" function, users will have the possibility to ungroup all the selected groups with one single click. Thanks horkana, I really hope to see this function implemented in the near future, as it is very usefull while dealing with complex groupped svg files imported from other applications AI, Corel It is also very usefull to export files to AI, groups seems to mess up the outline thickness, so you have to remove all groups to have a correct import of the SVG in AI.
Quite annoying behaviour Anyway, the "Ungroup All" function could be a usefull thing. However, if you were to gather together a shortlist of enhancements such as this one which would be relatively easy and suitable for implementing as extensions you might be able to send a message to the mailing list and inspire some interest. I am always interested to know how other applications do things. Do any other vector graphics applications offer an "Ungroup All" option and if so how is it presented in the user interface?
Yes, Corel Draw has that function since version 8 or even version 7. Quite usefull function! Woulnd't be possible to add a visual hint of the process that is being performed? Yes, of course. But improving performance is probably much more difficult than adding a progress bar, and meanwhile a visual hint would be acceptable. Inkscape needs visual feedback for several time consuming processes that apparently hang the program to the user eye. I just wanted to stress a little more the need for the [ungroup all] function.
Yesterday I imported a big PDF file generated by Adobe Indesign into inkscape and it took me almost 10 minutes to get rid of all the groups and begin to edit it. I attached a screenshot of Corel Draw's context menu to this post. This will open file. So it is ok for tens of imbricated groups but not for hundreds. Moreover it is still quite slow especially because this command line does not work with the -z option no GUI. Then I searched how to write a Python extension extending default 'inkex' extension.
Unfortunately I have found neither documentation about any ungrouping function nor any use of such function in an existing extension. This site also publish the Inkscape API. It should look like:. Hence such functions would need to be implemented again in the Python plugin. This is not so trivial for ungrouping as the group may have transformation applied.
I may implement it in Python though, if I find the ungrouping function in Inkscape source code. Modifications: name of the function, end of "for" loop, menu names at the end of the function. This gives untested :. Please that the code repository of Inkscape trunk has moved to Launchpad  after the release of Inkscape 0. I have tested the extension from Gitorious. It works for moderate grouping but the extension failed on a ko plain svg file with nested groups. Here is the log:. Right, and I won't do anything about it.
Patches welcome, but I don't want to get this excessively complicated note, that you've hit libxml limit, not problem of my code.
Also note, that in inkscape It has been fixed in Here's a patch to inkex. I just put my modified inkex. Patch is against 0.
With this and Matej's "Deep Ungroup" extension see previous comment , we have a working solution for the OP. Though, I admit, a cleaner solution would have been to extend the inkex.
I've restructured it to be iterative with a stack instead of recursive. If you have millions of elements that are thousands of levels of nesting deep, this is a HUGE slowdown.
Before it was running in time O N log N and space O log N with a high coefficient, so this means a huge speedup with a small space decrease.
It is now trivial to add a "max depth of X" limit add current depth as a member of the tuple in the queue and only ungroup if it's less than X , and possible to have a "leave the last Y levels" limit perform the ungroup Y levels up from the current level instead of at the current level , though I've not implemented those features.
Thank you, Robin, that's a great job. I google again today, find the same thread, and damned if it's not only there, but updated, patched, extended too. Looks like i accidentally uploaded a version that had been tabified. Here's the proper, no-tabs version. For the curious, each tab was supposed to be 8 spaces. Thank you for clean up, but I have now problems with its results.
View of the document shouldn't change. It performs exactly as your original one does, except faster just tested. It also performs exactly how simply ungrouping manually would work -- I get the same results that I get when I select everything and simply ungroup manually it takes 7 ungroups.
Do you intend for your plugin to have different behavior than simply running the ungroup command a bunch of times? It could be changed recognize a clip and not ungroup that, or to transform the clipped object so that the clip is no longer necessary. I think the former is better. But, that's a functional change -- the cleanup didn't alter the functionality in any way that I can see.
I also see that deep ungroup doesn't play well with inkscape undo. Is that something easily fixable? In order for this extension to work around it, it would have to track the clip-path nestings and create its own nested clip-path objects to assign the children in order to propagate clips without view changes.. That's pdefinitely ossible -- look at the "Layer Clip" extension -- but it's quite a bit more work.
You'd have to keep the relevant clip-path objects in the queue and add sub-elements to them as you get new clip-paths. Well, I don't know what else my old plugin did, but when opening the mentioned PDF, it didn't change the view.
Your one does. Given that working on these Google Calendar exports is the main purpose of the plugin for me, I cannot use your plugin however awesome it is and I don't dispute that.
Just to make sure we're seeing the same thing: The view change that I see is that the boxes around the date numbers in the upper right of each day area quadruple in size. Is that what you're talking about? Looking at the svg, and how your plugin and mine! Perhaps google recently changed their generation of calendar exports?
I believe you that it worked before, but neither your plugin nor mine, nor the standard ungroup function, will work on the PDF you linked without changing the view. I decided to go whole hog and I basically re-structured it from the ground up. I added the parameters I discussed in comment 23, allowing you to ungroup the whole document, leave levels of grouping at the top, leave levels of grouping at the bottom as measured from the top, and leave levels of grouping at the bottom as measured from the bottom.
In your PDF, only the lowest level of grouping contains the odd clip-path behavior, so you can just set it to ungroup all but one level and the view doesn't change at all. You can also easily add any filter you'd like, possibly even an xpath expression, kind of like the color replace extension see coloreffect. Your original plugin removed any and all inherited styles from the document, even for non-group containers such as embedded svgs, anchors, and switches.
I also created a stub for propagating clip-paths to a group's children, but it's not implemented yet because it's not as simple as just copying it to the children: The child might already have a clip-path, requiring you to make a new hierarchical clip-path in the defs section of the svg; and any transform the child has apparently will apply the clip-path as well, meaning you'd need to apply the reverse of that transform to the clip-path itself in order to maintain the view.
It does the ungrouping on the way up, instead of on the way down, because it has to hit bottom before it can know the height from the bottom. That is not what I see. Interesting, the last version from comment 33 seems to work correctly Your pictures contradict some of your statements.
There was a point where I had a bug not propagating the transform correctly that caused the missing text that you see, but I didn't think I'd uploaded that version. I'd go check, but it's fixed in the latest version anyway, so I'll take your word and evidence! Sorry about that. In any case, our plugins now give the same result, though the iterative version works where the svg depth is greater than and the recursive one doesn't, and the iterative one has a few more options now.
It also runs vastly faster and avoids doing a bunch of changes unrelated to ungrouping that came as part of using the global inheritance-removal script. I couldn't leave well enough alone, so I added the clip-path transform tracking. Now it ungroups without any visual change whatsoever. It's a little slower when there are many nested clip-paths because I have it set up an inverted tree of nested clip-path references, but it's still pretty fast.
The big issue is that when you apply a clip-path to an element with a transform, the transform applies to the clip-path as well To make matters worse, you can't just set the transform on the clipPath element itself, but you have to apply it to all the children. Something similar probably needs to be done to track masks as well, but I'll leave that to someone else -- it's likely pretty close to the exact same code.
How to group and ungroup objects in Inkscape
Any ideas? I was gonna download a file from vecteezy. Firstly, Inkscape is awesome. OK, now we can take a look at a possible solution. There are two things you can try, under the Object menu: Clip and Mask.
Inkscape tutorial: Basic
This tutorial demonstrates the basics of using Inkscape. If you have opened it from the Inkscape Help menu, it is a regular Inkscape document that you can view, edit, or copy from. You can also save a copy to a location of your choice. The Basic Tutorial covers canvas navigation, managing documents, shape tool basics, selection techniques, transforming objects with selector, grouping, setting fill and stroke, alignment, and stacking order. For more advanced topics, check out the other tutorials in the Help menu. There are many ways to pan scroll the document canvas.