How to get Links scaling in illustrator using JavaScript

Community Beginner ,
Dec 24, 2020 Dec 24, 2020

Copy link to clipboard

Copied

Hi,

 

How to get links scaling X-value and Y-Value in illustator using javascript.

 

Thanks

TOPICS
Scripting

Views

99

Likes

translate

Translate

Translate

Report

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

correct answers 1 Correct Answer

Engaged , Dec 24, 2020 Dec 24, 2020
Hi, here's an example of getting scale and rotation of linked (or embedded) item: var item = app.activeDocument.selection[0]; if (item.typename == 'PlacedItem' || item.typename == 'RasterItem') { var m = item.matrix; var rotatedAmount = asDegrees(Math.atan2(m.mValueB, m.mValueA)); //rotation goes the other way for placed items! if (item.typename == 'PlacedItem') rotatedAmount = -rotatedAmount; var scaledAmount = [m.mValueA * 100, m.mValueD * 100]; alert(item.typename ...

Likes

translate

Translate

Translate
Engaged ,
Dec 24, 2020 Dec 24, 2020

Copy link to clipboard

Copied

Hi, here's an example of getting scale and rotation of linked (or embedded) item:

 

var item = app.activeDocument.selection[0];
if (item.typename == 'PlacedItem' || item.typename == 'RasterItem') {
    var m = item.matrix;
    var rotatedAmount = asDegrees(Math.atan2(m.mValueB, m.mValueA));
    //rotation goes the other way for placed items!
    if (item.typename == 'PlacedItem') rotatedAmount = -rotatedAmount;
    var scaledAmount = [m.mValueA * 100, m.mValueD * 100];
    alert(item.typename
        + '\nscaleX = ' + scaledAmount[0]
        + '\nscaleY = ' + scaledAmount[1]
        + '\nrotation = ' + rotatedAmount
    );
}
function asDegrees(radians) { return radians * 57.2957795 }

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 25, 2020 Dec 25, 2020

Copy link to clipboard

Copied

Hello! m1b Check if there is a zoom in the connection diagram, and if there is a zoomed-in or enlarged link diagram, select it. How to script this? Thank you

Likes

translate

Translate

Translate

Report

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

Copy link to clipboard

Copied

No quite sure yet what you mean. You want script to select a linked image (PlacedItem) that has a scale greater than 100?

Likes

translate

Translate

Translate

Report

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