[vtkusers] vtkParticleReader and vtkGlyph3D

Sgouros, Thomas thomas_sgouros at brown.edu
Tue Apr 3 15:23:06 EDT 2018


Hi Sebastien:

Sorry if that was unclear. The third block of code comes first, and
reader->Update() is called before I use its GetOutput().  In situ, it looks
like this:

 ...
  vtkSmartPointer<vtkParticleReader> reader = vtkSmartPointer<
vtkParticleReader>::New();
  reader->SetFileName ( filePath.c_str() );
  reader->SetDataByteOrderToBigEndian();
  reader->Update();

  // Create anything you want here, we will use a cube for the demo.
  vtkSmartPointer<vtkCubeSource> cubeSource =
      vtkSmartPointer<vtkCubeSource>::New();

  vtkSmartPointer<vtkGlyph3D> glyph3D =  vtkSmartPointer<vtkGlyph3D>::New();
  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
  glyph3D->SetInputData(reader->GetOutput());
  glyph3D->Update();

  ...

I don't think I understand what you mean by the connection instead of the
dataset directly.

Is there a way to peek inside glyph3D and see what it thinks it has?

Thank you,

 -Tom


On Tue, Apr 3, 2018 at 2:53 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> Tom,
>
> Just make sure that reader->Update(); was called before
> glyph3D->SetInputData(reader->GetOutput());
> But it would be better to use the connection instead of the dataset
> directly.
>
> Seb
>
> On Tue, Apr 3, 2018 at 12:27 PM, Sgouros, Thomas <thomas_sgouros at brown.edu
> > wrote:
>
>> Hello all:
>>
>> Can someone help me understand why this code works:
>>
>>   vtkSmartPointer<vtkGlyph3D> glyph3D = vtkSmartPointer<vtkGlyph3D>::N
>> ew();
>>   glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
>>   glyph3D->SetInputData(polydata);
>>   glyph3D->Update();
>>
>> And this does not (nothing displayed)?
>>
>>   vtkSmartPointer<vtkGlyph3D> glyph3D =  vtkSmartPointer<vtkGlyph3D>::N
>> ew();
>>   glyph3D->SetSourceConnection(cubeSource->GetOutputPort());
>>   glyph3D->SetInputData(reader->GetOutput());
>>   glyph3D->Update();
>>
>> The first clip is from https://www.vtk.org/Wiki/
>> VTK/Examples/Cxx/Filtering/Glyph3D
>>
>> The 'reader' object is stolen from the ParticleReader example:
>>
>>   vtkSmartPointer<vtkParticleReader> reader =
>> vtkSmartPointer<vtkParticleReader>::New();
>>   reader->SetFileName ( filePath.c_str() );
>>   reader->SetDataByteOrderToBigEndian();
>>   reader->Update();
>>
>> The program compiles, but no data appears. It works fine (data appears)
>> in the context of the ParticleReader example, where it shows all the data
>> points. But I want to see them as glyphs, not little squares. I seem to be
>> misunderstanding something fundamental, but not seeing what it could be.
>>
>> Many thanks,
>>
>>  -Tom
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> https://vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180403/bf41448e/attachment.html>


More information about the vtkusers mailing list