Пример #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 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])
Пример #3
0
def restoresalomeiparm(module='ParaViS', splitflag=1):
    import salome
    import iparameters
    ipar = iparameters.IParameters(
        salome.myStudy.GetCommonParameters("Interface Applicative", 1), True)
    #ipar.setProperty("AP_ACTIVE_VIEW", "ParaView_0_0")
    if splitflag == 1:
        ipar.setProperty("AP_ACTIVE_VIEW", "VTKViewer_0_0")
        ipar.setProperty(
            "AP_WORKSTACK_INFO",
            "00000001000000000000000201000000020000014a000002e9000000040000000100000001000000080000001a00560054004b005600690065007700650072005f0030005f00300000000102000000040000000200000001000000080000001a004f00430043005600690065007700650072005f0030005f00300000000002000000080000001800500061007200610056006900650077005f0030005f00300000000102"
        )
    ipar.setProperty("AP_ACTIVE_MODULE", module)
    ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: 2")
    #?
    #ipar.append("AP_MODULES_LIST", "Geometry")
    #ipar.append("AP_MODULES_LIST", "Mesh")
    #ipar.append("AP_MODULES_LIST", "ParaViS")
    ipar.append("AP_VIEWERS_LIST", "ParaView_1")
    ipar.append("AP_VIEWERS_LIST", "OCCViewer_2")
    ipar.append("AP_VIEWERS_LIST", "VTKViewer_3")
    iparameters.getSession().restoreVisualState(1)
Пример #4
0
def restoresalomeiparm(module="ParaViS", splitflag=1):
    import salome
    import iparameters

    ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1), True)
    # ipar.setProperty("AP_ACTIVE_VIEW", "ParaView_0_0")
    if splitflag == 1:
        ipar.setProperty("AP_ACTIVE_VIEW", "VTKViewer_0_0")
        ipar.setProperty(
            "AP_WORKSTACK_INFO",
            "00000001000000000000000201000000020000014a000002e9000000040000000100000001000000080000001a00560054004b005600690065007700650072005f0030005f00300000000102000000040000000200000001000000080000001a004f00430043005600690065007700650072005f0030005f00300000000002000000080000001800500061007200610056006900650077005f0030005f00300000000102",
        )
    ipar.setProperty("AP_ACTIVE_MODULE", module)
    ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: 2")
    # ?
    # ipar.append("AP_MODULES_LIST", "Geometry")
    # ipar.append("AP_MODULES_LIST", "Mesh")
    # ipar.append("AP_MODULES_LIST", "ParaViS")
    ipar.append("AP_VIEWERS_LIST", "ParaView_1")
    ipar.append("AP_VIEWERS_LIST", "OCCViewer_2")
    ipar.append("AP_VIEWERS_LIST", "VTKViewer_3")
    iparameters.getSession().restoreVisualState(1)
ipar.setParameter(
    "SMESH_3", "VTKViewer_0_Sizes",
    "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
ipar.setParameter("SMESH_3", "VTKViewer_0_PointMarker", "std:1:9")
ipar.setParameter("SMESH_3", "VTKViewer_0_Opacity", "1")
ipar.setParameter("SMESH_3", "VTKViewer_0_ClippingPlane", "Off")
# set up entry SMESH_4 (mesh) parameters
ipar.setParameter("SMESH_4", "VTKViewer_0_Visibility", "On")
ipar.setParameter("SMESH_4", "VTKViewer_0_Representation", "2")
ipar.setParameter("SMESH_4", "VTKViewer_0_IsShrunk", "0")
ipar.setParameter("SMESH_4", "VTKViewer_0_Entities", "e:0:f:1:v:0:0d:0:b:0")
ipar.setParameter(
    "SMESH_4", "VTKViewer_0_Colors",
    "surface:0:0.666667:1:backsurface:100:volume:1:0:0.666667:-100:edge:0:0.666667:1:node:1:0:0:outline:0:0.27451:0:elem0d:0:1:0:ball:0:0.333333:1:orientation:1:1:1"
)
ipar.setParameter(
    "SMESH_4", "VTKViewer_0_Sizes",
    "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
ipar.setParameter("SMESH_4", "VTKViewer_0_PointMarker", "std:1:9")
ipar.setParameter("SMESH_4", "VTKViewer_0_Opacity", "1")
ipar.setParameter("SMESH_4", "VTKViewer_0_ClippingPlane", "Off")

if salome.sg.hasDesktop():
    salome.sg.updateObjBrowser(True)
    iparameters.getSession().restoreVisualState(1)

import libSALOME_Swig
gui = libSALOME_Swig.SALOMEGUI_Swig()
gui.AddIObject(salome.ObjectToID(Mesh_2.GetMesh()))
gui.AddIObject(salome.ObjectToID(Mesh_2_WL.GetMesh()))
Пример #6
0
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Sketch_1, 'Sketch_1' )

### Store presentation parameters of displayed objects
import iparameters
ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "GEOM", 1))

#Set up entries:
# set up entry GEOM_5 (Sketch_1) parameters
objId = geompy.getObjectID(Sketch_1)
ipar.setParameter(objId, "OCCViewer_0_Visibility", "Off")
ipar.setParameter(objId, "OCCViewer_0_DisplayMode", "0")
ipar.setParameter(objId, "OCCViewer_0_Transparency", "0")
ipar.setParameter(objId, "OCCViewer_0_TopLevelFlag", "false")
ipar.setParameter(objId, "OCCViewer_0_Isos", "0:0")
ipar.setParameter(objId, "OCCViewer_0_VectorMode", "false")
ipar.setParameter(objId, "OCCViewer_0_VerticesMode", "false")
ipar.setParameter(objId, "OCCViewer_0_NameMode", "false")
ipar.setParameter(objId, "OCCViewer_0_DeflectionCoeff", "0.001")
ipar.setParameter(objId, "OCCViewer_0_MarkerType", "7:3")
ipar.setParameter(objId, "OCCViewer_0_Material", "Physical=0:FrontShininess=0.13:BackShininess=0.13:Transparency=0:Ambient=1:AmbientColor=#333333:FrontAmbientCoefficient=0.3:BackAmbientCoefficient=0.25:Diffuse=1:DiffuseColor=#000000:FrontDiffuseCoefficient=0.5:BackDiffuseCoefficient=0.4:Specular=1:SpecularColor=#ffffff:FrontSpecularCoefficient=0.3:BackSpecularCoefficient=0.3:Emissive=0:EmissiveColor=#000000:FrontEmissiveCoefficient=0:BackEmissiveCoefficient=0")
ipar.setParameter(objId, "OCCViewer_0_EdgeWidth", "1")
ipar.setParameter(objId, "OCCViewer_0_IsosWidth", "1")


if salome.sg.hasDesktop():
  salome.sg.updateObjBrowser(1)
  iparameters.getSession().restoreVisualState(1)