This page is an archive of iMAL's wiki that operated between 2012 and 2022. It documented projects, residencies and workshops mostly taking place at iMAL's Fablab.

Older & newer Fablab projects are now found at fablab.imal.org

Loading STL with Modelbuilder

Simple example (based on a modelbuilder example). The STL file should of course be in your sketch folder.

import unlekker.util.*;
import unlekker.modelbuilder.*;

UNav3D nav;

UGeometry model;

void setup() {
  size(600,600, P3D);

  nav=new UNav3D(this);
  nav.trans.set(width/2,height/2,0);
  smooth();
  
  model=new UGeometry();
  model = UGeometry.readSTL(this,"data/eggcup-smallhearts.stl");
  model.scale(5.0).center();
}

void draw() {
  background(100);
  lights();
  
  nav.doTransforms();
  if(mousePressed) {
    fill(255,255,255, 128);
    noStroke();
  }
  else {
    fill(255);
    stroke(100);
  }

  model.draw(this);
}

public void mouseDragged() {
  nav.mouseDragged();
}
	
public void keyPressed() {
  nav.keyPressed();

  if(key=='s') {
    model.writeSTL(this, 
      IO.getIncrementalFilename("Yan01 ####.stl",sketchPath));
  }
}

Gallery

Info

Difficulty: ●○○○○

Contributors:

Last updated: February 2012