We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I am trying to export this iteration of the notch snowflake into Rhino, but when I do all I get is a Single line. I can t figure it out. The code is here
import processing.dxf.*;
RawDXF dxf;
ArrayList<KochLine> lines;
boolean record;
void setup () {
size (800, 800,P3D);
background(255);
lines = new ArrayList<KochLine>();
PVector a = new PVector(50, 400);
PVector b = new PVector(700, 400);
PVector c = new PVector(width/2, 400+width*cos(radians(90)));
lines.add(new KochLine(a, b));
lines.add(new KochLine(b, c));
lines.add(new KochLine(c, a));
for (int i = 0; i < 3; i++) {
generate();
}
}
void draw() {
background(255);
if (record) {
dxf = (RawDXF) createGraphics(width, height, DXF, "output.dxf");
beginRaw(dxf);
}
for (KochLine l : lines) {
l.display();
if (record) {
endRaw();
record = false;
}
}
}
void generate() {
ArrayList next = new ArrayList<KochLine>();
for (KochLine l : lines) {
PVector a = l.kochA();
PVector b = l.kochB();
PVector c = l.kochC();
PVector d = l.kochD();
next.add(new KochLine(a, b));
next.add(new KochLine(b, c));
next.add(new KochLine(c, d));
next.add(new KochLine(d, a));
}
lines = next;
}
void keyReleased()
{
if (key == 's' || key == 'S') {
saveFrame("KochRooms.png");
println ("image saved");
}
if (key == 'r' || key == 'R') {
record = true;
println ("dxf Exported");
}
}
any help would be much appreciated, it saves the file and i can open it but it isn't what I need it to be to work with in Rhino.
Answers
That is bc you are calling enRaw() inside the for loop. Fix that and see if that solves your problem.
Kf
Right - that entire block should be moved out: