BRepMesh_FastDiscret doesn’t triangulate holes

Hi everybody,

I have a problem using BRepMesh_FastDiscret:

I create a face with a hole inside which I wanna triangulate.
Therefore I create first the outer face by a surf:

TColgp_Array2OfPnt array_2d(1, 2, 1, 2);
array_2d.SetValue(1,1, list_boundary_points_occ[0]);
array_2d.SetValue(1,2, list_boundary_points_occ[1]);
array_2d.SetValue(2,1, list_boundary_points_occ[3]);
array_2d.SetValue(2,2, list_boundary_points_occ[2]);
Handle(Geom_Surface) surf_handle = new Geom_BezierSurface(array_2d);
GeomAdaptor_Surface new_surface_adaptor(surf_handle);
BRepBuilderAPI_MakeFace whole_face_builder = BRepBuilderAPI_MakeFace();
whole_face_builder.Init(new_surface_adaptor.Surface());
whole_face_builder.Build();

Then I create a smaller wire representing the hole:

TopoDS_Wire wire_of_current_hole = …

And then I use “Add” to add the wire as hole to the face:

whole_face_builder.Add(wire_of_current_hole);

Everything’s fine, the resulting face includes the hole.
But when triangulating the face, the whole face without the hole is triangulated:
BRepMesh_FastDiscret mymesh(0.01,whole_face_builder.Face(), boundingBox, 30, true, true, false, true );

Does anyone know why?

NadjaS's picture

I figured out, that using

BRepMesh_FastDiscret* my_mesh = new BRepMesh_FastDiscret(0.01,whole_face_builder.Face(), boundingBox, 30, true, true, false, true );

the number of returned triangles in

my_mesh->NbTriangles()

is 15. Obviously the hole was triangulated in respect.
But how can I have access to these 15 triangles??
Using
my_mesh->TrianglesOfDomain(1, map_integer_triangles);
the size of map_integer_triangles is only 2.

Does anyone have an idea??

sergey zaritchny's picture

Hello NadjaS,

Check, please TrianglesOfDomain() for all Domains: ->NbDomains().
NB. I would recommend you to test 6.4.0 which is coming soon.
Regards
Sergey

NadjaS's picture

Hi Sergey,
that's the thing I've already tried:
I have one domain, which is ok, I think.
But using TrianglesOfDomain() for that domain, the size of the received MeshDS_MapOfInteger is 2 and I get again only the triangulated face without the hole...
Regards
Nadja

sergey zaritchny's picture

Hi Nadja,
Probably it is a bug, it depends...
Attach, please (if you want) a kept in 'brep' format file with the specified face.
I will try to check and will inform you if it is a bug.
regards
Sergey

NadjaS's picture

Hi Sergey,

here it is.
Thanks a lot!

Attachments: 
sergey zaritchny's picture

Hi Nadja,
A simple check in Draw shows that your shape (face with hole) is invalid.
As result you got an expectable result in Mesher.
See below Draw report (where F1 is your face):
Draw[14]> checkshape F1
On Shape faulty_1 :
BRepCheck_SelfIntersectingWire
On Shape faulty_2 :
BRepCheck_UnorientableShape
Shape faulty_1 on shape faulty_2 :
BRepCheck_SelfIntersectingWire
Shape faulty_3 on shape faulty_2 :
BRepCheck_NoCurveOnSurface
Shape faulty_4 on shape faulty_2 :
BRepCheck_NoCurveOnSurface
Shape faulty_5 on shape faulty_2 :
BRepCheck_NoCurveOnSurface
Shape faulty_6 on shape faulty_2 :
BRepCheck_NoCurveOnSurface

Faulty shapes in variables faulty_1 to faulty_6

It means that Wire has bad orientation and some edges don't have pcurves:
Draw[21]> pcurve F1

rouge FORWARD
bleu REVERSED
rose EXTERNAL
orange INTERNAL
Error: Edge 5 does not have pcurve
Error: Edge 6 does not have pcurve
Error: Edge 7 does not have pcurve
Error: Edge 8 does not have pcurve
I.e. big bounding wire has bad orientation of edges (see the attached picture).
Small wire (hole) has not pcurves on surface at all.
I hope it helps you.
Good luck.
Sergey

Attachments: 
NadjaS's picture

Hi Sergey,
thanks a lot, now it works!

Best regards, Nadja