ungroup to avoid transform/translate

Post questions on how to use or achieve an effect in Inkscape.
charrington
Posts: 4
Joined: Thu Oct 09, 2014 4:24 am

ungroup to avoid transform/translate

Postby charrington » Thu Oct 09, 2014 4:31 am

I've read some discussions but haven't been able to figure this out. I want to save my SVG files without any tranforms or translates. The discussions said to remove any groups. But it does not appear to be possible to ungroup objects. I can select individual shapes but when I view the XML I still see all my path elements are contained in a g element. Perhaps I am going about this the wrong way. My goal as I stated is to "flatten" my drawing - meaning remove any transform/translate statements by having the underlying coordinate points changed to reflect the transform.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: ungroup to avoid transform/translate

Postby tylerdurden » Thu Oct 09, 2014 6:09 am

Try:
Edit: Preferences>Transforms>Store transformation>Optimized
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

charrington
Posts: 4
Joined: Thu Oct 09, 2014 4:24 am

Re: ungroup to avoid transform/translate

Postby charrington » Thu Oct 09, 2014 11:03 am

That's already set. So how does one make it do its thing?

charrington
Posts: 4
Joined: Thu Oct 09, 2014 4:24 am

Re: ungroup to avoid transform/translate

Postby charrington » Thu Oct 09, 2014 11:26 am

I did find that I can remove the transform on the parent g element by going into the xml editor and dragging the shapes out of the g and then deleting it. But I assume there is a more direct way that doesn't involve using the xml editor and removing the g element.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: ungroup to avoid transform/translate

Postby Lazur » Thu Oct 09, 2014 12:16 pm

Inkscape implements layers as groups.
If there is just one layer in use, it will appear as a group in the codes.
Eventually there has to be somekind of transformation -at least if saved as inkscape svg-, because the coordinate system is flipped vertically compared to the specs.


What do you mean you cannot ungroup all objects?
Are you inside one?
Press Ctrl+Backspace to move out of it.


Other objects, like rectangles also can have transformations, so you may need to convert all objects to paths, too.


Off topic:
Remembered a similar topic, but now that I found it, it seems less related:http://www.inkscapeforum.com/viewtopic.php?f=5&t=16728.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: ungroup to avoid transform/translate

Postby tylerdurden » Thu Oct 09, 2014 12:25 pm

@ charrington:

You might want to upload an example.

When I test the individual or group transforms, they are removed and reflected in the path coordinates. The only group I have remaining is the Inkscape layer group(s)

Maybe you have seen this post/topic?
~suv wrote:Not all objects can use optimized transforms:
  • groups will keep them -> ungroup, nudge and group again (watch out for nested transformed groups)
  • shapes (except rectangles) always use preserved transforms (workaround: convert to path and nudge)
  • clones (workaround - unlink - not very useful)
  • any object with a filter effect applied will use preserved transforms
  • possibly others…

viewtopic.php?f=22&t=8838

Since then, it seems that dragging and spinbox-entry will not interfere with optimized transforms. Not on the recent pre-release anyway, so nudging is not the only way to locate objects.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

charrington
Posts: 4
Joined: Thu Oct 09, 2014 4:24 am

Re: ungroup to avoid transform/translate

Postby charrington » Thu Oct 09, 2014 1:31 pm

First, thanks everyone who's responding. It's great to see such an active community.
See two attachments. For ship1.svg, I created a 32x32 drawing, pasted in a collection of shapes, then resized with all selected to fit into the doc. Note that there is a g element which parents all shapes. No transformation present.
In ship2.svg I changed the document to be 22x22 and then resized with all selected to make fit in doc. Now the g element has a transform.
Q1: why was transform added?
Q2: any way to remove transform (besides what I did - drag all shapes out of g in xml editor then resize)
Q3: why is there a g element? Does this represent a default layer which is always created?

I just did this test. Before pasting shapes into new doc, I removed the g element which had been present by default. Now after all my above manipulations I am left with shapes without any g or transform. So I think I found a way to achieve what I want. But I'm here to learn (just started using InkScape).
Attachments
ship2.svg
(4.23 KiB) Downloaded 204 times
ship1.svg
(4.17 KiB) Downloaded 247 times

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: ungroup to avoid transform/translate

Postby Lazur » Thu Oct 09, 2014 1:58 pm

I suggest to combine the paths together first.
If not satisfied with scaling results, you could try digging into the specs and add right viewbox parts into the codes with a notepad, and try how that response for icons.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: ungroup to avoid transform/translate

Postby tylerdurden » Thu Oct 09, 2014 11:28 pm

This seems an interesting example of Inkscape coordinates vs SVG coordiates.

When you resize the page, Inkscape will place transforms on the existing layers to maintain Internal coordinates.

However, after resizing the page, a newly added layer will not have the transforms and the existing objects can be grouped (if not already), scaled, cut and pasted-in-place into the new layer. (Very similar to pasting into a new document.) Thereafter, the empty original layer(s) that have the transforms can be deleted.

I presume this "flattening" issue is related somehow to using the SVG in other software?
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/


Return to “Help with using Inkscape”