//function : refineResult
//purpose :
//=======================================================================
-const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult)
+const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult)
{
- TopoDS_Shape aResult;
- if (theResult.ShapeType() == TopAbs_COMPOUND) {
- Standard_Integer nbSubResults = 0;
- TopoDS_Iterator itr(theResult);
- for (; itr.More(); itr.Next()) nbSubResults++;
- if (nbSubResults == 1) {
- itr.Initialize(theResult);
- if (itr.More()) aResult = itr.Value();
- } else {
- /// MPV: store compound anyway: it may be Boolean operation that produces two solids from one
- aResult = theResult;
+ TopoDS_Shape aResult = theResult;
+ const TopAbs_ShapeEnum aShType = theResult.ShapeType();
+ if(aShType == TopAbs_COMPOUND || aShType == TopAbs_SHELL || aShType == TopAbs_WIRE) {
+ Standard_Integer aSubResultsNb = 0;
+ TopoDS_Iterator anIt(theResult);
+ for(; anIt.More(); anIt.Next()) {
+ ++aSubResultsNb;
+ }
+ if(aSubResultsNb == 1) {
+ anIt.Initialize(theResult);
+ if(anIt.More()) {
+ aResult = anIt.Value();
+ }
}
}
+
return aResult;
}
#include "GeomAlgoAPI_Pipe.h"
+#include "GeomAlgoAPI_DFLoader.h"
+
#include <GeomAPI_Dir.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
this->addToShape(aToShape);
// Setting result.
- TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
- aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
- this->setShape(aResultGeomShape);
+ TopoDS_Shape aResult = aPipeBuilder->Shape();
+ aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
+ GeomShapePtr aGeomSh(new GeomAPI_Shape());
+ aGeomSh->setImpl(new TopoDS_Shape(aResult));
+ this->setShape(aGeomSh);
this->setDone(true);
}
return;
}
}
- if(aPipeBuilder->Shape().IsNull()) {
- return;
- }
+ TopoDS_Shape aResult = aPipeBuilder->Shape();
// Setting naming.
GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
this->addToShape(aToShape);
// Setting result.
- TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
- aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
- this->setShape(aResultGeomShape);
+ if(aResult.IsNull()) {
+ return;
+ }
+ aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
+ GeomShapePtr aGeomSh(new GeomAPI_Shape());
+ aGeomSh->setImpl(new TopoDS_Shape(aResult));
+ this->setShape(aGeomSh);
this->setDone(true);
}
return;
}
}
- if(aPipeBuilder->Shape().IsNull()) {
- return;
- }
+ TopoDS_Shape aResult = aPipeBuilder->Shape();
// Setting naming.
GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
this->addToShape(aToShape);
// Setting result.
- TopoDS_Shape aResultShape = aPipeBuilder->Shape();
- GeomShapePtr aResultGeomShape(new GeomAPI_Shape());
- aResultGeomShape->setImpl(new TopoDS_Shape(aResultShape));
- this->setShape(aResultGeomShape);
+ if(aResult.IsNull()) {
+ return;
+ }
+ aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
+ GeomShapePtr aGeomSh(new GeomAPI_Shape());
+ aGeomSh->setImpl(new TopoDS_Shape(aResult));
+ this->setShape(aGeomSh);
this->setDone(true);
}