SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Enumerations | Functions
model.h File Reference
#include <SketchUpAPI/common.h>
#include <SketchUpAPI/unicodestring.h>
#include <SketchUpAPI/model/defs.h>

Go to the source code of this file.

Data Structures

struct  SUModelStatistics
 Contains an array of entity counts that can be indexed per entity type. More...
 

Enumerations

enum  SUModelUnits {
  SUModelUnits_Inches, SUModelUnits_Feet, SUModelUnits_Millimeters, SUModelUnits_Centimeters,
  SUModelUnits_Meters
}
 Units options settings. More...
 
enum  SUModelVersion {
  SUModelVersion_SU3, SUModelVersion_SU4, SUModelVersion_SU5, SUModelVersion_SU6,
  SUModelVersion_SU7, SUModelVersion_SU8, SUModelVersion_SU2013, SUModelVersion_SU2014,
  SUModelVersion_SU2015, SUModelVersion_SU2016, SUModelVersion_SU2017, SUModelVersion_SU2018,
  SUModelVersion_SU2019
}
 SketchUp model file format version. More...
 

Functions

SU_RESULT SUModelCreate (SUModelRef *model)
 Creates an empty model object for the purposes of writing a SketchUp document. This model object must be released with SUModelRelease. More...
 
SU_RESULT SUModelCreateFromFile (SUModelRef *model, const char *file_path)
 Creates a model from a SketchUp file on local disk. This model object must be released with SUModelRelease. More...
 
SU_RESULT SUModelCreateFromBuffer (SUModelRef *model, const unsigned char *buffer, size_t buffer_size)
 Creates a model from a SketchUp skp file buffer. This model object must be released with SUModelRelease. More...
 
SU_RESULT SUModelRelease (SUModelRef *model)
 Releases a model object and its associated resources. The root component of the model object and all its child objects must not be released explicitly. More...
 
SU_RESULT SUModelGetEntities (SUModelRef model, SUEntitiesRef *entities)
 Retrieves model entities. More...
 
SU_RESULT SUModelGetNumMaterials (SUModelRef model, size_t *count)
 Retrieves the number of materials in a model object. More...
 
SU_RESULT SUModelGetMaterials (SUModelRef model, size_t len, SUMaterialRef materials[], size_t *count)
 Retrieves all the materials associated with a model object. More...
 
SU_RESULT SUModelAddMaterials (SUModelRef model, size_t len, const SUMaterialRef materials[])
 Adds materials to a model object. Note that the materials cannot be already owned. More...
 
SU_RESULT SUModelGetNumComponentDefinitions (SUModelRef model, size_t *count)
 Retrieves the number of components associated with a model. More...
 
SU_RESULT SUModelGetComponentDefinitions (SUModelRef model, size_t len, SUComponentDefinitionRef definitions[], size_t *count)
 Retrieves the component definitions that define component instances but not groups. More...
 
SU_RESULT SUModelGetNumGroupDefinitions (SUModelRef model, size_t *count)
 Retrieves the number of component definitions that define groups. More...
 
SU_RESULT SUModelGetGroupDefinitions (SUModelRef model, size_t len, SUComponentDefinitionRef definitions[], size_t *count)
 Retrieves the component definitions that define groups. More...
 
SU_RESULT SUModelGetNumImageDefinitions (SUModelRef model, size_t *count)
 Retrieves the number of component definitions that define images. More...
 
SU_RESULT SUModelGetImageDefinitions (SUModelRef model, size_t len, SUComponentDefinitionRef definitions[], size_t *count)
 Retrieves the component definitions that define images. More...
 
SU_RESULT SUModelAddComponentDefinitions (SUModelRef model, size_t len, const SUComponentDefinitionRef components[])
 Adds component definitions to a model object. More...
 
SU_RESULT SUModelRemoveComponentDefinitions (SUModelRef model, size_t len, SUComponentDefinitionRef components[])
 Remove definitions of components, images, and groups from a model object. All component definitions, their geometry, and attached instances will be released. More...
 
SU_RESULT SUModelSaveToFile (SUModelRef model, const char *file_path)
 Saves the model to a file. More...
 
SU_RESULT SUModelSaveToFileWithVersion (SUModelRef model, const char *file_path, enum SUModelVersion version)
 Saves the model to a file using a specific SketchUp version format. More...
 
SU_RESULT SUModelGetCamera (SUModelRef model, SUCameraRef *camera)
 Retrieves the camera of a model object. The returned camera object points to model's internal camera. So it must not be released via SUCameraRelease. More...
 
