Hello I am trying to write a 3d random Walker P3D
But I do not achieve to export all the boxes as .dxf
my goal is to be able to open the file in Rhino and export it as .stl and send it to a 3d Printing
I will appreciate any help or orientation to learn how to fix this code.
Thanks
// Random Walker3d part2
import processing.dxf.*;
boolean record; //set boolean for recording the dxf file
// Create a Walker Object
Walker3d W3d;
//Gloabal Variables
void setup() {
size(600, 600, P3D);
background(255);
frameRate(60); //The default rate is 60 frames per second.
W3d = new Walker3d(60); // Initialize the new Object
// Function to export 3d to dxf
}
void draw() {
if (keyPressed == true) {
if (key == 's' || key == 'S') {
beginRaw(DXF, "walker3d_box.dxf");
}
}
// Call Class Methods
W3d.step();
W3d.display();
endRaw();
}
// Class
class Walker3d {
// fields
int x;
int y;
int z;
float size;
// Constructor
Walker3d(float _size) {
x = width/2;
y = height/2;
z = 0;
size = _size;
}
// Methods
void step() {
int stepX = int (random(3))-1; //Yields -1.0,1
int stepY = int (random(3))-1;
int stepZ = int (random(3))-1;
x += stepX ;
y += stepY ;
z += stepZ ;
}
void display() {
noFill();
stroke(0);
translate(x, y, 0);
// box(size);
box(size);
// box(w, h, d);
}
}