Allow faces to be profiles for a sweep & minor fix loft

Allow faces to be used as the profiles for a Part_Sweep
some minor fixes for Part_Loft
This commit is contained in:
jmaustpc 2013-03-10 04:28:38 +11:00 committed by Yorik van Havre
parent 0a7a9d9cf2
commit a3ef789f5a
3 changed files with 12 additions and 7 deletions

View File

@ -189,7 +189,7 @@ App::DocumentObjectExecReturn *Loft::execute(void)
profiles.Append(shape);
}
else {
return new App::DocumentObjectExecReturn("Linked shape is not a vertex, edge nor wire.");
return new App::DocumentObjectExecReturn("Linked shape is not a vertex, edge, wire nor face.");
}
}
@ -290,7 +290,11 @@ App::DocumentObjectExecReturn *Sweep::execute(void)
// There is a weird behaviour of BRepOffsetAPI_MakePipeShell when trying to add the wire as is.
// If we re-create the wire then everything works fine.
// https://sourceforge.net/apps/phpbb/free-cad/viewtopic.php?f=10&t=2673&sid=fbcd2ff4589f0b2f79ed899b0b990648#p20268
if (shape.ShapeType() == TopAbs_WIRE) {
if (shape.ShapeType() == TopAbs_FACE) {
TopoDS_Wire faceouterWire = ShapeAnalysis::OuterWire(TopoDS::Face(shape));
profiles.Append(faceouterWire);
}
else if (shape.ShapeType() == TopAbs_WIRE) {
BRepBuilderAPI_MakeWire mkWire(TopoDS::Wire(shape));
profiles.Append(mkWire.Wire());
}
@ -302,7 +306,7 @@ App::DocumentObjectExecReturn *Sweep::execute(void)
profiles.Append(shape);
}
else {
return new App::DocumentObjectExecReturn("Linked shape is not a vertex, edge nor wire.");
return new App::DocumentObjectExecReturn("Linked shape is not a vertex, edge, wire nor face.");
}
}

View File

@ -69,7 +69,7 @@ LoftWidget::LoftWidget(QWidget* parent)
Gui::Application::Instance->runPythonCode("import Part");
d->ui.setupUi(this);
d->ui.selector->setAvailableLabel(tr("Vertex/Wire/Face"));
d->ui.selector->setAvailableLabel(tr("Vertex/Edge/Wire/Face"));
d->ui.selector->setSelectedLabel(tr("Loft"));
connect(d->ui.selector->availableTreeWidget(), SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
@ -188,7 +188,7 @@ void LoftWidget::changeEvent(QEvent *e)
QWidget::changeEvent(e);
if (e->type() == QEvent::LanguageChange) {
d->ui.retranslateUi(this);
d->ui.selector->setAvailableLabel(tr("Vertex/Wire/Face"));
d->ui.selector->setAvailableLabel(tr("Vertex/Edge/Wire/Face"));
d->ui.selector->setSelectedLabel(tr("Loft"));
}
}

View File

@ -70,7 +70,7 @@ SweepWidget::SweepWidget(QWidget* parent)
Gui::Application::Instance->runPythonCode("import Part");
d->ui.setupUi(this);
d->ui.selector->setAvailableLabel(tr("Vertex/Wire"));
d->ui.selector->setAvailableLabel(tr("Vertex/Edge/Wire/Face"));
d->ui.selector->setSelectedLabel(tr("Sweep"));
connect(d->ui.selector->availableTreeWidget(), SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
@ -99,7 +99,8 @@ void SweepWidget::findShapes()
const TopoDS_Shape& shape = (*it)->Shape.getValue();
if (shape.IsNull()) continue;
if (shape.ShapeType() == TopAbs_WIRE ||
if (shape.ShapeType() == TopAbs_FACE ||
shape.ShapeType() == TopAbs_WIRE ||
shape.ShapeType() == TopAbs_EDGE ||
shape.ShapeType() == TopAbs_VERTEX) {
QString label = QString::fromUtf8((*it)->Label.getValue());