Part WB Loft tool extension
This commit is contained in:
parent
3c621107c4
commit
44a6a8fd1a
|
@ -27,6 +27,7 @@
|
|||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Face.hxx>
|
||||
# include <TopoDS_Shell.hxx>
|
||||
# include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -168,12 +169,19 @@ App::DocumentObjectExecReturn *Loft::execute(void)
|
|||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<count; i++) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user