How to add layers and filters

Filters and layers are mechanisms to group entities together. This sample shows how to add filters with layers to SC.
Layers and filters — HOOPS Communicator documentation


  1. Add a later to each node with SC::Store::AssemblyTree::AddFilterToNode or SC::Store::AssemblyTree::SetNodeLayerId
    (If you want to use non-ASCII layer name, you need to set the name as UTF8. )

assembly_tree.AddLayerToNode(child_node, 1, "Layer 1"); assembly_tree.SetNodeLayerId(body_instance_node, 1);

  1. Create a filter with layers
    Create FilterData and add to node using SC::Store::AssemblyTree::AddFilterToNode
    For example, this filter contains only later1 and layer2. When applying this filter, nodes of layer1 and layer2 are displayed.
SC::Store::FilterData scFilterData1;
scFilterData1.isDisplayFilter = true;
scFilterData1.filterName = "Filter 1";
scFilterData1.isActive = true;

SC::Store::LayerFilterItemData&  scFilterLayers1 = scFilterData1.layerFilterItemData;
scFilterLayers1.isInclusive = true;

assembly_tree.AddFilterToNode(root_id, scFilterData1);

sc_store_cubes_sample_layers_filters.cpp (9.4 KB)