We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
3d export (Read 1994 times)
3d export
Dec 15th, 2009, 8:30am
 
hello,

now i finished my 3d sketch. now i'd like to export this to a 3d program like cinema 4d. actually i tried ''import processing.dxf.*;'' and the superCAD library. it works more ore less but both export just the actual positions of my spheres (the sketch is full of them and they are moving).
what i want is to export the actual screen (3d!) to any 3d program.
i think the problem is that those dxf ''outprinters''   just capture the ''void draw''. the result of my screen is effected by not ''redraw'' the screen (at the bottom of the text). So is there any solution.

thanks for helping

void draw () {
 //background (back);
 smooth();
 lights();

Re: 3d export
Reply #1 - Dec 15th, 2009, 8:49am
 
you can put all the stuff that happens in your draw loop inside another for loop. Could slow down your sketch though. You better call noLoop() in setup.  cause you have to compute all the frames you rendered before in one frame now. Files will get really large quickly.
Re: 3d export
Reply #2 - Dec 15th, 2009, 9:56am
 
could you explain a bit more precise how to put all the stuff that happens into draw . or maybe ther is an example?
Re: 3d export
Reply #3 - Dec 15th, 2009, 10:25am
 
instead of writing


void setup(){
 size(500, 500, P3D);
noStroke();
}
void draw () {
//background (back);
lights();
translate(random(width),random(height));
sphere(10);
}


you write now :

int numberOfFrames = 30;

void setup(){
 size(500, 500, P3D);
 noStroke();
 noLoop();
}

void draw(){
 background (0);
lights();
 for(int i = 0; i<numberOfFrames;i++){
    pushMatrix();
   translate(random(width),random(height));
   sphere(10);
   popMatrix();
 }
}



so youve got what you would draw in 30 frames in 1 frame now. and can save it.
Re: 3d export
Reply #4 - Dec 15th, 2009, 10:31am
 
thank you again cedric..very helpful
Re: 3d export
Reply #5 - Dec 15th, 2009, 11:02am
 
hello again...now it works but lines are not exported..any idea how deal with this..
Re: 3d export
Reply #6 - Dec 17th, 2009, 4:56am
 
Hi erdmann,
According to http://dev.processing.org/source/index.cgi/trunk/processing/dxf/src/processing/dxf/RawDXF.java?view=markup the lines should be exported. In superCAD, it should be there as well. I'm not sure if the edges of triangles or polygons are exported as well (I think it's not). Note that curves will be exported into broken lines.

Could you post code?
Re: 3d export
Reply #7 - Dec 17th, 2009, 10:44pm
 
I guess he has to draw lines with begin and endshape.
a line drawn with line() is probably not exported.
But thast just a guess.

Anyway some 3d programms wont show your lines and points as they dont have any surface
Re: 3d export
Reply #8 - Dec 22nd, 2009, 5:13am
 
as with other replies, it would be good to see the code you're working with. however, by way of an initial response continuing cedric's thoughts, exporting spheres to dxf will give you horrible, dense geometry to attempt to rework. i'd suggest exporting to separate files, spheres to an obj and any linework to a dxf...like so:

Code:
import processing.dxf.*;
import superCAD.*;

int numberOfFrames = 30;

void setup(){
 size(500, 500, P3D);
 noStroke();
 noLoop();
}

void draw(){
 background (255);
 lights();

 beginRaw("superCAD."+"ObjFile","Export"+"/OBJFILE"+".obj");  
 for(int i = 0; i<numberOfFrames;i++){
   pushMatrix();
   translate(random(width),random(height));
   sphere(10);
   popMatrix();
 }
 endRaw();

 strokeWeight(1);
 stroke(0);
 beginRaw(DXF,"Export"+"/DXFFILE"+".dxf");  
 for(int i = 0; i<numberOfFrames;i++){
   line(random(width),random(height),random(width),random(height));
 }
 endRaw();
}

Re: 3d export
Reply #9 - Jan 4th, 2010, 7:34am
 
That's nice!, pip cares about elegance...

superCAD is wysiwyg, spheres are exported as polyhedrons. superCAD doesn't know that much about the geometry, everything is a set of points, lines and triangles. In ANAR+, since we maintain our database of primitives, where it's possible, when we have the opportunity, we've implemented exports for rich primitives (such CSG sphere, cube, boxes, Splines). For example, a sphere is exported as a CSG with AutoLISP (for AutoCAD). The geometry remains more high level this way and cleaner.
Page Index Toggle Pages: 1