SU_RESULT SUModelSetCamera (SUModelRef model, SUCameraRef *camera)
 Sets the current camera of a model object. More...
 
SU_RESULT SUModelGetNumScenes (SUModelRef model, size_t *num_scenes)
 Retrieves the number of scene cameras of a model object. More...
 
SU_RESULT SUModelGetNumLayers (SUModelRef model, size_t *count)
 Retrieves the number of layers in a model object. More...
 
SU_RESULT SUModelGetLayers (SUModelRef model, size_t len, SULayerRef layers[], size_t *count)
 Retrieves the layers in a model object. More...
 
SU_RESULT SUModelAddLayers (SUModelRef model, size_t len, const SULayerRef layers[])
 Adds layer objects to a model object. More...
 
SU_RESULT SUModelGetDefaultLayer (SUModelRef model, SULayerRef *layer)
 Retrieves the default layer object of a model object. More...
 
SU_RESULT SUModelRemoveLayers (SUModelRef model, size_t len, SULayerRef layers[])
 Removes all layers provided in the array. The default layer cannot be removed. All entities on the deleted layers will be moved to the default layer. More...
 
SU_RESULT SUModelGetVersion (SUModelRef model, int *major, int *minor, int *build)
 Retrieves the version of a model object. The version consists of three numbers: major version number, minor version number, and the build number. More...
 
SU_RESULT SUModelGetNumAttributeDictionaries (SUModelRef model, size_t *count)
 Retrieves the number of attribute dictionaries of a model object. More...
 
SU_RESULT SUModelGetAttributeDictionaries (SUModelRef model, size_t len, SUAttributeDictionaryRef dictionaries[], size_t *count)
 Retrieves the attribute dictionaries of a model object. More...
 
SU_RESULT SUModelGetAttributeDictionary (SUModelRef model, const char *name, SUAttributeDictionaryRef *dictionary)
 Retrieves the attribute dictionary of a model object that has the given name. If a dictionary with the given name does not exist, one is added to the model object. More...
 
SU_RESULT SUModelIsGeoReferenced (SUModelRef model, bool *is_geo_ref)
 Retrieves whether the model is georeferenced. More...
 
SU_RESULT SUModelGetLocation (SUModelRef model, SULocationRef *location)
 Retrieves the location information of a given model. More...
 
SU_RESULT SUModelGetStatistics (SUModelRef model, struct SUModelStatistics *statistics)
 Calculates the sum of all entities by type in the model. More...
 
SU_RESULT SUModelSetGeoReference (SUModelRef model, double latitude, double longitude, double altitude, bool is_z_value_centered, bool is_on_ocean_floor)
 Georeferences the model. More...
 
SU_RESULT SUModelGetRenderingOptions (SUModelRef model, SURenderingOptionsRef *rendering_options)
 Retrieves the rendering options of a model object. More...
 
SU_RESULT SUModelGetShadowInfo (SUModelRef model, SUShadowInfoRef *shadow_info)
 Retrieves the shadow info of a model object. More...
 
SU_RESULT SUModelGetOptionsManager (SUModelRef model, SUOptionsManagerRef *options_manager)
 Retrieves options manager associated with the model. More...
 
SU_RESULT SUModelGetNorthCorrection (SUModelRef model, double *north_correction)
 Retrieves the angle which will rotate the north direction to the y-axis for a given model. More...
 
SU_RESULT SUModelMergeCoplanarFaces (SUModelRef model)
 Merges all adjacent, coplanar faces in the model. More...
 
SU_RESULT SUModelGetScenes (SUModelRef model, size_t len, SUSceneRef scenes[], size_t *count)
 Retrieves all the scenes associated with a model object. More...
 
SU_RESULT SUModelGetSceneWithName (SUModelRef model, const char *name, SUSceneRef *scene)
 Retrieves the scenes with the given name associated with a model object. More...
 
SU_RESULT SUModelAddScenes (SUModelRef model, size_t len, const SUSceneRef scenes[])
 Adds scenes to a model object. More...
 
SU_RESULT SUModelAddScene (SUModelRef model, int index, SUSceneRef scene, int *out_index)
 Adds scenes to a model object. More...
 
SU_RESULT SUModelGetActiveScene (SUModelRef model, SUSceneRef *scene)
 Retrieves the active scene associated with a model object. More...
 
SU_RESULT SUModelSetActiveScene (SUModelRef model, SUSceneRef scene)
 Sets the provided scene as the active scene. More...
 
