Changes mainly focusing on viewport borders and using text widgets:
- The C++ snippet
ViewportBorderhas been renamed to DrawViewportBorder. It now returns avtkActor2D. Additionally a structViewportBorderSpecifieris provided to specify what lines need to be drawn around the border. This is particularly useful for drawing borders around multiple viewports without duplicating adjacent borders. - The Python snippet DrawViewportBorder has also been refactored to return a
vtkActor2D. It also uses a a dataclass calledViewportBorderSpecifier. - The C++ snippet ReadPolyData has been rewritten to use the C++ filesystem. Note the use of
.generic_string()- really important for Windows! The thinking here is that the C++filesystemis so natural and easy to use, much like Python’spathlibso why not use it.
Of course, examples affected by these changes have been rewritten and … “improved”. Additionally, in the case of the C++ examples, where the viewports were labelled, these labels have been converted to vtkTextWidgets. The advantage of this is that the text widgets stay in the same relative position when the window is resized. To position multiple text widgets, a function is provided called GetTextPositions(...), in C++, and get_text_positions(...), in Python. There is a PythonicAPI snippet GetTextPositions for this.
To get an idea of how these functions are used, please see:
- C++ PlatonicSolids
- PythonicAPI: PlatonicSolids
Here is what the old version looked like:
and this is the new version:
For a more complex example using all the above changes, see:
- C++ ReadAllPolyDataTypesDemo. Also in this example note the use of
vtk_cli11and C++filesystem- so much easier to process command line data and check for existence of files etc. - PythonicAPI: ReadAllPolyDataTypesDemo.
Here is what the old version looked like:
and this is the new version:



