Tags: 3d, 3D printing, Code, digital-fabrication, library, makerbot, modelbuilder, processing.org, stl
MakerBot models built with code included with the ModelBuilder library, also downloadable from my Thingiverse account
Update, March 16, 2012: New Modelbuilder build (0020) released, containing minor fixes and some less-than-well documented experimental features (UApp, UAppSketch). Biggest news is the UMovieMaker sub-lib, which provides a replacement for Shiffman’s MovieMaker library that was discontinued for Processing 2.0b.
UMovieMaker is distributed separately from the main Modelbuilder lib and uses the Monte Media Library by Werner Randelshofer. The lib matches MovieMaker’s syntax and provides Quicktime export without dependencies on Apple’s flaky Quicktime for Java. See included examples for typical uses: UMovieMaker-001.
Update, Feb 25, 2012: Modelbuilder is now hosted on Github: https://github.com/mariuswatz/modelbuilder. See the post about the updated README for information abouth Processing 2.0 beta compatibility.
Update, June 21 2012: I have started an OpenProcessing Modelbuilder collection of sketches. Watch that space for new demos or submit your own…
Update, June 14 2012: Revised Modelbuilder-0007a03 with source and new examples now on Github: modelbuilder-v0007a03.zip
Update, May 24 2012: Modelbuilder-0007a03 with complete source and new examples is now on Github: modelbuilder-v0007a03.zip
Update, April 24 2012: Modelbuilder-0007a01 with complete source and new examples is now on Github: https://github.com/mariuswatz/modelbuilder. Download the exportded/modelbuilder-0007a01.zip for the latest version packaged and ready for use in Processing (1.5.1 only…)
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.
Coders using the library to output models for 3D printing need to be aware of face orientation (see Wikipedia: Handedness) so that face normals are generated correctly.
Always check models to see if face normals are correct before attempting to 3D print them. As always, I recommed the Open Source tool MeshLab for previewing and testing models. MeshLab will render backwards-facing faces as all black, giving an easy preview of incorrect geometry.
Happy mesh building, look forward to seeing models on Thingiverse!
Download modelbuilder-0004.zip and unpack it. Copy the “modelbuilder” folder to your “libraries” folder and restart Processing. If you have the now obsolete unlekkerLib installed you should remove it before adding ModelBuilder, which effectively replaces unlekkerLib.
The ModelBuilder library folder includes (rudimentary) JavaDoc documentation, the library source code and a series of examples located in “modelbuilder/examples”. The most advanced example is mb_04_gui_parametric, which contains the code used to create MakerBot prints shown above. The “gui” examples use Andreas Schlegel’s ControlP5 library, which must be downloaded and installed before running them.
This should be considered an experimental in-progress release and some features are likely to change. As usual, niceties like good documentation have been left for last, so the best way to get a feel for the library is to run through the examples provided. Bug and / or success reports are welcome, just leave comments on this post.






