I want to render a structure of trusses using the Tubes filter. Importantly, each truss has a different (scalar) thickness. My problem is that I cannot select a scalar property for the “Vary Radius” option. (The scalar dropdown menu in Tube properties is empty).
Here’s some sample code that I wrote in Julia
, for a structure composed of 2 trusses, with two unique thicknesses
# [x,y] coordinates of nodes
nodes = [
[0.0 0.0], # node 1
[1.0 0.0], # node 2
[0.5 1.0], # node 3
]
# [nodes] to make up elements
elements = [
[1 2], # element 1
[2 3], # element 2
]
# toy displacement vector
u = [0.0, 0.0, -0.5, -1.0, 0.0, 0.0]
# thickness of each element
t = [0.1, 0.2]
# 3D coordinates of the nodes
points3D = zeros(3, 3)
for (i,n) in enumerate(nodes)
points3D[i,1:2] = n
end
# elements make up grouped coordinates
cells = [MeshCell(PolyData.Lines() , r) for r in eachrow(vcat(elements...))]
# add displacement as a vector to the dofs of each node
uvec = zeros(3,3)
for i in range(1,3)
uvec[i,1] = u[i*2-1]
uvec[i,2] = u[i*2]
end
# add displacement vector
vtk_grid("paraview/testfile", transpose(points3D), cells) do vtk
vtk["displacement"] = transpose(uvec)
vtk["thickness"] = t
end
After loading the file in the ParaView UI (and applying Tube filter), the “Scalars” option is empty, as can be seen below.
One thing I tried is to use cells = [MeshCell(VTKCellTypes.VTK_LINE , r) for r in eachrow(vcat(elements...))]
, so an “unstructured grid” instead of “poly data” (this requires the Extract Surface filter to be applied before the Tube filter. However, this still does not fix the issue.
Looking forward to hearing your insights and suggestions.