Exporting to dxf / pdf / tiff
in
Core Library Questions
•
2 years ago
Hello Processing World,
I am trying to export from an extrusion sketch to a vector and/or high-res file. Seemingly easy, right. Well after I export to .pdf / .dxf / .tif they all come up totally black, empty (0 KB), and/or I am not able to open the .dxf in CS5 Illustrator. I used to work at an architecture firm and I could open their AutoCAD files fine for whatever reason. Just previewing them now, all these files look totally black. What is going on? Please help—I just need a vector file! Here is what I have:
import processing.dxf.*;
boolean record;
PImage extrude;
int[][] values;
float angle = 0;
void setup() {
size(1688, 953, P3D);
// Load the image into a new array
extrude = loadImage("Echograms38.jpg");
extrude.loadPixels();
values = new int[extrude.width][extrude.height];
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
color pixel = extrude.get(x, y);
values[x][y] = int(brightness(pixel));
}
}
}
void keyPressed() {
// use a key press so that it doesn't make a million files
if (key == 'r') record = true;
}
void draw() {
if (record) {
beginRaw(DXF, "echo-##.dxf");
}
// Update the angle
angle += 0.005;
// Rotate around the center axis
translate(width/2, 0, -128);
rotateY(angle);
translate(-extrude.width/2, 100, -128);
// Display the image mass
for (int y = 0; y < extrude.height; y++) {
for (int x = 0; x < extrude.width; x++) {
stroke(values[x][y]);
point(x, y, -values[x][y]);
if (record) {
endRaw();
record = false;
}
}
}
}
1