[vtkusers] Disconnected 3D lines segments
Oldrich Svec
oldrich.svec at gmail.com
Wed Aug 24 05:22:53 EDT 2011
Hi,
I try to save an array of disconnected 3D line segments using Activiz
.NET. I use the following sample code:
points = vtkPoints.New()
lines = vtkCellArray.New()
id1 = points.InsertNextPoint(0.,0.,0.)
id2 = points.InsertNextPoint(1.,0.,0.)
id3 = points.InsertNextPoint(0.,1.,0.)
id4 = points.InsertNextPoint(0.,0.,1.)
line = vtkLine.New()
line.GetPointIds().InsertNextId id1
line.GetPointIds().InsertNextId id2
lines.InsertNextCell line
line = vtkLine.New()
line.GetPointIds().InsertNextId id3
line.GetPointIds().InsertNextId id4
lines.InsertNextCell line
poly = vtkPolyData.New()
poly.SetPoints points
poly.SetLines lines
vtp = vtkPolyDataWriter.New()
vtp.SetFileName @"D:\\test.vtk"
vtp.SetFileTypeToASCII()
vtp.SetInput poly
vtp.Write()
Those lines are however connected. How to make the two lines disconnected?
PS: I obtain this vtk:
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 4 float
0 0 0 1 0 0 0 1 0
0 0 1
LINES 2 10
4 0 0 0 1
4 0 0 2 3
and I want to obtain this vtk:
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 4 float
0 0 0 1 0 0 0 1 0
0 0 1
LINES 2 6
2 0 1
2 2 3
More information about the vtkusers
mailing list