tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/74-how-to-access-to-each-path-in-typeNodeBox: Discussion 2014-02-11T22:15:20Ztag:support.nodebox.net,2012-11-01:Comment/244349312013-02-04T16:28:11Z2013-02-04T16:28:11ZHow to access to each path in type<div><p>There's no built-in node to do this, but you can use this custom
one. It contains a .py script that it uses to take out the
contours. The code is really simple:</p>
<pre>
<code>def contours(path):
return path.contours</code>
</pre>
<p>We have some documentation on <a href=
"http://nodebox.net/node/documentation/advanced/programming-nodes.html">
writing your own nodes</a>. Note that accessing the graphics API is
subject to change as we are moving to a new, more performant
API.</p></div>Frederik De Blesertag:support.nodebox.net,2012-11-01:Comment/244349312013-02-04T23:56:08Z2013-02-04T23:56:08ZHow to access to each path in type<div><p>Thank you very much :-)</p>
<p>Best,</p>
<p>Q</p></div>Kyuha Shimtag:support.nodebox.net,2012-11-01:Comment/244349312013-02-05T18:48:50Z2013-02-05T18:48:50ZHow to access to each path in type<div><p>Hello Frederik,<br>
Your code worked fine with rectangle, but when I tried it for type.
I got an error.<br>
[cid:<a href=
"mailto:F2470894-F178-42BD-94E7-C029F3352540@mit.edu">F2470894-F178-42BD-94E7-C029F3352540@mit.edu</a>]
Please let me know how to solve this.<br>
Thank you.</p>
<p>All the best,<br>
Q</p>
<p>Q / K y u h a S h i m</p>
<p>Research Fellow / Data Visualization Specialist | Senseable City
Lab, MIT<br>
Faculty | MFA Digital+Media, RISD</p>
<p>MIT, 9-209, 77 Mass. Avenue,<br>
Cambridge, MA 02139 USA</p>
<p>e <a href="mailto:qshim@mit.edu">qshim@mit.edu</a><a href=
"mailto:qshim@mit.edu">qshim@mit.edu</a> || <a href=
"mailto:qshim@risd.edu">qshim@risd.edu</a><a href=
"mailto:qshim@risd.edu">qshim@risd.edu</a><br>
t +1.401.924.1002<br>
w <a href="http://kyuhashim.com">http://kyuhashim.com</a></p></div>Kyuha Shimtag:support.nodebox.net,2012-11-01:Comment/244349312013-02-06T10:14:10Z2013-02-06T10:14:11ZHow to access to each path in type<div><p>Found some weirdness with the output of contours.py (screenshot
attached). The output cant be used by other nodes.</p>
<p>Im not a coder nor a programmer and that's why I love Nodebox.
The ability to split compound shapes into paths should be
implemente into a node. Also I miss a node who returns the height
and width of a shape.</p></div>Usertag:support.nodebox.net,2012-11-01:Comment/244349312013-02-06T16:52:33Z2013-02-06T16:52:33ZHow to access to each path in type<div><p>The function I showed returned a list of Contour objects, not
paths. The new example converts all of the contours to proper
paths.</p>
<p>The code looks like this:</p>
<pre>
<code>from nodebox.graphics import Path
def contours(path):
return [Path(c) for c in path.contours]</code>
</pre>
<p>A note of warning: we're currently revising the NodeBox graphics
API so all code that relies on it will break. This is not so bad
for internal code, since we can change it, but if you write your
own graphics code you will have to rewrite it. Any code that just
uses built-in Python primitives and libraries (e.g. working with
numbers and strings) will continue to work.</p></div>Frederik De Bleser