I have 3d points in file.I read them :
def points_to_array(pathIn):
pointArray = []
point = []
in_file = open(pathIn, 'r')
for line in in_file.readlines():
split_line = line.strip('\n').split(' ')
for i in range(0, 3):
point.append(float(split_line[i]))
pointArray.append(point)
point = []
return pointArray
And display them this way
import pyvista as pv
plotter = pv.Plotter(window_size=(1600, 1100))
points = points_to_array("C:\points.txt")
npPointArray = np.array(points)
plotter.add_points(npPointArray, color = 'r')
I want to add a line between some points (i.e from point to point as they appear in the file) Can I do this? how?
Here's a simple example that should help. What this example does is create some lines as defined by the
linesarray using thevtkformat of describing cells (basically, the number of points per cell, and then the cell connectivity). In this example, we're just going to create two simple lines, but you could make more, and include as many points per line as you wish.