Skip to content

Curve

A collection of connected edges that form a smooth path in the model.

Curves group multiple edges together into a single logical shape, like the segments of a circle or a smooth arc. When you draw a circle in SketchUp, it creates many short edges that share a single Curve parent. This lets you manipulate the entire shape as one unit.

Most curves you’ll encounter are ArcCurve instances, which add radius and center properties. The base Curve class handles polylines and other non-circular grouped edges.

let model = await SketchUpApi.getActiveModel();
// Create a circle to work with.
await model.performOperation(op => {
const center = [0, 0, 0];
const normal = [0, 0, 1];
const radius = 50;
const segments = 12;
op.createCircle(model, center, normal, radius, segments);
}, 'Draw circle');
// Fetch all curves from the model.
let curves = await model.entities.getCurves();
let curve = curves[0];
console.log(curve.edges.length, curve.vertices.length);
// => 12 12
console.log(curve.isPolygon, curve.length);
// => true 314.15

SDK 2.23.0 Protocol 1.20.0

readonly attributes: Attributes

A container for storing custom key-value metadata on this curve. You can attach arbitrary data (strings, numbers, booleans) that persists with the SketchUp model.


readonly edges: Edge[]

All edges that make up this curve, in order from first to last. For a closed curve like a circle, the last edge connects back to the first vertex.


readonly id: number

The persistent ID that uniquely identifies this curve across sessions.


readonly isPolygon: boolean

Whether this curve forms a closed loop, with the last vertex connected back to the first. Circles and regular polygons are closed; polylines and arcs are typically open.


readonly type: Curve = EntityType.Curve

The entity type discriminator for runtime type checking.


readonly vertices: Vertex[]

All vertices where this curve’s edges meet, in sequence. For an open curve this includes endpoints; for a closed curve every vertex connects two edges.

get firstEdge(): Edge

The first edge in this curve’s sequence. For an open curve this is the edge at the start endpoint; for a closed curve it’s an arbitrary starting edge.

Edge


get lastEdge(): Edge

The last edge in this curve’s sequence. For a closed curve like a circle, this edge’s end vertex connects back to the first edge’s start vertex.

Edge


get length(): number

The total length of this curve in the current model units, calculated by summing the straight-line distances between all edge endpoints. For arcs and circles this approximates the true curved length based on the number of segments.

number


get sketchupId(): SketchupId

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

SketchupId


get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string

refresh(): Promise<Curve>

Re-fetches this curve from SketchUp to get its current state. Because Curve is a snapshot, it can become stale if the model changes. Call refresh() to get an up-to-date copy.

Promise<Curve>

A new Curve reflecting the current model state. Throws if the curve has been deleted.

let model = await SketchUpApi.getActiveModel();
let curves = await model.entities.getCurves();
// Later after the user changes something...
let fresh = await curves[0].refresh();
console.log(fresh.edges.length, fresh.length);

toString(): string

string