<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16850" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Try changing your selection array from vtkIntArray 
to vtkIdTypeArray and check that the filters copy the GLOBALIDS (the default is 
not to copy or interpolate).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>John.</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=remywendy@gmail.com href="mailto:remywendy@gmail.com">da xu</A> 
</DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, July 08, 2009 8:12 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] vtkSelection with 
  GLOBALIDS,vtkExtractSelection returns empty</DIV>
  <DIV><BR></DIV>Hey all,<BR><BR>I am trying to extract a section of my datasets 
  using vtkSelection. I currently have a GUI that the user clicks on to select a 
  start and end point using vtkPointPicker, returning the PointID. With a 
  starting POINTID and ending POINTID, i then use a vtkSelection with field type 
  POINT, ContentType GLOBALIDS to extract a dataset containing the points (with 
  vtkSelectionNode's SetSelectionList correctly set I believe). However, I 
  always end up extracting an empty grid.<BR><BR>I can't figure out 
  if:<BR> My vtkSelectionNode is set up incorrectly<BR> I'm using 
  vtkExtractSelection incorrectly.<BR> The vtkPointPicker doesnt actually 
  get GLOBALIDS ?<BR> Missing an update somewhere?<BR><BR>Here is the 
  code:<BR><BR>// Set up vtkSelectionNode<BR>    vtkSelection* 
  selection = vtkSelection::New();<BR>    vtkSelectionNode* 
  selectionNode = vtkSelectionNode::New();<BR>    
  selectionNode->SetFieldType(
  <DIV class="ii gt" id=:91>vtkSelectionNode::POINT);<BR>    
  selectionNode->SetContentType(vtkSelectionNode::GLOBALIDS);<BR><BR>// 
  Populate the selection node with our GLOBALIDS (obtained from 
  vtkPointPicker)<BR>    vtkIntArray* intarray = 
  vtkIntArray::New();<BR>    for (int a = first; a < second; 
  a++)<BR>    {<BR>        
  intarray->InsertNextValue(a);<BR>    }<BR>    
  selectionNode->SetSelectionList(intarray);<BR>    
  selection->AddNode(selectionNode);<BR><BR>// Some setup stuff, Our source 
  data is from a multiblock data set<BR>    vtkMultiBlockDataSet 
  *extractFrom = vtkMultiBlockDataSet::SafeDownCast(<A 
  href="http://m_v_modules.at/" 
  target=_blank>m_v_modules.at</A>(0)->getDataObject());<BR>    
  int nblocks = extractFrom->GetNumberOfBlocks();<BR><BR>    
  vtkGeometryFilter *filter = vtkGeometryFilter::New();<BR>    
  vtkDataSetMapper *mapper = vtkDataSetMapper::New();<BR>    int 
  counter=0;<BR>    vtkExtractSelection* extractSelection = 
  vtkExtractSelection::New();<BR><BR>// Iterate through our datasets (structured 
  grids) and apply vtkExtractSelection to them. Always extracts 
  empty!<BR>    vtkCompositeDataIterator *iter = 
  extractFrom->NewIterator();<BR>    
  iter->InitTraversal();<BR><BR>    int totalpoints = 
  0;<BR>    while 
  (!iter->IsDoneWithTraversal())<BR>    
  {<BR>        vtkDataSet* ds = 
  vtkDataSet::SafeDownCast(iter->GetCurrentDataObject());<BR>    
      if (ds)<BR>        
  {<BR>            const char* name 
  = ds->GetClassName();    /// Temp 
  debugger<BR>            
  extractSelection->RemoveAllInputs();<BR>    
          extractSelection->SetInput(0, 
  ds);    /// Set the vtkDataSet for 
  extraction<BR>            
  extractSelection->SetInput(1, selection);    /// Set the 
  vtkSelection for extraction<BR>        
      vtkDataObject* extracted = 
  extractSelection->GetOutput();<BR>        
      extractSelection->Update();<BR>    
          const char* name2 = 
  extracted->GetClassName();    /// Temp 
  debugger<BR>            
  <BR>            
  vtkUnstructuredGrid* unstructGridTest = 
  vtkUnstructuredGrid::SafeDownCast(extracted);<BR>    
          int ntemp1 = 
  unstructGridTest->GetNumberOfPoints();<BR>    
          totalpoints += 
  ntemp1;<BR>            
  counter++;<BR>        }<BR>    
      iter->GoToNextItem();<BR>    }<BR></DIV>
  <P>
  <HR>
  <P></P>_______________________________________________<BR>Powered by 
  www.kitware.com<BR><BR>Visit other Kitware open-source projects at 
  http://www.kitware.com/opensource/opensource.html<BR><BR>Please keep messages 
  on-topic and check the VTK FAQ at: 
  http://www.vtk.org/Wiki/VTK_FAQ<BR><BR>Follow this link to 
  subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE></BODY></HTML>