-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
break;
}
- storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
+ storeResult(aBaseShape, aPathShape, aPipeAlgo, aResultIndex++);
}
} else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList,
return;
}
- storeResult(aBaseShapesList, aPipeAlgo, aResultIndex++);
+ storeResult(aBaseShapesList, aPathShape, aPipeAlgo, aResultIndex++);
} else {
setError("Error: Wrong creation method.");
return;
//==================================================================================================
void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+ const std::shared_ptr<GeomAPI_Shape> thePathShape,
const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex)
{
// Store generated edges/faces.
GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
- GeomAPI_Shape::ShapeType aShapeTypeToExplode;
+ GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
switch(aBaseShapeType) {
case GeomAPI_Shape::VERTEX: {
}
case GeomAPI_Shape::COMPOUND: {
aShapeTypeToExplode = GeomAPI_Shape::COMPOUND;
+ break;
}
+ default:
+ return; // unsupported type of shape
}
if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE);
}
+ if (thePathShape.get())
+ aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE);
// Store from shapes.
storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_");
//==================================================================================================
void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
+ const std::shared_ptr<GeomAPI_Shape> thePathShape,
const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex)
{
{
GeomShapePtr aBaseShape = *anIter;
GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
- GeomAPI_Shape::ShapeType aShapeTypeToExplode;
+ GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
switch(aBaseShapeType) {
case GeomAPI_Shape::VERTEX: {
aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
ListOfShape aV1History, aV2History;
thePipeAlgo->generated(aV1, aV1History);
thePipeAlgo->generated(aV2, aV2History);
- aResultBody->generated(aV1, aV1History.front());
- aResultBody->generated(aV2, aV2History.front());
+ if (!aV1History.empty())
+ aResultBody->generated(aV1, aV1History.front());
+ if (!aV2History.empty())
+ aResultBody->generated(aV2, aV2History.front());
}
case GeomAPI_Shape::FACE:
case GeomAPI_Shape::SHELL: {
aShapeTypeToExplode = GeomAPI_Shape::EDGE;
break;
}
+ default:
+ return; // unsupported type of shape
}
aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode);
}
+ if (thePathShape.get())
+ aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE);
+
// Store from shapes.
storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_");
aShapeTypeToExplore = GeomAPI_Shape::COMPOUND;
break;
}
+ default:
+ return; // unsupported type of shape
}
// Store shapes.