Arc mesh tool created with Modelbuilder and ControlP5
I did a short lecture + workshop about digital fabrication and parametric modeling with Processing yesterday at NYU’s ITP program. Thanks to Dan Shiffman for the invite, it ended up being a lot of fun because of the great turnout of enthusiastic ITP’ers. It certainly made me even more regretful that I was unable to teach a fabbing course at ITP this semester, but with luck there will be other oppportunities.
As promised I have uploaded the pre-written examples I demo’ed as well as the code I (frenziedly) wrote live during our 1.5 hour coding session. The focus was to demonstrate the logic of the Modelbuilder library, a set of utilities and aimed at abstracting and simplifying some common tasks in computational creation of 3D meshes.
The library is really not all that sophisticated, but it shifts the focus away from OpenGL drawing logic towards a more object-oriented way of imaging 3D forms based on UVertexList objects. In a typical situation it should simplify a lot of tasks, as well as save dozens of for() loops and repetitive code. It also allows some pragmatic coding (aka “lazy”) coding practices enabling easy reuse of geometries due to the assumption that operations like “new UVertexList(vl)” should always copy input data by content rather than by reference.
I’m pleased to say that Modelbuilder performed well in the demo session, there’s nothing like live coding to reveal weaknesses or inconsistencies in code. But the Modelbuilder logic proved consistent under stress testing and we were able to do some pretty decent mesh generation in a limited amount of time.
Download: Workshop Code
A ZIP with all the files shown (including the Modelbuilder and ContolP5 libraries) can be downloaded from http://db.tt/5Ehmn6uz. It includes the following code examples:
- simple_geo_arc_4 A tool for creating a composition of 3D arcs (w/ valid face normal orientation and passing the “waterproof” criteria for 3D printing), generating output to STL format. This was written live in around 30 minutes.
- mb_04_gui_parametric A parametric 3D form generator created for my Makerbot residency – results look valid on screen but for some reason export to STL results in flawed models. I’ll look into debugging this example.
- mb_04_gui_heightfield An example showing how to create a heightfield mesh from an image, allowing interactive control of mesh resolution and Z scaling. Potentially useful for geographical elevation maps and Kinect depth maps.
- A set of examples demonstrating the core Modelbuilder functions
08:19 | October 22nd, 2011 | marius watz | +del.icio.us | +digg | trackback

