- AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis);
- anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName");
- aName = anAttr._narrow(SALOMEDS.AttributeName);
- aName.SetValue("Applied Hypothesis");
- anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable");
- aSelAttr = anAttr._narrow(SALOMEDS.AttributeSelectable);
- aSelAttr.SetSelectable(0);
- anAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap");
- aPixmap = anAttr._narrow(SALOMEDS.AttributePixMap);
- aPixmap.SetPixMap( "mesh_tree_hypo.png" );
-
- SO = myStudyBuilder.NewObject(AHR);
- SO = SO._narrow(SALOMEDS.SObject)
- myStudyBuilder.Addreference (SO,SO_Hypothesis);
+ AHR = myStudyBuilder.NewObjectToTag (SO_MorSM, Tag_RefOnAppliedHypothesis)
+ aName = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeName")
+
+ # The same name as in SMESH_Mesh_i::AddHypothesis() ##################
+ aName.SetValue("Applied hypotheses")
+
+ aSelAttr = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributeSelectable")
+ aSelAttr.SetSelectable(0)
+ aPixmap = myStudyBuilder.FindOrCreateAttribute(AHR, "AttributePixMap")
+ aPixmap.SetPixMap( "mesh_tree_hypo.png" )
+
+ # VSR: added temporarily - reference to applied hypothesis is published automatically by the engine
+ else :
+ it = myStudy.NewChildIterator(AHR)
+ while it.More() :
+ res, Ref = it.Value().ReferencedObject()
+ if res and Ref is not None and Ref.GetID() == Hypothesis_Entry :
+ return
+ it.Next()
+ # VSR ######################################################################
+
+ SO = myStudyBuilder.NewObject(AHR)
+ myStudyBuilder.Addreference (SO,SO_Hypothesis)