SU_RESULT SUModelAddMatchPhotoScene (SUModelRef model, const char *image_file, SUCameraRef camera, const char *scene_name, SUSceneRef *scene)
 Adds a single matched photo scene to a model object. More...
 
SU_RESULT SUModelGetName (SUModelRef model, SUStringRef *name)
 Retrieves the name of a model object. More...
 
SU_RESULT SUModelSetName (SUModelRef model, const char *name)
 Sets the name of a model object. More...
 
SU_RESULT SUModelGetPath (SUModelRef model, SUStringRef *path)
 Retrieves the file path of a model object. More...
 
SU_RESULT SUModelGetTitle (SUModelRef model, SUStringRef *title)
 Retrieves the title of a model object. More...
 
SU_RESULT SUModelGetDescription (SUModelRef model, SUStringRef *description)
 Retrieves the description of a model object. More...
 
SU_RESULT SUModelSetDescription (SUModelRef model, const char *description)
 Sets the description of a model object. More...
 
SU_RESULT SUModelGetUnits (SUModelRef model, enum SUModelUnits *units)
 Returns the units associated with the given model. More...
 
SU_RESULT SUModelGetClassifications (SUModelRef model, SUClassificationsRef *classifications)
 Retrieves the classifications of a model object. More...
 
SU_RESULT SUModelGetAxes (SUModelRef model, SUAxesRef *axes)
 Retrieves the axes of a model object. More...
 
SU_RESULT SUModelGetStyles (SUModelRef model, SUStylesRef *styles)
 Retrieves the styles of a model object. More...
 
SU_RESULT SUModelGetInstancePathByPid (SUModelRef model, SUStringRef pid_ref, SUInstancePathRef *instance_path_ref)
 Retrieves the instance path (including an entity) corresponding to a given persistent id. More...
 
SU_RESULT SUModelGetNumFonts (SUModelRef model, size_t *count)
 Retrieves the number of fonts in a model object. More...
 
SU_RESULT SUModelGetFonts (SUModelRef model, size_t len, SUFontRef fonts[], size_t *count)
 Retrieves all the fonts associated with a model object. More...
 
SU_RESULT SUModelGetDimensionStyle (SUModelRef model, SUDimensionStyleRef *style)
 Retrieves the dimension style associated with a model object. More...
 
SU_RESULT SUModelGetLengthFormatter (SUModelRef model, SULengthFormatterRef *formatter)
 Retrieves length formatter settings from the model. The given length formatter object must have been constructed using SULengthFormatterCreate. It must be released using SULengthFormatterRelease. More...
 
SU_RESULT SUModelGenerateUniqueMaterialName (SUModelRef model, const char *in_name, SUStringRef *out_name)
 Retrieves a unique material name from the model that is based on the provided one. If the provided name is unique it will be returned, otherwise any trailing indices will be replaced by a new index. More...
 
SU_RESULT SUModelFixErrors (SUModelRef model)
 Fixes any errors found in the given model. More...
 
SU_RESULT SUModelOrientFacesConsistently (SUModelRef model, bool recurse_components)
 Updates the faces in the model so that they are oriented consistently. More...
 
SU_RESULT SUModelGetLineStyles (SUModelRef model, SULineStylesRef *line_styles)
 Retrieves line styles from the model. More...
 
SU_RESULT SUModelLoadDefinition (SUModelRef model, const char *filename, SUComponentDefinitionRef *definition)
 Loads a component from a file. More...
 
SU_RESULT SUModelRemoveMaterials (SUModelRef model, size_t len, SUMaterialRef materials[])
 Removes all materials provided in the array. More...
 
SU_RESULT SUModelRemoveScenes (SUModelRef model, size_t len, SUSceneRef scenes[])
 Removes selected scenes from a model. More...
 
SU_RESULT SUModelGetNumAllMaterials (SUModelRef model, size_t *count)
 Retrieves the number of all the materials in a model including those belonging to SUImageRef and SULayerRef. More...
 
SU_RESULT SUModelGetAllMaterials (SUModelRef model, size_t len, SUMaterialRef materials[], size_t *count)
 Retrieves all the materials associated with a model object including those belonging to SUImageRef and SULayerRef. More...
 
SU_RESULT SUModelGetGuid (SUModelRef model, SUStringRef *guid)
 Retrieves the guid of a model object. More...
 

Enumeration Type Documentation

Units options settings.

Enumerator
SUModelUnits_Inches 
SUModelUnits_Feet 
SUModelUnits_Millimeters 
SUModelUnits_Centimeters 
SUModelUnits_Meters 

