<div dir="ltr"><div><div><div>I am looking at the pointToCellData.py example. <br><br></div>In that example an unstructured grid reader opens a .vtk file and extracts some named unstructured grid scalar and vector data like so... <br><br>reader = vtk.vtkUnstructuredGridReader()<br>reader.SetFileName(VTK_DATA_ROOT + "/Data/blow.vtk")<br>reader.SetScalarsName("thickness9")<br>reader.SetVectorsName("displacement9")<br><br>p2c = vtk.vtkPointDataToCellData()<br>p2c.SetInputConnection(reader.GetOutputPort())<br>p2c.PassPointDataOn()<br>warp = vtk.vtkWarpVector()<br>warp.SetInputConnection(p2c.GetOutputPort())<br>thresh = vtk.vtkThreshold()<br>thresh.SetInputConnection(warp.GetOutputPort())<br>thresh.ThresholdBetween(0.25, 0.75)<br>thresh.SetInputArrayToProcess(1, 0, 0, 0, "thickness9")<br><br><br></div>In the code I've written to front end this, I want to replace the reader with my own method for extracting an unstructured grid like so...<br><br>gap_data_block, gap_file_info = getgap.get_gap_data_from_files(gap_file)<br></div><div style="text-align:left">points = vtk.vtkPoints()<br>points.SetData(VN.numpy_to_vtk(gap_data_block, deep=True))<br>ugrid = vtk.vtkUnstructuredGrid()<br>ugrid.SetPoints(points)</div><div style="text-align:left"><br></div><div style="text-align:left">Where gap_data_block is a numpy array of shape (n,3) carrying data for dimensions are x/y/z.</div><div style="text-align:left"><br></div><div style="text-align:left">Ultimately I want to get a surface elevation plot of gap_data_block by working through the example code cited above.<br></div><div style="text-align:left"><br></div><div style="text-align:left">As part of this (extremely) pedagogical experience, I feel I need to do two things:</div><div style="text-align:left"><ol><li>Find a way to label columns one and two of get_data_block as a vector using some equivalent to reader.SetVectorsName()</li><li>Find a way to label columns three of get_data_block as a scalar using some equivalent to reader.SetVectorsName()</li><li>Find a way to set the input connection, or input data of a vtkPointDataToCellData object to my vtkUnstructuredGrid object ugrid. <br></li></ol><p>I've been looking at this for a few hours now, any help getting my ugrid to an elevation plot would be appreciated. <br></p><p>Thanks, <br></p><p>nt<br></p><p><br></p></div><div style="text-align:left"><br></div><div style="text-align:left"><br></div></div>