Personal tools
You are here: Home Forum How to use Salome? How to Display wath I create in a script

How to Display wath I create in a script

Up to How to use Salome?
  • How to Display wath I create in a script

    Posted by HAEFFLER_Benoit at October 30. 2007
    Hello I have write a litel script to Add Edge Betwenn a Group_Of_Node and a Node.

    But I  can not display new edge

    i have try :        
            salome.sg.Display(aGroupEntry)
            salome.sg.UpdateView()


    My script :  

    def Make_GroupOfEdge(Mesh,Group_Of_Node,Node,Name="Group_of_Edge";):
        "Add Edge Betwenn a Group_Of_Node and a Node"

        try:
            #find node number of Group_Of_Node
            NbGrp=Group_Of_Node.GetIDs()

            #find node number of Node
            NbN=Node.GetIDs()

            #Create Edge and adding to a Group_of_Edge
            a=0
            aGroup = Mesh.CreateEmptyGroup(smesh.EDGE, Name)

            while a
                e = mesh.AddEdge([NbGrp[a] , NbN[0]])
                aGroup.Add([e])       
                a=a+1
       
       

            #Display and UpdateView
            ActiveStudyId = salome.sg.getActiveStudyId()
            aGroupEntry = salome.ObjectToID(aGroup)   
           
            salome.sg.updateObjBrowser(ActiveStudyId)
            salome.sg.Display(aGroupEntry)
            salome.sg.UpdateView()
           
            #print info
            print "A group of Egde was added with the Entry : ", aGroupEntry
            print "This Group contain ", aGroup.Size() ," Edges"
            print "This Group contain the Edge : ",aGroup.GetListOfID()
           
       
            return aGroup
       
        except:
            print "The first argument must be a smesh.Mesh instance "
            print """     you can try : mesh = smesh.Mesh(shape_mesh, "Mesh_name";)"""
            print "The second and the thrid argument must be group of node of your mesh"
            print """The forth argument is the name of the new group of edge, default value is "Group_of_Edge" """


Powered by Ploneboard
Document Actions