Loading SketchUp models
HOOPS Visualize is able to load SketchUp models using the SketchUp library. SketchUp functionality is limited to Windows platforms.
All SketchUp-related classes are members of the HPS::Sketchup container class. The SketchUp API is abstracted away from you by HOOPS Visualize. If you have a need to access the SketchUp API directly, you need to include the SDK in your development environment.
Steps for loading SketchUp models are delineated below:
Step 1: Get SketchUp
In order to use the SketchUp functionality, you must obtain the SketchUp library SketchUpAPI.lib from its developer (it is distributed with the SketchUp SDK) and include it in your build. The supported version of the SketchUp SDK is noted in the release notes.
Step 2: Include SketchUp header
To utilize the SketchUp importer, you need to include sprk_sketchup.h in your source.
HOOPS Visualize uses the same basic framework to import SketchUp files as it does for other file types. The main difference is the use of functions from the HPS::Sketchup container class.
In the code sample, SetView has been called. This sets the view's camera to the same setting as the main camera in the model file. The main camera is the camera that was active when the file was saved.
Units and NamedOptions are imported as user data in a segment called "model_information", which will be created as a subsegment of the segment where the model is imported. All NamedOptions will be present as key-value pairs.
There will also be two user data pertaining to units in that segment. One is called "length unit" and its value can be one of the following:
The second one is called "length format" and its value can be one of the following:
HOOPS Visualize is able to import the following entities from a SketchUp model:
- Components definition
- Component instance
- FreeHand curves
- Attributes as user data
- Layers (see below)
Special notes regarding layers
The importer is able to read geometry assigned to a layer, however, layers themselves as a concept are not imported. Thus, associations between layers and geometric data are lost. Visibility settings for geometry which were present on the active layer at the time the model was saved will be used for those entities when loaded by HOOPS Visualize.