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.
Example
Section titled “Example”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 12console.log(curve.isPolygon, curve.length);// => true 314.15- CurveRef
- ArcCurve
- Edge.getCurve
- SketchupOperation
SDK 2.23.0 Protocol 1.20.0
Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes: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.
readonlyedges: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.
readonlyid:number
The persistent ID that uniquely identifies this curve across sessions.
isPolygon
Section titled “isPolygon”
readonlyisPolygon: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.
readonlytype:Curve=EntityType.Curve
The entity type discriminator for runtime type checking.
vertices
Section titled “vertices”
readonlyvertices: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.
Accessors
Section titled “Accessors”firstEdge
Section titled “firstEdge”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”lastEdge
Section titled “lastEdge”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”length
Section titled “length”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
sketchupId
Section titled “sketchupId”Get Signature
Section titled “Get Signature”get sketchupId():
SketchupId
JS API identifier for this curve. Pass it to API methods that accept a sketchupId.
Returns
Section titled “Returns”typeName
Section titled “typeName”Get Signature
Section titled “Get Signature”get typeName():
string
Returns a named variant of the type field.
SDK 2.35.0
Returns
Section titled “Returns”string
Methods
Section titled “Methods”refresh()
Section titled “refresh()”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.
Returns
Section titled “Returns”Promise<Curve>
A new Curve reflecting the current model state. Throws if the curve has been deleted.
Example
Section titled “Example”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()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string