Entities
The gateway to querying drawing elements owned by a container.
Every container — the root model, a group, or a component definition —
exposes an .entities property which is an Entities instance. Use it
to fetch drawing elements like edges, faces, groups, and more. You can
retrieve everything or filter by type.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Get all entities in the model rootlet all = await model.entities.get();
// Filter by typelet faces = await model.entities.get({ filterBy: { types: ['Face'] }});
// Get curves and arc-curveslet curves = await model.entities.getCurves();SDK 2.29.0
Properties
Section titled “Properties”parent
Section titled “parent”
readonlyparent:EntitiesContainer|EntitiesContainerRef
The container (model, group, or component definition) that owns these entities.
Methods
Section titled “Methods”get<
Filter>(options?):Promise<EntityTypeForFilter<Filter,DrawingElement>[]>
Fetches all drawing elements owned by this container. Without a filter,
returns every edge, face, group, component instance, and more. Use
filterBy to narrow by entity type.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<EntityTypeForFilter<Filter, DrawingElement>[]>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Get all entitieslet all = await model.entities.get();
// Get only faceslet faces = await model.entities.get({ filterBy: { types: ['Face'] }});
// Get entities inside a grouplet groups = await model.entities.get({ filterBy: { types: ['Group'] }});let edges = await groups[0].entities.get({ filterBy: { types: ['Edge'] }});getActiveSectionPlane()
Section titled “getActiveSectionPlane()”getActiveSectionPlane():
Promise<SectionPlane|undefined>
Fetches the currently active section plane for this container, if one
exists. Section planes cut through the model to reveal interior geometry.
Returns undefined if no section plane is active.
Returns
Section titled “Returns”Promise<SectionPlane | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let plane = await model.entities.getActiveSectionPlane();
if (plane) { console.log('Active section plane found');}SDK 2.16.0 Protocol 1.13.0
getCurves()
Section titled “getCurves()”getCurves<
Filter>(options?):Promise<EntityTypeForFilter<Filter,ArcCurve|Curve>[]>
Fetches all curves and arc-curves owned by this container. Returns an empty array if the SketchUp version does not support curve queries. Curves are collections of edges that form continuous arcs or polylines.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<EntityTypeForFilter<Filter, ArcCurve | Curve>[]>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let curves = await model.entities.getCurves();
for (const curve of curves) { console.log(curve.edges.length);}SDK 2.23.0 Protocol 1.20.0
toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string