Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchAPI / SketchAPI_Rotation.cpp
index 7b5ec3831fd28d50250bfd64d3755f015d7845fb..a5b332adcff416c261a5b917022967a5ee4efe07 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -66,6 +66,21 @@ void SketchAPI_Rotation::setRotationList(
 }
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Rotation::rotated() const
+{
+  std::list<ObjectPtr> aList = rotatedObjects()->list();
+  // remove all initial features
+  std::list<FeaturePtr> anIntermediate;
+  std::list<ObjectPtr>::const_iterator anIt = aList.begin();
+  for (; anIt != aList.end(); ++anIt) {
+    FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+    AttributeBooleanPtr isCopy = aFeature->boolean(SketchPlugin_SketchEntity::COPY_ID());
+    if (isCopy.get() && isCopy->value())
+      anIntermediate.push_back(aFeature);
+  }
+  return SketchAPI_SketchEntity::wrap(anIntermediate);
+}
+
+std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_Rotation::rotatedList() const
 {
   std::list<ObjectPtr> aList = rotationList()->list();
   std::set<ObjectPtr> anOriginalObjects;
@@ -137,7 +152,7 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const
 
   // Dump variables for a list of rotated features
   theDumper << "[";
-  std::list<std::shared_ptr<SketchAPI_SketchEntity> > aList = rotated();
+  std::list<std::shared_ptr<SketchAPI_SketchEntity> > aList = rotatedList();
   std::list<std::shared_ptr<SketchAPI_SketchEntity> >::const_iterator anIt = aList.begin();
   for (size_t anIndex = 0; anIndex < aFirstNotDumped; ++anIndex)
     for (int i = 1; i < aNbCopies->value() && anIt != aList.end(); ++i, ++anIt) {
@@ -145,7 +160,7 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const
         theDumper << ", ";
       theDumper << (*anIt)->feature();
     }
-  theDumper << "] = " << theDumper.name(aBase) << ".rotated()" << std::endl;
+  theDumper << "] = " << theDumper.name(aBase) << ".rotatedList()" << std::endl;
 
   if (theDumper.isDumped(aRotObjects)) {
     aNbDumpedArguments.erase(aBase);