CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] scripting with paraview clip filter

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2017, 09:07
Default scripting with paraview clip filter
  #1
Member
 
Join Date: Sep 2014
Posts: 32
Rep Power: 11
yongxiang is on a distinguished road
Hello everyone,

I wish to use paraview for cutting my openfoam data into a smaller region for some post-procing. In paraview there is a filter called Clip, which can fulfill this task. I recorded down the python script from a paraview session. But I don't know how to get out the raw data from the generated Clip, if any of you would show me so?

The recorded python scripts are flowllowed, any rendering object are commended,

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'OpenFOAMReader'
tSfoam = OpenFOAMReader(FileName='./TS.foam')
tSfoam.MeshRegions = ['internalMesh']
tSfoam.CellArrays = [ 'U_subtract_U_bf']

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps( )


# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1433, 860]

# show data in view
#tSfoamDisplay = Show(tSfoam, renderView1)
## trace defaults for the display properties.
#tSfoamDisplay.ColorArrayName = [None, '']
#tSfoamDisplay.GlyphType = 'Arrow'
#tSfoamDisplay.ScalarOpacityUnitDistance = 0.006523068215381728
#tSfoamDisplay.SetScaleArray = [None, '']
#tSfoamDisplay.ScaleTransferFunction = 'PiecewiseFunction'
#tSfoamDisplay.OpacityArray = [None, '']
#tSfoamDisplay.OpacityTransferFunction = 'PiecewiseFunction'

# reset view to fit data
#renderView1.ResetCamera()

# set scalar coloring
#ColorBy(tSfoamDisplay, ('FIELD', 'vtkBlockColors'))

# show color bar/color legend
#tSfoamDisplay.SetScalarBarVisibility(renderView1, True)
#
## get color transfer function/color map for 'vtkBlockColors'
#vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors')
#
## get opacity transfer function/opacity map for 'vtkBlockColors'
#vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors')

animationScene1.GoToNext()

# create a new 'Clip'
clip1 = Clip(Input=tSfoam)
clip1.ClipType = 'Plane'
clip1.Scalars = [None, '']

# init the 'Plane' selected for 'ClipType'
clip1.ClipType.Origin = [0.35899998992681503, 0.05000000074505806, 0.004999999888241291]

# Properties modified on clip1
clip1.Scalars = ['POINTS', '']

# Properties modified on clip1.ClipType
clip1.ClipType.Origin = [0.1, 0.05000000074505806, 0.004999999888241291]

# show data in view
#clip1Display = Show(clip1, renderView1)
# trace defaults for the display properties.
#clip1Display.ColorArrayName = [None, '']
#clip1Display.GlyphType = 'Arrow'
#clip1Display.ScalarOpacityUnitDistance = 0.0062578805709500715
#clip1Display.SetScaleArray = [None, '']
#clip1Display.ScaleTransferFunction = 'PiecewiseFunction'
#clip1Display.OpacityArray = [None, '']
#clip1Display.OpacityTransferFunction = 'PiecewiseFunction'

# hide data in view
Hide(tSfoam, renderView1)
yongxiang is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Listing the inputs of a grouped dataset with a programmable python filter in Paraview NadineHS ParaView 3 December 12, 2021 15:54
[General] Scripting paraview module in an IDE jfn ParaView 0 August 6, 2018 14:23
[General] How to use Median filter in Paraview? It's always greyed out... jiejie ParaView 6 August 24, 2015 13:02
Using clip filter to acquire smooth interface sharonyue OpenFOAM Post-Processing 0 April 14, 2015 12:03
paraFoam reader for OpenFOAM 1.6 smart OpenFOAM Installation 13 November 16, 2009 22:41


All times are GMT -4. The time now is 03:30.