[vtkusers] How to extract poly data from an unstructured grid

Elvis Dowson elvis.dowson at mac.com
Thu Oct 9 06:49:43 EDT 2008


Hi Dominik,
                          I'm getting the following error in the  
terminal window, when I run the code.

elvis-dowsons-macbook-pro:~ elvis$ wish
% ERROR: In /Users/elvis/Tool/vtk-5.x/src/VTK/Filtering/ 
vtkAlgorithm.cxx, line 739
vtkPainterPolyDataMapper (0x89aa00): Attempt to get output port index  
0 for an algorithm with 0 output ports.

ERROR: In /Users/elvis/Tool/vtk-5.x/src/VTK/Filtering/ 
vtkDemandDrivenPipeline.cxx, line 722
vtkStreamingDemandDrivenPipeline (0x6130f20): Input port 0 of  
algorithm vtkPolyDataNormals(0x61309c0) has 0 connections but is not  
optional.

ERROR: In /Users/elvis/Tool/vtk-5.x/src/VTK/Filtering/ 
vtkDemandDrivenPipeline.cxx, line 722
vtkStreamingDemandDrivenPipeline (0x6130f20): Input port 0 of  
algorithm vtkPolyDataNormals(0x61309c0) has 0 connections but is not  
optional.

ERROR: In /Users/elvis/Tool/vtk-5.x/src/VTK/Filtering/ 
vtkDemandDrivenPipeline.cxx, line 722
vtkStreamingDemandDrivenPipeline (0x6130f20): Input port 0 of  
algorithm vtkPolyDataNormals(0x61309c0) has 0 connections but is not  
optional.

I have looked at the test example for vtkDataSetSurfaceFilter http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/IO/Testing/Tcl/TestXMLUnstructuredGridIO.tcl?root=VTK&content-type=text/plain

What could be causing it?

Best regards,

Elvis Dowson

Example TCL code

# This example shows how to manually construct triangle cell using  
unstructured grids
# and display its surface normal.
#

package require vtk
package require vtkinteraction

# Create an unstructured grids containing a triangle cell.
vtkPoints trianglePoints
   trianglePoints SetNumberOfPoints 3
   trianglePoints InsertPoint 0 0 0 0
   trianglePoints InsertPoint 1 1 0 0
   trianglePoints InsertPoint 2 .5 .5 0
vtkTriangle aTriangle
   [aTriangle GetPointIds] SetId 0 0
   [aTriangle GetPointIds] SetId 1 1
   [aTriangle GetPointIds] SetId 2 2
vtkUnstructuredGrid aTriangleGrid
   aTriangleGrid Allocate 1 1
   aTriangleGrid InsertNextCell [aTriangle GetCellType] [aTriangle  
GetPointIds]
   aTriangleGrid SetPoints trianglePoints
vtkDataSetMapper aTriangleMapper
   aTriangleMapper SetInput aTriangleGrid
vtkActor aTriangleActor
   aTriangleActor SetMapper aTriangleMapper
   aTriangleActor AddPosition 4 0 2
   [aTriangleActor GetProperty] SetDiffuseColor .3 1 .5

# Create an arrow glyph to represent the surface normal for the  
triangle cell.

vtkDataSetSurfaceFilter triangleCellDataSetSurfaceFilter
   triangleCellDataSetSurfaceFilter SetInput aTriangleGrid

vtkPolyDataMapper trianglePolyData
   trianglePolyData SetInputConnection  
[triangleCellDataSetSurfaceFilter GetOutputPort]

vtkPolyDataNormals triangleCellNormals
   # TODO: Fix this
   triangleCellNormals SetInputConnection [trianglePolyData  
GetOutputPort]
   triangleCellNormals ComputePointNormalsOff
   triangleCellNormals ComputeCellNormalsOn

# Specify the shape of the glyph
vtkArrowSource arrowSource

vtkGlyph3D arrowGlyph
   arrowGlyph ScalingOn
   arrowGlyph SetScaleFactor 0.7
   arrowGlyph SetVectorModeToUseNormal
   arrowGlyph SetScaleModeToScaleByVector
   arrowGlyph OrientOn
   arrowGlyph SetSourceConnection [arrowSource GetOutputPort]
   arrowGlyph SetInputConnection [triangleCellNormals GetOutputPort]

vtkDataSetMapper arrowGlyphMapper
   arrowGlyphMapper SetInputConnection [arrowGlyph GetOutputPort]

vtkActor glyphActor
   glyphActor SetMapper arrowGlyphMapper


# Create the usual rendering stuff.
vtkRenderer ren1
vtkRenderWindow renWin
   renWin AddRenderer ren1
   renWin SetSize 300 150
vtkRenderWindowInteractor iren
   iren SetRenderWindow renWin

ren1 SetBackground .1 .2 .4

ren1 AddActor aTriangleActor
ren1 AddActor glyphActor

ren1 ResetCamera
ren1 ResetCameraClippingRange

renWin Render

# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .



On Oct 9, 2008, at 12:43 PM, Dominik Szczerba wrote:

> Sorry, ExtractSurface is Paraview name.
> In vtk it is vtkDataSetSurfaceFilter.
>
> Dominik
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081009/5b966e7b/attachment.htm>


More information about the vtkusers mailing list