MakerBot models built with code included with the ModelBuilder library, also downloadable from my Thingiverse account
Update, July 1 2011: I’ve uploaded ModelBuilder v0004, which fixes a few really silly bugs in 0003. Download it from http://code.google.com/p/codeandform/.
I’m happy to announce the first public release of my new ModelBuilder library, created as part of my artist-in-residence project at MakerBot Industries and beta tested in the Interactive Parametrics workshop. The occasion for today’s release is the MakerBot User Group New York, where I’ll talk about the library and show off my MakerBot models.
ModelBuilder focuses on functions useful for digital fabrication purposes, such as creating meshes, centering models around origin, scaling to given dimensions, output to STL format etc. It emulates Processing’s beginShape / vertex / endShape logic to build mesh geometry which can then be manipulated and transformed.
The UVertexList class allows the user to build paths of vertices. Vertex lists are then fed into various UGeometry.quadStrip() functions to construct quad strip meshes, most likely eliminating the need for dozens of for loops in the process. See the online copy of the ModelBuilder JavaDoc for a more complete overview.
Read the rest of this entry »
21:59 | April 6th, 2011 | marius watz | +del.icio.us | +digg | trackback
This weekend I’ll be teaching the Interactive Parametrics Workshop with Studio Mode (Gil Akos and Ronnie Parsons) and MakerBot (represented by Bre Pettis). We’ve been planning this for a while, but since it’s happening during my residency at MakerBot we thought it’d be fun to focus on the MakerBot as a possible output method. Our thanks to Bre and the MakerBot crew for supporting the workshop!
With a good mix of architects and code-hacking designers as our participants it should be an interesting weekend. We will be posting the resulting code examples and STL models after the workshop.
Tools & libraries
Read the rest of this entry »
04:15 | February 18th, 2011 | marius watz | +del.icio.us | +digg | trackback
As documented in this thread on the Processing forums the TileSaver class seems to be broken for current versions of Processing. Sadly I’m not sure what the problem is and I don’t have time to fix it right now.
However, I tried the original TileSaver code posted back in 2006 and miraculously that still works. This would imply a larger issue with the unlekkerLib library and Processing 1.0, which I’ll have to address when I have the time.
For now, here is a link to a working Processing sketch using the old TileSaver code: TileSaverTest.zip
07:22 | August 18th, 2009 | marius watz | +del.icio.us | +digg | trackback
After several requests I’ve taken the time to make unlekkerLib compatible with Processing 1.0. Apologies to anyone who’s been inconvenienced by the lack of a 1.0 version.
In particular, STL export should work again. However I haven’t had the chance to test the code very much, so please let me know if you find any bugs.
Download
08:19 | April 16th, 2009 | marius watz | +del.icio.us | +digg | trackback
I’ve uploaded a new version of my unlekkerLib library. For some inexplicable reason version 0002 was missing some classes that were needed for certain examples to function. As a result the TileSaver class was broken, which was a serious omission.
You can download unlekkerLib-0003 from the Code & Form Google Code repository. I’ve added the missing classes, but otherwise the library is the same. If you still experience problems please report them here.
20:51 | July 12th, 2008 | marius watz | +del.icio.us | +digg | trackback
I’ve decided to put my Processing hacks from the Code & hacks page and consolidate them into a downloadable archive. Thus the Code & Form code library is born. It will contain various demos and hacks, as well as example code for the unlekkerLib library. It should be much easier to publish code this way, since students etc. can simply download the archive and dump the contents in their sketchbook folder for quick access.
I’ve started a Google Code repository for this purpose, which seems a good way to go. I’m still figuring out SVN etc, hopefully I can switch to publishing the unlekkerLib source “live” through SVN once I figure it out. I’ll also publish archives of code written during past workshops to the repository.
There seems to be a growing list of Processing-related Google Code repositories out there, examples include Toxi’s Toxiclibs, interfascia and jddaniels. Do a search for processing.org to find more.
14:44 | April 12th, 2008 | marius watz | +del.icio.us | +digg | trackback
I just posted a quick update to unlekkerLib. It seems the first version I posted used Java 5 because I hadn’t configured Eclipse correctly. This version is compiled for 1.4. I have tested it with Processing 0125, but please give me feedback if it gives you trouble.
I added two new functions to the library, nothing big but could be useful for some people:
[071028] unlekkerLib-0002 features:
- unlekker.data.POVRay: Primitive POV-Ray triangle geometry export.
- unlekker.data.FeedReader: Feed reading utility class (requires installing extra JARs)
To use the feed classes simply use the code from this previous post, minus the class definitions.
02:30 | October 28th, 2007 | marius watz | +del.icio.us | +digg | trackback
I’ve just uploaded a new Processing library called unlekkerLib. It is a collection of tools and code snippets I use frequently, and which I’ve now just barely cleaned up enough for other people to use. Instead of releasing them piece by piece, I’ve decided to bundle them together in a package hierarchy.
The main reason I decided to release it now is the STL export code I’ve written for my rapid prototyping projects. Several people have asked for the code, so I wanted to get it out there for you to play with. Obviously, it works as well with Processing as it does with regular Java.
Caveat emptor:There’s not much documentation but I do provide the source code. This is v.0001 – the very first release, so it’s pretty basic. See below for an idea of what the library contains. Right now the most exciting new component is the unlekker.data.STL class, which supports export and import of STL stereolithography files for rapid prototyping. Have a look at the Javadoc for more details.
Updates will appear here: http://workshop.evolutionzone.com/unlekkerlib/.
Read the rest of this entry »
19:12 | September 24th, 2007 | marius watz | +del.icio.us | +digg | trackback
After suggesting to my AHO class that they consider using RSS feeds in Processing, I realized that there is actually no built-in functionality to do so. The XML class built into Processing is too basic to handle feeds, it seems. To remedy the situation I’ve cooked up a quick hack using the ROME library for RSS / Atom syndication.
To run the code below you’ll need to download ROME and JDOM. Make a “code” subfolder in your sketch and paste “jdom.jar” and “rome-*.jar” into it, then run the code as given. The FeedReader and FeedEntry convenience classes take care of parsing the feed and returning the entries with the most common fields included. Error checking is rudimentary, however.
Code – feedParser.pde
Read the rest of this entry »
03:08 | September 24th, 2007 | marius watz | +del.icio.us | +digg | trackback