]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchAPI/SketchAPI_Rotation.cpp
Salome HOME
Add new method to get the list of rotated/translated entities of MultiRotation/MultiT...
[modules/shaper.git] / src / SketchAPI / SketchAPI_Rotation.cpp
index 7b5ec3831fd28d50250bfd64d3755f015d7845fb..4a83244cea932eb4336d14e7cb042193a2cd222d 100644 (file)
@@ -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);