static bool getPath(TopoDS_Wire& thePathOut,
const GeomShapePtr thePathShape);
static bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder);
+static ListOfShape getListFromShape(const TopoDS_Shape& theShape);
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
const GeomShapePtr thePathShape)
{
build(theBaseShape, thePathShape);
}
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const GeomShapePtr theBaseShape,
const GeomShapePtr thePathShape,
const GeomShapePtr theBiNormal)
build(theBaseShape, thePathShape, theBiNormal);
}
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_Pipe::GeomAlgoAPI_Pipe(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
const GeomShapePtr thePathShape)
build(theBaseShapes, theLocations, thePathShape);
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape,
const GeomShapePtr thePathShape)
{
TopAbs_ShapeEnum aBaseShapeType = aBaseShape.ShapeType();
if(aBaseShapeType != TopAbs_VERTEX && aBaseShapeType != TopAbs_EDGE &&
aBaseShapeType != TopAbs_WIRE && aBaseShapeType != TopAbs_FACE &&
- aBaseShapeType != TopAbs_SHELL) {
+ aBaseShapeType != TopAbs_SHELL && aBaseShapeType != TopAbs_COMPOUND) {
return;
}
this->initialize(aPipeBuilder);
// Setting naming.
- GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
- aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
- aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
- this->addFromShape(aFromShape);
- this->addToShape(aToShape);
+ this->setToShapes(getListFromShape(aPipeBuilder->LastShape()));
+ this->setFromShapes(getListFromShape(aPipeBuilder->FirstShape()));
// Setting result.
TopoDS_Shape aResult = aPipeBuilder->Shape();
this->setDone(true);
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape,
const GeomShapePtr thePathShape,
const GeomShapePtr theBiNormal)
}
}
TopoDS_Shape aResult = aPipeBuilder->Shape();
+ if(aResult.IsNull()) {
+ return;
+ }
// Setting naming.
- GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
- aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
- aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
- this->addFromShape(aFromShape);
- this->addToShape(aToShape);
+ this->setToShapes(getListFromShape(aPipeBuilder->LastShape()));
+ this->setFromShapes(getListFromShape(aPipeBuilder->FirstShape()));
// Setting result.
- if(aResult.IsNull()) {
- return;
- }
aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
GeomShapePtr aGeomSh(new GeomAPI_Shape());
aGeomSh->setImpl(new TopoDS_Shape(aResult));
this->setDone(true);
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes,
const ListOfShape& theLocations,
const GeomShapePtr thePathShape)
this->setDone(true);
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_Pipe::generated(const GeomShapePtr theShape,
ListOfShape& theHistory)
{
}
// Auxilary functions:
-//=================================================================================================
+//==================================================================================================
bool getBase(TopoDS_Shape& theBaseOut,
TopAbs_ShapeEnum& theBaseTypeOut,
const GeomShapePtr theBaseShape)
return true;
}
-//=================================================================================================
+//==================================================================================================
bool getPath(TopoDS_Wire& thePathOut,
const GeomShapePtr thePathShape)
{
return true;
}
-//=================================================================================================
+//==================================================================================================
bool buildPipe(BRepOffsetAPI_MakePipeShell* thePipeBuilder)
{
thePipeBuilder->Build();
return isDone == Standard_True;
}
+
+//==================================================================================================
+ListOfShape getListFromShape(const TopoDS_Shape& theShape)
+{
+ ListOfShape aList;
+
+ TopAbs_ShapeEnum aType = theShape.ShapeType();
+ if(aType == TopAbs_WIRE || aType == TopAbs_SHELL || aType == TopAbs_COMPOUND) {
+ for(TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next()) {
+ GeomShapePtr aGeomShape(new GeomAPI_Shape());
+ aGeomShape->setImpl(new TopoDS_Shape(anIt.Value()));
+ aList.push_back(aGeomShape);
+ }
+ } else {
+ GeomShapePtr aGeomShape(new GeomAPI_Shape());
+ aGeomShape->setImpl(new TopoDS_Shape(theShape));
+ aList.push_back(aGeomShape);
+ }
+
+ return aList;
+}