From: mpv Date: Mon, 6 Jun 2016 13:54:56 +0000 (+0300) Subject: Minor changes and optimization X-Git-Tag: V_2.4.0~142 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eaac0035dc42859548ad7dcddff736d197f72e2d;p=modules%2Fshaper.git Minor changes and optimization --- diff --git a/src/ModelAPI/Test/Test1512.py b/src/ModelAPI/Test/Test1512.py index 7ed32b0a6..25f843acf 100755 --- a/src/ModelAPI/Test/Test1512.py +++ b/src/ModelAPI/Test/Test1512.py @@ -143,6 +143,9 @@ check_owner("Boolean_2_1/Modified_2", "face", aTower) check_owner("Boolean_2_1/Modified_3&Extrusion_1_1/Generated_Face_2", "edge", aBox) check_owner("Boolean_2_1/Modified_2&Extrusion_3_1/To_Face_1_1", "edge", aTower) +# check the connected topology method: solid is not a compound of connected topology +assert(aFuse.firstResult().shape().isConnectedTopology() == False) + #========================================================================= # End of test #========================================================================= diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 805d6a621..9766c0a9e 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -367,15 +367,14 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); bool isObject = anAttr->isObject(); ObjectPtr anObject = anAttr->object(); - AttributePtr anAttributeAttr = anAttr->attr(); anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); if (anAttrs.size() > 0) { - std::list >::iterator anAttr = anAttrs.begin(); - for(; anAttr != anAttrs.end(); anAttr++) { - if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { + std::list >::iterator anAttrIter = anAttrs.begin(); + for(; anAttrIter != anAttrs.end(); anAttrIter++) { + if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttr); + std::dynamic_pointer_cast(*anAttrIter); if (aRef->isObject() != isObject) continue; if (isObject) { @@ -386,6 +385,7 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute } } else { // the attribute reference + AttributePtr anAttributeAttr = anAttr->attr(); if (aRef->attr() == anAttributeAttr) { theError = errorMessage(EqualAttributes, anAttributeAttr.get() ? anAttributeAttr->id() : "", diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 29031a04b..aa6e7fb4f 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -106,11 +106,8 @@ void SketchPlugin_Arc::initDerivedClassAttributes() data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::typeId()); ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); - data()->addAttribute(INVERSED_ID(), ModelAPI_AttributeBoolean::typeId()); - AttributeBooleanPtr isInversed = - std::dynamic_pointer_cast(attribute(INVERSED_ID())); - if (!isInversed->isInitialized()) - isInversed->setValue(false); + AttributeBooleanPtr isInversed = std::dynamic_pointer_cast( + data()->addAttribute(INVERSED_ID(), ModelAPI_AttributeBoolean::typeId())); // get the initial values if (anEndAttr->isInitialized()) { @@ -118,14 +115,18 @@ void SketchPlugin_Arc::initDerivedClassAttributes() myYEndBefore = anEndAttr->y(); } - data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId()); - std::dynamic_pointer_cast( - data()->attribute(ARC_TYPE()))->setValue(ARC_TYPE_CENTER_START_END()); + AttributeStringPtr anArcType = std::dynamic_pointer_cast( + data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId())); data()->addAttribute(PASSED_POINT_ID(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + + // set after all to avoid in attributeChanged reference to not existing attributes + if (!isInversed->isInitialized()) + isInversed->setValue(false); + anArcType->setValue(ARC_TYPE_CENTER_START_END()); } void SketchPlugin_Arc::execute()