Layers and Filters
Both filters and layers are mechanisms to group entities together. They are either extracted from a CAD model during import or are created during authoring. They currently can't be created or edited via the HOOPS Web Viewer API.
Filters allow you to combine entities in logical groups often for the purpose of bringing attention to particular components in order to simplify the model or express an idea. That is usually done through highlighting or showing and hiding those filtered components but it is up to you to apply any desired attributes.
To retrieve a list of all the filters available in a CAD model you first call the function getFilters():
The function returns a map of in this case four filters with their ID and name. If you need the name of an individual filter you can call the function getFilterName().
To get a list of all filters that show or hide a given node, use getFiltersWithNode():
In this case node 12 is included in filters with id's 1, 2 and 3.
The function getNodesFromFiltersId() makes it easy to find all nodes for which a set of filters applies. The behavior differs depending on the first filter that is applied. If the first filter has the inclusive flag, all nodes except those in the filter are removed. If the first filter is exclusive, all nodes are kept, and the nodes in the filter are removed. After the first one, all filters are applied in order and nodes are added or removed depending on whether or not they are inclusive.
To make this behavior more clear, see below for a code sample that interprets the results of getNodesFromFiltersId() and selects nodes in case of an inclusive filter and hides the nodes otherwise:
A layer is simply a logical group of objects. The objects are not required to be related in any way. A node can only be linked to one layer.
To retrieve a list of all the layers available in a CAD model you first call the function getLayers():
The function returns a map of &ndash in this case &ndash 33 layers with their ID and name. If you need the name of an individual layer or its id you can call the function getLayerName().
To find out which layer a specific node belongs to call the function getNodeLayerId():
In the case above the node with id 6842 belongs to layer 43. As mentioned before a node can only belong to a single layer.
Retrieving Nodes Per Layer
The function getNodesFromLayer() retrieves all nodes belonging to a given layer:
In this case layer 43 (A215_EXT WALL PANELS) is associated with 2 nodes with id 6842 and 6844. It is up to you to apply attributes (e.g., highlighting, isolating) to those nodes as you see fit.