Skip to content
Snippets Groups Projects
T.py 6.29 KiB
Newer Older
  • Learn to ignore specific revisions
  • Klaus Böhnlein's avatar
    Klaus Böhnlein committed
    # state file generated using paraview version 5.7.0
    
    # ----------------------------------------------------------------
    # setup views used in the visualization
    # ----------------------------------------------------------------
    
    # trace generated using paraview version 5.7.0
    #
    # To ensure correct image size when batch processing, please search 
    # for and uncomment the line `# renderView*.ViewSize = [*,*]`
    
    #### import the simple module from the paraview
    from paraview.simple import *
    #### disable automatic camera reset on 'Show'
    paraview.simple._DisableFirstRenderCameraReset()
    
    # Create a new 'Render View'
    renderView1 = CreateView('RenderView')
    renderView1.ViewSize = [901, 795]
    renderView1.AxesGrid = 'GridAxes3DActor'
    renderView1.CenterOfRotation = [0.22986745834350586, 0.03941011428833008, 0.17028677463531494]
    renderView1.StereoType = 'Crystal Eyes'
    renderView1.CameraPosition = [53.44770716226582, -21.61022632014142, -4.102774671003825]
    renderView1.CameraFocalPoint = [0.22986745834350583, 0.039410114288330106, 0.17028677463531497]
    renderView1.CameraViewUp = [-0.28235039193869665, -0.7988816556360265, 0.531099196441028]
    renderView1.CameraFocalDisk = 1.0
    renderView1.CameraParallelScale = 5.748834779828519
    renderView1.Background = [0.32, 0.34, 0.43]
    
    SetActiveView(None)
    
    # ----------------------------------------------------------------
    # setup view layouts
    # ----------------------------------------------------------------
    
    # create new layout object 'Layout #1'
    layout1 = CreateLayout(name='Layout #1')
    layout1.AssignView(0, renderView1)
    
    # ----------------------------------------------------------------
    # restore active view
    SetActiveView(renderView1)
    # ----------------------------------------------------------------
    
    # ----------------------------------------------------------------
    # setup the data processing pipelines
    # ----------------------------------------------------------------
    
    # create a new 'Legacy VTK Reader'
    matlab_exportvtk = LegacyVTKReader(FileNames=['/home/klaus/Desktop/DUNE/dune-microstructure/Matlab-Programs/matlab_export.vtk'])
    
    # create a new 'Legacy VTK Reader'
    pointSetvtk = LegacyVTKReader(FileNames=['/home/klaus/Desktop/Paraview-Data/ParaView-v5.9.0/Testing/Data/pointSet.vtk'])
    
    # ----------------------------------------------------------------
    # setup the visualization in view 'renderView1'
    # ----------------------------------------------------------------
    
    # show data from pointSetvtk
    pointSetvtkDisplay = Show(pointSetvtk, renderView1)
    
    # get color transfer function/color map for 'RandomPointScalars'
    randomPointScalarsLUT = GetColorTransferFunction('RandomPointScalars')
    randomPointScalarsLUT.RGBPoints = [2.0, 0.231373, 0.298039, 0.752941, 5.5, 0.865003, 0.865003, 0.865003, 9.0, 0.705882, 0.0156863, 0.14902]
    randomPointScalarsLUT.ScalarRangeInitialized = 1.0
    
    # trace defaults for the display properties.
    pointSetvtkDisplay.Representation = 'Points'
    pointSetvtkDisplay.ColorArrayName = ['POINTS', 'RandomPointScalars']
    pointSetvtkDisplay.LookupTable = randomPointScalarsLUT
    pointSetvtkDisplay.RenderPointsAsSpheres = 1
    pointSetvtkDisplay.OSPRayScaleArray = 'RandomPointScalars'
    pointSetvtkDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
    pointSetvtkDisplay.SelectOrientationVectors = 'RandomCellVectors'
    pointSetvtkDisplay.ScaleFactor = 0.7009325742721558
    pointSetvtkDisplay.SelectScaleArray = 'RandomPointScalars'
    pointSetvtkDisplay.GlyphType = 'Arrow'
    pointSetvtkDisplay.GlyphTableIndexArray = 'RandomPointScalars'
    pointSetvtkDisplay.GaussianRadius = 0.03504662871360779
    pointSetvtkDisplay.SetScaleArray = ['POINTS', 'RandomPointScalars']
    pointSetvtkDisplay.ScaleTransferFunction = 'PiecewiseFunction'
    pointSetvtkDisplay.OpacityArray = ['POINTS', 'RandomPointScalars']
    pointSetvtkDisplay.OpacityTransferFunction = 'PiecewiseFunction'
    pointSetvtkDisplay.DataAxesGrid = 'GridAxesRepresentation'
    pointSetvtkDisplay.PolarAxes = 'PolarAxesRepresentation'
    
    # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
    pointSetvtkDisplay.ScaleTransferFunction.Points = [2.0, 0.0, 0.5, 0.0, 9.0, 1.0, 0.5, 0.0]
    
    # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
    pointSetvtkDisplay.OpacityTransferFunction.Points = [2.0, 0.0, 0.5, 0.0, 9.0, 1.0, 0.5, 0.0]
    
    # show data from matlab_exportvtk
    matlab_exportvtkDisplay = Show(matlab_exportvtk, renderView1)
    
    # trace defaults for the display properties.
    matlab_exportvtkDisplay.Representation = 'Surface With Edges'
    matlab_exportvtkDisplay.ColorArrayName = [None, '']
    matlab_exportvtkDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
    matlab_exportvtkDisplay.SelectOrientationVectors = 'None'
    matlab_exportvtkDisplay.ScaleFactor = 9.9
    matlab_exportvtkDisplay.SelectScaleArray = 'None'
    matlab_exportvtkDisplay.GlyphType = 'Arrow'
    matlab_exportvtkDisplay.GlyphTableIndexArray = 'None'
    matlab_exportvtkDisplay.GaussianRadius = 0.495
    matlab_exportvtkDisplay.SetScaleArray = [None, '']
    matlab_exportvtkDisplay.ScaleTransferFunction = 'PiecewiseFunction'
    matlab_exportvtkDisplay.OpacityArray = [None, '']
    matlab_exportvtkDisplay.OpacityTransferFunction = 'PiecewiseFunction'
    matlab_exportvtkDisplay.DataAxesGrid = 'GridAxesRepresentation'
    matlab_exportvtkDisplay.PolarAxes = 'PolarAxesRepresentation'
    
    # setup the color legend parameters for each legend in this view
    
    # get color legend/bar for randomPointScalarsLUT in view renderView1
    randomPointScalarsLUTColorBar = GetScalarBar(randomPointScalarsLUT, renderView1)
    randomPointScalarsLUTColorBar.Title = 'RandomPointScalars'
    randomPointScalarsLUTColorBar.ComponentTitle = ''
    
    # set color bar visibility
    randomPointScalarsLUTColorBar.Visibility = 1
    
    # show color legend
    pointSetvtkDisplay.SetScalarBarVisibility(renderView1, True)
    
    # ----------------------------------------------------------------
    # setup color maps and opacity mapes used in the visualization
    # note: the Get..() functions create a new object, if needed
    # ----------------------------------------------------------------
    
    # get opacity transfer function/opacity map for 'RandomPointScalars'
    randomPointScalarsPWF = GetOpacityTransferFunction('RandomPointScalars')
    randomPointScalarsPWF.Points = [2.0, 0.0, 0.5, 0.0, 9.0, 1.0, 0.5, 0.0]
    randomPointScalarsPWF.ScalarRangeInitialized = 1
    
    # ----------------------------------------------------------------
    # finally, restore active source
    SetActiveSource(matlab_exportvtk)
    # ----------------------------------------------------------------