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

**URL:** https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713
**Category:** ParaView Support
**Created:** [August 18, 2023, 2:31am UTC](https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713 "2023-08-18T02:31:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [August 18, 2023, 2:31am UTC](https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713/1 "2023-08-18T02:31:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [August 18, 2023, 1:53pm UTC](https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713/2 "2023-08-18T13:53:21Z")

</div>

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](https://www.paraview.org/Wiki/ParaView/Simple_ParaView_3_Python_Filters#:~:text=1Examples%20of%20Filters%20Programmed%20using%20the%20Python%20Programmable,%28Filter%29%207Helix%20%28Source%29%208Producing%20Data%20with%20Timesteps%20%28Source%29), 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

---

<div class="post-metadata">

### Author: ![Venke](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/v/6de8d8/32.png) [@Venke](https://discourse.paraview.org/u/Venke)
#### Post date: [August 21, 2023, 6:27am UTC](https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713/3 "2023-08-21T06:27:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![wsherman](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8797f3/32.png) [@wsherman](https://discourse.paraview.org/u/wsherman)
#### Post date: [August 21, 2023, 6:44pm UTC](https://discourse.paraview.org/t/how-best-to-generate-line-segments-from-6-column-csv-data/12713/4 "2023-08-21T18:44:06Z")

</div>

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
