For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Vertices Count with Explorer

Fel Grd's picture

Hi everyone,

I'm trying to make basic shape exploration with TopExp_Explorer and I can't understand why the value I got are wrong.

I import a basic cube in STL format, so i'm supposed to find 36 vertices according to the file description, and when I apply the import after the exploration I got 72.

I'm using the basic algorithm provided by the documentation, so there is an OCCT reason to give the double of vertices after an import ?

Thanks for reading

Kirill Gavrilov's picture

STL file defines triangles without connectivity information (e.g. all nodes shared in original geometry are just duplicated).

This kind of geometry has very limited usage scenarios when converted into BRep format without surface reconstruction.
Usually it is better preserving triangulation as is (Poly_Triangulation, as returned by RWStl::ReadFile()),
or even implementing RWStl_Reader interface at application level to decide yourself what to do with triangles read from STL file (and how to merge / not to merge nodes).

Fel Grd's picture

Ok, thank you for the advice on RWStl !

On the number of vertices : I understand the duplication of nodes, but for a simple cube, the triangulation gives 12 faces (each face of the cube cut in 2 triangles), each triangle gives 3 vertices ==> 3x12 = 36 instead of 8 real vertices , still not explain 72 .

Thanks again for the quick answer !

Kirill Gavrilov's picture

On OCCT 7.3.0, read as Face per triangle (obsolete):

readstl s cube.stl
trinfo s
nbshapes s


This shape contains 0 triangles.
                    0 nodes.
Number of shapes in s
 VERTEX    : 8
 EDGE      : 18
 WIRE      : 12
 FACE      : 12
 SHELL     : 1
 SOLID     : 0
 SHAPE     : 51

and read as Poly_Triangulation:

readstl t cube.stl triangulation
trinfo t
nbshapes t


This shape contains 12 triangles.
                    8 nodes.
Number of shapes in t
 VERTEX    : 0
 EDGE      : 0
 WIRE      : 0
 FACE      : 1
 SHELL     : 0
 SOLID     : 0
 SHAPE     : 1

So far I don't see anything returning 72...
Probably you are counting all Vertices of each Edge of each Triangle, which are not unique but shared in BRep, which gives 12 Face (triangles) * 3 Edges * 2 Vertices = 72.