Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #2082 Sketch multiple rotation does not work as expected: debug information
[modules/shaper.git]
/
src
/
PartSetPlugin
/
PartSetPlugin_Duplicate.cpp
diff --git
a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
index f92c0e912a895a79b195896df95811709a704f39..4e900e8c492c2b50fb599f441793ac33ac1a1569 100644
(file)
--- a/
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
+++ b/
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
@@
-1,8
+1,11
@@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: PartSetPlugin_Duplicate.cxx
// Created: 20 May 2014
// Author: Mikhail PONIKAROV
#include "PartSetPlugin_Duplicate.h"
// File: PartSetPlugin_Duplicate.cxx
// Created: 20 May 2014
// Author: Mikhail PONIKAROV
#include "PartSetPlugin_Duplicate.h"
+#include "PartSetPlugin_Part.h"
#include <ModelAPI_AttributeRefAttr.h>
#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeRefAttr.h>
#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Data.h>
@@
-10,17
+13,8
@@
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_Session.h>
-using namespace std;
-
-PartSetPlugin_Duplicate::PartSetPlugin_Duplicate()
-{
-}
-
-void PartSetPlugin_Duplicate::initAttributes()
+void PartSetPlugin_Duplicate::execute()
{
{
- PartSetPlugin_Part::initAttributes();
- data()->addAttribute(ORIGIN_REF(), ModelAPI_AttributeRefAttr::type());
-
std::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
std::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
std::shared_ptr<ModelAPI_ResultPart> aSource; // searching for source document attribute
std::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
std::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
std::shared_ptr<ModelAPI_ResultPart> aSource; // searching for source document attribute
@@
-33,14
+27,12
@@
void PartSetPlugin_Duplicate::initAttributes()
aSource.reset();
}
if (aSource) {
aSource.reset();
}
if (aSource) {
+ // create a new Part feature
+ FeaturePtr aNewPart = aRoot->addFeature(PartSetPlugin_Part::ID(), false);
+ aNewPart->execute(); // to make result and generate a unique name
+
std::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
std::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
- aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), data()->name());
-
data()->refattr(ORIGIN_REF())->setObject(aSource
);
+ aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(),
+
std::dynamic_pointer_cast<ModelAPI_ResultPart>(aNewPart->firstResult())->partDoc()->id()
);
}
}
}
}
-
-void PartSetPlugin_Duplicate::execute()
-{
- if (data()->refattr(ORIGIN_REF())->object())
- PartSetPlugin_Part::execute();
-}