Skip to main content
Inspiring
October 20, 2020
Answered

Rotate an entire document with all elements 90 degrees

  • October 20, 2020
  • 1 reply
  • 905 views

Using extended panel I'm trying to rotate an entire document and it's elements 90 degrees. 

The document consist of about 30 layers with some "hidden" meaning they are not displaying because they don't have any elements.  The rotation would have to be on everything including artboard.  Basically the equivalent of highlighting all and then "rotating" on the AI interface.

 

I've tried the rotate script: https://github.com/mprewitt/AI-Rotate-Artboard

It doesn't work as it says it's extremly buggy.

Is this possible in illustrator scripting?

This topic has been closed for replies.
Correct answer femkeblanco

This is a basic idea:

var groups = app.activeDocument.groupItems;
var d = app.activeDocument.artboards[0].artboardRect;
rect1 = app.activeDocument.pathItems.rectangle(d[1], d[0], d[2], -d[3]);
app.executeMenuCommand( "selectall" );
app.executeMenuCommand( "group" );
groups[0].rotate(-90);
app.executeMenuCommand( "deselectall" );
rect1.selected = true;
app.executeMenuCommand( "setCropMarks" );
app.activeDocument.artboards[0].remove();
app.executeMenuCommand( "selectall" );
app.executeMenuCommand( "ungroup" );
app.executeMenuCommand( "deselectall" );

 

1 reply

femkeblanco
femkeblancoCorrect answer
Legend
October 20, 2020

This is a basic idea:

var groups = app.activeDocument.groupItems;
var d = app.activeDocument.artboards[0].artboardRect;
rect1 = app.activeDocument.pathItems.rectangle(d[1], d[0], d[2], -d[3]);
app.executeMenuCommand( "selectall" );
app.executeMenuCommand( "group" );
groups[0].rotate(-90);
app.executeMenuCommand( "deselectall" );
rect1.selected = true;
app.executeMenuCommand( "setCropMarks" );
app.activeDocument.artboards[0].remove();
app.executeMenuCommand( "selectall" );
app.executeMenuCommand( "ungroup" );
app.executeMenuCommand( "deselectall" );