void FaceMakerExtrusion::Build() { this->NotDone(); this->myGenerated.Clear(); this->myShapesToReturn.clear(); this->myShape = TopoDS_Shape(); TopoDS_Shape inputShape; if (mySourceShapes.empty()) throw Base::Exception("No input shapes!"); if (mySourceShapes.size() == 1){ inputShape = mySourceShapes[0]; } else { TopoDS_Builder builder; TopoDS_Compound cmp; builder.MakeCompound(cmp); for (const TopoDS_Shape& sh: mySourceShapes){ builder.Add(cmp, sh); } inputShape = cmp; } std::vector<TopoDS_Wire> wires; TopTools_IndexedMapOfShape mapOfWires; TopExp::MapShapes(inputShape, TopAbs_WIRE, mapOfWires); // if there are no wires then check also for edges if (mapOfWires.IsEmpty()) { TopTools_IndexedMapOfShape mapOfEdges; TopExp::MapShapes(inputShape, TopAbs_EDGE, mapOfEdges); for (int i=1; i<=mapOfEdges.Extent(); i++) { BRepBuilderAPI_MakeWire mkWire(TopoDS::Edge(mapOfEdges.FindKey(i))); wires.push_back(mkWire.Wire()); } } else { wires.reserve(mapOfWires.Extent()); for (int i=1; i<=mapOfWires.Extent(); i++) { wires.push_back(TopoDS::Wire(mapOfWires.FindKey(i))); } } if (!wires.empty()) { //try { TopoDS_Shape res = FaceMakerCheese::makeFace(wires); if (!res.IsNull()) this->myShape = res; //} //catch (...) { //} } this->Done(); }