SketchUp model file format version.

Since
SketchUp 2014, API 2.0
Enumerator
SUModelVersion_SU3 
SUModelVersion_SU4 
SUModelVersion_SU5 
SUModelVersion_SU6 
SUModelVersion_SU7 
SUModelVersion_SU8 
SUModelVersion_SU2013 
SUModelVersion_SU2014 
SUModelVersion_SU2015 
SUModelVersion_SU2016 
SUModelVersion_SU2017 
SUModelVersion_SU2018 
SUModelVersion_SU2019 

Function Documentation

SU_RESULT SUModelAddComponentDefinitions ( SUModelRef  model,
size_t  len,
const SUComponentDefinitionRef  components[] 
)

Adds component definitions to a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of component definitions to add.
[in]componentsThe array of component definitions to add.
Returns
SU_RESULT SUModelAddLayers ( SUModelRef  model,
size_t  len,
const SULayerRef  layers[] 
)

Adds layer objects to a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of layers to add.
[in]layersThe layers to add.
Returns
SU_RESULT SUModelAddMatchPhotoScene ( SUModelRef  model,
const char *  image_file,
SUCameraRef  camera,
const char *  scene_name,
SUSceneRef scene 
)

Adds a single matched photo scene to a model object.

Since
SketchUp 2015, API 3.0
Parameters
[in]modelThe model object.
[in]image_fileThe full path of the image associated with this scene.
[in]cameraThe camera associated with this scene.
[in]scene_nameThe name of the scene to add.
[out]sceneThe scene object created.
Returns
SU_RESULT SUModelAddMaterials ( SUModelRef  model,
size_t  len,
const SUMaterialRef  materials[] 
)

Adds materials to a model object. Note that the materials cannot be already owned.

Parameters
[in]modelThe model object.
[in]lenThe number of material objects to add.
[in]materialsThe array of material objects to add.
Returns
SU_RESULT SUModelAddScene ( SUModelRef  model,
int  index,
SUSceneRef  scene,
int *  out_index 
)

Adds scenes to a model object.

Warning
*** Breaking Change: The behavior of SUModelAddScene changed in SketchUp SDK 2018 API 6.0 to return SU_ERROR_INVALID_ARGUMENT if the given scene name already exists in the model.
Parameters
[in]modelThe model object.
[in]indexWhere in the list to add the scene. -1 to place at the end.
[in]sceneThe scene object to add.
[out]out_indexThe index that the scene was added at.
Returns
SU_RESULT SUModelAddScenes ( SUModelRef  model,
size_t  len,
const SUSceneRef  scenes[] 
)

Adds scenes to a model object.

Warning
*** Breaking Change: The behavior of SUModelAddScenes changed in SketchUp SDK 2018 API 6.0 to return SU_ERROR_INVALID_ARGUMENT if at least one scene name already exists in the model or if there are duplicated names in the scenes array.
Parameters
[in]modelThe model object.
[in]lenThe number of scene objects to add.
[in]scenesThe array of scene objects to add.
Returns
SU_RESULT SUModelCreate ( SUModelRef model)

Creates an empty model object for the purposes of writing a SketchUp document. This model object must be released with SUModelRelease.

Parameters
[out]modelThe model object created.
Returns
SU_RESULT SUModelCreateFromBuffer ( SUModelRef model,
const unsigned char *  buffer,
size_t  buffer_size 
)

Creates a model from a SketchUp skp file buffer. This model object must be released with SUModelRelease.

Since
SketchUp 2017 M2, API 5.2
Parameters
[out]modelThe model object created.
[in]bufferThe SketchUp file buffer.
[in]buffer_sizeThe SketchUp file buffer size.
Returns
SU_RESULT SUModelCreateFromFile ( SUModelRef model,
const char *  file_path 
)

Creates a model from a SketchUp file on local disk. This model object must be released with SUModelRelease.

Parameters
[out]modelThe model object created.
[in]file_pathThe source file path of the SketchUp file. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUModelFixErrors ( SUModelRef  model)

Fixes any errors found in the given model.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
Returns
SU_RESULT SUModelGenerateUniqueMaterialName ( SUModelRef  model,
const char *  in_name,
SUStringRef out_name 
)

Retrieves a unique material name from the model that is based on the provided one. If the provided name is unique it will be returned, otherwise any trailing indices will be replaced by a new index.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
[in]in_nameThe suggested name.
[out]out_nameThe returned name.
Returns
SU_RESULT SUModelGetActiveScene ( SUModelRef  model,
SUSceneRef scene 
)

