Support specifying rotation center in Graphic object’s Rotate() function


Version: 2025

Type: Features

Category: Programming

Subcategory: Origin C

Jira: ORG-29208


GraphObject:: BOOL Rotate(double dAngle, point *ptCenter, BOOL bUndo = FALSE); 

E.g. Add the following Origin C code in Code Builder.

void test_rotate(string type, int x, int y, int degree)
{
GraphLayer ml = Project.ActiveLayer();
point pt(x, y); //specify x, y in pixel
GraphObject gr = ml.GraphObjects(type);
BOOL bUndo = true;
gr.Rotate(degree, &pt, bUndo);
}

In Graph window, add a rectangle object, object name is Rect

In the Scripts Window, execute the follow to rotate the rectangle 45 degrees based on rotation center at (2000px, 3000px),
test_rotate("Rect", 2000, 3000, 45);