Author Topic: Coordinates of groups  (Read 4196 times)

November 29, 2015, 02:55:32 PM
Read 4196 times

lukaszml

  • Sr. Newbie

  • Offline
  • **

  • 2
Hello,
I have problem with Inkscape coordinate system.
I use inkscape as a UI desinger. I want export each group as a single svg and...I do it by python parser and inkscape commandline renderer.
But I have problem with coordinates of each object.
For example,
I have in inkscape group which is complete window deeper in group we have other group for example X (close) button, which construct by path, rectangle and ellipse

And parsers create tree of folders depend on <g></g>
When parser "see" <g></g> then create folder named <id of group> and go deeper until it encounters at <g root_img="true"></g> then all between <g....></g> treats as separate svg and call Inkscape commandline to render it, and save as <id of group>.png.

After all process I have.
Code: [Select]
[folder]Window
[image]close_btn.png
[image]title_bar.png
[folder]Products_list
[image]product_belt1.png
[image]product_belt3.png
[image]product_belt2.png
[folder]Advanced_options_window
[image]hide_btn.png
[image]title_aow_bar.png
[folder]Options
[image]opt1.png
[image]opt2.png
[image]opt3.png

I want now cooridnates.txt which have inside, for instance:

close_btn 1250, 10
title_bar 0, 0
product_belt1.png 150, 150
etc..

But how get absolute coordinates of each group ?

Someone have any idea ?


EDIT. It is possible to make plug-in which add additional arguments[x=150, y=120] to all groups in xml?

November 29, 2015, 09:06:50 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to Inkscape Community!

I'm afraid I'm not very tech savvy, and don't understand clearly what you're asking.  I see in the XML Editor, that there are coordinates for each object in the group.  I'm a little surprised that there aren't already coordinates for groups.....  Because a group is an object, just like a rectangle is an object.....

EDIT. It is possible to make plug-in which add additional arguments[x=150, y=120] to all groups in xml?

Given my lack of technical expertise, I can't say for sure.  Hopefully some of our more tech oriented members can answer.  However, it seems to me like it should be entirely possible.

There is an extension, and a good deal of discussion about it, in another Inkscape forum:  http://www.inkscapeforum.com/viewtopic.php?f=5&t=8826 which exports node coordinates from the file.  Perhaps that might do part of what you want?

Or maybe it's not quite what you're thinking?

 :ot1:
If you do end up writing an extension, would you try to have it listed in the repository?  http://wiki.inkscape.org/wiki/index.php/ExtensionsRepository  You just have to ask for an account on the development mailing list https://inkscape.org/en/community/mailing-lists/.

Or at least let me know where it can be downloaded.  I'm working on a project to get all Inkscape extensions listed in one place (on inkscape.org).  Currently, many are scattered here and there around the internet, and users can't find them very easily.

Or I could probably add it to the repository, since I already have an account, with your permission, of course.
 :ot2:

  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 30, 2015, 06:48:32 AM
Reply #2

lukaszml

  • Sr. Newbie

  • Offline
  • **

  • 2
Inkscape have aberrant algorithm of positioning objects. When we draw rectangle, eclipse or path, inkscape set position of object in arguments, for example ellipse have cx and cy and its ok :), but standard SVG have another frame of reference in space than Inkscape.
X: 0 Y:0 in inkscape -- left down corner but in SVG is top left corner. Either when we group ellipse and move, CX and CY don't change, but group got "transform" for example transform(-10, 10) when we move 10pixels left and 10pixels down...
This says inkscape draw eclipse in position x and y and next move by another x, and y..
I don't know why authors of inkscape create soo abstract alogrithm...

Now I go search Extension which able to manage xml.


btw. http://www.inkscapeforum.com/viewtopic.php?f=5&t=8826 is outdated :( not work in 0.91

November 30, 2015, 08:23:15 AM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, that's a known issue where Inkscape has (0,0) in bottom left corner, and SVG standards have in top left.  If I'm not mistaken, I think it's on the Roadmap to fix that.  http://wiki.inkscape.org/wiki/index.php/Roadmap  Although this Roadmap is not set in stone, at the moment, it's hoped it will be fixed in version 0.93.

I don't know why they made it this way to begin with, either.  Who knows, maybe SVG standard changed, and Inkscape hasn't caught up yet?  Btw, if you don't already know, you can reach developers via their mailing list or IRC channel.  Mailing list link above, IRC:  https://inkscape.org/en/community/discussion/  Not the one with the applet at the top, but further down.  Although I suspect many devs visit both.

When you say the Export Coordinates extension doesn't work in 0.91, is that from reading that topic?  Or did you actually look into the code?  I have the impression from that topic, that it's fixable.  But again, the details are over my head.

Good luck on your extension search.  I'm sorry it's such a bother currently.  Hopefully I can finish the work on getting all the extensions listed in one place, pretty soon.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann