Skip to content

SectionPlane

A clipping plane that cuts through the model to reveal interior geometry.

Section planes are used to create cutaway views of buildings, mechanical parts, or any 3D model where you need to see what’s inside. The plane is defined by four coefficients [a, b, c, d] that form the equation ax + by + cz + d = 0. Everything on one side of the plane is hidden, revealing the cross-section.

Only one section plane can be active at a time. When a section plane is active, SketchUp hides geometry on the negative side of the plane and optionally displays the cut surface. You can control visibility of section cuts and planes through Model.updateRenderingOptions.

let model = await SketchUpApi.getActiveModel();
// Make section cuts visible in the viewport
await model.updateRenderingOptions({
DisplaySectionCuts: true,
DisplaySectionPlanes: true,
});
// Create a horizontal section plane at height 50
await model.performOperation(op => {
// Plane equation [0, 0, 1, -50] cuts at z = 50
const planeRef = op.createSectionPlane(
model, [0, 0, 1, -50]
);
op.sectionPlaneActivate(planeRef);
}, 'Create section plane');
// Query the section plane back
let planes = await model.entities.get({
filterBy: { types: ['SectionPlane'] }
});
let sectionPlane = planes[0];
console.log(sectionPlane.active);
// => true
console.log(sectionPlane.plane);
// => { a: 0, b: 0, c: 1, d: -50 }

SDK 2.16.0 Protocol 1.13.0

  • BaseDrawingElement

readonly active: boolean

Whether this section plane is currently active and performing the cut. Only one section plane can be active at a time. Use Operation.sectionPlaneActivate to activate a plane.


readonly attributes: Attributes

The attribute dictionaries attached to this element. Attributes store custom key-value metadata that extensions can read and write.

BaseDrawingElement.attributes


readonly castsShadows: boolean

Whether this element casts shadows onto other geometry.

BaseDrawingElement.castsShadows


readonly hidden: boolean

Whether this element is hidden. Hidden elements don’t appear in the viewport unless the user enables “View > Hidden Geometry.”

BaseDrawingElement.hidden


readonly id: number

The persistent ID that uniquely identifies this section plane.


readonly materialRef: MaterialRef | undefined

A reference to the material applied to this element, if any. Call getMaterial() to fetch the full Material object with color and texture data.

BaseDrawingElement.materialRef


readonly name: string

The display name shown in the Outliner and assigned by SketchUp, like “Section Plane 1” or a custom name set by the user.


readonly plane: Plane

The plane equation coefficients that define where this section plane cuts. The plane follows ax + by + cz + d = 0, where [a, b, c] is the normal vector and d is the distance from the origin.


readonly receivesShadows: boolean

Whether this element receives shadows cast by other geometry.

BaseDrawingElement.receivesShadows


readonly symbol: string

A single-character label displayed on the section plane glyph in the viewport, like “A”, “B”, or “C”. SketchUp assigns these automatically.


readonly tagRef: TagRef | undefined

A reference to the tag (formerly “layer”) assigned to this element. Call getTag() to fetch the full Tag object.

BaseDrawingElement.tagRef


readonly type: SectionPlane = EntityType.SectionPlane

get sketchupId(): SketchupId

JS API identifier for this section plane. Pass it to API methods that accept a sketchupId.

SketchupId

BaseDrawingElement.sketchupId


get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string

getBounds(): Promise<BoundingBox>

Fetches the axis-aligned bounding box for this element from SketchUp.

Promise<BoundingBox>

let model = await SketchUpApi.getActiveModel();
let all = await model.entities.get();
let element = all[0];
let box = await element.getBounds();
console.log(box.min.x, box.min.y, box.min.z);
console.log(box.max.x, box.max.y, box.max.z);

SDK 2.30.0

BaseDrawingElement.getBounds


getMaterial(): Promise<Material | undefined>

Fetches the material applied to this element. Returns undefined if the element uses the default material.

Promise<Material | undefined>

let model = await SketchUpApi.getActiveModel();
let all = await model.entities.get();
let element = all[0];
let mat = await element.getMaterial();
if (mat) {
console.log(mat.name, mat.color.toHex());
}

SDK 2.30.0

BaseDrawingElement.getMaterial


getTag(): Promise<Tag | undefined>

Fetches the tag assigned to this element. Most elements have a tag — even those on the default “Untagged” tag. Returns undefined only if the tag reference is missing.

Promise<Tag | undefined>

let model = await SketchUpApi.getActiveModel();
let all = await model.entities.get();
let element = all[0];
let tag = await element.getTag();
if (tag) {
console.log(tag.name);
}

SDK 2.30.0

BaseDrawingElement.getTag


refresh(): Promise<SectionPlane>

Re-fetches this section plane from SketchUp to get its current state. Because SectionPlane is a snapshot, it can become stale if the model changes (for example, if another section plane is activated). Call refresh() to get an up-to-date copy.

Promise<SectionPlane>

A new SectionPlane reflecting the current model state. Throws if the section plane has been deleted.

let model = await SketchUpApi.getActiveModel();
let planes = await model.entities.get({
filterBy: { types: ['SectionPlane'] },
});
// Later, after the user makes changes...
let fresh = await planes[0].refresh();
console.log(fresh.active, fresh.plane);

toString(): string

Returns a string representation of an object.

string

readonly materialId: number | undefined

BaseDrawingElement.materialId


readonly tagId: number | undefined

BaseDrawingElement.tagId


get bounds(): Promise<BoundingBox>

Promise<BoundingBox>

BaseDrawingElement.bounds


get tag(): Promise<Readonly<Tag> | undefined>

Promise<Readonly<Tag> | undefined>

BaseDrawingElement.tag