[vtkusers] vtkAssembly how to set the opacity?

David Doria daviddoria+vtk at gmail.com
Wed Feb 24 08:45:18 EST 2010


On Wed, Feb 24, 2010 at 5:49 AM, Giancarlo Amati <ilferraresebono at hotmail.it
> wrote:

>  hello VtkUSERS,
>
> is there any way to set the opacity of a vtkAssembly object?
>
> Many thanks.
> Giancarlo
>
>
It doesn't look like you can set properties for the entire assembly, but you
can set the opacity of every object in the assembly like this:


  vtkSmartPointer<vtkAssembly> assembly =
      vtkSmartPointer<vtkAssembly>::New();
  assembly->AddPart(actor1);
  assembly->AddPart(actor2);

  vtkSmartPointer<vtkPropCollection> collection =
    vtkSmartPointer<vtkPropCollection>::New();

  assembly->GetActors(collection);
  collection->InitTraversal();
  for(unsigned int i = 0; i < collection->GetNumberOfItems(); i++)
    {

 vtkActor::SafeDownCast(collection->GetNextProp())->GetProperty()->SetOpacity(0.5);
    }

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100224/3c14d745/attachment.htm>


More information about the vtkusers mailing list