Skip to content

Curve

let model = await SketchUpApi.getActiveModel();
await model.performOperation(async operation => {
const result = operation.createCurve(model, [
[0, 0, 0],
[10, 0, 0],
[10, 10, 0],
[0, 10, 0],
]);
const curve = await operation.entityForRef(result.curve);
console.log('Curve:', curve);
console.log('Edges:', curve.edges.length);
}, 'Create a curve');
let model = await SketchUpApi.getActiveModel();
await model.performOperation(async operation => {
const result = operation.createCircle(
model,
[0, 0, 0], // center
[0, 0, 1], // normal (Z-axis)
10, // radius
);
const circle = await operation.entityForRef(result.curve);
console.log('Circle:', circle);
console.log('Radius:', circle.radius);
console.log('Is circular:', circle.circular);
}, 'Create a circle');
let model = await SketchUpApi.getActiveModel();
await model.performOperation(async operation => {
const result = operation.createArc(
model,
[0, 0, 0], // center
[10, 0, 0], // xaxis (defines radius and start direction)
[0, 0, 1], // normal (Z-axis)
10, // radius
0, // start angle
Math.PI, // end angle (180 degrees)
);
const arc = await operation.entityForRef(result.curve);
console.log('Arc:', arc);
console.log('Radius:', arc.radius);
console.log('Start angle:', arc.startAngle);
console.log('End angle:', arc.endAngle);
}, 'Create an arc');