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";
<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">