JuliaVTK / WriteVTK.jl

Julia package for writing VTK XML files
Other
151 stars 32 forks source link

Support for visualizing 1-dimensional line elements? #104

Open ntm529 opened 2 years ago

ntm529 commented 2 years ago

Is there support within this package for one-dimensional line elements? I am visualizing 1-dimensional line elements within 3D in Paraview, and can't seem to find support for visualizing line elements within the package.

jipolanco commented 2 years ago

Sorry, somehow I missed this issue when it first appeared. If I understand correctly, yes, it is possible to visualise 1-dimensional lines in 3D space. This is done using unstructured (or polydata) grids, see in particular the docs here.

Here is one full example adapted from the docs:

using WriteVTK

points = rand(3, 100)
lines = [MeshCell(PolyData.Lines(), i:(i + 5)) for i in 1:10:90]  # lines connecting 6 points each

vtk_grid("lines", points, lines) do vtk
    vtk["line_id"] = 1:length(lines)
end

In Paraview:

lines

Let me know if this solves the issue.