Go Down

Topic: Processing - Saving as a DWG (Read 1 time) previous topic - next topic


Mar 08, 2010, 10:41 pm Last Edit: Mar 08, 2010, 10:45 pm by alex_hinds Reason: 1
Hi, I'm struggling on where to put the script to make my processing animation save as a DXF file as well as stop it at a particular place. Would anyone have any ideas?
This is my script so far:

import processing.dxf.*;
import ddf.minim.analysis.*;
import ddf.minim.*;
FFT fftLin;
FFT fftLog;

Waveform myRects;

Minim minim;
AudioPlayer groove;

boolean record;

PFont font;

float camzoom;
float maxX = 0;float maxY = 0;float maxZ = 0;
float minX = 0;float minY = 0;float minZ = 0;

void setup(){
 minim = new Minim(this);
 groove = minim.loadFile("01.mp3");
 //repeat the song

font = loadFont("Eureka-90.vlw");

 fftLog = new FFT(groove.bufferSize(),groove.sampleRate());
 fftLog.logAverages(22,4);     //adjust numbers to adjust spacing

 float w = float (width/fftLog.avgSize());
 float x = w;
 float y = 0;
 float z = 50;
 float radius = 10;  
 myRects = new Waveform(x,y,z,radius);

void draw(){
 if (record) {
   // Note that #### will be replaced with the frame number. Fancy!
   beginRecord(PDF, "frame-0001.pdf");


 if (frameCount>130){
   for(int i = 0; i < fftLog.avgSize(); i++){
     float zoom = 1;
     float jitter = (fftLog.getAvg(i)*2);
     PVector foc = new PVector(myRects.x+jitter, myRects.y+jitter, 0);
     PVector cam = new PVector(zoom, zoom, -zoom);
 //play the song



   record = false;
   println("Done DXF~!");

void stop() {
 // always close Minim audio classes when you finish with them
 // always stop Minim before exiting

class Waveform{
 float x,y,z;
 float radius;

 PVector[] pts = new PVector[fftLog.avgSize()];

 PVector[] trace = new PVector[0];

 Waveform(float incomingX, float incomingY, float incomingZ, float incomingRadius){
   x = incomingX;
   y = incomingY;
   z = incomingZ;
   radius = incomingRadius;

 void update(){

 void plot(){
   for(int i = 0; i < fftLog.avgSize(); i++){
     int w = int(width/fftLog.avgSize());

     x = i*w;
     y = frameCount*5;
     z = height/3-fftLog.getAvg(i)*03;

     point(x, y, z);
     pts = new PVector(x, y, z);
     //increase size of array trace by length+1
     trace = (PVector[]) expand(trace, trace.length+1);
     //always get the next to last
     trace[trace.length-1] = new PVector(pts.x, pts.y, pts.z);

void textdraw(){
   for(int i =0; i<fftLog.avgSize(); i++){    
     translate(pts.x, pts.y, pts.z);

 void plotTrace(){
   //drawing points
    for(int i=0; i<trace.length; i++){
    //locator(trace.x, trace.y, trace.z, 1);
    point(trace.x, trace.y, trace.z);
   //drawing poly surface

   int inc = fftLog.avgSize();

   for(int i=1; i<trace.length-inc; i++){
     if(i%inc != 0){

       float value = (trace.z*100);
       float m = map(value, -500, 20000, 0, 255);
       fill(m*2, 381, -m*2, 222);
       vertex(trace.x, trace.y, trace.z);
       vertex(trace[i-1].x, trace[i-1].y, trace[i-1].z);
       vertex(trace[i+inc].x, trace[i+inc].y, trace[i+inc].z);
       vertex(trace[i-1+inc].x, trace[i-1+inc].y, trace[i-1+inc].z);

   //draw splines
    int skip = 5;
    stroke(255, 20);  
    for(int i=0; i<trace.length; i+=inc*skip){
    for(int j=0; j<inc; j+=skip){
    curveVertex(trace[i+j].x, trace[i+j].y, trace[i+j].z);
    */  }

void keyPressed() {
 // use a key press so that it doesn't make a million files
 if (key == 'r') record = true;



Did you notice the title up there? It says Arduino forum. I didn't see any Arduino code there.

I see nothing that indicates that there's an Arduino involved at all.


Hi, Dont worry, thanks for reading my post but i've worked it out now.


Go Up