+ delete _offsetMesh; //_offsetMesh = 0;
+}
+
+//================================================================================
+/*!
+ * \brief Create an offset solid from a given one
+ * \param [in] theShape - input shape can be a solid, solidcompound or a compound with solids
+ * \param [in] theMesh - main mesh
+ * \param [out] theError - error description
+ * \return TopoDS_Shape - result offset shape of the same type as the received shape
+ */
+//================================================================================
+
+TopoDS_Shape StdMeshers_Cartesian_VL::ViscousBuilder::MakeOffsetSolid(const TopoDS_Shape & theShape,
+ SMESH_Mesh & theMesh,
+ std::string & theError )
+{
+ double offset = -_hyp->GetTotalThickness();
+ double tol = Precision::Confusion();
+ TopAbs_ShapeEnum typeOfShape = theShape.ShapeType();
+
+ TopTools_IndexedMapOfShape shapeList;
+ TopExp::MapShapes( theShape, TopAbs_SOLID, shapeList );
+ std::vector<TopoDS_Shape> shrinkBodies;
+
+ for ( int i = 1; i <= shapeList.Size(); ++i )
+ {
+ auto solid = shapeList( i );
+ // If Shape is solid call direct
+ BRepOffset_MakeOffset * makeOffset = new BRepOffset_MakeOffset();
+ makeOffset->Initialize( solid, offset, tol, BRepOffset_Skin, /*Intersection=*/false,
+ /*selfInter=*/false, GeomAbs_Intersection);
+
+ // exclude inlet FACEs
+ SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+ for ( TopExp_Explorer fEx( theShape, TopAbs_FACE ); fEx.More(); fEx.Next() )
+ {
+ TGeomID fID = meshDS->ShapeToIndex( fEx.Current() );
+ if ( !_shapesWVL.count( fID ))
+ makeOffset->SetOffsetOnFace( TopoDS::Face( fEx.Current()), 0 );
+ }
+
+ makeOffset->MakeOffsetShape();
+ if ( makeOffset->IsDone() )
+ {
+ shrinkBodies.push_back( makeOffset->Shape() );
+ _makeOffsetCollection.push_back( makeOffset );
+ }
+ else
+ {
+ switch ( makeOffset->Error() )
+ {
+ case BRepOffset_NoError:
+ theError = "OK. Offset performed successfully.";break;
+ case BRepOffset_BadNormalsOnGeometry:
+ theError = "Degenerated normal on input data.";break;
+ case BRepOffset_C0Geometry:
+ theError = "C0 continuity of input data.";break;
+ case BRepOffset_NullOffset:
+ theError = "Null offset of all faces.";break;
+ case BRepOffset_NotConnectedShell:
+ theError = "Incorrect set of faces to remove, the remaining shell is not connected.";break;
+ case BRepOffset_CannotTrimEdges:
+ theError = "Can not trim edges.";break;
+ case BRepOffset_CannotFuseVertices:
+ theError = "Can not fuse vertices.";break;
+ case BRepOffset_CannotExtentEdge:
+ theError = "Can not extent edge.";break;
+ default:
+ theError = "operation not done.";
+ }
+ theError = "BRepOffset_MakeOffset error: " + theError;
+
+ return TopoDS_Shape();
+ }
+ }
+
+ if ( typeOfShape == TopAbs_COMPOUND || typeOfShape == TopAbs_COMPSOLID )
+ {
+ _solidCompound.SetGlue( BOPAlgo_GlueFull );
+ _solidCompound.SetToFillHistory( true );
+ for ( auto solid : shrinkBodies )
+ _solidCompound.AddArgument( solid );
+
+ _solidCompound.Perform();
+ return _solidCompound.Shape();
+ }
+ else
+ return shrinkBodies[ 0 ]; // return one solid
+