Retrieves the active scene associated with a model object.

Since
SketchUp 2016, API 4.0
Parameters
[in]modelThe model object.
[out]sceneThe scene object retrieved.
Returns
SU_RESULT SUModelGetAllMaterials ( SUModelRef  model,
size_t  len,
SUMaterialRef  materials[],
size_t *  count 
)

Retrieves all the materials associated with a model object including those belonging to SUImageRef and SULayerRef.

Warning
*** Materials from SUImageRef and SULayerRef should not be applied to any other entity in the model. They are uniquely owned by the image or layer.
Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[in]lenThe number of material objects to retrieve.
[out]materialsThe material objects retrieved.
[out]countThe number of material objects retrieved.
Returns
SU_RESULT SUModelGetAttributeDictionaries ( SUModelRef  model,
size_t  len,
SUAttributeDictionaryRef  dictionaries[],
size_t *  count 
)

Retrieves the attribute dictionaries of a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of attribute dictionaries to retrieve.
[out]dictionariesThe dictionaries retrieved.
[out]countThe number of attribute dictionaries retrieved.
Returns
SU_RESULT SUModelGetAttributeDictionary ( SUModelRef  model,
const char *  name,
SUAttributeDictionaryRef dictionary 
)

Retrieves the attribute dictionary of a model object that has the given name. If a dictionary with the given name does not exist, one is added to the model object.

Parameters
[in]modelThe model object.
[in]nameThe name of the attribute dictionary to retrieve. Assumed to be UTF-8 encoded.
[out]dictionaryThe dictionary object retrieved.
Returns
SU_RESULT SUModelGetAxes ( SUModelRef  model,
SUAxesRef axes 
)

Retrieves the axes of a model object.

Parameters
[in]modelThe model object.
[out]axesThe axes object retrieved.
Returns
SU_RESULT SUModelGetCamera ( SUModelRef  model,
SUCameraRef camera 
)

Retrieves the camera of a model object. The returned camera object points to model's internal camera. So it must not be released via SUCameraRelease.

Parameters
[in]modelThe model object.
[out]cameraThe camera object retrieved.
Returns
SU_RESULT SUModelGetClassifications ( SUModelRef  model,
SUClassificationsRef classifications 
)

Retrieves the classifications of a model object.

Parameters
[in]modelThe model object.
[out]classificationsThe classifications object retrieved.
Returns
SU_RESULT SUModelGetComponentDefinitions ( SUModelRef  model,
size_t  len,
SUComponentDefinitionRef  definitions[],
size_t *  count 
)

Retrieves the component definitions that define component instances but not groups.

Parameters
[in]modelThe model object.
[in]lenThe number of component definitions to retrieve.
[out]definitionsThe component definitions retrieved.
[out]countThe number of component definitions retrieved.
Returns
SU_RESULT SUModelGetDefaultLayer ( SUModelRef  model,
SULayerRef layer 
)

Retrieves the default layer object of a model object.

Parameters
[in]modelThe model object.
[out]layerThe layer object retrieved.
Returns
SU_RESULT SUModelGetDescription ( SUModelRef  model,
SUStringRef description 
)

Retrieves the description of a model object.

Parameters
[in]modelThe model object.
[out]descriptionThe destination of the retrieved description object.
Returns
SU_RESULT SUModelGetDimensionStyle ( SUModelRef  model,
SUDimensionStyleRef style 
)

Retrieves the dimension style associated with a model object.

Since
SketchUp 2017, API 5.0
Parameters
[in]modelThe model object.
[out]styleThe dimension style retrieved.
Returns
SU_RESULT SUModelGetEntities ( SUModelRef  model,
SUEntitiesRef entities 
)

Retrieves model entities.

Parameters
[in]modelThe model object.
[out]entitiesThe entities retrieved.
Returns
SU_RESULT SUModelGetFonts ( SUModelRef  model,
size_t  len,
SUFontRef  fonts[],
size_t *  count 
)

Retrieves all the fonts associated with a model object.

Since
SketchUp 2017, API 5.0
Parameters
[in]modelThe model object.
[in]lenThe number of font objects to retrieve.
[out]fontsThe font objects retrieved.
[out]countThe number of font objects retrieved.
Returns
SU_RESULT SUModelGetGroupDefinitions ( SUModelRef  model,
size_t  len,
SUComponentDefinitionRef  definitions[],
size_t *  count 
)

Retrieves the component definitions that define groups.

