Skip to content
Snippets Groups Projects
Commit 7fe4ffb4 authored by David C. Lonie's avatar David C. Lonie Committed by Code Review
Browse files

Merge topic 'empty-array-init' into master

90d75926 Handle empty array initialization in numpy_support.
parents 4f1b4a13 90d75926
No related branches found
No related tags found
No related merge requests found
......@@ -140,6 +140,12 @@ def numpy_to_vtk(num_array, deep=0, array_type=None):
vtk_typecode = get_vtk_array_type(z.dtype)
result_array = create_vtk_array(vtk_typecode)
# Fixup shape in case its empty or scalar.
try:
testVar = shape[0]
except:
shape = (0,)
# Find the shape and set number of components.
if len(shape) == 1:
result_array.SetNumberOfComponents(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment