Save quads to DXF
in
Core Library Questions
•
1 year ago
Hello,
I'm trying to save some quads to a dxf file, but that doesn't seem to work.
Here's what I've tried with a modified version of the SimpleExport sample:
- import processing.dxf.*;
- boolean record = false;
- RawDXF dxf;
- void setup() {
- size(400, 400, P3D);
- noStroke();
- sphereDetail(12);
- }
- void draw() {
- if (record == true){
- dxf = (RawDXF) createGraphics(height, width, DXF, "output.dxf");
- beginRaw(dxf);
- dxf.setLayer(1);
- }
- lights();
- background(0);
- translate(width / 3, height / 3, -200);
- rotateZ(map(mouseY, 0, height, 0, PI));
- rotateY(map(mouseX, 0, width, 0, HALF_PI));
- for (int y = -2; y < 2; y++) {
- for (int x = -2; x < 2; x++) {
- for (int z = -2; z < 2; z++) {
- pushMatrix();
- translate(120*x, 120*y, -120*z);
- beginShape(QUADS);
- vertex(0,0,0);
- vertex(100,0,0);
- vertex(100,100,0);
- vertex(0,100,0);
- endShape();
- //sphere(30);
- popMatrix();
- }
- }
- }
- if (record == true) {
- endRaw();
- record = false; // Stop recording to the file
- }
- }
- void keyPressed() {
- if (key == 'R' || key == 'r') { // Press R to save the file
- record = true;
- }
- }
A file gets written to disk, but is empty.
Any hints ?
Thanks,
George
1