misterTT
YaBB Newbies
Offline
Posts: 1
dxf setlayer
Oct 2nd , 2006, 10:18pm
Hi all, i'm brand new to processing, and have been learning via cannibalising one of j. tarbell's sketches, and writing various cubes in 3d. I'm recording these(one frame at a time), and assembling them back together in rhino as one huge file. my problem: i'm trying to get each frame to write as a different layer using dxf.setLayer(layernum); as outlined in the rawDXF library. i'm getting a "nullpointer exception" when I try to run this, even if i'm just pasting the rawDXF code to a new sketch. ideally, because i'm writing 1000+ individual .dxf files, i'd like to connect the variable 'layernum' to 'millis' in order to get an ascending heirarchy of layers. import processing.dxf.*; boolean record; RawDXF dxf; int layernum = 1; void setup() { size(500, 500, P3D); } void keyPressed() { // use a key press so that it doesn't make a million files if (key == 'r') record = true; } void draw() { if (record) { float m = millis(); dxf = (RawDXF) createGraphics("processing.dxf.RawDXF", "output" + m + ".dxf"); beginRaw(dxf); } // do all your drawing here, and to set the layer, call: dxf.setLayer(layernum); // where 'num' is an integer. // the default is zero, or you can set it to whatever. if (record) { endRaw(); record = false; } } anybody know what's wrong? i'd paste the whole sketch in here, but I get the same error with either one. also, dealing with the OCD library and OPENGL, i'm able to get some 3d navigation to work while the sketch is running, but the screen accumulates frame by frame, and never clears the image. I've seen this issue brought up in searching the forums, but haven't come across anything that helps. thanks in advance, processing is rediculously addicting!