Loading STL with Modelbuilder

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

{syntaxhighlighter brush: java;fontsize: 100; first-line: 1; }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)); } }{/syntaxhighlighter}



Difficulty: ●○○○○


Last updated: 10 years ago