# 3d Random Walker export-as-dxf

**URL:** <https://discourse.processing.org/t/3d-random-walker-export-as-dxf/21847>\
**Category:** Coding Questions\
**Created:** [June 13, 2020, 8:11pm UTC](https://discourse.processing.org/t/3d-random-walker-export-as-dxf/21847 "2020-06-13T20:11:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andresobregonl](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@andresobregonl](https://discourse.processing.org/u/andresobregonl)\
**Post date:** [June 13, 2020, 8:11pm UTC](https://discourse.processing.org/t/3d-random-walker-export-as-dxf/21847/1 "2020-06-13T20:11:50Z")

</div>

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

```auto
// 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);
  }
}

```

---

<div class="post-metadata">

**Author:** ![renec112](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/renec112/32/9168_2.png) [@renec112](https://discourse.processing.org/u/renec112)\
**Post date:** [June 13, 2020, 8:24pm UTC](https://discourse.processing.org/t/3d-random-walker-export-as-dxf/21847/2 "2020-06-13T20:24:19Z")

</div>

You can btw put your preformat you code so it will be easier to help you

```auto
// Random Walker3d part2
import processing.dxf.*;
boolean record; //set boolean for recording the dxf file
// Create a Walker Object
Walker3d W3d;

```

I don’t have the solution, but hov about storing all the values in an array for each draw loop?  
Then at the exist, or after some frame outputting that array to .dxf
