Search code examples
javaeclipseprocessingdxf

Processing create DXF from inside Eclipse


this works in processing and it's IDE of version 2.2. Moved that to Eclipse and the drawing part works

import processing.core.*;
import processing.dxf.*;

public class ShowCameraParts extends PApplet {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    boolean record = false;
    QuadWith2EarsAttached[] tp = new QuadWith2EarsAttached[1];

    public void setup() {
        size(Settings.WINDOW_X, Settings.WINDOW_Y);
        // lights(); lights() is not available with this renderer.
        background(200);
        noFill();
        stroke(0);
        tp[0] = new QuadWith2EarsAttached(this);
    }

    public void draw() {

        if (record == true) {
            beginRaw(DXF,"CameraPart.dxf"); // Start recording to the file
        }

        tp[0].draw();

        if (record == true) {
            endRaw();
            record = false; // Stop recording to the file
        }
    }

    public void keyPressed() {
        if (key == 'R' || key == 'r') { // Press R to save the file
            record = true;
            println("DXF Done");
        }
    }
}

but when I run it in Eclipse I get this error when "r" is pressed

DXF Done
beginRaw() is not available with this renderer.
endRaw() is not available with this renderer.

What is the right way to create an dxf from the graphic created in processing ?


Solution

  • strangely since I have uncommented

    import processing.dxf.*;
    

    it simply works. Not sure why but it does the job