예제 #1
0
def displaysalomeplease(i5=100, debug=4, complaint="", complaint1=""):
    import SalomePyQt

    # i5[4:1 activate VTK-Viewer [2:2Erase :1DisplayAll [3:1 Fitall
    # complaint1!='' vtk, else occ. complaint1: obj to display
    # displaysalomeplease(10021, 4,)# ok erase occ
    # displaysalomeplease(11021, 4,groupName) #__display only groupname in vtk-viewer
    # FitAll()o #2:100, DisplayAll() #3 10 (erase 20), VTKViewer")[0]) #1000
    #
    # salome.sg.ResetView() #?: = Fitall? Fitall in VTK case nearer
    # gg.UpdateViewer()
    # error
    # 0. something with "mesh update" (from context menu)
    # 1. Konsole or Funktion sg.Display: hover over case: Solution occ: gg.UpdateViewer()
    gg = salome.ImportComponentGUI("GEOM")
    sg = SalomePyQt.SalomePyQt()
    if int(str(i5)[len(str(i5)) - 4]) == 0:
        sg.activateView(sg.getActiveView())
        sg.activateView(sg.findViews("OCCViewer")[0])
        if complaint1 != "":
            a = salome.myStudy.FindObjectByName(complaint, "GEOM")[0].GetID()
            salome.sg.Display(a)
        if int(str(i5)[len(str(i5)) - 2]) == 2:
            salome.sg.EraseAll()
        for i in salome.sg.getAllSelected():
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        salome.sg.UpdateView()  # ?was
        if int(str(i5)[len(str(i5)) - 2]) == 1:
            salome.sg.DisplayAll()  # 3 10
        if int(str(i5)[len(str(i5)) - 3]) == 1:
            salome.sg.FitAll()  # 2:100
        else:
            gg.UpdateViewer()
        # salome.sg.FitAll()
    if int(str(i5)[len(str(i5)) - 4]) == 1:
        sg.activateView(sg.findViews("VTKViewer")[0])
        if int(str(i5)[len(str(i5)) - 2]) == 2:
            salome.sg.EraseAll()
        salome.sg.UpdateView()
        if complaint != "":
            a = salome.myStudy.FindObjectByName(complaint, "SMESH")[0].GetID()
            salome.sg.Display(a)  # only if vtk-viewer activated
        for i in salome.sg.getAllSelected():
            salome.sg.Display(i)
        if int(str(i5)[len(str(i5)) - 2]) == 1:
            salome.sg.DisplayAll()  # forelast digit
        if int(str(i5)[len(str(i5)) - 3]) == 1:
            salome.sg.FitAll()  # 2:100
        else:
            gg.UpdateViewer()
        import iparameters

        if debug != 4:
            iparameters.getSession().restoreVisualState(1)
    if int(str(i5)[len(str(i5)) - 4]) == 2:
        sg.activateView(sg.findViews("ParaView")[0])
