[vtkusers] extract selected cells of a polyData
-Daniel-
ich_daniel at habmalnefrage.de
Sun Aug 11 10:48:31 EDT 2013
Hi there,
why I can't extract cells from a vtkPolyData?
Please look at the following lines.
....
//More than one vtkPolyData append to one object.
vtkAppendPolyData polys = new vtkAppendPolyData();
polys.AddInputData(poly1);
polys.AddInputData(poly2);
vtkIdFilter ids = new vtkIdFilter();
ids.SetInputConnection(polys.GetOutputPort());
ids.PointIdsOn();
ids.CellIdsOn();
ids.FieldDataOn();
vtkHardwareSelector selector = new vtkHardwareSelector();
selector.SetRenderer(ren);
selector.SetArea(area[0], area[2], area[1], area[3]);
selector.SetFieldAssociation(1);
vtkSelection selection = selector.Select();
// number of nodes are more than 20 in my test
System.out.println("selection has "+selection.GetNumberOfNodes()+" nodes.");
vtkExtractSelection extractSelection = new vtkExtractSelection();
extractSelection.SetInputData(0, polys.GetOutput());
extractSelection.SetInputData(1, selection);
extractSelection.Update();
// =>Then:
vtkUnstructuredGrid extracted = (vtkUnstructuredGrid)
extractSelection.GetOutput();
// *number of cells are 0*?! *why?*
System.out.println( "There are " + extracted.GetNumberOfCells() + " cells in
the selection." );
....
// Therefore next steps are useless.
vtkDataSetMapper mapper = new vtkDataSetMapper();
mapper.SetInputConnection(extractSelection.GetOutputPort());
vtkActor actor = new vtkActor();
actor.SetMapper(mapper);
..
AND
how invert the selection in Java?
In C++ : "vtkSelectionNode::INVERSE()"
But how do I use this in following line in Java?
selectionNode.GetProperties().Set( "selectionInverse()", 1);
--
View this message in context: http://vtk.1045678.n5.nabble.com/extract-selected-cells-of-a-polyData-tp5722620.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list