Since
SketchUp 2016, API 4.0
Parameters
[in]modelThe model object.
[in]lenThe number of component definitions to retrieve.
[out]definitionsThe component definitions retrieved.
[out]countThe number of component definitions retrieved.
Returns
SU_RESULT SUModelGetGuid ( SUModelRef  model,
SUStringRef guid 
)

Retrieves the guid of a model object.

Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[out]guidThe guid string.
Returns
SU_RESULT SUModelGetImageDefinitions ( SUModelRef  model,
size_t  len,
SUComponentDefinitionRef  definitions[],
size_t *  count 
)

Retrieves the component definitions that define images.

Since
SketchUp 2019, API 7.0
Parameters
[in]modelThe model object.
[in]lenThe number of component definitions to retrieve.
[out]definitionsThe component definitions retrieved.
[out]countThe number of component definitions retrieved.
Returns
SU_RESULT SUModelGetInstancePathByPid ( SUModelRef  model,
SUStringRef  pid_ref,
SUInstancePathRef instance_path_ref 
)

Retrieves the instance path (including an entity) corresponding to a given persistent id.

Parameters
[in]modelThe model object.
[in]pid_refPersistent id of the entity.
[out]instance_path_refInstance path to the entity.
Returns
SU_RESULT SUModelGetLayers ( SUModelRef  model,
size_t  len,
SULayerRef  layers[],
size_t *  count 
)

Retrieves the layers in a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of layers to retrieve.
[out]layersThe layers retrieved.
[out]countThe number of layers retrieved.
Returns
SU_RESULT SUModelGetLengthFormatter ( SUModelRef  model,
SULengthFormatterRef formatter 
)

Retrieves length formatter settings from the model. The given length formatter object must have been constructed using SULengthFormatterCreate. It must be released using SULengthFormatterRelease.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
[out]formatterThe formatter used to retrieve the settings.
Returns
SU_RESULT SUModelGetLineStyles ( SUModelRef  model,
SULineStylesRef line_styles 
)

Retrieves line styles from the model.

Since
SketchUp 2019, API 7.0
Parameters
[in]modelThe model object.
[out]line_stylesThe line styles of the model.
Returns
SU_RESULT SUModelGetLocation ( SUModelRef  model,
SULocationRef location 
)

Retrieves the location information of a given model.

Parameters
[in]modelThe model object.
[out]locationThe location retrieved.
Returns
SU_RESULT SUModelGetMaterials ( SUModelRef  model,
size_t  len,
SUMaterialRef  materials[],
size_t *  count 
)

Retrieves all the materials associated with a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of material objects to retrieve.
[out]materialsThe material objects retrieved.
[out]countThe number of material objects retrieved.
Returns
SU_RESULT SUModelGetName ( SUModelRef  model,
SUStringRef name 
)

Retrieves the name of a model object.

Parameters
[in]modelThe model object.
[out]nameThe destination of the retrieved name object.
Returns
SU_RESULT SUModelGetNorthCorrection ( SUModelRef  model,
double *  north_correction 
)

Retrieves the angle which will rotate the north direction to the y-axis for a given model.

Parameters
[in]modelThe model object.
[out]north_correctionThe north correction angle retrieved (in degrees).
Returns
SU_RESULT SUModelGetNumAllMaterials ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of all the materials in a model including those belonging to SUImageRef and SULayerRef.

Warning
*** Materials from SUImageRef and SULayerRef should not be applied to any other entity in the model. They are uniquely owned by the image or layer.
Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[out]countThe number of material objects available.
Returns
SU_RESULT SUModelGetNumAttributeDictionaries ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of attribute dictionaries of a model object.

Parameters
[in]modelThe model object.
[out]countThe number of attribute dictionaries available.
Returns
SU_RESULT SUModelGetNumComponentDefinitions ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of components associated with a model.

Parameters
[in]modelThe model object.
[out]countThe number of components available.
Returns
SU_RESULT SUModelGetNumFonts ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of fonts in a model object.

Since
SketchUp 2017, API 5.0
Parameters
[in]modelThe model object.
[out]countThe number of font objects available.
Returns
SU_RESULT SUModelGetNumGroupDefinitions ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of component definitions that define groups.

Since
SketchUp 2016, API 4.0
Parameters
[in]modelThe model object.
[out]countThe number of component definitions available.
Returns
SU_RESULT SUModelGetNumImageDefinitions ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of component definitions that define images.

