Pythonista? NodeBox in NodeBox?

john's Avatar

john

08 Mar, 2015 07:51 AM

I like to develop interactive visualizations for the iPad ON the iPad. One great tool for this is the iOS app Pythonista. It's a wonderful IDE.

Now that I've discovered NodeBox, I'd love to be able to create visualizations and animations in NodeBox and move them to Pythonista so I could add interactivity and play with them on my iPad.

I notice that .ndbx files are just XML files with a fairly straightforward structure. And at least some NodeBox nodes are already written in Python (though probably using libraries that might not work in iOS). Pythonista has its own set of iOS libraries for creating GUIs and drawing things. In theory it shouldn't be *too* hard to translate most NodeBox nodes.

I understand that NodeBox Live would someday let me run NodeBox within mobile Safari but I'd rather work in Pythonista and leverage their libraries. If I could export or convert .ndbx files to Python code I'd be halfway there. How hard do you think it would be to do this? What libraries would I need?

A (somewhat) related question: how hard would it be to draw NodeBox networks in NodeBox? This looks like it might not be too hard if I could just figure out how to either import an .ndbx file and parse its XML or somehow convert it to a CSV file. I can put an .ndbx file up on the web and bring it in using the http_get node, but this just gets me the raw text so parsing would be painful. Does NodeBox have any ability to parse XML? There does not seem to be any documentation for http_get.

Not an urgent request, but it might make an excellent tutorial. It would be interesting to find new ways to visualize a nodeBox network, or even animate it! This would also let us save our beautiful networks as PDFs, print them, and hang them on the wall!

  1. Support Staff 1 Posted by john on 08 Mar, 2015 11:09 PM

    john's Avatar

    UPDATE

    I was able to answer my second question. It turns out it's quite possible to draw NodeBox networks in NodeBox (see attached screenshot).

    The trick is to convert the XML text of a .ndbx file to JSON using commonly available tools like this online converter:

    http://www.utilities-online.info/xmltojson/#.VPzQ8EK-Qts

    You can then paste the JSON text into a new file, upload it somewhere, and then import it into your NodeBox sketch using the http_get node, and hook that node to some query_json nodes (one for the nodes, one for the connections, etc.).

    From there it's just a matter of looking up what you need, drawing rectangles, connecting them with a link node, and so forth. The only tricky bit was drawing the individual input ports. For this I had to make a CSV file to list the port order for every node and port used in the network.

    As you can see from the attached screenshot, the output is quite legible. Both nodes and links are colored according to node category. I didn't show the rendered node or node comments, but this would not be hard.

    Now that I can draw my own networks, it would be easy to add side notes and callouts, insert a zoomed-in view of a subnetwork, alter the color scheme and add a legend, etc.

    I think it's very cool that NodeBox can draw itself. It's a nice illustration of the power of this tool.

    I will post what I have so far in the "Show Your Work" forum so other people can download draw-network and give it a spin on their own networks. If anyone comes up with some nice network drawings, please post some screenshots!

    John

  2. Support Staff 2 Posted by Frederik De Ble... on 09 Mar, 2015 09:37 AM

    Frederik De Bleser's Avatar

    To answer your first question, the nodes could be seen as universal "verbs" that can be programmed in any language. Most of the nodes are currently implemented in Java, though (and in JavaScript as well in NodeBox Live). The NodeBox engine is also written in Java, but is quite straightforward to port to other languages.

    The graphics operations can be quite complex because some depend on functionality provided by the Java APIs, so it would be some work to port those (for example, "compound path" that works much like Illustrator's Pathfinder).

    When we were porting the nodes to JavaScript, we created a dashboard that showed which nodes are there and which nodes still needed to be ported. This might be a helpful overview for you as well:

    http://nodocs.nodebox.net/

  3. 3 Posted by grolicus on 11 Mar, 2015 09:50 AM

    grolicus's Avatar

    john : "I like to develop interactive visualizations for the iPad ON the iPad.". I'm very much in the same boat, and I'm guessing we're not isolated cases..
    Frederik : just curious, "I understand that NodeBox Live would someday let me run NodeBox within mobile Safari". Would that be the full NodeBox experience (albeit running in a browser), or a limited version ? Any (even very sketchy) timeline on that ?

  4. Support Staff 4 Posted by Frederik De Ble... on 20 Mar, 2015 07:20 PM

    Frederik De Bleser's Avatar

    We're now doing testing with small groups to fix major outstanding bugs, I hope to release something after the Easter holiday.

    I'll also send you an invite so you can get started early :-)

    Best,

    F

  5. 5 Posted by shanejez on 21 Jun, 2015 08:18 PM

    shanejez's Avatar

    What's the ETA on the Nodebox web platform? I would love to be able to learn more about Nodebox on the go with my iPad. I am a new addition to the node based design world and I am trying to squeeze in my eduction time where possible.

  6. Support Staff 6 Posted by Frederik De Ble... on 21 Jun, 2015 08:33 PM

    Frederik De Bleser's Avatar

    We're close to beta. However, the editor will only work on desktop browsers for now, not on iPad. You will be able to view the output in an embed view using any browser, of course.

Reply to this discussion

Internal reply

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

Attaching KB article:

»

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

11 Nov, 2019 07:20 PM
27 Oct, 2019 04:08 AM
24 Oct, 2019 10:04 PM
24 Oct, 2019 04:55 AM
18 Oct, 2019 01:06 AM

 

10 Oct, 2019 01:11 AM
02 Oct, 2019 09:51 PM
30 Sep, 2019 08:21 AM
29 Sep, 2019 02:02 PM
03 Sep, 2019 01:35 AM
24 Aug, 2019 03:14 AM