Element sets can be used to specify which elements that should be visible at any given time in a data source within an unstruct grid model.
By creating a DataElementSet and adding DataElementSetItems to this you can filter the model based on any custom property, spacial position in world or window coordinates or any other criteria.
This tutorial shows how to create element sets and how to use the filtering to control which elements to show.
The demo file (30x30x30.vtf) contains a single part geometry with a synthetic scalar result.
Load the file and setup the model specification to show the result. For a more thorough explanation on creating a data source from a file interface and setup the model specification, see the Load VFT tutorial: UnstructGrid: Load model from file and set up model specification
Create the model and a VTF file interface data source. Open the file and set the created data source in the model.
Set the first state as current in the model specification.
Find the id of the first scalar result from the data source's directory.
We use the DataElementSetGenerator class to create the sets. This class provides methods for creating sets from an UnstructGridModel, either by world coordinates (as in this example) or in screen coordinates (with the createFromRegion() method).
First, create a set with all elements above the first plane. We use the FRONT and ON criteria so we will add any element that is either intersected by the plane or in front of the plane.
Then, create a second set with all elements below the second plane. We use the same criteria here.
Do an intersection of the two sets to get the elements that are between the two planes (the elements presents in both sets).
Add the now add the complete DataElementSet to the DataSource of the UnstructGridModel.
Specify to use this set (with id = 1) as our visible set in the ModelSpec of the UnstructGridModel. This will filter the model so only the elements in the set will be visible. When we specify one or more set ids as visible sets, the element filtering will be enabled.
Show all parts as surface mesh so we can see the elements.
The model is ready to use and can be added to the view. Exactly where the view exists depends on the platform and solution. These examples uses Qt and the view is set up in a cee::qt::ViewerWidget.