From: nds Date: Tue, 29 Nov 2016 09:02:44 +0000 (+0300) Subject: Issue #1781 Split circles into arcs leads to arcs with different centers X-Git-Tag: V_2.6.0~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9cc29e1bf568321b19bcaa33ab2ff45d3b807edb;p=modules%2Fshaper.git Issue #1781 Split circles into arcs leads to arcs with different centers Additional case is to create Circle, Line, distance between the circle and the line. Create two coincident points on circle. Split circle. Previous result is that the distance is removed. --- diff --git a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp index 0023cc47b..b83431b19 100755 --- a/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp @@ -48,6 +48,8 @@ #include #endif +#define CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES + static const double PI = 3.141592653589793238463; SketchPlugin_ConstraintSplit::SketchPlugin_ConstraintSplit() @@ -93,6 +95,10 @@ 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; getConstraints(aFeaturesToDelete, aFeaturesToUpdate, aTangentFeatures, aCoincidenceToFeature); @@ -216,7 +222,12 @@ 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()); } @@ -295,6 +306,11 @@ 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;