tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/5641-getting-coordinates-of-svg-partsNodeBox: Discussion 2015-11-17T02:44:20Ztag:support.nodebox.net,2012-11-01:Comment/384540182015-11-13T09:48:43Z2015-11-13T09:48:46ZGetting coordinates of svg parts <div><p>Could anyone kindly advise how to easily acquire a list of X and
Y for a bunch of imported objects?<br>
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.</p>
<p>Sorry if it's a stupid / obvious question. I haven't found
anything in reference.</p></div>pete.vasilyevtag:support.nodebox.net,2012-11-01:Comment/384540182015-11-16T04:53:43Z2015-11-16T04:53:43ZGetting coordinates of svg parts <div><p>There are at least 3 different ways to derive an X,Y
“origin” for an SVG shape:</p>
<p>• The upper left corner of the bounding box<br>
• The center of the bounding box<br>
• The first point of its path</p>
<p>From your screenshot it seems you have already found ways of
getting the first two. Here is how I would do it:</p>
<p>• 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.</p>
<p>• For center, use centroid.</p>
<p>• 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.</p>
<p>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.</p>
<p>I have attached the network, the svg, a screenshot, and a movie
showing the rotations in action.</p>
<p>Does that help?</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/384540182015-11-17T02:44:20Z2015-11-17T02:44:20ZGetting coordinates of svg parts <div><p>That helped, John. Thanks for your extensive answer!</p></div>pete.vasilyev