We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
.dxf export (Read 439 times)
.dxf export
Apr 7th, 2008, 6:51am
 
i was playing with the extrude pixel file under the 3d & open gl files.  i was trying to export the points as a .dxf (or .txt or .obj).  the app. runs fine but doesn't export the file into the sketch folder.  

here's the code that i was working with, almost line for line for the extrude file but added in the file export commands to export the file:

import processing.dxf.*;

boolean record = false;

PImage a;
boolean onetime = true;
int[][] aPixels;
int[][] values;
float angle;


void setup() {
 size(400, 400, P3D);
 
 aPixels = new int[width][height];
 values = new int[width][height];
 noFill();

 // Load the image into a new array
 // Extract the values and store in an array
 a = loadImage("DSCN1038.jpg");
 for (int i=0; i<height; i++) {
   for (int j=0; j<width; j++) {
     aPixels[j][i] = a.pixels[i*width + j];
     values[j][i] = int(blue(aPixels[j][i]));
   }
 }
}

void draw() {
 background(0);
 
 // Update and constrain the angle
 angle += 0.005;
 if (angle > TWO_PI) { angle = 0; }
 
 // Rotate around the center axis
 translate(width/2, 0, 128);
 rotateY(angle);  
 translate(-width/2, 0, 128);
 
 // Display the image mass
 for (int i=0; i<height; i+=2) {
   for (int j=0; j<width; j+=2) {
     stroke(values[j][i]);
     point(j, i, -values[j][i]);
   }
 }
 if (record == true) {
   endRaw();
   record = false;
 }
}

void keyPressed() {
 if (key == 'R' || key == 'r') {
   record = true;
 }
}




any comments are helpful and apprecited
Re: .dxf export
Reply #1 - Apr 7th, 2008, 6:52am
 
not sure why the smiley's come up, thought i disabled the smileys, guess not
Re: .dxf export
Reply #2 - Apr 7th, 2008, 9:45am
 
You're missing the
Code:
  if (record) {
beginRaw(DXF, "output.dxf");
}

block.
Page Index Toggle Pages: 1