[vtkusers] help needed with vtkBoxClipDataSet()
WolfgangZ
wollez at gmx.net
Thu Oct 18 12:48:16 EDT 2007
Hi,
I clip a unstructured mesh with vtkBoxClipDataSet. It displays correct
but extracting information about cells, nodes and boundingbox os wrong.
Here partially the code:
connect2 = vtk.vtkConnectivityFilter()
connect2.SetInput(aTriangleGrid)
### clipping the cells (but triangulation)
boxCut = vtk.vtkBoxClipDataSet()
boxCut.SetBoxClip(0.001,0.005,0.001,0.005,-1,1)
boxCut.SetInputConnection(connect2.GetOutputPort())
boxCut.GenerateClipScalarsOff()
boxCut.Update()
partGrid=vtk.vtkUnstructuredGrid()
partGrid=boxCut.GetOutput()
print partGrid.GetBounds()
the print results in this:
(0.0004729999927803874, 0.0053309998475015163, 0.00048099999548867345,
0.006076000165194273, 0.0, 0.0)
Also when I loop over the nodes "partGrid: by the following code I
only get coordinates in that value range.
npoints_cut=boxCut.GetOutput().GetNumberOfPoints()
for i in xrange(0,npoints_cut):
coord=boxCut.GetOutput().GetPoints().GetPoint(i)
print repr(coord[0]), repr(coord[1])
What I absolutely dont understand is that it displays correctly!
the visualisation is done by:
cutMapper = vtk.vtkDataSetMapper()
cutMapper.SetInput(partGrid)
cutActor = vtk.vtkActor()
cutActor.SetMapper(cutMapper)
cutActor.GetProperty().SetRepresentationToWireframe()
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(300, 300)
iren = vtk.vtkRenderWindowInteractor()
interactor=vtk.vtkInteractorStyleTerrain()
iren.SetInteractorStyle(interactor)
iren.SetRenderWindow(renWin)
ren.SetBackground(1, 1, 1)
ren.AddActor(cutActor)
ren.ResetCamera()
ren.GetActiveCamera().Azimuth(0)
ren.GetActiveCamera().Elevation(0)
ren.ResetCameraClippingRange()
# Render the scene and start interaction.
iren.Initialize()
interactor=vtk.vtkInteractorStyleTerrain()
iren.SetInteractorStyle(interactor)
renWin.Render()
iren.Start()
So any help is welcome!
Regards
Wolfgang
More information about the vtkusers
mailing list