How best to generate line-segments from 6 column CSV data?

Hello,

I’ve looked at existing topics discussing CSV data containing 2 points on a line, but in these other cases, vectors are generated, which then all presumably emanate from the origin. What I would like to do is generate a line segment from point (field 0, field 1, field 2) to (field 3, field 4, field 5). I’ve looked at the generic “Calculator” filter, and that seems good for returning a single coordinate (or vector), but not a two-coordinate entity – or can an array of points be generated? (Which could then be fed into some other filter – which I guess may or may not exist – and generate the line-segment geometry.

Thanks,
Bill

Hi Bill,

My recommendation is the programmable filter. The input would be the vtkTable that you read in from the CSV and the output would be a vtkPolyData. Inside you would loop over the rows of the table and for each row grab pairs of point coordinates from the 6 columns, append both to the polydata’s points and append one vtkLine cell to the outputs cells.

The second CVS reader (the one that woks with a table) and the Helix source example ParaView/Simple ParaView 3 Python Filters - KitwarePublic, except you would be reading from the table instead of writing to it, should help. I am sure there are better VTK python examples out there as well.

hth
Dave

Hi,
sounds like this would solve your problem: https://discourse.paraview.org/t/question-about-draw-multiple-line-segment-in-render-view/12283/2
Cheers,
Venke

Yeah, I read that, but a vector is different than a line segment. I guess we’ll have to bite the bullet and implement it as a Python filter as Dave suggested.

Thanks, Bill