<
import processing.svg.*;
void setup(){
noLoop();
beginRecord(SVG,“asdfasdf2.svg”);
size(1000, 1000,P3D);
noFill();
strokeWeight(2);
beginShape();
int squarenumber = 12;
for (int i = 1; i<squarenumber; i++){
// strokeWeight((squarenumber - i) * 0.20);
translate(80,80);
rotateY(0.1i);
rotateX(0.12 i);
box(80);
}
endShape();
endRecord();
}
Hello all im very new to coding in general and am having trouble getting an SVG to export properly. This code gives a simple output of rotating cubes across the diagonal of the output frame. When I run the code an output SVG is created that im able to view but its a blank white canvas with no lines. My end intention is to plot this on a pen plotter using inkscape. Im sure this is a simple fix but help would be appreciated.
Thank You!
svan
February 9, 2023, 7:22am
2
This runs on my system. All I did was add asterisk for multiplication in rotateX, rotateY
import processing.svg.*;
void setup() {
noLoop();
beginRecord(SVG, "asdfasdf2.svg");
size(1000, 1000, P3D);
noFill();
strokeWeight(2);
beginShape();
int squarenumber = 12;
for (int i = 1; i<squarenumber; i++) {
//strokeWeight((squarenumber - i) * 0.20);
translate(80, 80);
rotateY(0.1*i);
rotateX(0.12*i);
box(80);
}
endShape();
endRecord();
}
1 Like
glv
February 9, 2023, 11:06am
3
Hello @gummy12 ,
Please format your code as a courtesy to this community:
https://discourse.processing.org/faq#format-your-code
Important elements of your code are lost when not properly formatted when posting.
There is a tutorial here:
I modified your code with elements from this section of the tutorial:
SVG Files from 3D Geometry (With Screen Display)
I was then able to generate an SVG and could open it with Inkscape.
:)