diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index e0c4767aa6..4e8a42f6ca 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -119,13 +119,13 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void) // get the first input shape TopoDS_Shape S1; ret = getShape(Curve1, S1); - if (ret) + if (ret) return ret; // get the second input shape TopoDS_Shape S2; ret = getShape(Curve2, S2); - if (ret) + if (ret) return ret; // check for expected type @@ -711,16 +711,21 @@ Reverse::Reverse() App::DocumentObjectExecReturn* Reverse::execute(void) { - Part::Feature* source = Source.getValue(); - if (!source) + App::DocumentObject* source = Source.getValue(); + Part::TopoShape topoShape = Part::Feature::getShape(source); + if (topoShape.isNull()) return new App::DocumentObjectExecReturn("No part object linked."); try { - TopoDS_Shape myShape = source->Shape.getValue(); - if (!myShape.IsNull()) + TopoDS_Shape myShape = topoShape.getShape(); + if (!myShape.IsNull()){ this->Shape.setValue(myShape.Reversed()); - this->Placement.setValue(source->Placement.getValue()); - return App::DocumentObject::StdReturn; + Base::Placement p; + p.fromMatrix(topoShape.getTransform()); + this->Placement.setValue(p); + return App::DocumentObject::StdReturn; + } + return new App::DocumentObjectExecReturn("Shape is null."); } catch (Standard_Failure & e) { return new App::DocumentObjectExecReturn(e.GetMessageString()); diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index ccb2857d2b..a201714346 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -1264,7 +1264,7 @@ void CmdPartReverseShape::activated(int iMsg) { Q_UNUSED(iMsg); std::vector objs = Gui::Selection().getObjectsOfType - (Part::Feature::getClassTypeId()); + (App::DocumentObject::getClassTypeId()); openCommand(QT_TRANSLATE_NOOP("Command", "Reverse")); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { const TopoDS_Shape& shape = Part::Feature::getShape(*it); @@ -1302,8 +1302,7 @@ void CmdPartReverseShape::activated(int iMsg) bool CmdPartReverseShape::isActive(void) { - return Gui::Selection().countObjectsOfType - (Part::Feature::getClassTypeId(), nullptr, Gui::ResolveMode::FollowLink) > 0; + return PartGui::getShapesFromSelection().size() > 0; } //===========================================================================