Get coordinates of *selected nodes*

Post questions on how to use or achieve an effect in Inkscape.
sygi
Posts: 5
Joined: Mon Nov 26, 2018 4:53 am

Get coordinates of *selected nodes*

Postby sygi » Mon Dec 03, 2018 1:35 am

Hello,
I have a path, which has a number of nodes. I select some of the nodes with node-selection tool. I would like to be able (programmatically) get the coordinates of the selected nodes. I saw the path itself is encoded something like:

Code: Select all

<path
       id="path870"
       d="m 702.41652,705.5811 v 0.0156 h -0.0156 v 27.01954 h 0.0156 z"
       style="fill:none;stroke:#000000;stroke-width:1.88976383"
       inkscape:connector-curvature="0"
       sodipodi:nodetypes="cccccccc" />


I also see that the ids of the selected nodes are in the form of "path870:0:5". However, how do I map from the inside-path-id to the actual positions? These ids (5 in the example) are bigger than the number of nodes in the path, so it's not only the matter of taking the k-th node from the path.

I realized that if I click "Break path at selected nodes" and then "Break apart", I'll separate the selected nodes into a separate path, from which I can take all the nodes' coordinates. However, I wasn't able to find how to do "Break path at selected nodes" programmatically either :/

Any hints?

Note that the questions is different from asked in viewtopic.php?t=11620 , as I'd like to have the position of the particualar nodes (as opposed to all of them from within a path).

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Get coordinates of *selected nodes*

Postby Moini » Mon Dec 03, 2018 8:20 am

See http://wiki.inkscape.org/wiki/index.php ... evelopment (the linked bug report contains a script that does what you want)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

sygi
Posts: 5
Joined: Mon Nov 26, 2018 4:53 am

Re: Get coordinates of *selected nodes*

Postby sygi » Mon Dec 03, 2018 9:26 am


Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Get coordinates of *selected nodes*

Postby Moini » Mon Dec 03, 2018 9:41 am

You're welcome :)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”