<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>hi! vtk user the program below is TestPLYReadWrite.tcl , when
I run the program ,tcl/tk told me can't find package vtk!!!what is package
vtk???????</FONT></DIV>
<DIV><FONT size=2>can somebody tell me the reason? where can i get the
package????and is there another file format in vtk can write and read color
property of a polydata???????</FONT></DIV>
<DIV><FONT size=2>really thanks!!!! yours fang</FONT></DIV>
<DIV><FONT size=2> </FONT></DIV>
<DIV><FONT size=2>package require vtk<BR>package require
vtkinteraction</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>vtkSphereSource ss<BR> ss SetPhiResolution
10<BR> ss SetThetaResolution 20<BR>vtkSimpleElevationFilter
ele<BR> ele SetInput [ss GetOutput]<BR>vtkPointDataToCellData
pd2cd<BR> pd2cd SetInput [ele GetPolyDataOutput]</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># First way or writing<BR>vtkPLYWriter w<BR> w
SetInput [pd2cd GetPolyDataOutput]<BR> w SetFileName
plyWriter.ply<BR> w SetFileTypeToBinary<BR> w
SetDataByteOrderToLittleEndian<BR> w
SetColorModeToUniformCellColor<BR> w SetColor 255 0 0
<BR> w Write<BR>vtkPLYReader r<BR> r SetFileName
plyWriter.ply<BR> r Update<BR>file delete -force
plyWriter.ply<BR>vtkPolyDataMapper plyMapper<BR> plyMapper SetInput
[r GetOutput]<BR>vtkActor plyActor<BR> plyActor SetMapper
plyMapper</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Second way or writing - it will map through a lookup
table<BR>vtkLookupTable lut<BR> lut Build<BR>vtkPLYWriter
w2<BR> w2 SetInput [pd2cd GetPolyDataOutput]<BR> w2
SetFileName plyWriter.ply<BR> w2 SetFileTypeToBinary<BR>
w2 SetDataByteOrderToLittleEndian<BR> w2
SetColorModeToDefault<BR> w2 SetLookupTable lut<BR> w2
SetArrayName Elevation<BR> w2 SetComponent 0<BR> w2
Write<BR>vtkPLYReader r2<BR> r2 SetFileName
plyWriter.ply<BR> r2 Update<BR>vtkPolyDataMapper
plyMapper2<BR> plyMapper2 SetInput [r2 GetOutput]<BR>vtkActor
plyActor2<BR> plyActor2 SetMapper plyMapper2<BR>
plyActor2 AddPosition 1 0 0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Third way or writing - it will read the previous file with
rgb cell color<BR>vtkPLYReader r3<BR> r3 SetFileName
plyWriter.ply<BR> r3 Update<BR>vtkPLYWriter w3<BR> w3
SetInput [r3 GetOutput]<BR> w3 SetFileName
plyWriter.ply<BR> w3 SetFileTypeToBinary<BR> w3
SetDataByteOrderToLittleEndian<BR> w3
SetColorModeToDefault<BR> w3 SetArrayName RGB<BR> w3
SetComponent 0<BR> w3 Write<BR>vtkPLYReader r4<BR> r4
SetFileName plyWriter.ply<BR> r4 Update<BR>vtkPolyDataMapper
plyMapper3<BR> plyMapper3 SetInput [r4 GetOutput]<BR>vtkActor
plyActor3<BR> plyActor3 SetMapper plyMapper3<BR>
plyActor3 AddPosition 2 0 0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>file delete -force plyWriter.ply</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Create the RenderWindow, Renderer and both
Actors<BR>#<BR>vtkRenderer ren1<BR>vtkRenderWindow renWin<BR>
renWin AddRenderer ren1<BR>vtkRenderWindowInteractor iren<BR>
iren SetRenderWindow renWin</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># Add the actors to the renderer, set the background and
size<BR>#<BR>ren1 AddActor plyActor<BR>ren1 AddActor plyActor2<BR>ren1 AddActor
plyActor3</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>renWin SetSize 325 125 <BR>iren Initialize<BR>renWin
Render<BR>[ren1 GetActiveCamera] Zoom 3.0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>iren AddObserver UserEvent {wm deiconify
.vtkInteract}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2># prevent the tk window from showing up then start the event
loop<BR>wm withdraw .<BR></FONT></DIV></BODY></HTML>