Hello,<div><br></div><div>For some reason I am unable to use the blanking capability of the vtkUniformGrid class. I am interested in blanking cells (do not work on point either). For example the following (pyhton) code does not blank anything. What am I doing wrong.</div>
<div><br></div><div>I am now doubting that I properly understand what blanking is supposed to do: I would expect to only show the cell that are visible (i.e. not blanked).</div><div><br></div><div>Thanks,</div><div>Alex</div>
<div>-------------------------------------------------------------------</div>
<div><div><div>import vtk</div><div><br></div><div>uGrid = vtk.vtkUniformGrid()</div><div><br></div><div>uGrid.SetExtent(0,35, 0,35, 0,35)</div><div>uGrid.SetOrigin(0, 0,0)</div><div>uGrid.SetSpacing(1,1,1)</div><div>uGrid.SetScalarTypeToFloat ()</div>
<div>nCells = uGrid.GetNumberOfCells()</div><div><br></div><div># Set the data vector</div><div>data = vtk.vtkFloatArray()</div><div>data.SetNumberOfValues(nCells)</div><div>data.SetNumberOfComponents(1)</div><div><br></div>
<div><br></div><div># Set the blanking vector</div><div>dataBlank = vtk.vtkUnsignedCharArray()</div><div>dataBlank.SetNumberOfValues(nCells)</div><div>dataBlank.SetNumberOfComponents(1)</div><div><br></div><div>for i in range(nCells):</div>
<div> data.SetValue(i, float(i)/nCells)</div><div> dataBlank.SetValue(i, i%2)</div><div><br></div><div>uGrid.GetCellData().SetScalars(data)</div><div>uGrid.SetCellVisibilityArray(dataBlank)</div><div><br></div><div>#Test to see of the blanking is (internally) correct </div>
<div>for i in range(nCells):</div><div> if uGrid.IsCellVisible(i) : print i</div><div><br></div><div>mapper = vtk.vtkDataSetMapper()</div><div>mapper.SetInput(uGrid)</div><div>actor = vtk.vtkActor()</div><div>actor.SetMapper(mapper)</div>
<div><br></div><div>ren = vtk.vtkRenderer()</div><div>renWin = vtk.vtkRenderWindow()</div><div>renWin.AddRenderer(ren)</div><div>renWin.SetSize(500, 500)</div><div>iren = vtk.vtkRenderWindowInteractor()</div><div>iren.SetRenderWindow(renWin)</div>
<div><br></div><div>ren.AddActor(actor)</div><div>iren.Initialize()</div><div>renWin.Render()</div><div>iren.Start()</div></div></div>