[vtkusers] vtkMultiBlockDataSet and vtkCutter
nishant_rt
nishant.taluja at gmail.com
Tue May 26 15:53:23 EDT 2015
Hi,
I am trying to create a slice using vtkCutter on a multiblock dataset from
an Ensight reader. I am able to render it on single block of multiblock
dataset but not on all the blocks at once. Please see my script below to
render the plane using one block:
alg = vtk.vtkAlgorithm()
cdp = vtk.vtkCompositeDataPipeline()
alg.SetExecutive(cdp)
alg.SetDefaultExecutivePrototype(cdp)
reader = vtk.vtkEnSightGoldBinaryReader()
reader.SetCaseFileName('C:\CFD\PROJECTS\SE01-PROJECTS\SE01-A0001\CASES\SE01-A0001-02A\SE01-A0001-02A-its1000.encas')
reader.Update()
multiblock = reader.GetOutput()
pointdata = multiblock.GetBlock(0).GetPointData()
pointdata.SetActiveScalars("total_pressure")
plane = vtk.vtkPlane()
plane.SetOrigin(7, -1.5, 1.5)
plane.SetNormal(1, 0, 0)
planeCut = vtk.vtkCutter()
planeCut.SetCutFunction(plane)
planeCut.SetInputData(multiblock.GetBlock(0))
planeCut.Update()
lut = vtk.vtkColorTransferFunction()
lut.AddRGBPoint(0.0*1531.25, 0.0, 0.0, 1.0)
lut.AddRGBPoint(0.083*1531.25, 0.0, 0.333, 1.0)
lut.AddRGBPoint(0.167*1531.25, 0.0, 0.666, 1.0)
lut.AddRGBPoint(0.25*1531.25, 0.0, 1.0, 1.0)
lut.AddRGBPoint(0.333*1531.25, 0.0, 1.0, 0.666)
lut.AddRGBPoint(0.417*1531.25, 0.0, 1.0, 0.333)
lut.AddRGBPoint(0.5*1531.25, 0.0, 1.0, 0.0)
lut.AddRGBPoint(0.583*1531.25, 0.333, 1.0, 0.0)
lut.AddRGBPoint(0.667*1531.25, 0.666, 1.0, 0.0)
lut.AddRGBPoint(0.75*1531.25, 1.0, 1.0, 0.0)
lut.AddRGBPoint(0.833*1531.25, 1.0, 0.666, 0.0)
lut.AddRGBPoint(0.917*1531.25, 1.0, 0.333, 0.0)
lut.AddRGBPoint(1.0*1531.25, 1.0, 0.0, 0.0)
cutMapper = vtk.vtkPolyDataMapper()
cutMapper.SetInputConnection(planeCut.GetOutputPort())
cutMapper.SetLookupTable(lut)
cutMapper.SetScalarModeToUsePointData()
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.SetBackground(1, 1, 1)
renWin.SetSize(400, 300)
cutActor = vtk.vtkActor()
cutActor.SetMapper(cutMapper)
ren.AddActor(cutActor)
cutActor.RotateZ(90)
cutActor.RotateY(90)
iren.Initialize()
renWin.Render()
iren.Start()
I tried using vtkExtractBlock and also vtkCompositeDataGeometryFilter but it
did not work. Please help me to render the plane as I am struggling to get
the solution for the past few days.
Thanks,
Nishant
--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkMultiBlockDataSet-and-vtkCutter-tp5732015.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list