Some CAD formats support multiple configurations of a model or assembly structure. A configuration is a specific arrangement of the model with respect to its defining hierarchy. For example, parts may be in different positions, have different geometry or be omitted entirely in different configurations.
An example might be a model of a car with the steering wheel on the left side in one configuration and on the right side in a second configuration. A configuration is separate from a CAD view in that it is essentially a “sub-model” within a larger model and not just a set of modified properties on various entities of an existing mode.
Sometimes CAD models containing configurations are also referred to as “multi-model” or “multi-entry” files. Only CATIAV4, SolidWorks, and IDEAS files support configurations though it is also possible to create configurations via the HOOPS Communicator authoring API.
A model with two different configurations, the second one excluding several parts.
When importing a model containing configurations into HOOPS Communicator you have the option to include either all configurations or only a specific one. Without setting any option only the default configuration will be converted.
To import all configurations, use the option
--load_all_configurations true. This will import and convert all configurations of a model and make them accessible in the HOOPS Web Viewer.
Importing a specific configuration
Importing a specific configuration is generally a two-step process as you (or in effect the user interacting with the model) first needs to decide which of the configuration you are interested in. To query the configurations within a model without actually converting all of them you can use the –output_configurations command line option. For example:
When specifying the command line above a file containing a list of all configurations included in the model will be generated which will look something like this:
You can then present this list to the user so they can select the configuration they want to convert. To convert a specific configuration by its name you can use the
-–configuration command line option:
If you use this option in combination with
--load_all_configurations the specified configuration will be used as the default configuration that will be initially visible in the HOOPS Web Viewer.
Each configurations is referenced via a nodeid. To query all configurations in a model you can use the function getCadConfigurations which returns a map associating the name of the configuration with its ID.
var configmap = hwv.model.getCadConfigurations();
Result for the model used above:
To get the id of the default configuration, you can use the getDefaultCadConfiguration function. You can also query the currently active configuration with the getActiveCadConfiguration function.
Activating a configuration
To activate a configuration via the HOOPS Web Viewer UI simply switch to the Configuration tab in the Model Tree UI (which will only appear for models containing configurations) and activate the desired configuration.
To activate a specific configuration programmatically, simply pass its nodeId to the activateCadConfiguration function as seen below.
You can also activate the default Configuration with the activateDefaultCadConfiguration function.
With the configurationActivated callback, you can get notified if the HOOPS Web Viewer has switched to a different configuration (either programmatically or via the UI).
Even if you only specify a particular configuration to be loaded or don’t specificy a configuration at all during import (in which case only the default configuration will be converted) you can still query (and see in the UI) all configurations that have not been converted. However, they will not have any geometry associated with them. As HOOPS Communicator’s intelligent streaming only sends geometry that is visible and active to the client there is often little benefit in only converting a specific communication from a viewing perspective. Converting all configurations will therefore mostly improve conversion time.