- class CompositeAttributes(mapper, dataset)[source]#
This class employs VTK’s flat indexing and allows for accessing both the blocks of a composite dataset as well as the entire composite dataset. If there is only one composite dataset,
A, which contains datasets
[b, c], the indexing would be
[A, b, c].
If there are two composite datasets
[B, C]in one composite dataset,
A, each of which containing three additional datasets
[d, e, f], and
[g, h, i], respectively, then the head node,
A, would be the zero index, followed by the first child,
B, followed by all the children of
[d, e, f]. In data structures, this flat indexing would be known as “Depth-first search” and the entire indexing would be:
[A, B, d, e, f, C, g, h, i]
Note how the composite datasets themselves are capitalized and are accessible in the flat indexing, and not just the datasets.
Add a sphere and a cube as a multiblock dataset to a plotter and then change the visibility and color of the blocks. Note how the index of the cube is
1as the index of the entire multiblock is
>>> import pyvista as pv >>> dataset = pv.MultiBlock([pv.Cube(), pv.Sphere(center=(0, 0, 1))]) >>> pl = pv.Plotter() >>> actor, mapper = pl.add_composite(dataset) >>> mapper.block_attr.color = 'b' >>> mapper.block_attr.opacity = 0.1 >>> mapper.block_attr Composite Block Addr=... Attributes Visible: None Opacity: 0.1 Color: Color(name='blue', hex='#0000ffff', opacity=255) Pickable None
Return a block by its flat index.
Reset the color of all blocks.
Reset the opacities of all blocks.
Reset the pickability of all blocks.
Reset the visibility of all blocks.