Triangulation fails on face with Cylindrical Surface

Hi,

This is my fist post. 

I've been slowly working my way building BReps from scratch using BRepBuilderAPI. I made the shell in the image attached. 

When I tried to export it using BRepMesh_FastDiscret & BRep_Tool::Triangulation() all the faces export OK except the face shown in the second file.

In this case the Triangulation returns a null. 

If I check the status of the face it says No_Error.

            BRepBuilderAPI_MakeFace MF = BRepBuilderAPI_MakeFace(aCylinder, aWire);
            if (MF.IsDone())
            {
                TopoDS_Face aFace = MF;
                BRepCheck_Face aCF(aFace);
                aCF.Blind();
                BRepCheck_ListOfStatus aList = aCF.StatusOnShape(aFace);
                BRepCheck_Status anItem = aList.First();

            }

Tracing through the code. The problem is in here BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)

It tries this - I think for each edge but fails with aCurve2d.IsNull().... 

        Handle(Geom2d_Curve) aCurve2d = 
          BRep_Tool::CurveOnSurface(aEdge, aFace, aFirstParam, aLastParam);

        if (aCurve2d.IsNull())
          continue;

which fails because

cr->IsCurveOnSurface(S,loc))

is false.

I have a feeling that this is because of something I haven't done. Do I have to project the curve onto the surface?

Any suggestions? Are their other checks I can do? 

Kind Regards, 

Jon Gould

Jon Gould's picture

OK, I'll tell the truth - it's not my first post. But it is my first post in 13 years. I came back to see what progress had been made, whether the forums were any better.

Do a search for Gould and you will see I asked an almost identical question in 2003. I didn't get an answer then either.

The question isn't trivial. I'd spend some time working slowly through the docs before putting up the question. I wonder what one has to do to get some encouragement?

Jon
 

Qr Qr's picture

Hi Jon,

In order to help you with this, png is not enough. Can you attach the BREP file of your shell? Do you use Draw? Did you try to check your shape with "checkshape" command? I guess, your shape is invalid since you need to have p-curves in a valid solid. As a fast workaround, you can try using ShapeFix_Shape tool to check if it solves the problem.

Qr.