Model
The central object for reading and modifying a SketchUp model.
You retrieve a model snapshot with SketchUpApi.getActiveModel().
The snapshot captures the model state at that moment — id, revision,
entities, materials, scenes, selection, and more. If the model changes
(through your operations or the user’s actions), call refresh() to
fetch an updated snapshot with a new revision number.
Every modification you make must occur within performOperation(),
which wraps your changes in a named, undo-able operation. Queries
and read-only methods work outside of operations.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();console.log(model.title, model.revision);
// Query entities at the model rootlet faces = await model.entities.get({ filterBy: { types: ['Face'] }});
// Modify the model in a named operationawait model.performOperation(async op => { op.createEdge(model, [[0,0,0], [100,0,0]]);}, 'Add an edge');
// Refresh to see the new revisionlet updated = await model.refresh();console.log(updated.revision);Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes
The attribute dictionaries attached to the model.
readonlyguid:string
Globally unique identifier for this model.
readonlyid:number
Session-specific numeric identifier for this model instance.
readonlyname:string
Internal name of the model (typically the component definition name if this model was exported as a .skp and re-opened).
options
Section titled “options”
readonlyoptions:ModelOptions
Model-level options (units, geolocation, etc.).
revision
Section titled “revision”
readonlyrevision:number
Increments each time the model changes. Compare revisions to detect whether a snapshot is stale.
readonlytitle:string
The display title shown in the window title bar, based on the saved file name. Empty string if the model is unsaved.
readonlytools:Tools
Helpers for activating built-in SketchUp tools.
readonlyview:View
The active camera and view properties.
Accessors
Section titled “Accessors”entities
Section titled “entities”Get Signature
Section titled “Get Signature”get entities():
CallableEntities
Returns an Entities collection for querying and modifying the
drawing elements at the model root. Use entities.get() to
retrieve faces, edges, groups, etc., optionally filtered by type.
Returns
Section titled “Returns”Methods
Section titled “Methods”findEntities()
Section titled “findEntities()”Call Signature
Section titled “Call Signature”findEntities(
id):Promise<(Entity|undefined)[]>
Bulk retrieval of fresh entity snapshots by ID. Returns undefined
for any entity that no longer exists.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
Array of SketchupIds |
Returns
Section titled “Returns”Promise<(Entity | undefined)[]>
Call Signature
Section titled “Call Signature”findEntities<
T>(snapshot):Promise<(T|undefined)[]>
Bulk re-fetch of entity snapshots. Returns undefined for any
entity that has been deleted since your snapshot was taken.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
Array of existing entity snapshots |
Returns
Section titled “Returns”Promise<(T | undefined)[]>
Call Signature
Section titled “Call Signature”findEntities<
Ref>(ref):Promise<(EntityFor<Ref> |undefined)[]>
Bulk retrieval from entity references. Returns undefined for
any reference whose entity no longer exists.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
Array of entity references |
Returns
Section titled “Returns”Promise<(EntityFor<Ref> | undefined)[]>
Call Signature
Section titled “Call Signature”findEntities(
searchByItems):Promise<(Entity|undefined)[]>
Bulk retrieval of fresh entity snapshots by ID. Returns undefined
for any entity that no longer exists.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
readonly ( |
Returns
Section titled “Returns”Promise<(Entity | undefined)[]>
findEntity()
Section titled “findEntity()”Call Signature
Section titled “Call Signature”findEntity(
id,options):Promise<Entity>
Retrieves a fresh snapshot of an entity by ID, erroring if not found.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The entity’s SketchupId |
|
|
|
|
Pass |
Returns
Section titled “Returns”Promise<Entity>
Throws
Section titled “Throws”Error if the entity no longer exists
Call Signature
Section titled “Call Signature”findEntity(
id,options?):Promise<Entity|undefined>
Retrieves a fresh snapshot of an entity by ID, or undefined if deleted.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The entity’s SketchupId |
|
|
|
|
Optional find settings |
Returns
Section titled “Returns”Promise<Entity | undefined>
Call Signature
Section titled “Call Signature”findEntity<
T>(snapshot,options):Promise<T>
Re-fetches an entity snapshot, erroring if it has been deleted.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
An existing entity snapshot |
|
|
|
Pass |
Returns
Section titled “Returns”Promise<T>
Throws
Section titled “Throws”Error if the entity no longer exists
Call Signature
Section titled “Call Signature”findEntity<
T>(snapshot,options?):Promise<T|undefined>
Re-fetches an entity snapshot, or undefined if it has been deleted.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
An existing entity snapshot |
|
|
|
Optional find settings |
Returns
Section titled “Returns”Promise<T | undefined>
Call Signature
Section titled “Call Signature”findEntity<
Ref>(ref,options):Promise<EntityFor<Ref>>
Retrieves a fresh snapshot from an entity reference, erroring if deleted.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
An entity reference |
|
|
|
Pass |
Returns
Section titled “Returns”Promise<EntityFor<Ref>>
Throws
Section titled “Throws”Error if the entity no longer exists
Call Signature
Section titled “Call Signature”findEntity<
Ref>(ref,options?):Promise<EntityFor<Ref> |undefined>
Retrieves a fresh snapshot from an entity reference, or undefined if deleted.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
An entity reference |
|
|
|
Optional find settings |
Returns
Section titled “Returns”Promise<EntityFor<Ref> | undefined>
getActivePath()
Section titled “getActivePath()”getActivePath():
Promise<ActivePath>
Queries the active editing context (the chain of groups or component instances the user has double-clicked into). Returns an empty path if editing at the model root.
Returns
Section titled “Returns”Promise<ActivePath>
A promise resolving to the active path
SDK 2.17.0 Protocol 1.14.0
getActiveSectionPlanes()
Section titled “getActiveSectionPlanes()”getActiveSectionPlanes(
options?):Promise<readonlySectionPlane[]>
Queries the section planes that are currently active (cutting through the model). Section planes slice geometry to show interior views.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Optional filter to apply |
Returns
Section titled “Returns”Promise<readonly SectionPlane[]>
A promise resolving to the active section planes
SDK 2.29.0 Protocol 1.13.0
getAxes()
Section titled “getAxes()”getAxes():
Promise<Axes>
Queries the origin and orientation of the model’s global axes. These axes define the red, green, and blue direction vectors.
Returns
Section titled “Returns”Promise<Axes>
A promise resolving to the model axes
getBounds()
Section titled “getBounds()”getBounds():
Promise<BoundingBox>
Queries the axis-aligned bounding box that encloses all geometry in the model, in model coordinates.
Returns
Section titled “Returns”Promise<BoundingBox>
A promise resolving to the model’s bounding box
SDK 2.30.0 Protocol 0.7.0
getClassifications()
Section titled “getClassifications()”getClassifications():
Promise<ClassificationSchema[]>
Queries the classification schemas loaded in this model (IFC, gbXML, etc.). Used to annotate components with structured metadata.
Returns
Section titled “Returns”Promise<ClassificationSchema[]>
A promise resolving to the list of schemas
SDK 2.5.0 Protocol 1.3.0
getCRSLocation()
Section titled “getCRSLocation()”getCRSLocation():
Promise<CRSLocation|undefined>
Queries the Coordinate Reference System (CRS) location, which
provides precise geospatial positioning for the model. Returns
undefined if no CRS is set or the platform doesn’t support it.
Returns
Section titled “Returns”Promise<CRSLocation | undefined>
A promise resolving to the CRS location, or undefined
SDK 2.28.0 Protocol 1.25.0
getCurrentMaterial()
Section titled “getCurrentMaterial()”getCurrentMaterial():
Promise<Material|undefined>
Queries the material currently selected in SketchUp’s Materials panel. This is the material that will be painted when the user uses the Paint Bucket tool.
Returns
Section titled “Returns”Promise<Material | undefined>
A promise resolving to the current material, or undefined if none
SDK 2.30.0
getCurrentScene()
Section titled “getCurrentScene()”getCurrentScene():
Promise<Scene|undefined>
Queries the currently active scene (the one whose tab is selected).
Returns undefined if the model has no scenes.
Returns
Section titled “Returns”Promise<Scene | undefined>
A promise resolving to the current scene, or undefined
SDK 2.29.0 Protocol 1.7.0
getCurvesForEdges()
Section titled “getCurvesForEdges()”Retrieves the curves associated with a set of edges. Edges that belong to the same curve share a curve object. Edges not part of any curve are omitted from the result.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Array of edges or edge references |
Returns
Section titled “Returns”Array of curves (Curve or ArcCurve)
getDefinitions()
Section titled “getDefinitions()”getDefinitions():
Promise<readonlyComponentDefinition[]>
Queries all component definitions in the model. Each definition can have multiple instances placed throughout the model.
Returns
Section titled “Returns”Promise<readonly ComponentDefinition[]>
A promise resolving to the array of definitions
SDK 2.30.0
getEntitiesBoundsByIds()
Section titled “getEntitiesBoundsByIds()”getEntitiesBoundsByIds(
ids):Promise<BoundingBox[]>
Bulk queries for entity bounding boxes. Returns the boxes in the same order as the IDs you supplied.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
Array of entity IDs |
Returns
Section titled “Returns”Promise<BoundingBox[]>
A promise resolving to bounding boxes, in request order
SDK 1.8.0 Protocol 0.7.0
getEntityBoundsById()
Section titled “getEntityBoundsById()”getEntityBoundsById(
id):Promise<BoundingBox>
Queries the axis-aligned bounding box for a single entity by ID.
For bulk lookups, prefer getEntitiesBoundsByIds().
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The entity’s SketchupId |
Returns
Section titled “Returns”Promise<BoundingBox>
A promise resolving to the entity’s bounding box
SDK 1.8.0 Protocol 0.7.0
getFacesAreas()
Section titled “getFacesAreas()”getFacesAreas(
faces,transformLike?):Promise<[Face|FaceRef,number][]>
Bulk calculates face areas, accounting for openings cut by glued
components (like windows or doors). More accurate than Face.area
when components cut openings.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Array of faces or face references |
|
|
|
Optional transformation to apply |
Returns
Section titled “Returns”Promise<[Face | FaceRef, number][]>
Array of [face, area in square inches] pairs
SDK 2.25.0 Protocol 1.22.0
getFaceUVs()
Section titled “getFaceUVs()”getFaceUVs(
requests):Promise<FaceBulkResponse>
Bulk calculates UV texture coordinates for multiple faces and
points. Much faster than calling Face.getUVs() repeatedly.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Array of [face, UV request] pairs |
Returns
Section titled “Returns”Promise<FaceBulkResponse>
Array of [face, UV response] pairs
SDK 2.25.0 Protocol 1.22.0
getMaterials()
Section titled “getMaterials()”getMaterials():
Promise<Materials>
Queries all materials defined in the model. The returned Materials collection provides fast lookups by name or ID and lets you iterate over all materials.
Returns
Section titled “Returns”Promise<Materials>
A promise resolving to the materials collection
SDK 2.30.0
getNumberOfFaces()
Section titled “getNumberOfFaces()”getNumberOfFaces():
Promise<number>
Counts the total number of faces in the model, including faces inside component instances (expanded count). This matches the count shown in SketchUp’s Entity Info.
Returns
Section titled “Returns”Promise<number>
A promise resolving to the total face count
SDK 2.30.0
getRenderingOptions()
Section titled “getRenderingOptions()”getRenderingOptions():
Promise<RenderingOptions>
Queries the rendering options (edge display, materials, transparency, X-ray mode, etc.) that control how SketchUp displays the model.
Returns
Section titled “Returns”Promise<RenderingOptions>
A promise resolving to the rendering options
SDK 2.24.0 Protocol 1.21.0
getScenes()
Section titled “getScenes()”getScenes(
options?):Promise<Scene[]>
Queries all scenes (saved camera positions and settings) in the model. Scenes appear as tabs in SketchUp and can be animated or exported.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Optional filter to apply to the list |
Returns
Section titled “Returns”Promise<Scene[]>
A promise resolving to the array of scenes
SDK 2.29.0 Protocol 1.7.0
getSelectedStyle()
Section titled “getSelectedStyle()”getSelectedStyle():
Promise<SelectedStyle>
Queries the currently active style and its info (name, whether it’s been modified, etc.). This is the style applied to the model.
Returns
Section titled “Returns”Promise<SelectedStyle>
A promise resolving to the selected style
SDK 2.26.0 Protocol 1.23.0
getSelection()
Section titled “getSelection()”getSelection(
options?):Promise<Selection>
Queries the entities currently selected in SketchUp. You can optionally filter the selection server-side (e.g., only faces) to reduce data transfer.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Optional filter to apply server-side |
Returns
Section titled “Returns”Promise<Selection>
A promise resolving to the selection
SDK 2.14.0 Protocol 1.11.0
getSelectionMetadata()
Section titled “getSelectionMetadata()”getSelectionMetadata(
options?):Promise<SelectionMetadata>
Queries selection metadata (count, flags) without fetching the
actual entity snapshots. Much faster than getSelection() when
you only need to know what’s selected, not the full entities.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Optional filter to apply server-side |
Returns
Section titled “Returns”Promise<SelectionMetadata>
A promise resolving to the selection metadata
SDK 2.14.0 Protocol 1.11.0
getShadowInfo()
Section titled “getShadowInfo()”getShadowInfo():
Promise<ShadowInfo>
Queries the model’s shadow settings (time, date, location, shadow display state). Used to control how SketchUp renders shadows and sunlight.
Returns
Section titled “Returns”Promise<ShadowInfo>
A promise resolving to the shadow info
getSkp()
Section titled “getSkp()”getSkp(
options?):Promise<string>
Exports the model as a .skp file and returns it as a base64-encoded data URL. You can write this to disk, send it over a network, or trigger a browser download.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
{ |
Pass |
|
|
|
‐ |
Returns
Section titled “Returns”Promise<string>
A data URL: data:application/vnd.sketchup.skp;base64,...
SDK 2.30.3 Protocol 1.8.0
getStyles()
Section titled “getStyles()”getStyles(
options?):Promise<Style[]>
Queries all styles available in the model. Styles control edge, face, and background rendering settings.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Optional filter to apply |
Returns
Section titled “Returns”Promise<Style[]>
A promise resolving to the array of styles
SDK 2.26.0 Protocol 1.23.0
getTagManager()
Section titled “getTagManager()”getTagManager():
Promise<TagManager>
Queries the tag manager, which provides access to all tags (formerly called layers) and the active tag. Tags control visibility and can be assigned to entities.
Returns
Section titled “Returns”Promise<TagManager>
A promise resolving to the tag manager
invertSelection()
Section titled “invertSelection()”invertSelection():
Promise<SelectionMetadata>
Inverts the selection within the current editing context: previously selected entities become unselected and vice versa. This only affects entities in the current active path. Not an undo-able operation.
Returns
Section titled “Returns”Promise<SelectionMetadata>
Metadata for the selection after inversion
SDK 2.14.0 Protocol 1.11.0
observeActivePath()
Section titled “observeActivePath()”observeActivePath(
callback):ObserverHandle
Subscribes to changes in the active editing context. Your callback fires immediately with the current path, then again whenever the user double-clicks into or out of a group or component.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
Called with the new active path |
Returns
Section titled “Returns”An observer handle; call .close() to unsubscribe
SDK 2.30.0 Protocol 1.14.0
observeOptionsChanges()
Section titled “observeOptionsChanges()”observeOptionsChanges(
callback):ObserverHandle
Subscribes to changes in the model’s options (units, location, etc.). Your callback fires whenever the user changes a setting.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
Called with the updated options |
Returns
Section titled “Returns”An observer handle; call .close() to unsubscribe
SDK 2.30.0
observeRenderingOptions()
Section titled “observeRenderingOptions()”observeRenderingOptions(
callback):ObserverHandle
Subscribes to changes in the rendering options. Your callback fires whenever the user toggles edges, materials, or other display settings.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
Called with the change event |
Returns
Section titled “Returns”An observer handle; call .close() to unsubscribe
SDK 2.30.0 Protocol 1.21.0
observeSelectionMetadata()
Section titled “observeSelectionMetadata()”observeSelectionMetadata(
callback,options?):ObserverHandle
Subscribes to changes in the selection. For performance, only
metadata (count, flags) is sent. If you need the actual entities,
call getSelection() on the metadata object.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
Called with updated selection metadata |
|
|
Optional server-side filter |
Returns
Section titled “Returns”An observer handle; call .close() to unsubscribe
SDK 2.30.0 Protocol 1.11.0
performOperation()
Section titled “performOperation()”performOperation<
T>(instructions,name,options?):Promise<T>
Performs a named, undo-able operation on the model. All modifications to the model (adding entities, editing geometry, changing materials) must occur within an operation. If the instructions function throws, the operation is automatically aborted and the model is rolled back.
Note that if the operation makes no changes, the model’s revision number will not increment.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
Sync or async function that performs the changes |
|
|
|
Name shown in SketchUp’s undo stack |
|
|
Optional operation settings |
Returns
Section titled “Returns”Promise<T>
A promise resolving to the value your instructions return
redo()
Section titled “redo()”redo():
Promise<void>
Re-does the most recently undone operation. Equivalent to the user pressing Cmd+Shift+Z (Mac) or Ctrl+Y (Windows).
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the redo completes
SDK 1.7.0 Protocol 0.6.0
refresh()
Section titled “refresh()”refresh():
Promise<Model>
Re-fetches a fresh snapshot of this model. The new snapshot will have an updated revision number if the model has changed since you last retrieved it. Use this after operations or when you suspect the user has modified the model.
Returns
Section titled “Returns”Promise<Model>
A promise resolving to a new model snapshot
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();await model.performOperation( () => {}, 'Modify the model');let updated = await model.refresh();console.log(updated.revision);setCurrentScene()
Section titled “setCurrentScene()”setCurrentScene(
scene):Promise<void>
Activates the specified scene, switching the camera and settings to match that scene’s saved state. This is a view operation and does not require an operation wrapper.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The scene to activate |
Returns
Section titled “Returns”Promise<void>
SDK 2.29.0 Protocol 1.7.0
startOperation()
Section titled “startOperation()”startOperation(
name,options?):Promise<Operation>
Starts an operation manually, requiring you to call commit() or
abort() explicitly. Prefer performOperation() instead — it
handles commit/abort automatically and is safer.
Note that only one operation can be open at a time.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
Name shown in SketchUp’s undo stack |
|
|
Optional operation settings |
Returns
Section titled “Returns”Promise<Operation>
A promise resolving to the operation handle
- Model.performOperation for the recommended approach
- Operation.commit
- Operation.abort
toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string
undo()
Section titled “undo()”undo():
Promise<void>
Undoes the most recent operation in the model’s undo stack. Equivalent to the user pressing Cmd+Z (Mac) or Ctrl+Z (Windows).
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the undo completes
SDK 1.7.0 Protocol 0.6.0
updateRenderingOptions()
Section titled “updateRenderingOptions()”updateRenderingOptions(
update):Promise<void>
Updates one or more rendering options. If any key or value is invalid, this throws an error — but other valid updates in the same call will have already been applied.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
Key-value pairs of rendering options to update |
Returns
Section titled “Returns”Promise<void>
SDK 2.24.0 Protocol 1.21.0
Throws
Section titled “Throws”Error if any key or value is invalid
updateSelection()
Section titled “updateSelection()”updateSelection(
drawingElements,updateType):Promise<SelectionMetadata>
Changes which entities are selected in SketchUp. Pass 'add'
to extend the current selection, 'remove' to deselect specific
entities, 'replace' to clear everything and select only the
given entities, or 'toggle' to flip each entity’s selected
state. This is not an undo-able operation — it directly modifies
the UI selection.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”Promise<SelectionMetadata>
Metadata for the selection after the update
SDK 2.14.0 Protocol 1.11.0
Deprecated
Section titled “Deprecated”bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
Promise<BoundingBox>
SDK 1.8.0 Protocol 0.7.0
Returns
Section titled “Returns”Promise<BoundingBox>
classifications
Section titled “classifications”Get Signature
Section titled “Get Signature”get classifications():
Promise<readonlyClassificationSchema[]>
SDK 2.5.0 Protocol 1.3.0
Returns
Section titled “Returns”Promise<readonly ClassificationSchema[]>
activeSectionPlanes()
Section titled “activeSectionPlanes()”activeSectionPlanes(
filter?):Promise<readonlySectionPlane[]>
Query to find only the active section planes (protocol)
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
when provided, filters the list of active section planes |
Returns
Section titled “Returns”Promise<readonly SectionPlane[]>
a promise containing a snapshot of the active section planes
SDK 2.16.0 Protocol 1.13.0
componentInstances()
Section titled “componentInstances()”componentInstances(
filter?):Promise<readonlyComponentInstance[]>
Typesafe query to get all the component instances at the root of the model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly ComponentInstance[]>
a promise containing the array of component instances
components()
Section titled “components()”components():
Promise<readonlyComponentDefinition[]>
Query to get all the component (definitions) in the model
Returns
Section titled “Returns”Promise<readonly ComponentDefinition[]>
a promise containing the components
constructionLines()
Section titled “constructionLines()”constructionLines(
filter?):Promise<readonlyConstructionLine[]>
Query to find the constructionLines
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
Returns
Section titled “Returns”Promise<readonly ConstructionLine[]>
a promise containing a snapshot of the constructionLines
SDK 2.7.0 Protocol 1.5.0
constructionPoints()
Section titled “constructionPoints()”constructionPoints(
filter?):Promise<readonlyConstructionPoint[]>
Query to find the constructionPoints
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
Returns
Section titled “Returns”Promise<readonly ConstructionPoint[]>
a promise containing a snapshot of the constructionPoints
SDK 2.7.0 Protocol 1.5.0
currentMaterial()
Section titled “currentMaterial()”currentMaterial():
Promise<Material|undefined>
Returns
Section titled “Returns”Promise<Material | undefined>
curves()
Section titled “curves()”Gets the curves for root of this model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional filter to apply to the list of curves |
Returns
Section titled “Returns”Promise<readonly (ArcCurve | Curve)[]>
SDK 2.23.0 Protocol 1.20.0
dimensionLinears()
Section titled “dimensionLinears()”dimensionLinears(
filter?):Promise<readonlyDimensionLinear[]>
Query to find the dimension linear entities for this group
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly DimensionLinear[]>
a promise containing a snapshot of the dimension linear entities for this group
SDK 2.23.0 Protocol 1.20.0
dimensionRadials()
Section titled “dimensionRadials()”dimensionRadials(
filter?):Promise<readonlyDimensionRadial[]>
Query to find the dimension radial entities for this group
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly DimensionRadial[]>
a promise containing a snapshot of the dimension radial entities for this group
SDK 2.23.0 Protocol 1.20.0
edges()
Section titled “edges()”edges(
filter?):Promise<readonlyEdge[]>
Typesafe query to get all the edges at the root of the model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly Edge[]>
a promise containing the array of edges
export()
Section titled “export()”export(
options?):Promise<string>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
{ |
|
|
|
Returns
Section titled “Returns”Promise<string>
SDK 2.11.0 Protocol 1.8.0
faces()
Section titled “faces()”faces(
filter?):Promise<readonlyFace[]>
Typesafe query to get all the faces at the root of the model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly Face[]>
a promise containing the array of faces
findCurvesForEdges()
Section titled “findCurvesForEdges()”Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”findEntitiesById()
Section titled “findEntitiesById()”findEntitiesById(
ids):Promise<(Entity|undefined)[]>
Query to find an entities by an array of ids
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
the array of entity ids |
Returns
Section titled “Returns”Promise<(Entity | undefined)[]>
a promise with an array or entities in the order requested. If an entity is not found the array entry will be undefined.
findEntityById()
Section titled “findEntityById()”findEntityById(
id):Promise<Entity|undefined>
Query to find an entity by id
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
the entity id |
Returns
Section titled “Returns”Promise<Entity | undefined>
a promise with the entity, or undefined if no matching entity was found
findEntityWithTypeById()
Section titled “findEntityWithTypeById()”findEntityWithTypeById<
Type>(id,expectedType):Promise<EntityFromSketchupEntityEnum<Type> |undefined>
Utility to find an entity and validate the type. Usually called internally.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
the entity id |
|
|
|
|
the expected type of the entity |
Returns
Section titled “Returns”Promise<EntityFromSketchupEntityEnum<Type> | undefined>
a promise with the entity or undefined
Throws
Section titled “Throws”Error if the type of the entity from SketchUp does not match the expected type
getActiveSectionPlane()
Section titled “getActiveSectionPlane()”getActiveSectionPlane():
Promise<SectionPlane|undefined>
Gets the active section plane for the given entities container.
Returns
Section titled “Returns”Promise<SectionPlane | undefined>
A promise resolving to the SectionPlaneRef or undefined if none is active
SDK 2.16.0 Protocol 1.13.0
groups()
Section titled “groups()”groups(
filter?):Promise<readonlyGroup[]>
Typesafe query to get all the groups at the root of the model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly Group[]>
a promise containing the array of groups
images()
Section titled “images()”images(
filter?):Promise<readonlyImageEntity[]>
Query to find the images at the root of this model
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
|
|
optional additional filtering to apply |
Returns
Section titled “Returns”Promise<readonly ImageEntity[]>
a promise containing a snapshot of the images for this model
SDK 2.21.0 Protocol 1.18.0
materials()
Section titled “materials()”materials():
Promise<Materials>
Returns
Section titled “Returns”Promise<Materials>
numberOfFaces()
Section titled “numberOfFaces()”numberOfFaces():
Promise<number>
Returns
Section titled “Returns”Promise<number>
sectionPlanes()
Section titled “sectionPlanes()”sectionPlanes(
filter?):Promise<readonlySectionPlane[]>
Query to find the sectionPlanes
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
Returns
Section titled “Returns”Promise<readonly SectionPlane[]>
a promise containing a snapshot of the sectionPlanes
SDK 2.16.0 Protocol 1.13.0
snaps()
Section titled “snaps()”snaps(
filter?):Promise<readonlySnap[]>
Query to find the snaps
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
Returns
Section titled “Returns”Promise<readonly Snap[]>
a promise containing a snapshot of the snaps
SDK 2.20.0 Protocol 1.17.0
streamActivePath()
Section titled “streamActivePath()”streamActivePath(
callback):ObserverHandle
Streams changes to the active path on the current model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
callback that gets invoked whenever the active path changes. NOTE: This will be invoked immediately |
Returns
Section titled “Returns”a closable stream handle
SDK 2.17.0 Protocol 1.14.0
streamOptionsChanges()
Section titled “streamOptionsChanges()”streamOptionsChanges(
callback):ObserverHandle
Stream the changes to the model options
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
invoked whenever there is a change to the options in the model |
Returns
Section titled “Returns”a stream handle, used to cancel the stream.
streamRenderingOptions()
Section titled “streamRenderingOptions()”streamRenderingOptions(
callback):ObserverHandle
Streams changes to the rendering options associated with this model
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
( |
Returns
Section titled “Returns”SDK 2.24.0 Protocol 1.21.0
streamSelectionMetadata()
Section titled “streamSelectionMetadata()”streamSelectionMetadata(
callback,options?):ObserverHandle
Streams changes to the selection metadata in SketchUp.
NOTE this does not give you direct access to the selected entities for performance reasons. If you need to pull all the selected entities based on this metadata change, call getSelection on the metadata object
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
( |
callback invoked when there is a change to the selection. |
|
|
when supplied this provides server side filtering to the values returned to the client |
Returns
Section titled “Returns”The stream handle, used to cancel the stream
SDK 2.14.0 Protocol 1.11.0
texts()
Section titled “texts()”texts(
filter?):Promise<readonlyText[]>
Query to find the texts
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
Returns
Section titled “Returns”Promise<readonly Text[]>
a promise containing a snapshot of the texts
SDK 2.22.0 Protocol 1.19.0