How to create viewer for JT 3D file format

12.3k views Asked by At

I want to create a viewer which can view/render JT file format. I know there is 1 viewer available JT2Go but i want to create 1 for my own, as JT2GO is not open source.

My requirement is not so high and i don't require features which JT2GO has, I just want to render the 3D file, no layering or selecting of individual components is required. Just a plane viewer.

5

There are 5 answers

1
roemcke On

Start by getting the spec at:

http://www.plm.automation.siemens.com/en_us/Images/JT_v95_File_Format_Reference_Rev-A_tcm1023-111987.pdf

and write a library to read the file. The spec looks big but straight forward to implement. I think it should be possible to access elements of the file without keeping the whole datastructure in memory.

When programming the viewer part, don't use OpenGL directly, but use a scene graph library. (OpenSceneGraph is the first one that pops into my mind)

1
phkahler On

You might try adding support for this file format to the Open Asset Import Library:

http://assimp.sourceforge.net/

Also know by the unfortunate abbreviation ASSIMP. They already have a viewer, so once you add the format to the import library you'll be done. In addition you will have added support for another format to an existing open source library.

0
Davido On

To view the files once you load them, you basically need to implement OpenGL in your program. Each object is an array of float values that represent it's geometry (vertices). So once you pull this information out, you just render it using standard OpenGL calls. For example, put your vertices into a close packed array (single dimension array of floats):

vertexX, vertexY, vertexZ, normalX, normalY, normalZ

This array of floats represents all the faces of your model. Three vertices per face, with the above line being one vertex. Once you have a float array, it's simple to render.

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

glVertexPointer(3, GL_FLOAT, sizeof(vertices[0])*6, &vertices[0]);
glNormalPointer(GL_FLOAT, sizeof(vertices[0])*6, &vertices[3]);

glColor4f(R, G, B, 1); //range 0-1
glDrawArrays(GL_TRIANGLES, 0, numVertices); //number of floats in array divided by 6

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

Then just put this in your OpenGL-ES 1.1 render loop. Let me know if this does it for you. Also, please share how to read the JT file format if you have it working.

0
guest On

You can use the Java library from here: http://www.johannes-raida.de/jnetcad. As far as I can see, it should support JT version 8 files. I used the DXF import library and was quite happy. The API is the same, so you have access to all triangles with their coordinates, normals, color and layer.

0
user4861864 On

It is also possible to use the Open Cascade library. It is an open source C++ library (LGPL), and is primarily designed for CAD. Currently it also supports to read the facets (triangles) of JT documents: http://www.opencascade.org/support/applications/jt_assistant/ and the Jt assistant can also visualize the JT documents. The C++ code is of this application is open source (GPL). One advantage of the Jt assistant compare to Jt2Go is that it is possible to show different layers (groups) of the JT document.