[vtkusers] reading triangles data

Amy Henderson amy.henderson at kitware.com
Tue Oct 21 11:45:25 EDT 2003


Try using POLYGONS instead of TRIANGLES.  Then for each triangle, first 
specify the number of points (3), and then the point ids in that triangle.

- Amy

At 11:22 AM 10/21/2003 -0400, Patrick Schuska wrote:

>Hi.
>
>I am trying to read triangles data (I took the file from amira) with vtk. 
>But it doesn`t work. There comes allways the same error message.
>
>I think I did something with the header wrong.
>
>It looks like this..
>
>
>
>
>
># vtk DataFile Version 3.0
>
>Triangle Data
>
>
>
>BINARY
>
>
>
>DATASET POLYDATA
>
>
>
>TRIANGLES 3790
>
>
>
>&data&
>
>
>
>can anybody help me??
>
>Thanks, Patrick.
>
>
>
>
>
>error message:
>
>
>
>ERROR: In C:\martink\vtk42\VTK\IO\vtkPolyDataReader.cxx, line 305
>
>vtkPolyDataReader (0x064B5200): Unrecognized keyword: triangles
>
>
>
>my vtk file.
>
>
>
>
>
>package require vtk
>
>package require vtkinteraction
>
>
>
># Create the standard renderer, render window
>
># and interactor
>
>vtkRenderer ren1
>
>vtkRenderWindow renWin
>
>     renWin AddRenderer ren1
>
>vtkRenderWindowInteractor iren
>
>     iren SetRenderWindow renWin
>
>
>
># Create the reader for the data
>
>vtkPolyDataReader reader
>
>#vtkDataReader reader
>
>  reader SetFileName "D:/amira/ear2bsurf.vtk"
>
>
>
>
>
>vtkOutlineFilter outlineData
>
>   outlineData SetInput  [reader GetOutput]
>
>vtkPolyDataMapper mapOutline
>
>   mapOutline SetInput [outlineData GetOutput]
>
>vtkActor outline
>
>   outline SetMapper mapOutline
>
>   [outline GetProperty] SetColor 0 0 0
>
>
>
>  ren1 AddActor outline
>
>
>
>ren1 SetBackground 1 1 1
>
>renWin SetSize 600 600
>
>renWin Render
>
>
>
>proc TkCheckAbort {} {
>
>   set foo [renWin GetEventPending]
>
>   if {$foo != 0} {renWin SetAbortRender 1}
>
>}
>
>renWin AddObserver AbortCheckEvent {TkCheckAbort}
>
>
>
>iren AddObserver UserEvent {wm deiconify .vtkInteract}
>
>iren Initialize
>
>
>
>wm withdraw .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031021/3098d5d6/attachment.htm>


More information about the vtkusers mailing list