=======================
Loading Sketchup Models
=======================

HOOPS Visualize Desktop is able to load SketchUp models using the SketchUp SDK 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 Desktop. If you have a need to access the SketchUp API directly, you need to include the Sketchup SDK itself in your development environment.


Prerequisites
=============

Steps for loading SketchUp models are delineated below:


Step 1: Get SketchUp
--------------------

In order to use the SketchUp functionality, you must obtain the SketchUp libraries *SketchUpAPI.dll* and *SketchUpCommonPreferences.dll* from the developer (these are distributed with the SketchUp SDK) and include them in your build. The supported version of the SketchUp SDK is noted in the :doc:`release notes </general/release_notes/index>`.


Step 2: Include SketchUp Header
-------------------------------

To utilize the SketchUp importer, you need to include *sprk_sketchup.h* in your source.


Import Example
==============

HOOPS Visualize Desktop 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.

.. tabs::

	.. group-tab:: C++
	
		.. literalinclude:: ../../../internals/tests/docs/source/cpp/00740_skp_import.cpp
		   :start-after: //! [import]
		   :end-before: //! [import]
		   
	.. group-tab:: C#

		.. literalinclude:: ../../../internals/tests/docs/source/cs/00740_skp_import.cs
		   :start-after: //! [import]
		   :end-before: //! [import]

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
=====

``Units`` and ``NamedOptions`` are imported as :ref:`user data <prog_guide/0101_database: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:

* inches
* feet
* millimeters
* centimeters
* meters
* undefined

The second one is called "length format" and its value can be one of the following:

* decimal
* architectural
* engineering
* fractional
* undefined


.. _supported_entities:

Supported Entities
==================

HOOPS Visualize Desktop is able to import the following entities from a SketchUp model:

* Group
* Components definition
* Component instance
* Faces
* Edges
* Curves
* Texture
* Material
* Surfaces
* FreeHand curves
* Attributes as user data
* Metadata
* Scenes
* Visibility
* 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 Desktop.
