appas
July 28, 2023, 7:08pm
1
Hello,
I am trying to export an SVG of an animation frame according to the instructions in the Reference, section Single Frame from an Animation (With Screen Display) , but when I press the mouse button to export, I get the error “RuntimeException: No set() for PGraphicsSVG”.
I found this topic dealing with the error, but they work around the problem rather than solve it.
What does this error mean? How do I solve it? I do not have “pixel operations”, such as “set” in my code.
I am running Processing 4.3 on Windows 10 x64.
1 Like
glv
July 29, 2023, 1:19pm
2
Hello @appas .
You will get that error for any of the functions here:
This prints the exception to console:
protected void nope(String function) {
throw new RuntimeException("No " + function + "() for PGraphicsSVG");
}
The guidelines here may help:
Summary (TL;DR)
Ask complete questions to get better answers!
Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas.
Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want.
Can we run your code …
Try to generate a Minimum, Complete, Verifiable Example as per the guidelines and you may narrow things down.
Start whittling away at your code until you just have code that generates the error.
:)
Hi @appas , I think I noticed at some point that you can only export a single SVG per sketch, I don’t remember exactly the reason, and I think it is an awful limitation, but I think this is it. I’ll see if I can gather some reference. A code sample of what you are doing will help people help you.
glv
July 30, 2023, 8:53pm
4
Hello @villares ,
From what I glean from the library reference you can only export a single frame at a time; that could be each frame, the last frame or with some control statements for a frame you select.
Reference:
https://processing.org/reference/libraries/svg/index.html
:)
1 Like
appas
July 31, 2023, 12:49am
5
It was because I had a raster image as background. Commenting out the background(bg);
call made SVG export happen.
thanks for the reference @glv !
I don’t recall seeing the .dispose()
method before, maybe using some PGraphics
strategy with this can allow multiple exports…