Importing polylines from text file

In Sim4Life GUI-->Import, there is a .txt file format called "outline file files".
Can this one be used to import a polyline?

I have polylines defined like a list of points:

x1,y1,z1
x2,y2,y2
....
xn,yn,zn

I know this can be done using the Python API, but I was trying to find a way to do it via the GUI.

You would have to define the polylines in a supported file format, e.g. VTK.

To create such a file from Python, you could do something like this:

import vtk

# define points x1,y1,z1, etc.

# add the actual points
points = vtk.vtkPoints()
points.InsertNextPoint(x1,y1,z1)
points.InsertNextPoint(x2,y2,z2)
points.InsertNextPoint(x3,y3,z3)

# define the lines
lines = vtk.vtkCellArray()
lines.InsertNextCell(3) # next line is composed of 3 vertices
lines.InsertCellPoint(0) # vertex 1
lines.InsertCellPoint(1) # vertex 2
lines.InsertCellPoint(2) # vertex 3

# assemble as surface mesh
mesh = vtk.vtkPolyData()
mesh.SetPoints(points)
mesh.SetLines(lines)

# write to file, supported by Sim4Life, Paraview, etc.
writer = vtk.vtkDataSetWriter()
writer.SetInputData(mesh)
writer.SetFileName(r"E:\temp\Foo.vtk")
writer.Write()
Log in to reply