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.
IndexProgramming Questions & HelpOther Libraries › DXF Export in OpenGL
Page Index Toggle Pages: 1
DXF Export in OpenGL (Read 1257 times)
DXF Export in OpenGL
Aug 22nd, 2008, 12:38am
 
Hello,

I'm currently exporting 3d geometry from an OpenGL application in java mode. I have two issues:

1) my strokes are not joined when I import the dxf into Rhino

I'm drawing polylines this way:

beginShape()
vertex()
vertex()
vertex()
vertex()
vertex()
...
endShape()

but when I import the dxf the polyline is broken down into the line segments between each vertex. Is there a method to ensure these vertices are joined?

2) My second issue involves defining a RawDXF variable using the createGraphics method seen here:

http://dev.processing.org/reference/everything/javadoc/processing/dxf/RawDXF.html

I get this error:

C:/Users/mos/AppData/Local/Temp/build18396.tmp/MOScat.java:303:20:303:52: Semantic Error: No applicable overload for a method with signature "createGraphics(java.lang.String, java.lang.String)" was found in type "processing.core.PApplet". Perhaps you wanted the overloaded version "processing.core.PGraphics createGraphics(int $1, int $2, java.lang.String $3);" instead?

I tried constructing the rawDXF using the RawDXF(int width, int height, PApplet applet, java.lang.String path) constructor but unsuccessfully. I don't fully understand how to populate the fields. Any ideas?
Re: DXF Export in OpenGL
Reply #1 - Aug 22nd, 2008, 2:02am
 
use the following:
dxf = (RawDXF) createGraphics(width, height, DXF, "output.dxf");
http://processing.org/reference/createGraphics_.html

beginRaw/endRaw only support individual lines and triangles. it's just raw data before it's sent to the renderer.
Re: DXF Export in OpenGL
Reply #2 - Aug 22nd, 2008, 6:00pm
 
thanks fry- I have it working now aside from the fact that the dxf.setLayer(int) method doesn't appear to work at all

Searching through the DXF output in notepad reveals there's no layer information whatsoever in the exported file. Is this not implemented?

I'm also confused at the beginShape() method description of the RawDXF class:

"beginShape() is intended to be more flexible at the expense of being a little more complicated to use. it handles more complicated shapes that can consist of many connected lines (so you get joins) or lines mixed with curves."

found here: http://dev.processing.org/reference/everything/javadoc/processing/dxf/RawDXF.html

if joins are in fact impossible in exporting raw data then I find this usage of "join" a bit misleading...

You can see the applet I'm working on here for context, source isn't linked right now but will once things get cleaned up a bit:

http://applets.mos-office.net/MOScat/

The export functionality is disabled in the applet.
Re: DXF Export in OpenGL
Reply #3 - Aug 22nd, 2008, 6:14pm
 
I implemented the alternate dxf export syntax here on Simon Greenwold's example to test if layers would be exported. They were not.

Code:

import processing.dxf.*;
boolean record = false;
RawDXF dxf;

void setup() {
size(400, 400, P3D);
noStroke();
sphereDetail(12);
}

void draw() {
if (record == true){
dxf = (RawDXF) createGraphics(height, width, DXF, "output.dxf");
beginRaw(dxf);
dxf.setLayer(1);
}
lights();
background(0);
translate(width / 3, height / 3, -200);
rotateZ(map(mouseY, 0, height, 0, PI));
rotateY(map(mouseX, 0, width, 0, HALF_PI));
for (int y = -2; y < 2; y++) {
for (int x = -2; x < 2; x++) {
for (int z = -2; z < 2; z++) {
pushMatrix();
translate(120*x, 120*y, -120*z);
sphere(30);
popMatrix();
}
}
}
if (record == true) {
endRaw();
record = false; // Stop recording to the file
}
}

void keyPressed() {
if (key == 'R' || key == 'r') { // Press R to save the file
record = true;
}
}
Page Index Toggle Pages: 1