Salam for all,
For example :
Input SVG : One layer (root) with n groups
Output SVG : n layer (each layer contains one group
There is a simple way to do it with python ? python/xml ?
Thanks and best regards
[Solved] How to move each group to a new created layer
[Solved] How to move each group to a new created layer
Last edited by amjahed on Wed Jun 08, 2011 10:01 am, edited 1 time in total.
Re: How to move each group to a new created layer
Layers are (technically) groups in Inkscape.
You just need to add inkscape:groupmode="layer" attribute to each group <g> node.
Any language that can open an xml file and process it should be able to handle the task (outside of inkscape).
-Rob A>
You just need to add inkscape:groupmode="layer" attribute to each group <g> node.
Any language that can open an xml file and process it should be able to handle the task (outside of inkscape).
-Rob A>
Last edited by RobA on Wed Jun 01, 2011 2:10 am, edited 1 time in total.
- shawnhcorey
- Posts: 149
- Joined: Mon Jan 07, 2008 12:17 pm
Re: How to move each group to a new created layer
RobA wrote:Layers are (technically) groups in Inkscape.
You just need to add <i>inkscape:groupmode="layer"</i> attribute to each group <g> node.
Beware of nested groups. You should only add the above to the outer-most groups. I don't know what Inkscape would do if it thought an inner group was a layer.
Re: How to move each group to a new created layer
shawnhcorey wrote:RobA wrote:Layers are (technically) groups in Inkscape.
You just need to add <i>inkscape:groupmode="layer"</i> attribute to each group <g> node.
Beware of nested groups. You should only add the above to the outer-most groups. I don't know what Inkscape would do if it thought an inner group was a layer.
No problem. Inkscape supports sublayers (right from the layer dialog, insert a new layer before, after or as a sub-layer)
-Rob A>
- shawnhcorey
- Posts: 149
- Joined: Mon Jan 07, 2008 12:17 pm
Re: How to move each group to a new created layer
RobA wrote:No problem. Inkscape supports sublayers (right from the layer dialog, insert a new layer before, after or as a sub-layer)
Gee, you learn something new every day. Thanks.
Re: How to move each group to a new created layer
RobA wrote:Layers are (technically) groups in Inkscape.
You just need to add <i>inkscape:groupmode="layer"</i> attribute to each group <g> node.
Any language that can open an xml file and process it should be able to handle the task (outside of inkscape).
-Rob A>
Thanks ! Happy to find a solution easier than I expected.
From your answer, I modify (with text editor) :
Code: Select all
<g
id="g3771">
To :
Code: Select all
<g
inkscape:label="Layer-1"
inkscape:groupmode="layer"
id="g3771">
How to use the <i> attribute ?
Re: How to move each group to a new created layer
Sorry - the <i> and </i> came because I posted from elsewhere and it didn't get converted to bbcode.
What you show is exactly what you need - you don;t even need the label line.
Here is one I did with search/replace in a text editor, each group in the original layer ended up as a sublayer of the original "Layer 1":
-Rob A>
What you show is exactly what you need - you don;t even need the label line.
Here is one I did with search/replace in a text editor, each group in the original layer ended up as a sublayer of the original "Layer 1":
-Rob A>
Re: How to move each group to a new created layer
Great , It's so easy to do.
I summarize (case of an SVG file that has one layer) :
1- Create groups
2- In a text editor, remove :
and the last
3- replace all :
with :
See the two attached captures.
Thanks !
I summarize (case of an SVG file that has one layer) :
1- Create groups
2- In a text editor, remove :
Code: Select all
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
... >
and the last
Code: Select all
</g>
3- replace all :
Code: Select all
<g
with :
Code: Select all
<g inkscape:groupmode="layer"
See the two attached captures.
Thanks !