Create spheres from data containing positions and radius

Hello guys,

I’am starting to learn Paraview, and I want to create a lot of spheres from a file (.txt or csv for example) containing positions and radius of the spheres.

I was able to import the file in question, but I don’t know how to do the second step.

Can anyone help me please?

Thank you a lot !

You could begin with ParaviewGuide.pdf like I did.
In my view, creating a lot of spheres requires same amounts of Points in the file, then add certain kind of Filter to convert points to sphere.

Thank you Yoshino for your help,

Yeah, the file contains the positions coordinates of the mass center of spheres, and from it, I want to create the spheres in question.

I will take a look in ParaviewGuide.

Thank you :smiley:

@walid, for more specific answers to your questions, it is always helpful to post some example data so that we can see exactly what the issue is and make sure the solution works with your data.

As @Yoshino suggested, learning the interface of ParaView through the ParaView guide and also the tutorial is a good idea. These and other helpful resources are accessible from ParaView’s Help menu.

Anyway, back to the question at hand. After you load a csv or txt file, you will get a table of data. The steps to what you want are first to convert the table to a 3D representation of points using the Table to Points filter. Then the easiest way to convert these points to spheres is to use the Glyph filter.

Assuming your csv/txt file has at least 4 columns representing the x, y, and z position of each point and the radius of each, the following steps should do what you want.

  1. Open the csv/txt file. Apply.
  2. Add the Table To Points filter.
    1. Set the X Column, Y Column, and Z Column to the respective columns.
    2. Apply.
  3. Close the SpreadSheetView. (Hit the X button in the upper right.)
  4. Add the Glyph filter.
    1. Change Glyph Type to Sphere.
    2. Change Scale Array to the name of the column containing the radius.
    3. Change the Scale Factor to 2. (The spheres are scaled from a reference with radius 0.5.)
    4. Change Glyph Mode to All Points.
    5. Apply.

Here are an example csv file and an example ParaView state file that loads this file and uses to create spheres of the specified positions and radii:

example-points.csv (343 Bytes)
spheres-from-position-radius.pvsm (165.4 KB)

2 Likes

Thank you very much Kenneth,

Your assumption was right ! my file contains 3 colums representing x,y and z position, the column 4 is for the radius.

I just tried your method and it worked perfectly ! that’s exactly what I wanted.

Thank you a lot for you help Kenneth :smiley: