Hi Joachim,

Unfortunately I’m not allowed to share the step file as it’s under confidential information. It’s a relatively simple CAD part with 6 faces. I tried to gather some information through FreeCAD:

```
p = Part.read(cad_f)
p.isInfinite()
Out[2]: False
f = p.Faces[3] # this is the problematic face
f.Area
Out[4]: 16.237798546387225
[e.Length for e in f.Edges]
Out[7]:
[47.39898578042153,
3.8007894453146425,
11.167965277525747,
8.333213170139574,
3.0721468452084655,
7.539822368615504,
27.28597626138821,
42.197548223696415,
16.354753098347285,
75.73575564851302,
55.58014254418251,
3.800860005983231]
```

I’m also trying to use netgen in c++, but I’m not sure how to get the OCC status code. Can you point me to the right direction? This is roughly the code I’m using:

```
auto mesh = std::make_shared<netgen::Mesh>();
OCCGeometry* geom = LoadOCC_STEP(filename);
geom->HealGeometry();
auto sh = geom->GetShape();
std::cout << "infinite: " << sh.Infinite() << "\n";
TopoDS_Face face = TopoDS::Face(geom->fmap(4)); // the problematic face
TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation (face, loc);
if (triangulation.IsNull())
{
BRepTools::Clean (geom->shape);
BRepMesh_IncrementalMesh (geom->shape, 0.01, true);
triangulation = BRep_Tool::Triangulation (face, loc);
}
mesh->SetGeometry(std::shared_ptr<netgen::OCCGeometry>(geom, &NOOP_Deleter));
auto result = geom->GenerateMesh(mesh, ngParam);
```

which gives me:

```
Starting geometry healing procedure (tolerance: 0)
-----------------------------------
- repairing faces
-----------------------------------
Compounds : 0 (0)
Composite solids: 0 (0)
Solids : 1 (1)
Shells : 1 (1)
Wires : 8 (8)
Faces : 6 (6)
Edges : 25 (25)
Vertices : 19 (19)
Total surface area : 14688.5 (14688.5)
infinite: 0
triangulation entity: 0
terminate called after throwing an instance of 'ngcore::Exception'
what(): OCC-Triangulation could not be built. Do you have a bounded shape?
[1] 928384 IOT instruction (core dumped) ./MyMeshingApp
```

If I change isRelative to false with

`BRepMesh_IncrementalMesh (geom->shape, 0.01, false);`

I then get:

