[vtkusers] unstructured grid -> vtkContourFilter

WolfgangZillig wollez at gmx.net
Thu Jan 25 08:15:02 EST 2007


Hello,

I've an unstructured grid which I color through node values which are 
inserted as a scalar and a LookupTable. Now I want to extract contours 
of this graphic (at the moment all is 2D). Can I simply use the 
vtkContourFilter? And what do I have to use as input for the contour 
filter?

Thanks for any help!
Wolfgang


     #partial code:
	aTriangleGrid = vtk.vtkUnstructuredGrid()
	ugrid = vtk.vtkUnstructuredGridReader()
	ugrid.SetFileName(gridname)
	ugrid.Update()
	aTriangleGrid=ugrid.GetOutput()
	# Mapper
	aTriangleMapper = vtk.vtkDataSetMapper()
	aTriangleMapper.SetInput(aTriangleGrid)

     	while nodevals: # reading the node values from file
         	scalars.InsertNextValue(float(nodevals.pop(0)))

     	aTriangleGrid.GetPointData().SetScalars(scalars)
     	colorTransferFunction = vtk.vtkColorTransferFunction()
     	colorTransferFunction.AddRGBPoint(0.5, 0.0, 0.0, 1.0)
     	colorTransferFunction.AddRGBPoint((0.6, 1.0, 1.0, 0.0)
     	colorTransferFunction.AddRGBPoint(0.7, 1.0, 0.0, 0.0)
     	aTriangleMapper.SetLookupTable(colorTransferFunction)
	...




More information about the vtkusers mailing list