PDA

View Full Version : Parse STEP(.stp) File To OpenGL



Richard145
10-31-2006, 09:17 AM
Please Help,

I am new to OpenGL and have a question that is probably a little off topic but I am looking for any help/hints. I have a STEP file (.stp) that I am trying to parse so that I can use OpenGL to graph it. The STEP file has a LARGE number of ENTITIES defined (VERTEX_POINT, LINE, PLANE, etc) so I am trying to take one ENTITY at a time. I have been successful in graphing the LINE ENTITY (two x,y,z points with a GL_LINES drawn between them) but am having some difficulty with the PLANE entity.

In the STEP file, a PLANE ENTITY is made up of a AXIS2_PLACEMENT_3D ENTITY which is made up of a cartesian_point, direction1, and direction2. For example, I have a PLANE ENTITY which is made of an AXIS2_PLACEMENT_3D ENTITY which has a cartesian_point (0, 0, -1), direction1 (0, 0, 1), and direction2 (1, 0, 0). Has anyone out there had to do a STEP file format for graphing purposes? If so, do you have any info about what some of these ENTITIES mean as it applies to OpenGL graphing?

Thanks in advance for any help/hints. I appologize if this question is too off-topic but like I said, I am just looking for ANY hints or directions at this point.

k_szczech
10-31-2006, 01:35 PM
My bet is that cartesian_point is the center of plane (actually planes do not have center since they're infinite) and direction1 and direction2 are two orthogonal vectors on this plane.

You can draw such plane as a GL_QUADS:

vertex 1: cartesian_point - (direction1 + direction2) * scale
vertex 2: cartesian_point - (direction1 - direction2) * scale
vertex 3: cartesian_point + (direction1 + direction2) * scale
vertex 4: cartesian_point + (direction1 - direction2) * scaleThis is just a guess. I don't know anything about .stp files :)

Richard145
11-02-2006, 06:34 AM
Thank you k_szczech. I will give it a try.

ANY Ideas are greatly appreciated since I don't know much about the make-up a .stp file either and am new at OpenGL.