diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index d3df37ada..1f2088874 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -27,6 +27,7 @@ # include # include # include +# include #endif @@ -168,12 +169,19 @@ App::DocumentObjectExecReturn *Loft::execute(void) const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (shape.IsNull()) return new App::DocumentObjectExecReturn("Linked shape is invalid."); - if (shape.ShapeType() == TopAbs_WIRE) + if (shape.ShapeType() == TopAbs_WIRE) { profiles.Append(shape); - else if (shape.ShapeType() == TopAbs_VERTEX) + } + else if (shape.ShapeType() == TopAbs_EDGE) { + BRepBuilderAPI_MakeWire mkWire(TopoDS::Edge(shape)); + profiles.Append(mkWire.Wire()); + } + else if (shape.ShapeType() == TopAbs_VERTEX) { profiles.Append(shape); - else - return new App::DocumentObjectExecReturn("Linked shape is neither a vertex nor a wire."); + } + else { + return new App::DocumentObjectExecReturn("Linked shape is not a vertex, edge nor wire."); + } } Standard_Boolean isSolid = Solid.getValue() ? Standard_True : Standard_False; diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 490ba3c78..0a434914a 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1546,6 +1546,11 @@ TopoDS_Shape TopoShape::makeLoft(const TopTools_ListOfShape& profiles, aGenerator.AddVertex(TopoDS::Vertex (item)); countShapes++; } + else if (!item.IsNull() && item.ShapeType() == TopAbs_EDGE) { + BRepBuilderAPI_MakeWire mkWire(TopoDS::Edge(item)); + aGenerator.AddWire(mkWire.Wire()); + countShapes++; + } else if (!item.IsNull() && item.ShapeType() == TopAbs_WIRE) { aGenerator.AddWire(TopoDS::Wire (item)); countShapes++; @@ -1553,7 +1558,7 @@ TopoDS_Shape TopoShape::makeLoft(const TopTools_ListOfShape& profiles, } if (countShapes < 2) - Standard_Failure::Raise("Need at least two vertexes or wires to create loft face"); + Standard_Failure::Raise("Need at least two vertices, edges or wires to create loft face"); Standard_Boolean anIsCheck = Standard_True; aGenerator.CheckCompatibility (anIsCheck); diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index aed8dd911..b6d58885d 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -93,7 +93,9 @@ void LoftWidget::findShapes() const TopoDS_Shape& shape = (*it)->Shape.getValue(); if (shape.IsNull()) continue; - if (shape.ShapeType() == TopAbs_WIRE || shape.ShapeType() == TopAbs_VERTEX) { + if (shape.ShapeType() == TopAbs_WIRE || + shape.ShapeType() == TopAbs_EDGE || + shape.ShapeType() == TopAbs_VERTEX) { QString label = QString::fromUtf8((*it)->Label.getValue()); QString name = QString::fromAscii((*it)->getNameInDocument()); @@ -125,7 +127,7 @@ bool LoftWidget::accept() int count = d->ui.treeWidgetLoft->topLevelItemCount(); if (count < 2) { - QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices or wires are required.")); + QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices, edges or wires are required.")); return false; } for (int i=0; i