Skip to main content

GetRotation

Returns the rotation angle of the current drawing object.

Syntax

expression.GetRotation();

expression - A variable that represents a ApiDrawing class.

Parameters

This method doesn't have any parameters.

Returns

number

Example

How to get rotate from a drawing object.

// Get drawing rotate

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 65 * 36000, 10 * 36000, fill, stroke);
shape.SetPosition(100000, 2500000);
shape.SetRotation(90);

let rotAngle = shape.GetRotation();
let docContent = shape.GetContent();
let paragraph = docContent.GetElement(0);
paragraph.AddText("Drawing rotation angle is: " + rotAngle + " degrees");
page.AddObject(shape);