Getting coordinates of svg parts

pete.vasilyev's Avatar

pete.vasilyev

13 Nov, 2015 09:48 AM

Could anyone kindly advise how to easily acquire a list of X and Y for a bunch of imported objects?
Is centroid a default way of obtaining a shape origin? Using lookup for that feels clumsy to me, but i'm currently seaching for the fastest and more optimized way.

Sorry if it's a stupid / obvious question. I haven't found anything in reference.

  1. Support Staff 1 Posted by john on 16 Nov, 2015 04:53 AM

    john's Avatar

    There are at least 3 different ways to derive an X,Y “origin” for an SVG shape:

    • The upper left corner of the bounding box
    • The center of the bounding box
    • The first point of its path

    From your screenshot it seems you have already found ways of getting the first two. Here is how I would do it:

    • For upper left corner, do lookups of bounds.x and bounds.y. But you don’t have to concatenate them; just feed them into a “make_point” node.

    • For center, use centroid.

    • For first point, do a lookup on “points” and use the “first” node to grab the first point. In order to get the lookup to spit out a list of individual coordinates, use the Metadata menu to change its settings port from “value” to “list”. Then, so that the first node will take the first value of each shape instead of the whole collection of shapes, group the two nodes (lookup and first) into a subnetwork; that way they will fire once for each shape.

    I made a quick network to demonstrate this. I imported an SVG of a four-by-four collection of triangles and ungrouped it. I then put 3 copies side by side and colored them red, green, and blue. Each copy uses a different interpretation of origin and rotates about that origin. I also plot the origin points as black dots.

    I have attached the network, the svg, a screenshot, and a movie showing the rotations in action.

    Does that help?

    John

  2. 2 Posted by pete.vasilyev on 17 Nov, 2015 02:44 AM

    pete.vasilyev's Avatar

    That helped, John. Thanks for your extensive answer!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • origins.jpg 228 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

04 Dec, 2023 10:18 PM
04 Dec, 2023 10:14 PM
04 Dec, 2023 11:38 AM
29 Nov, 2023 05:30 AM
28 Nov, 2023 12:38 AM

 

27 Nov, 2023 04:40 AM
26 Nov, 2023 10:02 AM
22 Nov, 2023 09:33 AM
20 Nov, 2023 08:54 PM
17 Nov, 2023 01:43 AM
15 Nov, 2023 06:58 AM