diff --git a/src/Mod/Assembly/App/Item.cpp b/src/Mod/Assembly/App/Item.cpp index b41a0a327..98d339352 100644 --- a/src/Mod/Assembly/App/Item.cpp +++ b/src/Mod/Assembly/App/Item.cpp @@ -36,7 +36,7 @@ using namespace Assembly; namespace Assembly { -PROPERTY_SOURCE(Assembly::Item, Part::Feature) +PROPERTY_SOURCE_ABSTRACT(Assembly::Item, App::GeoFeature) Item::Item() { diff --git a/src/Mod/Assembly/App/Item.h b/src/Mod/Assembly/App/Item.h index 8119b4b36..c995f6057 100644 --- a/src/Mod/Assembly/App/Item.h +++ b/src/Mod/Assembly/App/Item.h @@ -25,13 +25,14 @@ #define Assembly_Item_H #include -#include +#include +#include namespace Assembly { -class AssemblyExport Item : public Part::Feature +class AssemblyExport Item : public App::GeoFeature { PROPERTY_HEADER(Assembly::Item); @@ -72,6 +73,8 @@ public: } //@} + virtual TopoDS_Shape getShape(void)const =0 ; + PyObject *getPyObject(void); }; diff --git a/src/Mod/Assembly/App/ItemAssembly.cpp b/src/Mod/Assembly/App/ItemAssembly.cpp index 159a11abb..7ef082955 100644 --- a/src/Mod/Assembly/App/ItemAssembly.cpp +++ b/src/Mod/Assembly/App/ItemAssembly.cpp @@ -53,6 +53,12 @@ short ItemAssembly::mustExecute() const } App::DocumentObjectExecReturn *ItemAssembly::execute(void) +{ + + return App::DocumentObject::StdReturn; +} + +TopoDS_Shape ItemAssembly::getShape(void) const { std::vector s; std::vector obj = Items.getValues(); @@ -60,7 +66,7 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void) std::vector::iterator it; for (it = obj.begin(); it != obj.end(); ++it) { if ((*it)->getTypeId().isDerivedFrom(Assembly::Item::getClassTypeId())) { - TopoDS_Shape aShape = static_cast(*it)->Shape.getValue(); + TopoDS_Shape aShape = static_cast(*it)->getShape(); if (!aShape.IsNull()) s.push_back(aShape); } @@ -75,15 +81,13 @@ App::DocumentObjectExecReturn *ItemAssembly::execute(void) aBuilder.Add(aRes, *it); } - if (aRes.IsNull()) - throw Base::Exception("Resulting shape is invalid"); - this->Shape.setValue(aRes); + //if (aRes.IsNull()) + // throw Base::Exception("Resulting shape is invalid"); + return aRes; } - else { - // set empty shape - this->Shape.setValue(TopoDS_Shape()); - } - return App::DocumentObject::StdReturn; + // set empty shape + return TopoDS_Compound(); + } -} +} \ No newline at end of file diff --git a/src/Mod/Assembly/App/ItemAssembly.h b/src/Mod/Assembly/App/ItemAssembly.h index 301177122..5d7a882c8 100644 --- a/src/Mod/Assembly/App/ItemAssembly.h +++ b/src/Mod/Assembly/App/ItemAssembly.h @@ -50,6 +50,8 @@ public: return "AssemblyGui::ViewProviderItemAssembly"; } //@} + + virtual TopoDS_Shape getShape(void) const; }; } //namespace Assembly diff --git a/src/Mod/Assembly/App/ItemPart.cpp b/src/Mod/Assembly/App/ItemPart.cpp index a74d6c527..f2911f676 100644 --- a/src/Mod/Assembly/App/ItemPart.cpp +++ b/src/Mod/Assembly/App/ItemPart.cpp @@ -28,6 +28,7 @@ #include #include "ItemPart.h" +#include using namespace Assembly; @@ -52,14 +53,20 @@ short ItemPart::mustExecute() const } App::DocumentObjectExecReturn *ItemPart::execute(void) +{ + return App::DocumentObject::StdReturn; +} + +TopoDS_Shape ItemPart::getShape(void) const { App::DocumentObject* obj = Model.getValue(); if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { - this->Shape.setValue(static_cast(obj)->Shape.getValue()); + return static_cast(obj)->Shape.getValue(); } - return App::DocumentObject::StdReturn; + return TopoDS_Shape(); + } } \ No newline at end of file diff --git a/src/Mod/Assembly/App/ItemPart.h b/src/Mod/Assembly/App/ItemPart.h index f2854d9ed..d1d77cc29 100644 --- a/src/Mod/Assembly/App/ItemPart.h +++ b/src/Mod/Assembly/App/ItemPart.h @@ -51,6 +51,8 @@ public: return "AssemblyGui::ViewProviderItemPart"; } //@} + + virtual TopoDS_Shape getShape(void) const; }; } //namespace Assembly diff --git a/src/Mod/Assembly/Gui/ViewProvider.cpp b/src/Mod/Assembly/Gui/ViewProvider.cpp index 5b0fd1474..5807f0493 100644 --- a/src/Mod/Assembly/Gui/ViewProvider.cpp +++ b/src/Mod/Assembly/Gui/ViewProvider.cpp @@ -34,7 +34,7 @@ using namespace AssemblyGui; -PROPERTY_SOURCE(AssemblyGui::ViewProviderItem,PartGui::ViewProviderPart) +PROPERTY_SOURCE(AssemblyGui::ViewProviderItem,Gui::ViewProviderGeometryObject) ViewProviderItem::ViewProviderItem() { diff --git a/src/Mod/Assembly/Gui/ViewProvider.h b/src/Mod/Assembly/Gui/ViewProvider.h index e3462c28c..fd76f56ab 100644 --- a/src/Mod/Assembly/Gui/ViewProvider.h +++ b/src/Mod/Assembly/Gui/ViewProvider.h @@ -24,13 +24,13 @@ #ifndef ASSEMBLYGUI_ViewProvider_H #define ASSEMBLYGUI_ViewProvider_H -#include +#include class SoGroup; namespace AssemblyGui { -class AssemblyGuiExport ViewProviderItem : public PartGui::ViewProviderPart +class AssemblyGuiExport ViewProviderItem : public Gui::ViewProviderGeometryObject { PROPERTY_HEADER(AssemblyGui::ViewProviderItem);