+ Make extrude again working for shapes without wires but edges

This commit is contained in:
wmayer 2014-03-25 10:16:50 +01:00
parent 12277cccf2
commit 9414c938c6

View File

@ -172,16 +172,28 @@ App::DocumentObjectExecReturn *Extrusion::execute(void)
// #0000910: Circles Extrude Only Surfaces, thus use BRepBuilderAPI_Copy // #0000910: Circles Extrude Only Surfaces, thus use BRepBuilderAPI_Copy
myShape = BRepBuilderAPI_Copy(myShape).Shape(); myShape = BRepBuilderAPI_Copy(myShape).Shape();
if (makeSolid && myShape.ShapeType() != TopAbs_FACE) { if (makeSolid && myShape.ShapeType() != TopAbs_FACE) {
std::vector<TopoDS_Wire> wires;
TopTools_IndexedMapOfShape mapOfWires; TopTools_IndexedMapOfShape mapOfWires;
TopExp::MapShapes(myShape, TopAbs_WIRE, mapOfWires); TopExp::MapShapes(myShape, TopAbs_WIRE, mapOfWires);
if (!mapOfWires.IsEmpty()) {
try {
std::vector<TopoDS_Wire> wires;
wires.reserve(mapOfWires.Extent());
for (int i=1; i<=mapOfWires.Extent(); i++) {
wires.push_back(TopoDS::Wire(mapOfWires.FindKey(i)));
}
// if there are no wires then check also for edges
if (mapOfWires.IsEmpty()) {
TopTools_IndexedMapOfShape mapOfEdges;
TopExp::MapShapes(myShape, 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 = makeFace(wires); TopoDS_Shape res = makeFace(wires);
if (!res.IsNull()) if (!res.IsNull())
myShape = res; myShape = res;