Skip to main content
ckiltoliert33552576
Participant
November 25, 2017
Answered

Redimension lots of objects (circles) separately

  • November 25, 2017
  • 2 replies
  • 409 views

Hi everyone !

This question may have already been answered, but I didn't find any.

Here is my issue : I'd like to selection a lot of different object (which are circles) and redimension each of them separately to 10px (they are at 13 px right now)

Someone told me I should use a script, but I don't know how, does anyone could help me with that ?

Thank you for your kindness

This topic has been closed for replies.
Correct answer OMOTI

Hi,

Is "redimension" mean resizing?

It is easy to resize each object. But It is difficult for me to align pixel grid after resizing via script. If you create something like an icon for web, you may need it.

The following script resize each selected object (excluding stroke width).

If your work is like this, try:

(function () {

    if (app.documents.length === 0) {

        return;

    }

   

    var doc = app.activeDocument,

        sel = doc.selection,

        size = new UnitValue(10, "px").as("pt"),

        i,

        max;

   

    for (i = 0, max = sel.length; i < max; i += 1) {

        if (sel.hasOwnProperty("resize")) {

            sel.resize(size / sel.width * 100, size / sel.height * 100);

        }

    }

}());

2 replies

OMOTI
Inspiring
November 29, 2017

Hello!

Did you know how to use the script?

Copy and paste this code using a text editor and save it as a text file with the name of "favoriteName.jsx".

Launch Illustrator and navigate File > Scripts > Other Script and choose the file "favoriteName.jsx".

Then the script is executed.

OMOTI
OMOTICorrect answer
Inspiring
November 25, 2017

Hi,

Is "redimension" mean resizing?

It is easy to resize each object. But It is difficult for me to align pixel grid after resizing via script. If you create something like an icon for web, you may need it.

The following script resize each selected object (excluding stroke width).

If your work is like this, try:

(function () {

    if (app.documents.length === 0) {

        return;

    }

   

    var doc = app.activeDocument,

        sel = doc.selection,

        size = new UnitValue(10, "px").as("pt"),

        i,

        max;

   

    for (i = 0, max = sel.length; i < max; i += 1) {

        if (sel.hasOwnProperty("resize")) {

            sel.resize(size / sel.width * 100, size / sel.height * 100);

        }

    }

}());

ckiltoliert33552576
Participant
November 25, 2017

Thank you for your answer, I will try it as soon as I learn how to use scripts in Illustrator !