Inkscape.org
Creating New Extensions Node Coordinates Extension
  1. #1
    cartoonygothica cartoonygothica @cartoonygothicpunker

    So, back in October, I asked for a feature that could show coordinates of selected nodes. Inklinea had created an extension to do just that. https://gitlab.com/inklinea/inspect-nodes

    Unfortunately, I've found that on some areas, coordinates that should be the same show up as different numbers when I use the extension. I mean, those nodes were literally snapped to each other. On other areas, the extension does not even give me coordinates; it gives me a wall of text.

  2. #2
    inklinea inklinea @inklinea⛰️

    I'm not 100% sure I can fix this. It may be due to different transforms on nodes on different objects / layers.

    Although I do write extensions - I'm not that advanced with nodes - apologies.

    :(

  3. #3
    cartoonygothica cartoonygothica @cartoonygothicpunker

    Well, thank you for responding. I appreciate your attempt at writing the extension. Anyone who is knowledgeable about nodes, please feel free to reply!

  4. #4
    Kaalleen Kaalleen @Kaalleen

    For troubleshooting it could be helpful if you provide a svg file which is including problematic areas.

  5. #5
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    I originally posted this in the Beyond the Basics section of the forum, but here it is.

    In one screenshot, the nodes that form where the bottom of the nose and the upper lip meet should have the same coordinates, but the extension gave two different coordinates. In the other screenshot, when I selected the six nodes that form the top of the head and the hair, the extension did not even give me coordinates. And here's the actual Inkscape file.

     

    Walloftext
    Nodecoordinatediscrepancy
    Prideflag Td
  6. #6
    Kaalleen Kaalleen @Kaalleen
    😀

    Ok thank you. I basically see two issues. One with transforms and an other one which is responsible to output the error message you've posted above.

    I tried to (quickly) fix both of them. You can check it out here: https://gitlab.com/kaalleen/inspect-nodes/

    I also found it a little bit annoying when the labels became too big. So I add an option to limit decimals and also an option to hide the chosen units within the labels.

    @inklinea I created a merge request to your repo.

  7. #7
    inklinea inklinea @inklinea⛰️

    Many thanks Kaalleen,

    Not just for the correction, 

    I've never tried to process a merge request before, 

    However - all the the changes I am going to study them. 

    There's lots of things I think I can learn from just looking at the merge !

    In particular - the fact I was using string comparisons to compare bools. 

    and also the fact I have been typing inkex.errormsg('etc') forever !

  8. #8
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    It works much better now! This might just be nitpicking, but I did notice that at one corner of the bows (where the red circle is), the coordinates show up with a slight discrepancy, when I test the extension on those three nodes. Yet, when I select each node one at a time, the coordinates match.

     

    Prideflag
    Nodecoordinatediscrepancy2
  9. #9
    inklinea inklinea @inklinea⛰️

    Well I've merged the merge - the first one I've done :)

    Thanks for your help Kaalleen

  10. #10
    Kaalleen Kaalleen @Kaalleen
    🔧

    Uh, I'm afraid I just gave you more merge-training :D. Sorry, I was so focused on the given bugs, that I introduced a new one. The point positions are completely off.

    Also (and that needs more testing than what I've done so far) I changed the unit conversion to use an inkex method. I hope I did not break anything by doing that.

    @cartoonygothicpunker I'm afraid there is not much I can do about it - at least not without putting much more work into it. These are the numbers that come directly from the points given to us by end_points.

  11. #11
    cartoonygothica cartoonygothica @cartoonygothicpunker

    I see. Well, thank you for making the updated extension. It's been real helpful for me.

  12. #12
    inklinea inklinea @inklinea⛰️

    haha - still many thanks Kaalleen. 

    It's good to get a 2nd opinion on things. I was sure the extension was reasonable ( except for some transform problems ). 

    However - now that another thing exists in the world - it's a starting point. 

    I am hopeful that we might get dbus commands in the future to instantly interrogate bounding boxes ( geo and visual ) and absolute node positions. 

     

  13. #13
    Kaalleen Kaalleen @Kaalleen

    Ok, reworked the code again (sorry @inklinea).

    Now it will also display the chosen number of decimals in the message box and displays the numbers in the chosen unit system. When you increase the decimals you can see, that most of the time this comes down to a rounding issue. I think even in the svg itself you can achieve just a certain accuracy.

  14. #14
    Kaalleen Kaalleen @Kaalleen
    inklinea

    I am hopeful that we might get dbus commands in the future to instantly interrogate bounding boxes ( geo and visual ) and absolute node positions. 

    Oh, I was following your dbus discussions. Haven't tried it out yet, but it seems like a very interesting approach.

  15. #15
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    Thanks, Kalleen. It does work a bit better now; at the very least, the number of digits shown after the decimal is more consistent. This is the other file I tested the extension on.

     

    Reference
  16. #16
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    In the first two Inkscape files I've shown, I found that when I move the object slightly in the direction that corresponds to the coordinates with the discrepancies (horizontally when the x-coordinates have the discrepancy or vertically when it's the y-coordinates), the discrepancies seemingly disappeared. I don't know why it doesn't work as well with my other files, such as this one.

    Personaredesign
  17. #17
    Kaalleen Kaalleen @Kaalleen

    I honestly don't know - but before I search through the whole file - what are the critical spots to look at?

  18. #18
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    So far, I would suggest the nodes where the middle and ends of the bows meet. I wanted to update my last post for this topic again, but it wouldn't let me, so I'll add it in this response. When I keep the number of digits after the decimal at three, the coordinate discrepancies are sometimes less noticeable because of rounding, but when I increased the number of digits to four, the discrepancies are more noticeable. Though these discrepancies may be too small for most people to notice, it bothers me that I can't get some nodes that are snapped to each other to match exactly. At this point, I'm not even sure whether it's because of the extension, or if the snapping tool is not as precise as it seems.

  19. #19
    Tyler Durden Tyler Durden @TylerDurden

    Due to rounding, discrepancies will always be more likely with each additional digit to the left of the decimal. One thousandth of a mm ( one micron)  is very small, well beyond the ability of human perception.

  20. #20
    Kaalleen Kaalleen @Kaalleen

    I'm curious why you need that high precision ... but ok, maybe a snapping extension is what you need. I quickly put one together for you (haven't tested it very well though - but maybe you can do that for me): https://gitlab.com/kaalleen/inkscape-snap-nodes

  21. #21
    cartoonygothica cartoonygothica @cartoonygothicpunker
    *

    I admit that I'm a perfectionist sometimes, not to mention autistic. A lot of the stuff I like to draw involves having certain lines and points directly on top of one another, and when such lines and points are not as close as they seem to be, it throws me off. I feel attracted to precision when it comes to making things, since I like being able to get things just right the first time, instead of always just eyeballing it. But thanks. I installed the extension, after I reinstalled Inkscape version 1.2.1. So far, I think it's working well.

  22. #22
    Kaalleen Kaalleen @Kaalleen

    Thank you for your open words. In that case I suppose I can expect no better person to test this new extension :)

    Btw. since a few days there is a new Inkscape version out there (1.2.2)

  23. #23
    cartoonygothica cartoonygothica @cartoonygothicpunker

    You're welcome. I did try to install it on the day it was first released, but Windows detected a threat, for some reason. I guess I'll reinstall version 1.2.2 at some point now. :)