+ netgen::Mesh * ngMesh = ngMeshes[ iLoop ];
+ ngMesh->DeleteMesh();
+
+ if ( iLoop == NO_LOC_SIZE )
+ {
+ ngMesh->SetGlobalH ( mparam.maxh );
+ ngMesh->SetMinimalH( mparam.minh );
+ Box<3> bb = occgeom.GetBoundingBox();
+ bb.Increase (bb.Diam()/10);
+ ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
+ aMesher.SetLocalSize( occgeom, *ngMesh );
+ aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMesh );
+ try {
+ ngMesh->LoadLocalMeshSize( mparam.meshsizefilename );
+ } catch (NgException & ex) {
+ return error( COMPERR_BAD_PARMETERS, ex.What() );
+ }
+ }
+
+ nodeVec.clear();
+ faceErr = aMesher.AddSegmentsToMesh( *ngMesh, occgeom, wires, helper, nodeVec,
+ /*overrideMinH=*/!_hypParameters);
+ if ( faceErr && !faceErr->IsOK() )
+ break;
+
+ //if ( !isCommonLocalSize )
+ //limitSize( ngMesh, mparam.maxh * 0.8);
+
+ // -------------------------
+ // Generate surface mesh
+ // -------------------------
+
+ const int startWith = MESHCONST_MESHSURFACE;
+ const int endWith = toOptimize ? MESHCONST_OPTSURFACE : MESHCONST_MESHSURFACE;
+
+ SMESH_Comment str;
+ try {
+ OCC_CATCH_SIGNALS;
+
+#ifdef NETGEN_V5
+ err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
+#else
+ char *optstr = 0;
+ err = netgen::OCCGenerateMesh(occgeom, ngMesh, startWith, endWith, optstr);
+#endif
+ if ( netgen::multithread.terminate )
+ return false;
+ if ( err )
+ str << "Error in netgen::OCCGenerateMesh() at " << netgen::multithread.task;
+ }
+ catch (Standard_Failure& ex)