HOOPS SketchUp Integration

1.0 Using the SketchUp HIO Component

2.0 Supported Entities

3.0 Input Handler Options

4.0 Integrating Directly With Google SketchUp

5.0 Platform Support

6.0 Required Libraries


1.0 Using the SketchUp HIO Component

Google SketchUp is an easy-to-use 3D modelling application developed by Google that allows users to create, change and share 3D models. These 3D models are saved in the .SKP file format. This format has been gaining widespread adoption within the Engineering community. The SketchUp HIO component lets you import SketchUp files into HOOPS. To use this integration, you must download and install the Google SketchUp SDK.

To use the HOOPS/HIO component for SketchUp, please follow the steps below:

  1. Create a hio_plugins directory in your application's working directory.
  2. Copy the hio_skp.hio file found in <hoops>/bin/<platform>/hio_plugins/hio_skp to the hio_plugins directory created in the previous step.
  3. Ensure that the SketchUp SDK is installed on your system and in your path.
  4. Run your application.

During start-up, when HOOPS/MVO finds the SketchUp HIO component in your application's path, it will perform the following steps:

  1. Load in the necessary SketchUp libraries.
  2. Create the appropriate input handler.
  3. Register this handler and the associated file extensions to the HIOManager.

Once the SketchUp HIO component is successfully loaded, your application will be able import SketchUp files without having to recompile HOOPS. To utilize the extensive services available in the SketchUp toolkit, you must compile against the SketchUp libraries directly and follow the steps described in 3.0 Integrating Directly with Google SketchUp.

1.1 Rebuilding the HIO Component

The SketchUp HIO component was built against a specific version of SketchUp. If you want your application to run against another version of SketchUp, we recommend that you rebuild the SketchUp HIO component with that version of the library. To do so, simply open the hio_skp_vc<version>.vcproj project located in the <hoops>/Dev_Tools/hoops_hio/hio_skp/source. Be sure to set the environment variable SKP_SDK_INSTALL_DIR to point to the root of your SketchUp installation before you begin building. Once the project is built against the correct libraries, an .hio file will be created. Note that you may face some obstacles building against a different version of the SketchUp if interfaces are not compatible with the original libraries that the HIO component was built against.

2.0 Supported Entities

HOOPS supports a variety of SketchUp entities. The following list names the supported entities.

Supported Entities:

  • Group
  • Components definition
  • Component Instance
  • Faces
  • Edges
  • Curves
  • Texture
  • Material
  • Surfaces
  • FreeHand Curves
  • Page/Views
  • Attributes as User Options
  • Metadata

Not Supported:

2.1 SKP Units

When a SKP model is imported into HOOPS, the model units are also imported. This information can be found in the "model_information" segment under the model key as a HOOPS User_Option called "cad units". For example, if the user option value is "cad units =Inches", this means that one unit length of the imported entity is equivalent to one inch. The possible units are as follows:

  • Inches
  • Feet
  • Millimeters
  • Centimeters
  • Meters
  • Undefined Units

HOOPS also supports the above units info via a User_Options called 'LengthUnit' to remain consitent with the orignal SKP units properties. Additionally, HOOPS stores the SKP units 'format' property as a User_Options called 'LengthFormat'. Possible values for 'LengthFormat' are:

  • Decimal
  • Architectural
  • Engineering
  • Fractional

Developers interested in obtaining further details about the original SKP units properties should refer to the SKP format documentation included in the SketchUp SDK available from Google.

 

 

3.0 Input Handler Options

Within HOOPS/MVO, a variety of input options are available to facilitate the importing process. Specifically for SketchUp, you will find HInputHandlerOptions::m_bIgnoreOffLayer and HInputHandlerOptions::m_bIgnoreOffEntity available in HInputHandlerOptions. Both options let you determine if elements that are not visible should be imported into HOOPS. For instance, if the m_bIgnoreOffLayer option is set to true, HOOPS will not import any layers that are not set to visible in the SketchUp file. When the option HInputHandlerOptions::m_bIgnoreOffEntity is true, HOOPS does not import entities whose visibility is off. Note, the default for both options is false. Thus, HOOPS will import all layers and entities whether they are visible or not. The following sample code shows to set options for the HIOUtilitySKP input handler.

HInputHandlerOptions skp_input_options;
// Set m_bIgnoreOffLayer to true so that HOOPS will not import of any layers (and its entities) whose visibility is off in the SketchUp file
skp_input_options.m_bIgnoreOffLayer = true;
//Set m_bIgnoreOffEntity to true so that HOOPS will not import of entities whose visibilty is off in the SketchUp file
skp_input_options.m_bIgnoreOffEntity = true;
skp_input_options.m_pHBaseView = view;.
view->GetModel()->Read(FileName, view, true, &skp_input_options);

In addition to importing entities and layers, you can also import metatdata by setting the HInputHandlerOptions::m_bImportMetadata option to true.

4.0 Integrating Directly with Google SketchUp

If you want to use the full range of the SketchUp SDK services, the SketchUp HIO Component may not be suitable. Instead, you should integrate directly with SketchUp. First, please ensure that the Google SketchUp SDK is installed and in your application's path. To proceed with the integration, please follow these steps below:

  1. Add files HIOUtilitySKP.h/.cpp and HSKPHelper.h/.cpp to your project. These files are located in the Dev_Tools/hoops_hio/hio_skp/source directory of your HOOPS installation. Refer hio_skp_vc80.vcproj in Dev_Tools/hoops_hio/hio_skp/source directory.

  2. Copy following three binaries from SketchUp SDK(SKP_SDK_INSTALL_DIR/sdk/SketchUpReader/lib/msvs2003) to your HOOPS bin directory ($(HOOPS_INSTALL_DIR)/bin/(PLATFORM)).
    • SketchUpReader.dll
    • xerces-c_2_6.dll
    • gdal12.dll
  3. Add following directory paths to your additional include folders' list:
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/hoops_3dgs/source
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/hoops_mvo/source
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/utility/source
  4. Add 'HIO_SKP' in your preprocessor defines.
  5. Add 'hoops_utilsstatd_md.lib hoops_mvo_mgkd.lib hoopsd.lib' as additional dependencies.
  6. Add following directory paths to your additional library folders' list:
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/hoops_3dgs/lib/(PLATFORM)
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/hoops_mvo/lib/(PLATFORM)
    • $(HOOPS_INSTALL_DIR)/Dev_Tools/utility/lib/(PLATFORM)

Once you have completed the above steps, you do not need to rely on the SketchUp HIO component anymore. Please remove the associated .hio file from the hio_plugins directory in your application's working directory. Note that in a direct integration, you must register HIOUtilitySKP via HIOManager::RegisterInputHandler so that the HBaseModel::Read function can recognize that the .skp file format is supported. For more information on HOOPS/MVO file input/output architecture, please see section 4.0 File Input/Output and the I/O Manager of the HOOPS/MVO Programming Guide.

You should now be able to read SKP Files in your application with code similar to this:

HIOUtilitySKP skp_reader;
skp_opt.m_pHBaseView = view;
HFileInputResult result = skp_reader.FileInputByKey("c:\\temp\\myFile.skp", &skp_opt);

5.0 Platform Support

The SketchUp HIO component is supported on the Windows platform for the Visual Studio 2008 and 2010, for 32-bit systems. (The Google SketchUp SDK is currently not supported under 64-bit windows.)

6.0 Required Libraries

For Release 19, the SketchUp HIO component requires version 8 of the Google SketchUp SDK.