tkeskita / BVtkNodes

Create and execute VTK pipelines in Blender Node Editor
GNU General Public License v3.0
111 stars 19 forks source link

Can't create vtkContourFilter for unstructured Dataset, maybe vktAssignAttributes unclear #104

Closed markus-ifg closed 8 months ago

markus-ifg commented 10 months ago

Hi there,

I'm not really sure if this is a bug or simply idiocy on my part. I have a unstructured *.vtu which reads in fine. It has a 3D-vector field called "Displacement" and I want to make a contour of the z (3rd) value. This is my node setup: image

I checked with paraview that the contour value really exists and gives a contour, but somehow the result is empty. I suspect my activation using AssignAttributes is either wrong or not working correctly. I have attached the vtu file.

Thanks a lot! pillartest.zip

Edit: I'm using Blender 3.4, but also tried it in 3.6.2 with the same result (except that there the search function in the node editor doesn't seem to work)

tkeskita commented 10 months ago

Hi,

I'm guessing it's not possible to activate only one vector component in vtkAssignAttribute. Try to extract the vector component into a single variable using vtkArrayCalculator, then it should work.

It looks like there is some bug in the node search function, I'll look into it, thanks!

BR, Tuomo

markus-ifg commented 9 months ago

Thanks for the reply! Using the documentation, I was able to calculate the magnitude of displacement. However, accessing a certain component using iHat etc. did not work. :(

Also, is there a more general way to access a certain index of a supplied data array? For example, I also have an additional cell data field called "Extra" with two components and I want to use the first index of that cell field (which I guess is kinda similar to my question of accessing the z-component of the displacement vector field). In the *.vtu file, the first indes of the "Extra" variable has the "ComponentName" "3", so I thought calling "Extra_3" could work, but the result is still an empty set.

tkeskita commented 9 months ago

Hi,

it seems that vtkArrayCalculator syntax has changed. Instead of using Function like U.iHat it is now necessary to use dot(U,iHat) to extract first scalar component from the vector. Please add Custom Code AddVectorArrayName("U") to vtkArrayCalculator. I'll update the docs accordingly, thanks! AFAIK this is the way to access components via nodes, but with Python code in Custom Filter you can access VTK data directly with Python.