[vtkusers] copying GlobalIds through vtkExtractGeometry

Eric Nodwell enodwell at ucalgary.ca
Mon Jul 19 18:11:37 EDT 2010


Hi,

I would like to preserve the attribute array GlobalIds of the PointData on an object being operated on by vtkExtractGeometry .  I am having some difficulty however in determining where to set the Copy Flag for GlobalIds.

According to the comments in the header of vtkDataSetAttributes, and examining the source code, this flag should be set on the destination, not on the source.  So that would suggest code like this:

  // Make an extractor
  vtkExtractGeometry* extractor = vtkExtractGeometry::New();
  extractor->SetImplicitFunction (function);
  extractor->SetInput (data);
 
  // OK, now get the output of the filter because we need to set the Copy Tuples flag on GlobalIds
  vtkDataSet* output = extractor->GetOutput();
  output->GetPointData()->CopyGlobalIdsOn();
  // CopyGlobalIds on output is verifiably ON at this point

  // Run the filter.
  extractor->Update();
  // Oops, CopyGlobalIds on output is verifiably OFF at this point.  No GlobalIds are present on output.

The problem is that the pipeline, during the Update of the vtkExtractGeometry object, calls vtkDataObject::PrepareForNewData, which wipes out any flags that we have set.

So the question is, what is the solution to this catch 22?  How does one set the Copy Tuple flag on the filter output *before* the filter updates, but *after* the PrepareForNewData call?

Thank you for any insight,
Eric Nodwell




More information about the vtkusers mailing list