Why cant I export to dxf?
in
Programming Questions
•
8 months ago
I followed the sample dxf from processing library but cant get it to work when i apply it to code. The code has two keypresses and i dont know how to fix them. Any ideas? The error is in line 39 below
- /* OpenProcessing Tweak of *@*http://www.openprocessing.org/sketch/8168*@* */
- /* !do not delete the line above, required for linking your tweak if you re-upload */
- // a processing remake of the web mode in mr doob's "harmony" procedural drawing app
- // http://mrdoob.com/lab/javascript/harmony/#web
- ArrayList history = new ArrayList();
- float distthresh = 60;
- import processing.dxf.*;
- boolean record = false;
- void setup(){
- size(900,600);
- background(255);
- stroke(0,50);
- smooth();
- }
- void draw(){
- if (record == true) {
- beginRaw(DXF, "output.dxf"); // Start recording to the file
- }
- }
- void mouseDragged(){
- PVector d = new PVector(mouseX,mouseY,0);
- history.add(0,d);
- for (int p=0; p<history.size(); p++){
- PVector v = (PVector) history.get(p);
- float joinchance = p/history.size() + d.dist(v)/distthresh;
- if (joinchance < random(0.4)) line(d.x,d.y,v.x,v.y);
- }
- }
- void keyPressed(){
- if (key == ' ') {
- background(255);
- history.clear();
- }
- 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;
- }
- }
1