tag:support.nodebox.net,2012-11-01:/discussions/show-your-work/266-bands-that-start-with-theNodeBox: Discussion 2018-05-20T01:35:07Ztag:support.nodebox.net,2012-11-01:Comment/453133472018-05-19T19:12:21Z2018-05-19T19:12:24ZBands that start with "The"<div><p>I've been playing around with Nodebox for about a month. A student turned me onto it, and I'm in love. This has been the most fun software to learn of anything I've ever tried, and certainly the most user friendly generative/data viz tool I've used. I love that even though I cannot program, that since I do at least understand the abstract way functions and variables must fit together I can still put together some pretty rad and complex things amazingly quickly.</p>
<p>As a visual designer interested in systems, I thought I'd try recreating a poster I made a long time ago, a visualization of bands starting with "the" in my itunes library...</p>
<p>The issues I ran into were related to data — I didn't have a good data source, just all the names pulled into a text file. I was able to figure out how to remove duplicates within nodebox, but couldn't figure out how to sort/group alphabetically other than manually making a bunch of "ranges"</p>
<p>I also realize that I use the same text node and group node on every single letter, so that's something that could be "subnetworked" or something?</p>
<p>Anyway, I'm really interested in using Nodebox to open new territory for my designs, as well utilize it as a way to get more into programming directly, if anyone has any suggestions for how I can utilize this more effectively/efficiently I'd be pleased to converse.</p>
<p>I'm a graphic design faculty in Baltimore, MD at the Maryland institute college of art, so I'm also trying to think about how Nodebox can become an integral tool in some of my classroom related things...</p>
<p>If anyone wants to play with my nodebox file its attached w/ the .txt data in the zip, the font I am using is League Gothic: <a href="https://www.theleagueofmoveabletype.com/league-gothic">https://www.theleagueofmoveabletype.com/league-gothic</a></p></div>kbjornardtag:support.nodebox.net,2012-11-01:Comment/453133472018-05-19T23:29:28Z2018-05-19T23:29:28ZBands that start with "The"<div><p>Hi kbjornard!</p>
<p>Welcome to the NodeBox community. Like you, I fell in love with NodeBox a few years ago and since then my initial impression has only deepened. I use NodeBox constantly, both at work (for data visualization) and for my own art projects.</p>
<p>Your instinct is correct: whenever you find yourself repeating the same set of nodes 27 times there is usually a simpler way of doing things. And, indeed, the secret is subnetworks.</p>
<p>A subnetwork is just a way of making your own function. In this case you need a function that reads in the whole list of band names a spits out one group at a time: the group that starts with A, the group that starts with B, etc.</p>
<p>I have attached a NodeBox network that perfectly recreates your poster using just such a subnetwork. I called it "alpha_groups". It takes the band list as an input along with three other parameters: Starting Letter, Font Name, and Font Size. If you set Starting Letter to A it will return a group of text paths for all bands starting with A.</p>
<p>I pass this function a list of 26 letters from A to Z (using a make_strings node) and it spits out 26 groups ready to place and color.</p>
<p>To see how it works, control click on alpha_groups and choose "Edit Children". It takes the list (passed through a Null node) and sends it to a starts_with node to produce a list of booleans (true or false) showing whether each band does or does not start with the supplied letter. We pass that to a cull node to remove all the bands that do not start with that letter. The bands that remain are turned into text paths and grouped together.</p>
<p>One subtle trick when making subnetworks like this: It matters a lot whether each input is taken in one at a time (value) or all at once (list). In order to work correctly, this subnetwork has to take in the band list all at once. So when I made the subnetwork I had to select it, click Metadata (above the ports pane), and for the first input "list" change its range from value to list. This detail is the single most confusing but all-important part of using subnetworks.</p>
<p>To finish I had to create one more subnetwork to handle band names that begin with something other than a letter. For this I made the "other_group" subnetwork. Just feed it the list and it spits back a group of text paths for all the non-alpha bands. I'll let you open that one up yourself to see how I did it.</p>
<p>The rest of the nodes to color and place the text groups are from your original network. I just tidied them up a bit.</p>
<p>Please play with this new simpler network and let me know if it answers your questions. You may also want to search this forum for other bits of example code. If you have a question there's a good chance it has already been asked and answered somewhere in the forum.</p>
<p>If you do incorporate NodeBox into your courses we'd all love to see samples of your work and the work of your students. And don't be afraid to ask for help when you get stuck.</p>
<p>Happy NodeBoxing!</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/453133472018-05-20T01:35:03Z2018-05-20T01:35:03ZBands that start with "The"<div><p>John, Aha! wow! Thank you!</p>
<p>Okay, I had not figured out that playing in the metadata options allowed for things to happen a certain/different way, thanks for sharing that.</p>
<p>Going through your updates makes a lot of sense. Thanks for taking the time to do that.</p>
<p>Can't wait to keep experimenting, and searching the forums for things!</p></div>kbjornard