diff --git a/src/Mod/TechDraw/App/DrawGeomHatch.cpp b/src/Mod/TechDraw/App/DrawGeomHatch.cpp index ddf41c9076..e77f7e4e2a 100644 --- a/src/Mod/TechDraw/App/DrawGeomHatch.cpp +++ b/src/Mod/TechDraw/App/DrawGeomHatch.cpp @@ -596,6 +596,7 @@ void DrawGeomHatch::setupPatIncluded(void) } } +//TODO: replace with FileInfo copy //copy whole text file from inSpec to outSpec void DrawGeomHatch::copyFile(std::string inSpec, std::string outSpec) { @@ -609,6 +610,18 @@ void DrawGeomHatch::copyFile(std::string inSpec, std::string outSpec) } } +void DrawGeomHatch::unsetupObject(void) +{ +// Base::Console().Message("DGH::unsetupObject() - status: %lu removing: %d \n", getStatus(), isRemoving()); + App::DocumentObject* source = Source.getValue(); + DrawView* dv = dynamic_cast(source); + if (dv != nullptr) { + dv->requestPaint(); + } + App::DocumentObject::unsetupObject(); +} + + // Python Drawing feature --------------------------------------------------------- diff --git a/src/Mod/TechDraw/App/DrawGeomHatch.h b/src/Mod/TechDraw/App/DrawGeomHatch.h index 7104200a6c..87995fe10e 100644 --- a/src/Mod/TechDraw/App/DrawGeomHatch.h +++ b/src/Mod/TechDraw/App/DrawGeomHatch.h @@ -65,6 +65,8 @@ public: return "TechDrawGui::ViewProviderGeomHatch"; } virtual PyObject *getPyObject(void) override; + virtual void unsetupObject(void) override; + DrawViewPart* getSourceView(void) const; diff --git a/src/Mod/TechDraw/App/DrawHatch.cpp b/src/Mod/TechDraw/App/DrawHatch.cpp index ecd381e04b..559bd4928c 100644 --- a/src/Mod/TechDraw/App/DrawHatch.cpp +++ b/src/Mod/TechDraw/App/DrawHatch.cpp @@ -280,6 +280,17 @@ void DrawHatch::copyFile(std::string inSpec, std::string outSpec) } } +void DrawHatch::unsetupObject(void) +{ +// Base::Console().Message("DH::unsetupObject() - status: %lu removing: %d \n", getStatus(), isRemoving()); + App::DocumentObject* source = Source.getValue(); + DrawView* dv = dynamic_cast(source); + if (dv != nullptr) { + dv->requestPaint(); + } + App::DocumentObject::unsetupObject(); +} + // Python Drawing feature --------------------------------------------------------- diff --git a/src/Mod/TechDraw/App/DrawHatch.h b/src/Mod/TechDraw/App/DrawHatch.h index 4859fcf6ee..9b3ea010c6 100644 --- a/src/Mod/TechDraw/App/DrawHatch.h +++ b/src/Mod/TechDraw/App/DrawHatch.h @@ -50,6 +50,8 @@ public: virtual const char* getViewProviderName(void) const override { return "TechDrawGui::ViewProviderHatch"; } + virtual void unsetupObject(void) override; + //return PyObject as DrawHatchPy virtual PyObject *getPyObject(void) override; diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 344a51c40e..7baa73d14d 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -620,7 +620,8 @@ std::vector DrawViewPart::getHatches() const std::vector result; std::vector children = getInList(); for (std::vector::iterator it = children.begin(); it != children.end(); ++it) { - if ((*it)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) { + if ( ((*it)->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId())) && + (!(*it)->isRemoving()) ) { TechDraw::DrawHatch* hatch = dynamic_cast(*it); result.push_back(hatch); } @@ -633,7 +634,8 @@ std::vector DrawViewPart::getGeomHatches() const std::vector result; std::vector children = getInList(); for (std::vector::iterator it = children.begin(); it != children.end(); ++it) { - if ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) { + if ( ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) && + (!(*it)->isRemoving()) ) { TechDraw::DrawGeomHatch* geom = dynamic_cast(*it); result.push_back(geom); }