Skip to content

UnknownEntityRef

A fallback ref for entity types the SDK doesn’t recognize.

When SketchUp returns an entity reference with a type that this version of the SDK hasn’t been updated to handle, it wraps the reference in an UnknownEntityRef rather than crashing. The type property is undefined, and the ref still carries a valid sketchupId — you just can’t resolve it to a typed class.

You’ll typically encounter this when a newer version of SketchUp introduces entity types that your SDK version predates. Checking for undefined type lets you handle these gracefully.

let model = await SketchUpApi.getActiveModel();
let entities = await model.entities.get();
for (const entity of entities) {
if (entity.type === undefined) {
console.log('Unknown entity:', entity.id);
} else {
console.log(entity.type, entity.id);
}
}

EntityRef

readonly sketchupId: SketchupId


readonly type: undefined = undefined

get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string