• 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 set ruler 0 point to canvas?

Contributor ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

 

Hi,

Using Javascript, how to set the ruler origin to top left canvas corner point?

 

screen.png

 

What is the official name for the area outside an artboard? Is it canvas, workspace, workarea, pastboard, ...?

Where is located it in the DOM? 

 

Thank you.

 

TOPICS
Scripting

Views

543

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

Guide , Jul 13, 2022 Jul 13, 2022

I don't know if it's official (it's not in my Using Adobe Illustrator guide), but I've seen it called pasteboard.  As it happens, I believe @CarlosCanto answered the same question yesterday.  See here.

Votes

Translate

Translate
Adobe
Guide ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

I don't know if it's official (it's not in my Using Adobe Illustrator guide), but I've seen it called pasteboard.  As it happens, I believe @CarlosCanto answered the same question yesterday.  See here.

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
Contributor ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

Thank you for sharing this info. This was very usefull. 

 

I did some small adjustments. Below my working code...

 

 

 

var myDoc = app.activeDocument;

var dim = getLargestBounds(); 

myDoc.rulerOrigin = [dim[0],dim[1]+myDoc.height];


function getLargestBounds() {  
    var tempLayer, tempText, left, top, LARGEST_SIZE = 16383;  

    tempLayer = app.activeDocument.layers.add();  
    tempText = tempLayer.textFrames.add();  

    left = tempText.matrix.mValueTX;  
    top = tempText.matrix.mValueTY;  

    tempLayer.remove();  

    var dimensions = [left, top, left + LARGEST_SIZE, top + LARGEST_SIZE ];

    return dimensions;
}  

 

 



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
Advocate ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

Bonjour,

myDoc.rulerOrigin = [dim[0],dim[1]+myDoc.height];

Cette ligne donne un bon résultat uniquement si le plan de travail 0 (artBoard) est dans sa position initiale.

Essayer de le déplacer et relancez le script, vous constaterez que la position de l'origine n'est pas à l'endroit souhaité.

Dans quel but voulez vous placer l'origine des règles à cet endroit ?

René

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
Mentor ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

I'm going to jump in here and say I'd like to be able to set the origin [0,0] to any point I select. Repeatedly, in the same doc. I'm not a good scripter and gave up on this some time ago. It would run once, then not again until I quit Illy - not a solution!

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
Advocate ,
Jul 15, 2022 Jul 15, 2022

Copy link to clipboard

Copied

Hi Met1

Sélectionnez un point sur un tracé existant.

// JavaScript Document for Illustrator
// De elleere
function main() {
  if (!selection.length) {return;}
  if (selection[0].typename != "PathItem") {return;}
    var idoc = app.activeDocument;
    var item = selection[0];
    var ptSel = item.selectedPathPoints;
    var r, pt;
      for (var i = 0; i < ptSel.length; i++) {
        var pt = ptSel[i];
          if (pt.selected == PathPointSelection.ANCHORPOINT) {
            r = i;
            break;
          }
      }
      if (r != undefined) {
         idoc.rulerOrigin = [0,0];
         idoc.rulerOrigin = pt.anchor;
      }
      else {beep();}
}
if (app.documents.length) main();

de elleere, pour vous servir...

 

 

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
Mentor ,
Jul 25, 2022 Jul 25, 2022

Copy link to clipboard

Copied

Sorry René, just realised (I pointed someone else to this script) that I never thanked you - It works great, I'm using it daily, Thanks!

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
Advocate ,
Jul 25, 2022 Jul 25, 2022

Copy link to clipboard

Copied

LATEST

Hi met1,

Merci pour le retour...

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
Contributor ,
Jul 14, 2022 Jul 14, 2022

Copy link to clipboard

Copied

Hi René,

 

Thank you for bringing up the issue with the moved artboards. This seems to fix it ...

 

setRuler2canvas();

function setRuler2canvas(){
    if(app.documents.length > 0){
        var myDoc = app.activeDocument;
        myDoc.rulerOrigin = [0,0];
        
        var dim = getLargestBounds(); 
        myDoc.rulerOrigin = [dim[0],dim[1]];
    }
}



function getLargestBounds() {  
    var tempLayer, tempText, left, top, LARGEST_SIZE = 16383;  

    tempLayer = app.activeDocument.layers.add();  
    tempText = tempLayer.textFrames.add();  

    left = tempText.matrix.mValueTX;  
    top = tempText.matrix.mValueTY;  

    tempLayer.remove();  

    var dimensions = [left, top, left + LARGEST_SIZE, top + LARGEST_SIZE ];

    return dimensions;
}  

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
Advocate ,
Jul 15, 2022 Jul 15, 2022

Copy link to clipboard

Copied

Bonjour tmmls,

Trés bien, cela fonctionne maintenant, mais vous n'avez pas répondu à ma question.

Dans quel but voulez vous placer l'origine des règles à cet endroit ?

René

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