## How to get Workspace size in CS6

Community Beginner ,
Dec 05, 2020

Copied

Hi. I cannot get the dimensions of the Workspace in CS6. Does anyone have any idea how to find out the dimensions?

I understand that it should be 16384 to 16384 on CS6. But how can I get the location of this area relative to the coordinate grid in the current file?

To get the dimensions of the workspace in CC, I use catching an exception when creating an artboard outside of the workspace. But in CS6 no exception is thrown.

``````MaiFuncs.getWorkspaceSize = function(){
var doc = app.activeDocument;
var res = {};
var step = 1000;
res.x_min = this.getWorkspaceCoord(-16000, step, "x");
res.x_max = this.getWorkspaceCoord(16000, -step, "x");;
res.y_min = this.getWorkspaceCoord(-16000, step, "y");;
res.y_max = this.getWorkspaceCoord(16000, -step, "y");;
return res;

}

MaiFuncs.getWorkspaceCoord = function(start, delta, coord) {

var artboards = app.activeDocument.artboards;
var aIndex = artboards.getActiveArtboardIndex();
var repeat = true;
var artboard;

while (repeat) {
try {
repeat = false;
var rect;
if (coord == "x")
rect = [start, 0, start+1, -1];
else
rect = [0 , start, 1, start-1];
}
catch (err) {
start = start+delta;
repeat = true;
}
}
artboard.remove();
artboards.setActiveArtboardIndex(aIndex);
return start;
}``````

Is there another way to get the dimensions of the Workspace?

Community Beginner
| Community Beginner

Result code:

``````MaiFuncs.getWorkspaceSizeCS6 = function(){
var d = activeDocument,
rects = [],
abs = d.artboards;
for (i = abs.length - 3; i >= 0; i--) {
var a = abs[i];
rects.push([a.artboardRect, a.name]);
a.remove();
}
d.rearrangeArtboards(DocumentArtboardLayout.Row, 1, 0, false);
var rect = abs[0].artboardRect;
var res = {};
res.x_min = rect[0] + 0.5 - 16383 / 2;
res.y_max = rect[1] - 0.5 + 16383 / 2;
res.x_max = res.x_min+16383;
res.y_min = res.y_max-16383;
for (i = rects.length - 1; i >= 0; i--) {
var rect = rects[i];
}
abs[0].remove();
abs[0].remove();
return res;
}``````
TOPICS
Scripting

Views

25

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## How to get Workspace size in CS6

Community Beginner ,
Dec 05, 2020

Copied

Hi. I cannot get the dimensions of the Workspace in CS6. Does anyone have any idea how to find out the dimensions?

I understand that it should be 16384 to 16384 on CS6. But how can I get the location of this area relative to the coordinate grid in the current file?

To get the dimensions of the workspace in CC, I use catching an exception when creating an artboard outside of the workspace. But in CS6 no exception is thrown.

``````MaiFuncs.getWorkspaceSize = function(){
var doc = app.activeDocument;
var res = {};
var step = 1000;
res.x_min = this.getWorkspaceCoord(-16000, step, "x");
res.x_max = this.getWorkspaceCoord(16000, -step, "x");;
res.y_min = this.getWorkspaceCoord(-16000, step, "y");;
res.y_max = this.getWorkspaceCoord(16000, -step, "y");;
return res;

}

MaiFuncs.getWorkspaceCoord = function(start, delta, coord) {

var artboards = app.activeDocument.artboards;
var aIndex = artboards.getActiveArtboardIndex();
var repeat = true;
var artboard;

while (repeat) {
try {
repeat = false;
var rect;
if (coord == "x")
rect = [start, 0, start+1, -1];
else
rect = [0 , start, 1, start-1];
}
catch (err) {
start = start+delta;
repeat = true;
}
}
artboard.remove();
artboards.setActiveArtboardIndex(aIndex);
return start;
}``````

Is there another way to get the dimensions of the Workspace?

Community Beginner
| Community Beginner

Result code:

``````MaiFuncs.getWorkspaceSizeCS6 = function(){
var d = activeDocument,
rects = [],
abs = d.artboards;
for (i = abs.length - 3; i >= 0; i--) {
var a = abs[i];
rects.push([a.artboardRect, a.name]);
a.remove();
}
d.rearrangeArtboards(DocumentArtboardLayout.Row, 1, 0, false);
var rect = abs[0].artboardRect;
var res = {};
res.x_min = rect[0] + 0.5 - 16383 / 2;
res.y_max = rect[1] - 0.5 + 16383 / 2;
res.x_max = res.x_min+16383;
res.y_min = res.y_max-16383;
for (i = rects.length - 1; i >= 0; i--) {
var rect = rects[i];
}
abs[0].remove();
abs[0].remove();
return res;
}``````
TOPICS
Scripting

Views

26

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 05, 2020 0
Community Beginner ,
Dec 05, 2020

Copied

I have found solution here: https://community.adobe.com/t5/illustrator/how-to-get-bounds-of-largest-possible-document-area/m-p/8...

Result code:

``````MaiFuncs.getWorkspaceSizeCS6 = function(){
var d = activeDocument,
rects = [],
abs = d.artboards;
for (i = abs.length - 3; i >= 0; i--) {
var a = abs[i];
rects.push([a.artboardRect, a.name]);
a.remove();
}
d.rearrangeArtboards(DocumentArtboardLayout.Row, 1, 0, false);
var rect = abs[0].artboardRect;
var res = {};
res.x_min = rect[0] + 0.5 - 16383 / 2;
res.y_max = rect[1] - 0.5 + 16383 / 2;
res.x_max = res.x_min+16383;
res.y_min = res.y_max-16383;
for (i = rects.length - 1; i >= 0; i--) {
var rect = rects[i];
}
abs[0].remove();
abs[0].remove();
return res;
}``````

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 05, 2020 0
Resources
Learning Resources for Illustrator
What's new and fixed in Illustrator
Fonts and Typography in Illustrator