<!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>&nbsp;</FONT></DIV>
<DIV><FONT size=2>package require vtk<BR>package require 
vtkinteraction</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>vtkSphereSource ss<BR>&nbsp;&nbsp; ss SetPhiResolution 
10<BR>&nbsp;&nbsp; ss SetThetaResolution 20<BR>vtkSimpleElevationFilter 
ele<BR>&nbsp;&nbsp; ele SetInput [ss GetOutput]<BR>vtkPointDataToCellData 
pd2cd<BR>&nbsp;&nbsp; pd2cd SetInput [ele GetPolyDataOutput]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2># First way or writing<BR>vtkPLYWriter w<BR>&nbsp;&nbsp; w 
SetInput [pd2cd GetPolyDataOutput]<BR>&nbsp;&nbsp; w SetFileName 
plyWriter.ply<BR>&nbsp;&nbsp; w SetFileTypeToBinary<BR>&nbsp;&nbsp; w 
SetDataByteOrderToLittleEndian<BR>&nbsp;&nbsp; w 
SetColorModeToUniformCellColor<BR>&nbsp;&nbsp; w SetColor 255 0 0 
<BR>&nbsp;&nbsp; w Write<BR>vtkPLYReader r<BR>&nbsp;&nbsp; r SetFileName 
plyWriter.ply<BR>&nbsp;&nbsp; r Update<BR>file delete -force 
plyWriter.ply<BR>vtkPolyDataMapper plyMapper<BR>&nbsp;&nbsp; plyMapper SetInput 
[r GetOutput]<BR>vtkActor plyActor<BR>&nbsp;&nbsp; plyActor SetMapper 
plyMapper</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2># Second way or writing - it will map through a lookup 
table<BR>vtkLookupTable lut<BR>&nbsp;&nbsp; lut Build<BR>vtkPLYWriter 
w2<BR>&nbsp;&nbsp; w2 SetInput [pd2cd GetPolyDataOutput]<BR>&nbsp;&nbsp; w2 
SetFileName plyWriter.ply<BR>&nbsp;&nbsp; w2 SetFileTypeToBinary<BR>&nbsp;&nbsp; 
w2 SetDataByteOrderToLittleEndian<BR>&nbsp;&nbsp; w2 
SetColorModeToDefault<BR>&nbsp;&nbsp; w2 SetLookupTable lut<BR>&nbsp;&nbsp; w2 
SetArrayName Elevation<BR>&nbsp;&nbsp; w2 SetComponent 0<BR>&nbsp;&nbsp; w2 
Write<BR>vtkPLYReader r2<BR>&nbsp;&nbsp; r2 SetFileName 
plyWriter.ply<BR>&nbsp;&nbsp; r2 Update<BR>vtkPolyDataMapper 
plyMapper2<BR>&nbsp;&nbsp; plyMapper2 SetInput [r2 GetOutput]<BR>vtkActor 
plyActor2<BR>&nbsp;&nbsp; plyActor2 SetMapper plyMapper2<BR>&nbsp;&nbsp; 
plyActor2 AddPosition 1 0 0</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2># Third way or writing - it will read the previous file with 
rgb cell color<BR>vtkPLYReader r3<BR>&nbsp;&nbsp; r3 SetFileName 
plyWriter.ply<BR>&nbsp;&nbsp; r3 Update<BR>vtkPLYWriter w3<BR>&nbsp;&nbsp; w3 
SetInput [r3 GetOutput]<BR>&nbsp;&nbsp; w3 SetFileName 
plyWriter.ply<BR>&nbsp;&nbsp; w3 SetFileTypeToBinary<BR>&nbsp;&nbsp; w3 
SetDataByteOrderToLittleEndian<BR>&nbsp;&nbsp; w3 
SetColorModeToDefault<BR>&nbsp;&nbsp; w3 SetArrayName RGB<BR>&nbsp;&nbsp; w3 
SetComponent 0<BR>&nbsp;&nbsp; w3 Write<BR>vtkPLYReader r4<BR>&nbsp;&nbsp; r4 
SetFileName plyWriter.ply<BR>&nbsp;&nbsp; r4 Update<BR>vtkPolyDataMapper 
plyMapper3<BR>&nbsp;&nbsp; plyMapper3 SetInput [r4 GetOutput]<BR>vtkActor 
plyActor3<BR>&nbsp;&nbsp; plyActor3 SetMapper plyMapper3<BR>&nbsp;&nbsp; 
plyActor3 AddPosition 2 0 0</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>file delete -force plyWriter.ply</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2># Create the RenderWindow, Renderer and both 
Actors<BR>#<BR>vtkRenderer ren1<BR>vtkRenderWindow renWin<BR>&nbsp;&nbsp;&nbsp; 
renWin AddRenderer ren1<BR>vtkRenderWindowInteractor iren<BR>&nbsp;&nbsp;&nbsp; 
iren SetRenderWindow renWin</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT size=2>renWin SetSize 325 125 <BR>iren Initialize<BR>renWin 
Render<BR>[ren1 GetActiveCamera] Zoom 3.0</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>iren AddObserver UserEvent {wm deiconify 
.vtkInteract}</FONT></DIV>
<DIV>&nbsp;</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>