3D particle (n-body) celestial motion animation

I note that @cory.quammen’s solution assumes that each .txt file has all the data at a particular time step. This is how ParaView assumes data is lain out: one file per time step (at least for simple files like delimited text files).

However, @troywigton’s description sounds like each file has all the timesteps for a single mass, which is not what ParaView is expecting. The easiest solution would be to change the way you write out your text files. In the example you started this post with, you have two files for particles that go through 3 time steps. You would change that to have 3 files like this:

Mass_t001.csv:

0,0,0
0,0,0

Mass_t002.csv:

1,1,1
-1,-1,-1

Mass_t003.csv:

2,2,2
-2,-2,-2

(Note, I changed the filenames to have a .csv extension. ParaView doesn’t really care about the difference between txt and csv, but csv is the more typical extension for a delimited text file using commas for delimiters.)

Loading data from text files that have data for all timesteps is not directly supported by ParaView. This was asked previously — Use a time column of a CSV as timestep — but did not have a good solution.

Here is a solution that might work. First, add a time value column to your data. (You said in your initial description that you could do that.) Second, concatenate all of your files together. If that is not easy when generating, you can do it in *nix/mac with a simple cat command (e.g. cat Mass*.txt > Mass_all.csv). Third, load this file into ParaView and use the Table to Points filter as described by @cory.quammen. This will give you a point for all mass for all time. Finally, use the Threshold filter to extract the masses at the timestep you want. If you want to animate over time, use the animation view panel (ViewAnimation View) to add a track to animate the threshold value.