[vtkusers] How to write multiple vtkPolyDataReaders into one single

Spencer Ross Austin sr.austin at btinternet.com
Tue Dec 11 04:34:33 EST 2007


Dear Goodwin Lawlor

 

I am a vtk user and unfortunetly relatively new to vtk, I have search the
archives and your post "How to write multiple vtkPolyData into on single XML
file" is the closest I've come to what I'm trying to do. I have created two
series of vtkPoints and saved them out in the polydata format with
vtkPolyDataWriter, once I have saved them I try to bring them both into a
new program and merge them together using vtkAppendPolyData. Whenever I try
to merge two files or even a file and some already existing PolyData it
won't render them out.

 

I have provided my code below

 

package require vtk

package require vtkinteraction

 

vtkRenderer ren1

vtkRenderWindow renWin

            renWin AddRenderer ren1

vtkRenderWindowInteractor iren

            iren SetRenderWindow renWin

ren1 SetBackground 1.8 1.8 1.8

renWin SetSize 720 720

 

# Inport two PolyData Files.

#

 

vtkPolyDataReader reader1

            reader1 SetFileName
"d:/education/spencer/simulation/servers.txt"

            reader1 update

  

vtkPolyDataReader reader2

            reader2 SetFileName "d:/education/spencer/simulation/points.txt"

            reader2 update

  

# Appended into a single polydata. 

vtkAppendPolyData apd

    apd AddInput [reader1 GetOutput]

    apd AddInput [reader2 GetOutput]

 

vtkSphereSource node

                        node SetRadius 1.25

                        node SetPhiResolution 18

                        node SetThetaResolution 18

 

#create a glyph using 'balls' as the object and 'inputData' for location
with 3D space

vtkGlyph3D glyphPointsServers

            glyphPointsServers SetInputConnection [apd GetOutputPort]

            glyphPointsServers SetSource [node GetOutput]

 

#Assign simple mapper to glyph

vtkPolyDataMapper glyphMapperServers

            glyphMapperServers SetInput [glyphPointsServers GetOutput]

 

#create actor of gylph to enable rendering of 

#primary server's

vtkActor glyphServers

            glyphServers SetMapper glyphMapperServers

            [glyphServers GetProperty] SetColor 255 0 0

            [glyphServers GetProperty] SetSpecular .3

            [glyphServers GetProperty] SetSpecularPower 10

            ren1 AddActor glyphServers

 

renWin Render

 

Thankyou for any help you can provide, 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071211/b68804a5/attachment.htm>


More information about the vtkusers mailing list