Tags: Code, library, Open source, processing.org, rapid-prototyping, stereolithography, stl, unlekkerlib
Rapid prototyping objects generated with Processing and output to STL using unlekkerLib.
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/.
- unlekker.data.STL: STL import and export.
- unlekker.util.Rnd: Mersenne Twister pseudo-random number generator.
- unlekker.util.TileSaver: The TileSaver class for creating high-res images from OpenGL graphics by tiling the viewport.
- unlekker.geom.Intersect: Line intersection and checking for collision with complex 2D polygons.
Download unlekkerLib-0001.zip and unpack it.
Copy the "unlekker" folder from the “00 For processing library folder” folder into the "libraries" subfolder of your Processing application. The library should now appear as a choice in "Import library" next time you start Processing.
The Java source can be found in “00 For processing library folder > unlekker> src”.





Excuse me
I have a “.stl” but I can’t read it on processing.
How do I to read it on processing.
Can you tell me?
Sorry , my English is poor.
unlekkerLib includes an example showing how to read STL files:
// unlekkerLib - Marius Watz, workshop.evolutionzone.com // // Example showing how to write geometry to a STL file // and then load it back in and render it using // unlekker.geom.PolyData. // // Compatible with unlekkerLib-0002 import unlekker.data.*; import unlekker.geom.*; STL stl; FaceList poly; void setup() { size(400,400, P3D); frameRate(25); readSTL(); } void draw() { background(0); translate(width/2,height/2); noStroke(); lights(); rotateY(radians(frameCount)); rotateX(radians(frameCount*0.25f)); fill(0,200,255, 128); poly.draw(this); } void readSTL() { // Read STL file stl=new STL(this,dataPath("Boxes.stl")); // Get polygon data poly=stl.getPolyData(); poly.normalize(400); // normalize object to 400 diameter poly.center(); // center it around world origin }