Since
SketchUp 2019, API 7.0
Parameters
[in]modelThe model object.
[out]countThe number of component definitions available.
Returns
SU_RESULT SUModelGetNumLayers ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of layers in a model object.

Parameters
[in]modelThe model object.
[out]countThe number of layers available.
Returns
SU_RESULT SUModelGetNumMaterials ( SUModelRef  model,
size_t *  count 
)

Retrieves the number of materials in a model object.

Parameters
[in]modelThe model object.
[out]countThe number of material objects available.
Returns
SU_RESULT SUModelGetNumScenes ( SUModelRef  model,
size_t *  num_scenes 
)

Retrieves the number of scene cameras of a model object.

Parameters
[in]modelThe model object.
[out]num_scenesThe number of scenes available.
Returns
SU_RESULT SUModelGetOptionsManager ( SUModelRef  model,
SUOptionsManagerRef options_manager 
)

Retrieves options manager associated with the model.

Parameters
[in]modelThe model object.
[out]options_managerThe options manager object retrieved.
Returns
SU_RESULT SUModelGetPath ( SUModelRef  model,
SUStringRef path 
)

Retrieves the file path of a model object.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
[out]pathThe destination of the retrieved path object.
Returns
SU_RESULT SUModelGetRenderingOptions ( SUModelRef  model,
SURenderingOptionsRef rendering_options 
)

Retrieves the rendering options of a model object.

Parameters
[in]modelThe model object.
[out]rendering_optionsThe rendering options object retrieved. This object is owned by the model and must not be explicitly released.
Returns
SU_RESULT SUModelGetScenes ( SUModelRef  model,
size_t  len,
SUSceneRef  scenes[],
size_t *  count 
)

Retrieves all the scenes associated with a model object.

Parameters
[in]modelThe model object.
[in]lenThe number of scene objects to retrieve.
[out]scenesThe scene objects retrieved.
[out]countThe number of scene objects retrieved.
Returns
SU_RESULT SUModelGetSceneWithName ( SUModelRef  model,
const char *  name,
SUSceneRef scene 
)

Retrieves the scenes with the given name associated with a model object.

Parameters
[in]modelThe model object.
[in]nameThe name of scene object to retrieve.
[out]sceneThe scene object retrieved.
Returns
SU_RESULT SUModelGetShadowInfo ( SUModelRef  model,
SUShadowInfoRef shadow_info 
)

Retrieves the shadow info of a model object.

Since
SketchUp 2015, API 3.0
Parameters
[in]modelThe model object.
[out]shadow_infoThe shadow info object retrieved. This object is owned by the model and must not be explicitly released.
Returns
SU_RESULT SUModelGetStatistics ( SUModelRef  model,
struct SUModelStatistics statistics 
)

Calculates the sum of all entities by type in the model.

Parameters
[in]modelThe model object.
[out]statisticsThe SUModelStatistics struct that will be populated with the number of each entity type in the model.
Returns
SU_RESULT SUModelGetStyles ( SUModelRef  model,
SUStylesRef styles 
)

Retrieves the styles of a model object.

Since
SketchUp 2017, API 5.0
Parameters
[in]modelThe model object.
[out]stylesThe styles object retrieved.
Returns
SU_RESULT SUModelGetTitle ( SUModelRef  model,
SUStringRef title 
)

Retrieves the title of a model object.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
[out]titleThe destination of the retrieved title object.
Returns
SU_RESULT SUModelGetUnits ( SUModelRef  model,
enum SUModelUnits units 
)

Returns the units associated with the given model.

Parameters
[in]modelThe model object.
[out]unitsThe units retrieved.
Returns
SU_RESULT SUModelGetVersion ( SUModelRef  model,
int *  major,
int *  minor,
int *  build 
)

Retrieves the version of a model object. The version consists of three numbers: major version number, minor version number, and the build number.

Parameters
[in]modelThe model object.
[out]majorThe major version number retrieved.
[out]minorThe minor version number retrieved.
[out]buildThe build version number retrieved.
Returns
SU_RESULT SUModelIsGeoReferenced ( SUModelRef  model,
bool *  is_geo_ref 
)

Retrieves whether the model is georeferenced.

Since
SketchUp 2017, API 5.0
Parameters
[in]modelThe model object.
[out]is_geo_refThe flag retrieved.
Returns
SU_RESULT SUModelLoadDefinition ( SUModelRef  model,
const char *  filename,
SUComponentDefinitionRef definition 
)

Loads a component from a file.

Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[in]filenameThe full path and filename to a SkethchUp model.
[out]definitionThe component definition that is created after load.
Returns
SU_RESULT SUModelMergeCoplanarFaces ( SUModelRef  model)

