Sat, 06/20/2020 - 14:30

Hi folks,

I'm totally struggling with an apparently very simple task : create a cylindrical topological face.

For testing purposes, I'm trying to build a cylindrical face from a cylinder centered on (0, 0, 0) and directed to +Z, and 4 edges delimiting the face to the 0..Pi/2 quadrant from Z = 0 to Z = 1 (i.e 2 arcs and 2 segments).

My code :

```
//solid construction ----------------------------------------------
BRep_Builder builder;
BRepBuilderAPI_MakeWire occt_wire;
occt_wire.Add(BRepBuilderAPI_MakeEdge
(
gp_Circ(gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), 1),
gp_Pnt(1, 0, 0),
gp_Pnt(0, 1, 0)
));
occt_wire.Add(BRepBuilderAPI_MakeEdge
(
gp_Pnt(0, 1, 0),
gp_Pnt(0, 1, 1)
));
occt_wire.Add(BRepBuilderAPI_MakeEdge
(
gp_Circ(gp_Ax2(gp_Pnt(0, 0, 1), gp_Dir(0, 0, -1)), 1),
gp_Pnt(0, 1, 1),
gp_Pnt(1, 0, 1)
));
occt_wire.Add(BRepBuilderAPI_MakeEdge
(
gp_Pnt(1, 0, 1),
gp_Pnt(1, 0, 0)
));
TopoDS_Shell shell;
builder.MakeShell(shell);
builder.Add(shell, BRepBuilderAPI_MakeFace
(
gp_Cylinder
(
gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)),
1
),
occt_wire
));
TopoDS_Solid solid;
builder.MakeSolid(solid);
builder.Add(solid, shell);
//tessellation ----------------------------------------------
BRepMesh_IncrementalMesh(solid, 0.01);
...
```

Result of tessellation is error 4 (IMeshData_Failure = Failed to generate mesh for some faces), and face is obviously not triangulated.

I don't get it ... could you tell me what is wrong with this fairly simple & direct method ?

Thanks ;-)

Edit : Just to anticipate several potential answers ...

I know I can solve the above problem just be building a constraint cylinder U = 0 .. Pi/2 and V = 0 ..1.

What I'm looking for is a general way of building a face from a given known surface and a closed wire, without asking OCCT to "deduce" any of the parameters, in order to achieve the maximum performance (because I have many faces to build this way).

Edit 2: "`BRepFill_Filling`

" could be a good candidate, but it seams pretty unstable when number of boundary edges increases, and as far as I can tell, it involves some unnecessary phases to "rebuild" the face, where I already have all information to build it manually.

Mon, 06/22/2020 - 02:00

Problem solved : BRepBuilderAPI_MakeFace(surface, wire) is expecting a wire with parametrized edges, what I've done thanks to ShapeFix_Edge.