]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3240: Angular Copy is not possible for projected entity
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Wed, 20 May 2020 15:08:10 +0000 (18:08 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Wed, 20 May 2020 15:08:10 +0000 (18:08 +0300)
Fix regression appeared on Test2273.py

src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/plugin-Sketch.xml

index 86411bf3f335464f1f0819df4b9b6a5f3b95b79c..fbc98f205b3266038eabf96d205ce2e108f7ea67 100644 (file)
@@ -1779,28 +1779,24 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid(
   if (!aCopyAttr || !aCopyAttr->value())
     return true; // feature is not a copy, thus valid
 
-  // check the copy feature is already referred by the "Multi" feature
   FeaturePtr aMultiFeature = ModelAPI_Feature::feature(theAttribute->owner());
+  // Collect original entities
+  std::set<FeaturePtr> anOriginalFeatures;
+  if (theArguments.size() > 1) {
+    AttributeRefListPtr anOrigList = aMultiFeature->reflist(theArguments.back());
+    for (int i = 0; i < anOrigList->size(); ++i)
+    {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(anOrigList->object(i));
+      if (aFeature == anAttrOwnerFeature)
+        return true;
+    }
+  }
+
+  // check the copy feature is already referred by the "Multi" feature
   AttributeRefListPtr aRefList = aMultiFeature->reflist(theArguments.front());
   for (int i = 0; i < aRefList->size(); ++i)
   {
-    ObjectPtr aCurObj = aRefList->object(i);
-    // First of all, check if the current object is referred twice or more by the constraint.
-    // In this case, it mentions the object is original and placed to the copied entities too.
-    // It might be passed through.
-    int aNbRefs = 0;
-    const std::set<AttributePtr>& aRefs = aCurObj->data()->refsToMe();
-    for (std::set<AttributePtr>::const_iterator aRIt = aRefs.begin();
-         aRIt != aRefs.end(); ++aRIt) {
-      FeaturePtr anOwner = ModelAPI_Feature::feature((*aRIt)->owner());
-      if (anOwner == aMultiFeature)
-        ++aNbRefs;
-    }
-    if (aNbRefs > 1)
-      continue;
-
-    // check the referred feature is in the list of copies
-    FeaturePtr aRefOwner = ModelAPI_Feature::feature(aCurObj);
+    FeaturePtr aRefOwner = ModelAPI_Feature::feature(aRefList->object(i));
     if (aRefOwner == anAttrOwnerFeature)
     {
       theError = "Attribute refers to the object generated by this feature";
index 8d111edbbc9af14d56a744e9149495feaaaf52e6..fbf9b0bf87be83c2a72aa9a5e3d449853c76f44a 100644 (file)
         <sketch_shape_selector id="ConstraintEntityA"
             label="Mirror line" tooltip="Select mirror line" shape_types="edge">
           <validator id="GeomValidators_ShapeType" parameters="line"/>
-          <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityC"/>
+          <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityC,ConstraintEntityB"/>
         </sketch_shape_selector>
         <sketch_multi_selector id="ConstraintMirrorList"
             label="Segments"
                     shape_types="vertex">
                 <validator id="PartSet_DifferentObjects"/>
                 <validator id="GeomValidators_ShapeType" parameters="vertex"/>
-                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB"/>
+                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB,ConstraintEntityA"/>
               </sketch_shape_selector>
               <sketch_shape_selector
                     id="MultiTranslationEndPoint"
                     shape_types="vertex">
                 <validator id="PartSet_DifferentObjects"/>
                 <validator id="GeomValidators_ShapeType" parameters="vertex"/>
-                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB"/>
+                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB,ConstraintEntityA"/>
               </sketch_shape_selector>
             </groupbox>
           </box>
                     shape_types="vertex">
                 <validator id="PartSet_DifferentObjects"/>
                 <validator id="GeomValidators_ShapeType" parameters="vertex"/>
-                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB"/>
+                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB,ConstraintEntityA"/>
               </sketch_shape_selector>
               <sketch_shape_selector
                     id="MultiTranslationEndPoint"
                     shape_types="vertex">
                 <validator id="PartSet_DifferentObjects"/>
                 <validator id="GeomValidators_ShapeType" parameters="vertex"/>
-                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB"/>
+                <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB,ConstraintEntityA"/>
               </sketch_shape_selector>
             </groupbox>
           </box>
               tooltip="Center of rotation"
               shape_types="vertex">
           <validator id="GeomValidators_ShapeType" parameters="vertex"/>
-          <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB"/>
+          <validator id="SketchPlugin_ReplicationReference" parameters="ConstraintEntityB,ConstraintEntityA"/>
         </sketch_shape_selector>
         <toolbox id="AngleType">
           <box id="FullAngle" title="Full angle" icon="icons/Sketch/angle_up_full_32x32.png">