0

I want to create line segments in Paraview. The format of my input data for each line segment is as: x0,y0,z0,x1,y1,z1,width I have tried using "Line" command like:

    for i in range(600):
      l = Line(Point1=(uniform(0,100),uniform(0,100),0),Point2=(uniform(0,100),uniform(0,100),0))

But, I can't find a way to specify the width to each line segment. Your help will be much appreciated. Best Regards, Hamid Rajabi.

Hamid Rajabi
  • 59
  • 1
  • 8

1 Answers1

1

The Line object does not know about the width. It is only a list of connected points. The width is a parameter of the representation. You can try something like that:

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

for i in range(600):
  l = Line(Point1=(uniform(0,100),uniform(0,100),0),Point2=(uniform(0,100),uniform(0,100),0))
  # get display properties
  line1Display = GetDisplayProperties(l, view=renderView1)

  # Properties modified on line1Display
  line1Display.LineWidth = 4.0
Nico Vuaille
  • 2,310
  • 1
  • 6
  • 14
  • Thank you very very much for your answer. However, since I am new to Paraview, I just faced two new problems: 1- How can I display all lines as "tubes" and all points as "spheres" 2- The number of my data is big and it seems to take the Paraview a long time to show all the lines. Again, thank you very much for your answer. Although, it's not easy to find help online in these matters, it was complete. – Hamid Rajabi Sep 30 '20 at 15:54
  • 1
    If you know how to use the GUI of ParaView, try the `Tool / Python Trace`. It will record the action you perform in the interface and dump it as a python script. It is very handful to discover the API. – Nico Vuaille Oct 01 '20 at 08:11
  • I am using Paraview 5.8.1 and it seems there is not such an option in the section. All in all it would be much more convenient for me to find a "scripting" solution for this. How can I do the same thing( plotting line segments with specific width for each) with a "vtk" code? – Hamid Rajabi Oct 01 '20 at 13:48
  • 1
    My bad, it is `Tools / Start Trace` menu – Nico Vuaille Oct 01 '20 at 14:03