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
File Export (3D) (Read 9701 times)
File Export (3D)
Jan 22nd, 2007, 1:06pm
 
I have written a file exporter that is based on the velocity template engine.

Since 3D Files (or 2d) represent the same info in different forms, it makes sense to have the file format info in a template. All that has to be done to export a new file format is to write a new template. No code changes are necessary. This way the PDF, SVG, PS, DXF, OBJ, etc, exports could all have the same code base.

The library runs with my framework and not in processing, however I would like to include it in processing.

One problem I have is how to set custom parameters for a library using the Recorder method. For example I would like to set the name of the template file and whether the file is to be exported in an ascii or binary format (e.g. STL). If I use createGraphics I have an instance of the graphics class (e.g. MyGraphics) and can call...

myGraphics.setBinary();

... but I can't do this with the recorder interface(or can I?). Perhaps a setParameter method could be added to PGraphics and PApplet that sets a value in a hashmap?

Re: File Export (3D)
Reply #1 - Jul 16th, 2007, 3:13pm
 
I also need help generating a STL file from my Processing program. Any way to get to STL from Processing? Via OpenGL?

Any help would be appreciated.

Gökhan Karakus
Re: File Export (3D)
Reply #2 - Jul 16th, 2007, 4:49pm
 
Hi

It will take a while before I get around to preparing the library. However in the mean time you can export it as a DXF, load it in Blender (blender.org) and save it as a STL.

Are you doing something with Rapid-Manufacturing? If so I would love to see some documentation of what you are doing.

Cheers,
Stephen

Re: File Export (3D)
Reply #3 - Jul 16th, 2007, 5:27pm
 
steven,

yes, that's exactly what i'm trying to do. Processing and Rapid Prototyping. i am coding something simple in Processing for output by materialise-mgx. the idea is to "design by numbers" a la John Maeda. i'm trying to get my head around the optimal way to interface Processing and RP/RM as design methods. (i come from an architectural theory/interactive design bkgnd). In terms of static 3D modelling, Processing of course provides lots of options with different mathematical formula  but that seems lıke the lazy man's approach. Im thinking of taking an animated 3D Processing structure and extrapolating a shape from there...will keep you posted.

I checked out your nifty site...thats pretty radical what you are doing, DIY design  products.

Peace,

Gökhan
Re: File Export (3D)
Reply #4 - Jul 16th, 2007, 6:11pm
 
Hi Gökhan

There is nothing wrong with being lazy. Laziness can be a driver for innovation Wink. You are just not as flexible using primitives.

tooteloo,
Stephen
Re: File Export (3D)
Reply #5 - Jul 16th, 2007, 10:43pm
 
So you want just your one recorder class that supports multiple formats?  Yeh, it's not architected that way, expects unique recorder class per type of "recording".

But, you could still hack something together, by extending the "meaning" of the filename parameter - either by parsing the extension, or stripping out a coded prefix, for example:

// use extension to determine export type
beginRecord("YourClass","output.stl");
beginRecord("YourClass","output.dxf");

// use coded prefix to determine export type
// (strip prefix before using as filename)
beginRecord("YourClass","STLBIN::output.bin");
beginRecord("YourClass","STLASC::output.txt");
beginRecord("YourClass","DXF::output.bin");

Just an idea.

[Edit]  Um, duh, silly me, or you could just typecast the return from beginRecord and call whatever class-specific stuff you want:

YourClass yc = (YourClass)beginRecord("YourClass","output.bin");
yc.SomethingOnlyYourClassSupports();

Re: File Export (3D)
Reply #6 - Jul 17th, 2007, 9:31am
 
Hi Davbol

Thanks for the ideas. As it turns out this is how I have done it in the mean time. For the format I use the file extension. In the case of STL you can write either an ascii or binary format by casting the type and using a setBinary(boolean) method.

The casting method works but I don't think it is particularly easy to understand for beginners.

I could hide the casting in the library so the user can call...

YourClass yc = exporter.beginRecord(string)
yc.setBinary(true);

which in turn calls...

return (YourClass)parent.beginRecord("YourClass", "output.stl");

This would make the libraries usage different to others though.

I could also inherit from PGraphics and override beginRecord(boolean) and make the user call

size(100, 100, exporter.OPENGL);

But I guess to start off with I will use the casting method though and simply document it.
Re: File Export (3D)
Reply #7 - Feb 7th, 2008, 6:58pm
 
hey y'all

i'm another architecture student, and just recently started messing with processing.

i've developed this 'cracking' script (i.e find average of vertices of polygon and recurse) but i'm a bit lost in terms of how to export dxf files. you guys make it sound so easy.

any help or redirection would be massively appreciated.
Re: File Export (3D)
Reply #8 - Feb 7th, 2008, 7:20pm
 
Hi there

Due to a lack of time I have not released my library but what I have done so far is on-line at http://fluidforms.eu/processing/fluid-forms-libs/

There is a rough documentation, perhaps it is enough to get you going.

You will have to replace the following line in the example...
String format = "stl";

...with ...
String format = "dxf";

to get a dxf file. Otherwise you can convert it in your favourite 3D modelling program.

Good luck,
Stephen
Re: File Export (3D)
Reply #9 - Aug 18th, 2008, 11:46pm
 
Hello,

Thanks for posting this library, it looks very useful. Unfortunately the link to the library on the site you posted is to:
http://www.fluid-forms.com/FluidLibs/releases/1-0/p5h2.zip

which seems to be your database library, not the 3D export library. Could you post a link to the 3D export library?

thank you,
douglas
Re: File Export (3D)
Reply #10 - Aug 19th, 2008, 9:51am
 
Sorry about that and thanks for letting me know.

I have updated the page to use the correct link.
Re: File Export (3D)
Reply #11 - Dec 27th, 2009, 12:17pm
 
FluidLibs is now http://fluidforms.eu/processing/fluid-forms-libs/
Page Index Toggle Pages: 1