Export dxf from animation
in
Core Library Questions
•
11 months ago
Hey-o. I have an animation of triangles that change size based on mouseX and mouseY inputs. I'd like to export the geometry created as a dxf file. I know you can do this for a pdf because you can pause and resume what's "recorded" to the pdf explained here:
http://processing.org/reference/libraries/pdf/index.html under "Pause while recording". Is this possible for a dxf? If not, how can I set up this animation to export the geometry at some point? Right now I have it set up to use a key press. Any help would be greatly appreciated! Keep on rockin in the free world.
- import processing.dxf.*;
- float xoff = 0.0;
- float x,y, xspeed, yspeed, angA;
- //boolean recording;
- //PGraphicsPDF pdf;
- boolean record;
- void setup() {
- size(1000,500,P3D);
- background(255);
- // pdf = (PGraphicsPDF) createGraphics(width, height, PDF, "triangles.pdf");
- //cam = new PeasyCam(this,100);
- }
- void draw() {
- if (record) {
- beginRaw(DXF, "output.dxf");
- }
- noiseDetail(3,0.57);
- x += 5;
- xoff = xoff + .01;
- float n = noise(xoff) * width;
- pushMatrix();
- stroke(0);
- //noFill();
- //fill(255*cos(n),45);
- //if (n*1.5 >= 180) {
- // fill(15);
- // } else {
- // fill(255);
- // }
- translate(x-(n/5),y+(n/5),.05);
- rotate(radians(n/1.5)+(y-x/10)/10);
- //rotate(radians(n*1.4)+(x-y/10));
- rectMode(CENTER);
- fill(255);
- stroke(0);
- //rect(0,0,mouseX/4,mouseY/2);
- triangle(0,0,50, 0, mouseY/4,mouseX/2);
- fill(0);
- stroke(255);
- //rect(0,0,mouseY/4,mouseX/2);
- triangle(mouseX/2,mouseY/4,50, 0, 0,50);
- fill(mouseY*mouseX/275, mouseX/(mouseY+1));
- stroke(0);
- //rect(0,15,mouseY/2,mouseX/4);
- triangle(0,0,mouseX/3, mouseY/2, 0,50);
- //box(60,30,3);
- popMatrix();
- //line(n, 0, n, height);
- if (x >= width+100) {
- x = 0;
- y+= 15;
- }
- if (y>= 300) {
- y = 0;
- //saveFrame("sizeNoise####.jpg");
- //background(255);
- }
- if (record) {
- endRaw();
- record = false;
- }
- }
- void keyPressed() {
- if (key == 'r') {
- record = true;
- }
- if (key == ' ') {
- saveFrame("frame####.jpg");
- }
- }
1