From 0a7a9d9cf2fb2746dd68a6a6722609591eb7b941 Mon Sep 17 00:00:00 2001 From: jmaustpc Date: Fri, 8 Mar 2013 00:48:08 +1100 Subject: [PATCH] Part_Loft add ability to use a Facefor a profile Part Loft internally uses either a vertices and/or wires as profiles. If an edge is selected always was converted into a wire for MakeLoft. This commit allows a face to be selected and then uses ShapeAnalysis::OuterWire to aquire a wire (from the outer edges of the face) to pass to MakeLoft. --- src/Mod/Part/App/PartFeatures.cpp | 7 ++++++- src/Mod/Part/Gui/TaskLoft.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 5cf9e98393..67e5e38c92 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -29,6 +29,7 @@ # include # include # include +# include # include # include # include @@ -173,7 +174,11 @@ 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_FACE) { + TopoDS_Wire faceouterWire = ShapeAnalysis::OuterWire(TopoDS::Face(shape)); + profiles.Append(faceouterWire); + } + else if (shape.ShapeType() == TopAbs_WIRE) { profiles.Append(shape); } else if (shape.ShapeType() == TopAbs_EDGE) { diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 7192c27c42..876468a224 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -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")); + d->ui.selector->setAvailableLabel(tr("Vertex/Wire/Face")); d->ui.selector->setSelectedLabel(tr("Loft")); connect(d->ui.selector->availableTreeWidget(), SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), @@ -98,7 +98,8 @@ void LoftWidget::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()); @@ -132,7 +133,7 @@ bool LoftWidget::accept() int count = d->ui.selector->selectedTreeWidget()->topLevelItemCount(); if (count < 2) { - QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices, edges or wires are required.")); + QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices, edges, wires or Faces are required.")); return false; } for (int i=0; itype() == QEvent::LanguageChange) { d->ui.retranslateUi(this); - d->ui.selector->setAvailableLabel(tr("Vertex/Wire")); + d->ui.selector->setAvailableLabel(tr("Vertex/Wire/Face")); d->ui.selector->setSelectedLabel(tr("Loft")); } }