A few weeks ago I started taking a closer look at Autodesk FormIt, mainly with a view to understanding how it might integrate with VASA. FormIt is a multi-platform (which I believe in this case means Windows, iOS and web) conceptual design and analysis tool. I haven’t really followed the development of FormIt, over the years, so if you’re interested in learning more about that then I suggested heading over to the product team’s blog. If you want to get started with using FormIt, then this Primer seems helpful.
Two things in particular had me intrigued about FormIt: its integration with Dynamo and its JavaScript API. These both seemed to be ways in which FormIt could talk to VASA: from chatting with Rhys Goldstein, it turned out he’d already tried using FormIt with VASA’s Dynamo package, and he shared a graph that I could use as the basis for that exploration (we’ll see that workflow in an upcoming post).
Today’s post is more about FormIt’s JavaScript API. FormIt doesn’t just have an extensive API, it also has some impressive tooling that lets you not only explore the API and its sample projects, but also publish your own plugins via a nifty GitHub integration. Oh, and the best thing of all? Your JavaScript plugins will work across platforms: I’ve built plugins in FormIt for Windows that work perfectly in FormIt in the browser, too.
FormIt’s JavaScript plugin API has two main areas (with equivalent namespaces): the core API for the FormIt application, and the WSM API for FormIt’s modelling kernel. Both are reasonably easy to get to grips with, thanks to plugin samples you can explore from within FormIt itself:
You can load various sample plugins via the Plugin Manager, and also visit their GitHub repositories to check out their source.
Speaking of GitHub, you can connect your own GitHub account to FormIt, and any of your repositories that have been assigned the label ‘formit-plugin’ will be added to a list of plugins you can load directly into FormIt. Very neat.
There are a few ways to build your own plugins for FormIt…
For those just getting started, the Plugin Playground is itself a FormIt plugin, with source code provided, that allows you to build your own plugins – by creating boilerplate HTML, CSS and JavaScript code that you can edit, right there in the FormIt environment – and then run them or save them back to your GitHub account. You can even use FormIt’s journalling mechanism to record code for operations you perform in the UI, which looks really handy. When you’re ready you can use the bullhorn icon to publish your plugin to the FormIt community. The FormIt team have clearly put a lot of thought (and work) into this mechanism. Nicely done!
For more advanced use-cases, it’s worth the effort of setting up your own local http server, and having that serve up your local plugin files for use in FormIt for Windows or FormIt for Web. I mostly found it easier to develop using FormIt for Windows, as it makes it really easy to “hard reload” the plugin from my web-server, whereas with FormIt for Web I found I sometimes needed to reload the page to pick up changes (I may have missed something that would have made this redundant, though).
But I’m not going to talk about my own efforts to develop FormIt plugins, today – that’s something I’ll talk a bit more about next week.
I’d been looking for an interesting plugin to highlight – and share the code for – when I stumbled across the perfect one. Some of our internal development teams participated recently in a “recharge sprint” where they could step away from their typically day-to-day development tasks and explore something new. When browsing the various projects that came out of this process, I found this Maze Generator by Brett Garrison, who recently joined the FormIt team in Boulder, Colorado. Brett decided to implement a depth-first search algorithm using backtracking (it seems he used the iterative approach, maintaining a stack to avoid the (call-)stack overflow issues that you risk by doing it recursively).
Here’s how you load and run this neat little plugin:
Here’s a resultant, randomized maze as a static image:
This is actually a perfect initial project to introduce this series of posts: I chatted with Brett about the fact he’d mentioned a “future direction” as extending the plugin to solve mazes, not just generate them. This made me think of a tweet I saw recently that used a simulation of gas dispersion inside a maze to solve it (backtracking the path of the “winning” particle to the entrance). I thought that might be a fun thing to integrate into FormIt.
But then I remembered a video by the Aussie BIM Guru himself – my fellow retro-enthusiast Gavin Crump – where he used Dynamo and Space Analysis to solve a 2D maze. Of course! The penny finally dropped: I could use VASA to solve this maze in 3D (even if it’s really just a 2D problem).
Over the coming posts we’re going to take a look at two different approaches for this: using Dynamo and VASA to solve a 3D maze – much as Gavin has done – and then using VASA directly from a JavaScript plugin (via its WebAsssembly package, something we saw recently) to do the same thing in a slightly more automated workflow. This is going to be fun!