From: Artem Zhidkov Date: Fri, 3 Jul 2020 08:38:10 +0000 (+0300) Subject: Task #3231: Sketcher Offset of a curve X-Git-Tag: V9_6_0a1~60^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=796586e4f6328e1fe90a94586a3ad401b4d77650;p=modules%2Fshaper.git Task #3231: Sketcher Offset of a curve Decline offset if duplicated entities are selected. --- diff --git a/src/Model/Model_AttributeIntArray.cpp b/src/Model/Model_AttributeIntArray.cpp index 82ea6415e..4f4b6b7d0 100644 --- a/src/Model/Model_AttributeIntArray.cpp +++ b/src/Model/Model_AttributeIntArray.cpp @@ -74,7 +74,7 @@ void Model_AttributeIntArray::setValue(const int theIndex, const int theValue, bool sendUpdated) { - if (myArray->Value(theIndex) != theValue) { + if (!isInitialized() || myArray->Value(theIndex) != theValue) { setInitialized(); myArray->SetValue(theIndex, theValue); if (sendUpdated) diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index beaef63a7..4ddedd519 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -519,6 +519,7 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefListPtr aSelAttr = std::dynamic_pointer_cast(theAttribute); + std::set aSelected; AttributeRefListPtr aRefListOfInitial = std::dynamic_pointer_cast( aFeature->attribute(SketchPlugin_Constraint::ENTITY_A())); @@ -530,6 +531,12 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, std::list::iterator anObjIter; for(int anInd = 0; anInd < aSelAttr->size(); anInd++) { ObjectPtr aSelObject = aSelAttr->object(anInd); + if (aSelected.find(aSelObject) != aSelected.end()) { + theError = "Error: An object selected twice"; + return false; + } + aSelected.insert(aSelObject); + anObjIter = anInitialObjects.begin(); for (; anObjIter != anInitialObjects.end(); anObjIter++) if (aSelObject == *anObjIter)