From 2e17372e7afde6155c85cc45f1cde56e198d7ff7 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 9 Dec 2016 07:42:30 +0300 Subject: [PATCH] Issue #1781 Split circles into arcs leads to arcs with different centers Correction to avoid previous workaround. --- src/Model/Model_AttributeRefAttr.cpp | 5 +++-- src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp | 14 -------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index 034620126..eff39c6f7 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -20,9 +20,10 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr theAttr std::shared_ptr aData = std::dynamic_pointer_cast( theAttr->owner()->data()); std::string anID = aData->id(theAttr); - if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str())) + ObjectPtr anObj = object(); + if (myIsInitialized && anObj == theAttr->owner() && myID->Get().IsEqual(anID.c_str())) return; // nothing is changed - REMOVE_BACK_REF(theAttr->owner()); + REMOVE_BACK_REF(anObj); myRef->Set(aData->label().Father()); myID->Set(aData->id(theAttr).c_str()); ADD_BACK_REF(theAttr->owner()); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp index b83431b19..e0b26898b 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp @@ -48,8 +48,6 @@ #include #endif -#define CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES - static const double PI = 3.141592653589793238463; SketchPlugin_ConstraintSplit::SketchPlugin_ConstraintSplit() @@ -95,9 +93,6 @@ void SketchPlugin_ConstraintSplit::execute() FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value()); ResultPtr aBaseFeatureResult = getFeatureResult(aBaseFeature); std::set aFeaturesToDelete, aFeaturesToUpdate; - #ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES - FeaturePtr aCircleFeatureToDelete; - #endif std::map aTangentFeatures; std::map aCoincidenceToFeature; @@ -223,11 +218,7 @@ void SketchPlugin_ConstraintSplit::execute() updateRefFeatureConstraints(getFeatureResult(aBaseFeature), aRefsToFeature); AttributePtr aCenterAttr = aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID()); -#ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES - aCircleFeatureToDelete = aCircleFeature; -#else aFeaturesToDelete.insert(aCircleFeature); -#endif // as circle is removed, temporary fill this attribute*/ aBaseObjectAttr->setObject(ResultPtr()); } @@ -306,11 +297,6 @@ void SketchPlugin_ConstraintSplit::execute() } #endif ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToDelete); -#ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES - std::set aCircleFeatures; - aCircleFeatures.insert(aCircleFeatureToDelete); - ModelAPI_Tools::removeFeatures(aCircleFeatures, false); -#endif #ifdef DEBUG_SPLIT std::cout << "update features after split:" << std::endl; -- 2.39.2