I try to connect points (listed in a table) with a Programmable Filter (script from here):
# the single input table this filter is applied to
table = inputs[0]
# print table properties and metrics just for sure
print("table: ", table)
print("table.GetNumberOfRows() = ", table.GetNumberOfRows())
num_rows = table.GetNumberOfRows()
# usual vtk workflow: fill vtkPoints first
vtkpoints = vtk.vtkPoints()
for i in range(0, num_rows):
vtkpoints.InsertPoint(i,
table.GetValue(i,13).ToFloat(), #x column
table.GetValue(i,12).ToFloat(), #y column
table.GetValue(i,14).ToFloat() #z column
)
vtkpoints.InsertPoint(i,
table.GetValue(0,13).ToFloat(), #x column
table.GetValue(0,12).ToFloat(), #y column
table.GetValue(0,14).ToFloat() #z column
)
output.SetPoints(vtkpoints)
# allocate vtkCell, representing single line
# if more lines, use output.Allocate(N_OF_LINES, 1)
output.Allocate(1, 1)
vtkpolyline = vtk.vtkPolyLine()
vtkpolyline.GetPointIds().SetNumberOfIds(num_rows)
# enumerate points to include in polyline
for i in range(0,num_rows):
vtkpolyline.GetPointIds().SetId(i, i)
# assign vtkPolyLine graphical object to created vtkCell
output.InsertNextCell(vtkpolyline.GetCellType(),
vtkpolyline.GetPointIds())
I get this error message:
Traceback (most recent call last):
- File “”, line 22, in *
- File “”, line 3, in RequestData*
TypeError: ‘NoneType’ object is not subscriptable
ERROR: In vtkTableToPolyData.cxx, line 83
vtkTableToPolyData (0x61dfbabfd540): Failed to locate the columns to use for the point coordinates
ERROR: In vtkExecutive.cxx, line 729
vtkPVCompositeDataPipeline (0x61dfbafa7040): Algorithm vtkTableToPolyData (0x61dfbabfd540) returned failure for request: vtkInformation (0x61dfbc0534c0)
- Debug: Off*
- Modified Time: 1424465*
- Reference Count: 1*
- Registered Events: (none)*
- Request: REQUEST_DATA*
- FROM_OUTPUT_PORT: 0*
- ALGORITHM_AFTER_FORWARD: 1*
- FORWARD_DIRECTION: 0*
Traceback (most recent call last):
- File “”, line 22, in *
- File “”, line 3, in RequestData*
TypeError: ‘NoneType’ object is not subscriptable - File “”, line 6*
- for i in range(0, numPoints-1):*
IndentationError: unexpected indent
Traceback (most recent call last): - File “”, line 22, in *
NameError: name ‘RequestData’ is not defined
Traceback (most recent call last): - File “”, line 22, in *
- File “”, line 3, in RequestData*
TypeError: ‘NoneType’ object is not subscriptable
Can you tell me what goes wrong?
I’m using:
Client Information:
Version: 5.12.1-1101-g3094ac888d
VTK Version: 9.3.0-3270-g66096615a1
Qt Version: 5.15.8
vtkIdType size: 64bits
Embedded Python: On
Python Library Path: /home/emanuel/miniforge3/lib/python3.11
Python Library Version: 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:53:30) [GCC 12.3.0]
Python Numpy Support: Off
Python Matplotlib Support: Off
Python Testing: Off
MPI Enabled: On
Disable Registry: Off
Test Directory:
Data Directory:
SMP Backend: TBB
SMP Max Number of Threads: 12
OpenGL Vendor: AMD
OpenGL Version: 4.6 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
OpenGL Renderer: RENOIR (renoir, LLVM 15.0.7, DRM 3.54, 6.5.0-1023-oem)
Accelerated filters overrides available: No
Connection Information:
Remote Connection: No