]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1781 Split circles into arcs leads to arcs with different centers
authornds <nds@opencascade.com>
Tue, 29 Nov 2016 09:02:44 +0000 (12:02 +0300)
committernds <nds@opencascade.com>
Tue, 29 Nov 2016 09:02:44 +0000 (12:02 +0300)
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.

src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp

index 0023cc47bac3d66610dcd808de9a9bf539c00a12..b83431b196a5b911a6dfdca73a9323ac1c40a385 100755 (executable)
@@ -48,6 +48,8 @@
 #include <iostream>
 #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<FeaturePtr> aFeaturesToDelete, aFeaturesToUpdate;
+  #ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES
+  FeaturePtr aCircleFeatureToDelete;
+  #endif
+
   std::map<FeaturePtr, IdToPointPair> aTangentFeatures;
   std::map<FeaturePtr, IdToPointPair> 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<FeaturePtr> aCircleFeatures;
+  aCircleFeatures.insert(aCircleFeatureToDelete);
+  ModelAPI_Tools::removeFeatures(aCircleFeatures, false);
+#endif
 
 #ifdef DEBUG_SPLIT
   std::cout << "update features after split:" << std::endl;