Merges all adjacent, coplanar faces in the model.

Parameters
[in]modelThe model object.
Returns
SU_RESULT SUModelOrientFacesConsistently ( SUModelRef  model,
bool  recurse_components 
)

Updates the faces in the model so that they are oriented consistently.

Since
SketchUp 2018, API 6.0
Parameters
[in]modelThe model object.
[in]recurse_componentsOrient components of the model.
Returns
SU_RESULT SUModelRelease ( SUModelRef model)

Releases a model object and its associated resources. The root component of the model object and all its child objects must not be released explicitly.

Parameters
[in]modelThe model object.
Returns
SU_RESULT SUModelRemoveComponentDefinitions ( SUModelRef  model,
size_t  len,
SUComponentDefinitionRef  components[] 
)

Remove definitions of components, images, and groups from a model object. All component definitions, their geometry, and attached instances will be released.

Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[in]lenThe number of component definitions to remove.
[in]componentsThe array of component definitions to remove.
Returns
SU_RESULT SUModelRemoveLayers ( SUModelRef  model,
size_t  len,
SULayerRef  layers[] 
)

Removes all layers provided in the array. The default layer cannot be removed. All entities on the deleted layers will be moved to the default layer.

Since
SketchUp 2019.2 API 7.1
Parameters
[in]modelThe model object.
[in]lenThe length of the array.
[in]layersThe layers to be deleted.
Returns
SU_RESULT SUModelRemoveMaterials ( SUModelRef  model,
size_t  len,
SUMaterialRef  materials[] 
)

Removes all materials provided in the array.

Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[in]lenThe length of the array.
[in]materialsThe materials to be deleted.
Returns
SU_RESULT SUModelRemoveScenes ( SUModelRef  model,
size_t  len,
SUSceneRef  scenes[] 
)

Removes selected scenes from a model.

Since
SketchUp 2019.2, API 7.1
Parameters
[in]modelThe model object.
[in]lenThe number of scenes in the array for removal.
[in]scenesThe scenes to be deleted from the model.
Returns
SU_RESULT SUModelSaveToFile ( SUModelRef  model,
const char *  file_path 
)

Saves the model to a file.

Note
Prior to SketchUp 2019.2, API 7.1 this function did not generate a new model GUID.
Parameters
[in]modelThe model object.
[in]file_pathThe file path destination of the serialization operation. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUModelSaveToFileWithVersion ( SUModelRef  model,
const char *  file_path,
enum SUModelVersion  version 
)

Saves the model to a file using a specific SketchUp version format.

Note
Prior to SketchUp 2019.2, API 7.1 this function did not generate a new model GUID.
Since
SketchUp 2014, API 2.0
Parameters
[in]modelThe model object.
[in]file_pathThe file path destination of the serialization operation. Assumed to be UTF-8 encoded.
[in]versionThe SKP file format version to use when saving.
Returns
SU_RESULT SUModelSetActiveScene ( SUModelRef  model,
SUSceneRef  scene 
)

Sets the provided scene as the active scene.

Since
SketchUp 2016, API 4.0
Parameters
[in]modelThe model object.
[in]sceneThe scene object to be set as the active scene.
Returns
SU_RESULT SUModelSetCamera ( SUModelRef  model,
SUCameraRef camera 
)

Sets the current camera of a model object.

Since
SketchUp 2016, API 4.0
Parameters
[in]modelThe model object.
[in]cameraThe camera object. This reference will become invalid when this function returns.
Returns
SU_RESULT SUModelSetDescription ( SUModelRef  model,
const char *  description 
)

Sets the description of a model object.

Parameters
[in]modelThe model object.
[in]descriptionThe description of the model object. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUModelSetGeoReference ( SUModelRef  model,
double  latitude,
double  longitude,
double  altitude,
bool  is_z_value_centered,
bool  is_on_ocean_floor 
)

Georeferences the model.

Parameters
[in]modelThe model object.
[in]latitudeLatitude of the model.
[in]longitudeLongitude of the model.
[in]altitudeAltitude of the model.
[in]is_z_value_centeredIndicates if z value should be centered.
[in]is_on_ocean_floorIndicates whether the model is on the ocean floor.
Returns
SU_RESULT SUModelSetName ( SUModelRef  model,
const char *  name 
)

Sets the name of a model object.

Parameters
[in]modelThe model object.
[in]nameThe name of the model object. Assumed to be UTF-8 encoded.
Returns