STEP reader Shape structure ?


I'm lost in the OCC data structure...

I use the documentation about the STEP reader, but this is not so clear to me.
I can get one or more Shape after file load... but after that there are a lot a different way to do the same thing... but for the moment no one did was I expect from it...

This is my goal : read the file data, mesh face is necesarry, do all the necessary things, but being able to get the triangles meshed and the associated vertices, so I can write them in an other file with different format...

For the moment, I get the vertices from the Face, but the elements location is not the good one in the final file...

I see I can get location from each Shape, for Face too ... are both necessary ?

Testing I get 2 kind of things : the elements parts dispatched in the scene... or the elements at the good place but each face seems to be meshed 2 times and I have two mesh for the elements...

Please, where to find the useful information in the datas, and how to use them ?

Thanks a lot !


_VincentB_'s picture

No answer ... I hope someone can help me.

For the moment, digging into the problem I found that I mesh more than 1 time each face.
I assume that running into each mesh, I create one more geometry, even if the current mesh is an high level one.

Is there any way to detect if a Shape is not a leaf of the assembly tree ? It would be very useful.



Roman Lygin's picture

Hi Vincent,

Is this still a problem after you seem to read the User's Guide and series about the geometry and topology on my blog ?
You may mesh your entire shape upfront using BRepMesh::Mesh() instead of doing this face by face.
When you are exploring a shape with TopExp_Explorer locations are applied to all the children from the initial shape down to one of your interest.
I don't know what you mean under 'leaf' but in a typical shape structure leaves are vertices or empty compounds that do not refer anything. Other shapes are normally parent shapes of more junior types (e.g. edge is a parent of 2 vertices).

Hope this helps.
Roman--- - the Open CASCADE blog

_VincentB_'s picture

Hi Roman,

I just tried to mesh all the Shape...
Converting it, no problem always is good :-)

But (of course...) the next problem is : now, I got a single 3d model instead of separates parts, and I cannot get colors or parts name ...
That's why I was thinking about running in the tree before meshing : this allow me to get the information I need (color, names, parents/children) to make my translation.

So, thanks a lot for your reply, because It's a good beginning for now. But if your can give me some advices on how to translate the file keeping alive the assembly, this would be very great :-)


Roman Lygin's picture

Hi Vincent,

I don't remember if I already replied on this but just in case. Meshing an entire shape (BRepMesh::Mesh()) does NOT break any topology. It just adds triangulation structures into each face and edge - I mentioned this on my blog when describing the face topology.
So after meshing a shape you will get exact same hierarchy of subshapes with the difference that edges and faces will have additional tessellation structures.

Moreover, meshing an entire shape can be a preferred way as meshing a face will reuse approximation points of an edge shared with the other face.

Hope this helps.
--- - the Open CASCADE blog