예제 #2
0
def zoomobj(x=-1,
            y=-1,
            z=-1,
            r=-1,
            obj_name1=[],
            obj_name2=[],
            viewer="VTKViewer"):
    salome.sg.EraseAll()
    gg = salome.ImportComponentGUI("GEOM")
    sg.activateView(sg.findViews(viewer)[0])
    if r != -1:
        sphere = geompy.MakeSphere(x, y, z, r)
        sphere_id = geompy.addToStudy(sphere, "Sphere")
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        gg.createAndDisplayGO(sphere_id)
        gg.setDisplayMode(sphere_id, 1)
        gg.setColor(sphere_id, 218, 165, 31)
        gg.setTransparency(sphere_id, 0.9)
        salome.sg.FitAll()
        #del ??
    else:
        obj_id = [
            salome.myStudy.FindObjectByName(i, i1)[0].GetID()
            for i in obj_name1 for i1 in ["GEOM", "SMESH"]
            if salome.myStudy.FindObjectByName(i, i1) != []
        ]
        print obj_id
        for i in obj_id:
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        salome.sg.FitAll()
    if obj_name2 != []:
        #display the rest unfittet
        obj_id2 = [
            salome.myStudy.FindObjectByName(i, i1)[0].GetID()
            for i in obj_name2 for i1 in ["GEOM", "SMESH"]
            if salome.myStudy.FindObjectByName(i, i1) != []
        ]
        for i in obj_id2:
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        gg.UpdateViewer()
예제 #3
0
def zoomobj(x=-1, y=-1, z=-1, r=-1, obj_name1=[], obj_name2=[], viewer="VTKViewer"):
    salome.sg.EraseAll()
    gg = salome.ImportComponentGUI("GEOM")
    sg.activateView(sg.findViews(viewer)[0])
    if r != -1:
        sphere = geompy.MakeSphere(x, y, z, r)
        sphere_id = geompy.addToStudy(sphere, "Sphere")
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        gg.createAndDisplayGO(sphere_id)
        gg.setDisplayMode(sphere_id, 1)
        gg.setColor(sphere_id, 218, 165, 31)
        gg.setTransparency(sphere_id, 0.9)
        salome.sg.FitAll()
        # del ??
    else:
        obj_id = [
            salome.myStudy.FindObjectByName(i, i1)[0].GetID()
            for i in obj_name1
            for i1 in ["GEOM", "SMESH"]
            if salome.myStudy.FindObjectByName(i, i1) != []
        ]
        print obj_id
        for i in obj_id:
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        salome.sg.FitAll()
    if obj_name2 != []:
        # display the rest unfittet
        obj_id2 = [
            salome.myStudy.FindObjectByName(i, i1)[0].GetID()
            for i in obj_name2
            for i1 in ["GEOM", "SMESH"]
            if salome.myStudy.FindObjectByName(i, i1) != []
        ]
        for i in obj_id2:
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        gg.UpdateViewer()
예제 #4
0
def displaysalomeplease(i5=100, debug=4, complaint='', complaint1=''):
    import SalomePyQt
    #i5[4:1 activate VTK-Viewer [2:2Erase :1DisplayAll [3:1 Fitall
    #complaint1!='' vtk, else occ. complaint1: obj to display
    #displaysalomeplease(10021, 4,)# ok erase occ
    #displaysalomeplease(11021, 4,groupName) #__display only groupname in vtk-viewer
    #FitAll()o #2:100, DisplayAll() #3 10 (erase 20), VTKViewer")[0]) #1000
    #
    #salome.sg.ResetView() #?: = Fitall? Fitall in VTK case nearer
    #gg.UpdateViewer()
    #error
    #0. something with "mesh update" (from context menu)
    #1. Konsole or Funktion sg.Display: hover over case: Solution occ: gg.UpdateViewer()
    gg = salome.ImportComponentGUI("GEOM")
    sg = SalomePyQt.SalomePyQt()
    if int(str(i5)[len(str(i5)) - 4]) == 0:
        sg.activateView(sg.getActiveView())
        sg.activateView(sg.findViews("OCCViewer")[0])
        if complaint1 != "":
            a = salome.myStudy.FindObjectByName(complaint, "GEOM")[0].GetID()
            salome.sg.Display(a)
        if int(str(i5)[len(str(i5)) - 2]) == 2: salome.sg.EraseAll()
        for i in salome.sg.getAllSelected():
            salome.sg.Display(i)
        salome.sg.updateObjBrowser(salome.myStudy._get_StudyId())
        salome.sg.UpdateView()  #?was
        if int(str(i5)[len(str(i5)) - 2]) == 1: salome.sg.DisplayAll()  #3 10
        if int(str(i5)[len(str(i5)) - 3]) == 1: salome.sg.FitAll()  #2:100
        else: gg.UpdateViewer()
    #salome.sg.FitAll()
    if int(str(i5)[len(str(i5)) - 4]) == 1:
        sg.activateView(sg.findViews("VTKViewer")[0])
        if int(str(i5)[len(str(i5)) - 2]) == 2: salome.sg.EraseAll()
        salome.sg.UpdateView()
        if complaint != "":
            a = salome.myStudy.FindObjectByName(complaint, "SMESH")[0].GetID()
            salome.sg.Display(a)  #only if vtk-viewer activated
        for i in salome.sg.getAllSelected():
            salome.sg.Display(i)
        if int(str(i5)[len(str(i5)) - 2]) == 1:
            salome.sg.DisplayAll()  # forelast digit
        if int(str(i5)[len(str(i5)) - 3]) == 1: salome.sg.FitAll()  #2:100
        else: gg.UpdateViewer()
        import iparameters
        if debug != 4: iparameters.getSession().restoreVisualState(1)
    if int(str(i5)[len(str(i5)) - 4]) == 2:
        sg.activateView(sg.findViews("ParaView")[0])