void GeomAlgoAPI_SketchBuilder::createFaces(
- const std::shared_ptr<GeomAPI_Pnt>& theOrigin, const std::shared_ptr<GeomAPI_Dir>& theDirX,
- const std::shared_ptr<GeomAPI_Dir>& theDirY, const std::shared_ptr<GeomAPI_Dir>& theNorm,
+ const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theNorm,
const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces,
std::list<std::shared_ptr<GeomAPI_Shape> >& theResultWires)
return;
gp_Dir aDirX = theDirX->impl<gp_Dir>();
- gp_Dir aDirY = theDirY->impl<gp_Dir>();
gp_Dir aNorm = theNorm->impl<gp_Dir>();
+ gp_Dir aDirY = aNorm.Crossed(aDirX);
gp_Pln aPlane(theOrigin->impl<gp_Pnt>(), aNorm);
void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
const std::shared_ptr<GeomAPI_Dir>& theDirX,
- const std::shared_ptr<GeomAPI_Dir>& theDirY,
const std::shared_ptr<GeomAPI_Dir>& theNorm,
const std::shared_ptr<GeomAPI_Shape>& theWire,
std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
{
- std::shared_ptr<GeomAPI_PlanarEdges> aWire = std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
- if(!aWire)
- return;
- // Filter wires, return only faces.
std::list<std::shared_ptr<GeomAPI_Shape> > aFilteredWires;
- createFaces(theOrigin, theDirX, theDirY, theNorm,
- aWire->getEdges(), theResultFaces, aFilteredWires);
+ std::shared_ptr<GeomAPI_PlanarEdges> aWire =
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
+ if(aWire) {
+ // Filter wires, return only faces.
+ createFaces(theOrigin, theDirX, theNorm,
+ aWire->getEdges(), theResultFaces, aFilteredWires);
+
+ return;
+ } else { // it may be only one circle
+ std::shared_ptr<GeomAPI_Edge> anEdge = std::dynamic_pointer_cast<GeomAPI_Edge>(theWire);
+ if (anEdge) {
+ std::list<std::shared_ptr<GeomAPI_Shape> > aList;
+ aList.push_back(anEdge);
+ createFaces(theOrigin, theDirX, theNorm,
+ aList, theResultFaces, aFilteredWires);
+ }
+ }
}