+
+// Auxilary functions:
+//==================================================================================================
+void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo,
+ const TopoDS_Shape& theBase,
+ const TopAbs_ShapeEnum theType,
+ BRepPrimAPI_MakePrism* thePrismBuilder)
+{
+ for(TopExp_Explorer anExp(theBase, theType); anExp.More(); anExp.Next()) {
+ const TopoDS_Shape& aShape = anExp.Current();
+ GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
+ aFromShape->setImpl(new TopoDS_Shape(thePrismBuilder->FirstShape(aShape)));
+ aToShape->setImpl(new TopoDS_Shape(thePrismBuilder->LastShape(aShape)));
+ thePrismAlgo->addFromShape(aFromShape);
+ thePrismAlgo->addToShape(aToShape);
+ }
+}
+
+//==================================================================================================
+void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo,
+ const TopoDS_Shape& theResult,
+ const TopAbs_ShapeEnum theType,
+ const TopoDS_Face& theToFace,
+ const TopoDS_Face& theFromFace)
+{
+ for(TopExp_Explorer anExp(theResult, theType); anExp.More(); anExp.Next()) {
+ const TopoDS_Shape& aShape = anExp.Current();
+ GeomShapePtr aGeomSh(new GeomAPI_Shape());
+ if(theType == TopAbs_VERTEX) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
+ IntTools_Context anIntTools;
+ if(anIntTools.IsValidPointForFace(aPnt, theToFace, Precision::Confusion()) == Standard_True) {
+ aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->addToShape(aGeomSh);
+ }
+ if(anIntTools.IsValidPointForFace(aPnt, theFromFace, Precision::Confusion()) == Standard_True) {
+ aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->addFromShape(aGeomSh);
+ }
+ } else if(theType == TopAbs_EDGE) {
+ TopoDS_Edge anEdge = TopoDS::Edge(aShape);
+ BRepLib_CheckCurveOnSurface anEdgeCheck(anEdge, theToFace);
+ anEdgeCheck.Perform();
+ if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
+ aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->addToShape(aGeomSh);
+ }
+ anEdgeCheck.Init(anEdge, theFromFace);
+ anEdgeCheck.Perform();
+ if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
+ aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->addFromShape(aGeomSh);
+ }
+ } else {
+ break;
+ }
+ }
+}