Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / Model / Model_AttributeSelection.cpp
index f1cf7fa5b42f4b8266c9cfac080b76ed11ed2e57..625ee19da88204244684dc98935c06435a38c162 100644 (file)
@@ -85,7 +85,15 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
   TDF_Label aSelLab = selectionLabel();
   aSelLab.ForgetAttribute(kSIMPLE_REF_ID);
   aSelLab.ForgetAttribute(kCONSTUCTION_SIMPLE_REF_ID);
-  if (!theContext.get()) {
+
+  bool isDegeneratedEdge = false;
+  // do not use the degenerated edge as a shape, a null context and shape is used in the case
+  if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) {
+    const TopoDS_Shape& aSubShape = theSubShape->impl<TopoDS_Shape>();
+    if (aSubShape.ShapeType() == TopAbs_EDGE)
+      isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape));
+  }
+  if (!theContext.get() || isDegeneratedEdge) {
     // to keep the reference attribute label
     TDF_Label aRefLab = myRef.myRef->Label();
     aSelLab.ForgetAllAttributes(true);