I’m writing a program with a GUI (ControlP5) in which the parent PApplet contains the textfields with parameters and a button to export to PDF. I want the child PApplet to contain all of the drawn information and export it to PDF. This PDF will contain the cutting drawing for a laser machine.
So far i’ve tried following the example on MultipleWIndows and with the svg/pdf library to export like this
class ChildApplet extends PApplet{
GridMaker griddifier = new GridMaker();
private float wsh_od, wsh_id, wsh_gap, wsh_sl, tub_id, tub_l, comp;
private Integer _making;
public ChildApplet(Float od, Float id, Float gap, Float sl, Float tubid, Float tubl, Float lacomp, Integer wmaking){
super();
PApplet.runSketch(new String[]{this.getClass().getName()}, this);
wsh_od = od;
wsh_id = id;
wsh_gap = gap;
wsh_sl = sl;
tub_id = tubid;
tub_l = tubl;
comp = lacomp;
_making = wmaking;
}
public void settings(){
size(1440,720);
}
public void setup(){
surface.setTitle("Child sketch");
griddifier.setupGrid(this, wsh_od, wsh_id, wsh_gap, wsh_sl, tub_id, tub_l, comp, .5, 60, _making, false, 0, 0);
noLoop();
beginRecord(SVG, "filename.svg");
}
public void draw(){
background(255);
griddifier.drawGrid();
endRecord();
}
}
It runs and it draws the pattern on the child applet but no file is generated.
i’ve also tried this.beginRecord() and this.endRecord() as well.
griddifier is an object for a custom class that handles the drawing part of the script