hi marius, excited about the modelbuilder lib, gave it a try and ran through the examples. i got some erros when first running it though. hunting down the causes told me that there is a conflict of interest with having both the modelBuilder and the unlekkerlib (latest version for me) installed at the same time. i removed the unlekkerlib and everything was running smoothly. just in case this happens to someone else, too.
Hi Andreas, happy to hear you’re testing the new lib. I’ve been using your controlP5 as a GUI component for parametric modelling.
unlekkerLib might give conflicts, but it should be considered obsolete as of this release so you can safely delete it from your libraries folder. If there’s any functionality you miss from the old unlekkerLib please let me know, although I can’t imagine anything that’s not done better by either the new library or toxicLibs etc.
My version of the TileSaver function has been broken for a long time now, I use Karsten’s version myself…
[...] created shapes using Mariuz Waltz’s ModelBuilder Library examples that were proportionally based on the recent budget cut proposal to NSHE. In this [...]
Hi Marius,
Just downloaded your library. Great! Exactly what I needed to make my exhibition next week. (Was going a bit mad trying to turn default Processing DXFs into STLs.)
Looks like the exhibition is saved, many thanks to you.
regards
phil
[...] this tutorial I will introduce you to the world of 3d Printing and Processing using the ModelBuilder library by Marius [...]
Excellent post with interesting comments. I will be watching for new comments
Norman Patrick
_________________________________________
Fire Blanket | Fire safety | Cash collection trolley
Hi Marius,
I have some enquires with regards to the importing and exporting of the .stl file format.
I am currently creating a GUI whereby I need to import a .stl file into the canvas.
I have read the javadoc and it is clear that I needed to use this particular constructor:
Public STL (processing.core PApplet applet, java.lang.String path)
{
path = “url”;
}
However, I always got an error.
If it is at all possible, could you upload a simple example on import .stl file into the canvas of GUI?
Thank you very much!
Best Regards,
asobu
The current Modelbuilder library doesn’t support reading STL, only export, so I’m not sure where you’re getting that constructor from. Can you provide a little more context for the code you’re using?
I will be posting a Modelbuilder update in the next few weeks, and that will include STL import.
[...] a design for one of the Makerbots donated to the event, an open-source 3d printing machine. Using Marius Watz’s model-building library for Processing, I created a program which transcodes a song into a 3d representation of its [...]
Marius,
I found this constructor in the following url:
http://workshop.evolutionzone.com/files/unlekkerLibDoc/unlekker/data/STL.html
thanks:)
[...] on a variety of approaches and tools from generative systems and interactive worlds to the great ModelBuilder and Box 2D libraries to name but a few. When you give these systems to a culturally and [...]
Hello,
I downloaded your finals, but I get these errors:
No library found for unlekker.util
No library found for unlekker.modelbuilder
What should I do?
Thank you for sharing your work.
Hi Ari, did you download the most recent version? Try this: modelbuilder-v0007a03.zip. As always you need to put the “modelbuilder” folder inside “libraries” inside your sketchbook.
Are you using Processing 2.0a? I haven’t upgraded Modelbuilder to that version yet.
this library sounds great.
i got this error: Exception in thread “Animation Thread” java.lang.NoSuchMethodError: controlP5.ControlP5.setMoveable(Z)V
i’m using processing 1.5.1 and controlP5 0.7.5
any ideas what i am doing wrong? thx.
Sorry about that, Modelbuilder is built on controlP5 0.5.4 for now. I plan to do a bigger migration when I update everything to work with Processing 2.0.
thanks that works now.
hi marius,
thanks for posting this library it is seriously awesome! Right now I’m using it to export some incredibly detailed STL files. everything works great when I turn the resolution down, but when I run my code at high resolution it starts but eventually causes java to stop responding. The largest file I’ve been able to export successfully had about 2,800,000 faces (which is fantastic, but not quite enough for what I’m trying to do). I’m not exactly sure what’s happening, maybe the UGeometry object has run out of space? maybe processing’s buffer has run out of space? the crashing happens before the writeSTL command executes, while I am still generating vertices and storing faces in the UGeometry object. there is no error code. what do you think? can you think of a way to export a bigger file?
thanks!
amanda
Hi Amanda, sorry for your trouble. For what it’s worth, anything over 1M faces is a lot of geometry and you’ll likely have trouble working with any files you export. But if you don’t get any errors I’d suggest increasing Processing’s memory in Processing Preferences. Does the Processing IDE crash or just your sketch?
ps. Curious to see what you’re exporting. Links?
hi,
thanks for the info, yeah I’ve realized that this is a limitation of processing/my machine and not the library. I messed around with processing’s memory a bit and managed to get some files out with up to 7.2M faces (pretty amazing!). I think if I want to get bigger files out I will just have to use a more powerful machine (I’m using a laptop currently). I will definitely send you a link when i post my project! printing out my first test tomorrow…
http://www.instructables.com/id/3D-Printed-Record/
3d printed record, built with the modelbuilder library!
[...] using Processing, ModelBuilder Library by Marius Watz and a 3D printer, Amanda Ghassaei at instructables managed to print a [...]
[...] used for coding interactive graphics applications. To get Processing to export to STL, I used the ModelBuilder Library written by Marius Watz (if you are into Arduino/Processing and 3D printing I highly recommend [...]
[...] in the last step as an STL file. To get Processing to export straight to STL, I used the ModelBuilder Library written by Marius Watz (if you are into Arduino/Processing and 3D printing I highly recommend [...]
[...] Amanda took the audio files and ran them through a Python script that generated discrete values. She then took those values and plotted them in a Processing sketch as thousands of triangular slices nestled into a spiral groove. The variations in the size of these triangles are what ultimately translate to the audio that’s picked up by the phonograph needle. The 3D file was exported from Processing in STL format using the ModelBuilder Library. [...]
[...] Amanda took the audio files and ran them through a Python script that generated discrete values. She then took those values and plotted them in a Processing sketch as thousands of triangular slices nestled into a spiral groove. The variations in the size of these triangles are what ultimately translate to the audio that’s picked up by the phonograph needle. The 3D file was exported from Processing in STL format using the ModelBuilder Library. [...]
[...] lots of room for experimentation and complexity. You can read about it and download it here: http://workshop.evolutionzone.com/2011/04/06/code-modelbuilder-library-public-release/ and here’s a collection of Processing sketches that use the library- I’ll be adding [...]
[...] Written in Java, it is an open source tool available for download for free. On the other hand, Modelbuilder is a library for use with Processing. This library is created by Marius Watz. If you are not sure [...]
Hi and thanks! Your library is so great. Here at Aalto University we used modelbuilder in Nokia 820 Hackathon, check out our work results here: http://www.thingiverse.com/haques/collections/square-parts
[...] lots of room for experimentation and complexity. You can read about it and download it here: http://workshop.evolutionzone.com/2011/04/06/code-modelbuilder-library-public-release/ and here’s a collection of Processing sketches that use the library- I’ll be adding [...]