• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to get Links scaling in illustrator using JavaScript

Participant ,
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

305

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

Community Expert , 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
    
...

Votes

Translate

Translate
Adobe
Community Expert ,
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 }

Votes

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
Explorer ,
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

Votes

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
Community Expert ,
Dec 25, 2020 Dec 25, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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