```
meshed area = 58.3703
maximal area = 32.4756
GIVING UP
meshed area = 58.3703
maximal area = 32.4756
GIVING UP
ERROR: Problem in Surface mesh generation
WARNING! NOT ALL FACES HAVE BEEN MESHED
SURFACE MESHING ERROR OCCURRED IN 1 FACES:
WARNING: Intersecting elements 20 and 1081
el1 = np = 3 3 31 165
el2 = np = 3 19 140 620
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 20 and 1097
el1 = np = 3 3 31 165
el2 = np = 3 19 620 623
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 20 and 1084
el1 = np = 3 3 31 165
el2 = np = 3 144 19 623
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 21 and 1083
el1 = np = 3 31 32 166
el2 = np = 3 143 144 622
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 21 and 1084
el1 = np = 3 31 32 166
el2 = np = 3 144 19 623
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 21 and 1085
el1 = np = 3 31 32 166
el2 = np = 3 144 623 622
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 23 and 1083
el1 = np = 3 32 33 167
el2 = np = 3 143 144 622
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 23 and 1104
el1 = np = 3 32 33 167
el2 = np = 3 142 143 630
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 23 and 1107
el1 = np = 3 32 33 167
el2 = np = 3 630 143 622
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 157
el1 = np = 3 33 34 168
el2 = np = 3 8 75 224
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 158
el1 = np = 3 33 34 168
el2 = np = 3 80 8 224
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 1087
el1 = np = 3 33 34 168
el2 = np = 3 75 8 624
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 1104
el1 = np = 3 33 34 168
el2 = np = 3 142 143 630
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 1181
el1 = np = 3 33 34 168
el2 = np = 3 8 142 624
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 25 and 1334
el1 = np = 3 33 34 168
el2 = np = 3 624 142 630
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 27 and 268
el1 = np = 3 34 35 169
el2 = np = 3 79 80 224
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 27 and 158
el1 = np = 3 34 35 169
el2 = np = 3 80 8 224
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 29 and 268
el1 = np = 3 35 36 170
el2 = np = 3 79 80 224
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 29 and 358
el1 = np = 3 35 36 170
el2 = np = 3 79 224 223
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 29 and 163
el1 = np = 3 35 36 170
el2 = np = 3 78 79 227
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 29 and 266
el1 = np = 3 35 36 170
el2 = np = 3 227 79 223
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 31 and 163
el1 = np = 3 36 4 40
el2 = np = 3 78 79 227
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 31 and 211
el1 = np = 3 36 4 40
el2 = np = 3 78 227 251
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 31 and 210
el1 = np = 3 36 4 40
el2 = np = 3 77 78 251
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 157 and 25
el1 = np = 3 8 75 224
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 158 and 27
el1 = np = 3 80 8 224
el2 = np = 3 34 35 169
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 158 and 25
el1 = np = 3 80 8 224
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 161 and 1684
el1 = np = 3 76 77 226
el2 = np = 3 40 4 145
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 161 and 1711
el1 = np = 3 76 77 226
el2 = np = 3 145 9 900
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 162 and 1711
el1 = np = 3 76 226 225
el2 = np = 3 145 9 900
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 163 and 29
el1 = np = 3 78 79 227
el2 = np = 3 35 36 170
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 163 and 31
el1 = np = 3 78 79 227
el2 = np = 3 36 4 40
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 166 and 1715
el1 = np = 3 11 81 229
el2 = np = 3 147 148 903
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 166 and 1713
el1 = np = 3 11 81 229
el2 = np = 3 146 147 902
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 167 and 1713
el1 = np = 3 81 10 230
el2 = np = 3 146 147 902
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 168 and 1717
el1 = np = 3 12 82 99
el2 = np = 3 148 149 904
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 168 and 1719
el1 = np = 3 12 82 99
el2 = np = 3 149 150 905
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 169 and 1717
el1 = np = 3 82 11 231
el2 = np = 3 148 149 904
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 169 and 1715
el1 = np = 3 82 11 231
el2 = np = 3 147 148 903
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 170 and 1717
el1 = np = 3 99 82 231
el2 = np = 3 148 149 904
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 171 and 1715
el1 = np = 3 11 229 231
el2 = np = 3 147 148 903
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 210 and 31
el1 = np = 3 77 78 251
el2 = np = 3 36 4 40
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 210 and 1684
el1 = np = 3 77 78 251
el2 = np = 3 40 4 145
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 211 and 31
el1 = np = 3 78 227 251
el2 = np = 3 36 4 40
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 213 and 1713
el1 = np = 3 229 81 230
el2 = np = 3 146 147 902
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 266 and 29
el1 = np = 3 227 79 223
el2 = np = 3 35 36 170
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 268 and 29
el1 = np = 3 79 80 224
el2 = np = 3 35 36 170
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 268 and 27
el1 = np = 3 79 80 224
el2 = np = 3 34 35 169
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 316 and 1684
el1 = np = 3 77 251 226
el2 = np = 3 40 4 145
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 358 and 29
el1 = np = 3 79 224 223
el2 = np = 3 35 36 170
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1053 and 1719
el1 = np = 3 12 99 17
el2 = np = 3 149 150 905
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1053 and 1721
el1 = np = 3 12 99 17
el2 = np = 3 150 151 906
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1081 and 1676
el1 = np = 3 19 140 620
el2 = np = 3 154 3 879
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1081 and 20
el1 = np = 3 19 140 620
el2 = np = 3 3 31 165
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1082 and 1725
el1 = np = 3 141 18 621
el2 = np = 3 152 153 908
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1082 and 1760
el1 = np = 3 141 18 621
el2 = np = 3 154 923 153
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1083 and 21
el1 = np = 3 143 144 622
el2 = np = 3 31 32 166
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1083 and 23
el1 = np = 3 143 144 622
el2 = np = 3 32 33 167
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1084 and 21
el1 = np = 3 144 19 623
el2 = np = 3 31 32 166
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1084 and 20
el1 = np = 3 144 19 623
el2 = np = 3 3 31 165
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1085 and 21
el1 = np = 3 144 623 622
el2 = np = 3 31 32 166
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1086 and 1721
el1 = np = 3 17 99 603
el2 = np = 3 150 151 906
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1087 and 25
el1 = np = 3 75 8 624
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1097 and 20
el1 = np = 3 19 620 623
el2 = np = 3 3 31 165
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1103 and 1725
el1 = np = 3 18 17 603
el2 = np = 3 152 153 908
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1103 and 1721
el1 = np = 3 18 17 603
el2 = np = 3 150 151 906
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1104 and 23
el1 = np = 3 142 143 630
el2 = np = 3 32 33 167
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1104 and 25
el1 = np = 3 142 143 630
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1107 and 23
el1 = np = 3 630 143 622
el2 = np = 3 32 33 167
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1177 and 1676
el1 = np = 3 620 140 670
el2 = np = 3 154 3 879
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1179 and 1760
el1 = np = 3 141 621 672
el2 = np = 3 154 923 153
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1180 and 1760
el1 = np = 3 140 141 672
el2 = np = 3 154 923 153
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1180 and 1676
el1 = np = 3 140 141 672
el2 = np = 3 154 3 879
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1181 and 25
el1 = np = 3 8 142 624
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1185 and 1725
el1 = np = 3 18 603 675
el2 = np = 3 152 153 908
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1200 and 1725
el1 = np = 3 18 675 621
el2 = np = 3 152 153 908
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1332 and 1676
el1 = np = 3 670 140 672
el2 = np = 3 154 3 879
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1334 and 25
el1 = np = 3 624 142 630
el2 = np = 3 33 34 168
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1676 and 1332
el1 = np = 3 154 3 879
el2 = np = 3 670 140 672
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1676 and 1180
el1 = np = 3 154 3 879
el2 = np = 3 140 141 672
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1676 and 1177
el1 = np = 3 154 3 879
el2 = np = 3 620 140 670
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1676 and 1081
el1 = np = 3 154 3 879
el2 = np = 3 19 140 620
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1684 and 210
el1 = np = 3 40 4 145
el2 = np = 3 77 78 251
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1684 and 316
el1 = np = 3 40 4 145
el2 = np = 3 77 251 226
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1684 and 161
el1 = np = 3 40 4 145
el2 = np = 3 76 77 226
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1711 and 162
el1 = np = 3 145 9 900
el2 = np = 3 76 226 225
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1711 and 161
el1 = np = 3 145 9 900
el2 = np = 3 76 77 226
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1713 and 167
el1 = np = 3 146 147 902
el2 = np = 3 81 10 230
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1713 and 213
el1 = np = 3 146 147 902
el2 = np = 3 229 81 230
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1713 and 166
el1 = np = 3 146 147 902
el2 = np = 3 11 81 229
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1715 and 169
el1 = np = 3 147 148 903
el2 = np = 3 82 11 231
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1715 and 171
el1 = np = 3 147 148 903
el2 = np = 3 11 229 231
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1715 and 166
el1 = np = 3 147 148 903
el2 = np = 3 11 81 229
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1717 and 168
el1 = np = 3 148 149 904
el2 = np = 3 12 82 99
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1717 and 170
el1 = np = 3 148 149 904
el2 = np = 3 99 82 231
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1717 and 169
el1 = np = 3 148 149 904
el2 = np = 3 82 11 231
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1719 and 168
el1 = np = 3 149 150 905
el2 = np = 3 12 82 99
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1719 and 1053
el1 = np = 3 149 150 905
el2 = np = 3 12 99 17
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1721 and 1053
el1 = np = 3 150 151 906
el2 = np = 3 12 99 17
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1721 and 1086
el1 = np = 3 150 151 906
el2 = np = 3 17 99 603
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1721 and 1103
el1 = np = 3 150 151 906
el2 = np = 3 18 17 603
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1725 and 1185
el1 = np = 3 152 153 908
el2 = np = 3 18 603 675
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1725 and 1200
el1 = np = 3 152 153 908
el2 = np = 3 18 675 621
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1725 and 1082
el1 = np = 3 152 153 908
el2 = np = 3 141 18 621
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1725 and 1103
el1 = np = 3 152 153 908
el2 = np = 3 18 17 603
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1760 and 1082
el1 = np = 3 154 923 153
el2 = np = 3 141 18 621
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1760 and 1179
el1 = np = 3 154 923 153
el2 = np = 3 141 621 672
layer1 = 1
layer2 = 1
WARNING: Intersecting elements 1760 and 1180
el1 = np = 3 154 923 153
el2 = np = 3 140 141 672
layer1 = 1
layer2 = 1
Num. of mesh nodes generated: 1114
Num. of mesh triangles generated: 2190
Mesh was generated.
Mesh generation succeeded.
```

which seems to work (I visualized the mesh and it seems more or less alright).