Salome HOME
Fix for import/export features
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_MultiRotation.cpp
index d4cf1ec716bc09175e5644225b62e131756af982..5b4f02c81ffbb150807309fbdd16af0d13fd394d 100644 (file)
@@ -47,6 +47,12 @@ void SketchPlugin_MultiRotation::initAttributes()
 
 void SketchPlugin_MultiRotation::execute()
 {
+  if (!sketch()) {
+    // it is possible, that this method is called before this feature has back reference to sketch
+    // in this case, the execute is performed after this is done
+    return;
+  }
+
   AttributeSelectionListPtr aRotationObjectRefs = selectionList(ROTATION_LIST_ID());
   int aNbCopies = integer(NUMBER_OF_COPIES_ID())->value();
 
@@ -100,6 +106,7 @@ void SketchPlugin_MultiRotation::execute()
   for (; aUsedIter != isUsed.end(); aUsedIter++) {
     if (!(*aUsedIter)) {
       aRefListOfShapes->remove(*anInitIter);
+      aRefListOfRotated->remove(*aTargetIter++);
       for (int i = 0; i < aCurrentNbCopies && aTargetIter != aTargetList.end(); i++, aTargetIter++) {
         aRefListOfRotated->remove(*aTargetIter);
         // remove the corresponding feature from the sketch