From: Artem Zhidkov Date: Wed, 20 May 2020 15:08:10 +0000 (+0300) Subject: Issue #3240: Angular Copy is not possible for projected entity X-Git-Tag: V9_5_0rc1~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=246d714d1d33e9661807c5c72457f623cf689228;p=modules%2Fshaper.git Issue #3240: Angular Copy is not possible for projected entity Fix regression appeared on Test2273.py --- diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 86411bf3f..fbc98f205 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -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 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& aRefs = aCurObj->data()->refsToMe(); - for (std::set::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"; diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 8d111edbb..fbf9b0bf8 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -794,7 +794,7 @@ - + - + - + @@ -853,7 +853,7 @@ shape_types="vertex"> - + - + @@ -896,7 +896,7 @@ tooltip="Center of rotation" shape_types="vertex"> - +