Inkscape: A Vector Drawing Tool

Moving an Object from Root to Different Layer

Asked by Tex Pepper on 2012-01-21

Greetings All,

I am attempting to edit a degree-6 Sierpinski Carpet (a very complex object requiring lots of memory). The object itself - actually a composite of 10 sub-objects - was created by another program is stored on disk as an SVG file.

When I open the SVG file with Inkscape, the program loads the object into the (root) layer. I don't want it there because the root layer cannot be locked nor hidden.

When I select the object and attempt to move it to another layer, the program hangs.

When I copy the object to the clipboard and attempt to paste it into another layer, the program hangs.

When I copy one of the sub-objects to another layer and then go back to delete the original from (root), the program hangs.

I also copied a sub-object to the clipboard and then attempted to paste it to a new, blank page, Inkscape complained of an orphaned object and recommended I press Shift-D to refer to the source. I did this but then got second message stating that the original could not be found.

How can I load an SVG image directly into a working layer and edit it there? Can I do this?

Thanks,
Tex

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
2012-01-21
Last reply:
2012-01-21
~suv (suv-lp) said : #1

> How can I load an SVG image directly into a working layer and edit it there? Can I do this?

Open a new document, and import the SVG file via 'File > Import': the content of the imported SVG file will be placed onto the current layer (possibly inside a group - depending on the structure of the original file).

~suv (suv-lp) said : #2

For additional help, access to the SVG file would be required to allow further analysis of its content (complaints about an 'orphaned object' indicate that the original file makes use of clones or SVG symbols).

Tex Pepper (tex-chili) said : #3

Thanks ~suv, the import worked - partly. Interestingly, the image imported as a *single* object, not the original composite of 10 sub-objects. Is there a way to import the SVG whilst preserving its original structure?

Also, even though the object imports, operations on it tend to hang Inkscape. I fear the object may be too complex for Inkscape to manage properly.

If you'd like, you can download the original SVG file here...

http://upload.wikimedia.org/wikipedia/commons/4/4e/Sierpinski_carpet_6.svg

Thanks,
Tex

~suv (suv-lp) said : #4

> the image imported as a *single* object

It is a imported as group (hint: if you select the "single object", the message in the status bar tells you the object type). You can either ungroup it (menu 'Object > Ungroup'), or enter the group and edit each of the members of the group as needed:
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Groups.html>

The recursive nature of the file structure makes any editing rather slow. If you want to change the shape or color of the original cell, you might be better off diving into SVG itself, and edit the symbol with the id "s" manually in the SVG source.

~suv (suv-lp) said : #5

> Is there a way to import the SVG whilst preserving its original structure?

The original structure is preserved, just that the top-level <svg> container is converted into a <group> container (because the document the file is imported to already has a parent <svg> node).

There are no other options when using 'File > Import'. Usually, copy&paste into a new document would work just fine. In this case however, the original (hidden) symbols (SVG element <symbol> in the <defs> section which is recursively instantiated with <use>) are not carried over when using the clipboard (known issue, tracked in bug #167907).

~suv (suv-lp) said : #6

Two versions of the file with two layers (the background rectangle, and above the layer with the Sierpinski Carpet).
<http://imgh.us/Sierpinski_carpet_6-layered-1.svg>
<http://imgh.us/Sierpinski_carpet_6-layered-2.svg>

The difference:
- the first one has manually inserted layer groups (using a plain text editor), including the required name space declaration.
- the second one had the groups inserted manually, then was opened in Inkscape to add the layer atttibute & name, and was resaved in Inkscape (as 'Inkscape SVG').

(You'll notice the difference when viewing the SVG source of both modified files in a plain text editor (like Notepad++ on Windows, Gedit or Vim on Linux, TextEdit or MacVim on OS X).)

Both files are slow to open in Inkscape. You could unlink the clones (select all, 'Edit > Clone > Unlink Clone', repeat) for faster editing, but it will increase the file size a lot, and loose the characteristic recursive nature of such a fractal. And it does take its time to process the nested clones, too.
All about clones in Inkscape:
<http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Clones.html>

~suv (suv-lp) said : #7

Turns out that unlinking the symbols isn't really an option either (sorry about that misinformation without testing it in-depth beforehand).

Can you help with this problem?

Provide an answer of your own, or ask Tex Pepper for more information if necessary.

To post a message you must log in.