for(; aRIter != aResults.cend(); aRIter++) {
boost::shared_ptr<Model_Data> aResData =
boost::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
- if (aResData->label().IsEqual(theLabel))
+ if (aResData->label().Father().IsEqual(theLabel))
return *aRIter;
}
}
{
boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theResult->data());
if (aData) {
- TDF_Label aFeatureLab = aData->label().Father().Father();
+ TDF_Label aFeatureLab = aData->label().Father().Father().Father();
return feature(aFeatureLab);
}
return FeaturePtr();
boost::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
aSource->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value(),
data()->name());
+ data()->refattr(ORIGIN_REF())->setObject(aSource);
}
}
+
+void PartSetPlugin_Duplicate::execute()
+{
+ if (data()->refattr(ORIGIN_REF())->object())
+ PartSetPlugin_Part::execute();
+}
/// Request for initialization of data model of the feature: adding all attributes
PARTSETPLUGIN_EXPORT virtual void initAttributes();
+
+ /// doesn't call creation of new document, just does nothing if document was not copied
+ PARTSETPLUGIN_EXPORT virtual void execute();
};
#endif
boost::shared_ptr<ModelAPI_Document> aRoot = aPManager->rootDocument();
boost::shared_ptr<ModelAPI_Document> aCurrent;
boost::shared_ptr<PartSetPlugin_Part> a;
- for(int a = aRoot->size(ModelAPI_Feature::group()) - 1; a >= 0; a--) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(
- aRoot->object(ModelAPI_Feature::group(), a));
- if (aFeature->getKind() == PartSetPlugin_Part::ID()) {
- boost::shared_ptr<PartSetPlugin_Part> aPart =
- boost::static_pointer_cast<PartSetPlugin_Part>(aFeature);
- if (aPart && aPart->firstResult() &&
- aPart->firstResult()->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value() ==
- aPManager->currentDocument()) {
+ for(int a = aRoot->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
+ ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(
+ aRoot->object(ModelAPI_ResultPart::group(), a));
+ if (aPart && aPart->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value() ==
+ aPManager->currentDocument())
+ {
+ FeaturePtr aFeature = aRoot->feature(aPart);
+ if (aFeature) {
// do remove
- aPart->firstResult()->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value()->close();
- aRoot->removeFeature(aPart);
+ aPart->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value()->close();
+ aRoot->removeFeature(aFeature);
}
}
}