From d7c73b6f25c471b02988690ca7fa1d632eef150c Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 26 May 2015 18:12:06 +0300 Subject: [PATCH] Issue #355 - Delete: elements of sketch and constraints An iteration through the opened documents to find references to a feature in the "PartSet" document. --- src/XGUI/XGUI_Workshop.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 646a41bfa..89d6e4b6a 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1313,7 +1313,22 @@ bool XGUI_Workshop::deleteFeatures(const QObjectPtrList& theList, foreach (ObjectPtr aObj, theList) { FeaturePtr aFeature = ModelAPI_Feature::feature(aObj); if (aFeature.get() != NULL) { - aObj->document()->refsToFeature(aFeature, aRefFeatures, false); + DocumentPtr aFeatureDoc = aObj->document(); + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr aModuleDoc = aMgr->moduleDocument(); + // objects from "Part" documents can refer to the the features of "PartSet". + // So, it the referenced features should be checked in these documents + if (aFeatureDoc == aModuleDoc) { + std::list aDocuments = aMgr->allOpenedDocuments(); + std::list anOpenedDocs = aMgr->allOpenedDocuments(); + std::list::const_iterator anIt = anOpenedDocs.begin(), + aLast = anOpenedDocs.end(); + for (; anIt != aLast; anIt++) { + (*anIt)->refsToFeature(aFeature, aRefFeatures, false); + } + } + else + aFeatureDoc->refsToFeature(aFeature, aRefFeatures, false); } } // 2. warn about the references remove, break the delete operation if the user chose it -- 2.39.2