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

artboards and origin

New Here ,
Aug 24, 2011 Aug 24, 2011

Copy link to clipboard

Copied

Hi, I'm trying to draw some objects to fixed positions on artboards by first setting the document origin to the top - left position of the artboard. However this seems to work for some of the artboards but not for all.

Sample code:

#target illustrator // create artboards var CurrentDoc = app.documents.add ( DocumentColorSpace.CMYK, 595, 841, 12, DocumentArtboardLayout.GridByRow, 50, 6); var artboardRef = CurrentDoc.artboards; // loopt through all artboards for ( var i = 0; i < artboardRef.length; i++ )   {    // set page and ruler origin    var RulerLeft = artboardRef.artboardRect[0];

   var RulerTop  = artboardRef.artboardRect[1] ;    CurrentDoc.rulerOrigin = [RulerLeft,RulerTop];    CurrentDoc.pageOrigin  = [RulerLeft,RulerTop];      //add text to artboard    var cTextRef = CurrentDoc.textFrames.add();    cTextRef.textRange.characterAttributes.textFont=app.textFonts.getByName("Verdana");    cTextRef.textRange.characterAttributes.size = 27;    cTextRef.contents = "ArtBoard: "+ (i+1);    cTextRef.left = +55;    cTextRef.top = -64;    redraw();   }

8 out of 12 artboards get the text at the right position (but not in the right order when I look at the artboards palette). Text for 4 artboards is placed completely outside any of the artboards.

Any help is appreciated,

Michel

TOPICS
Scripting

Views

828

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

Enthusiast , Aug 25, 2011 Aug 25, 2011

Some Math operation is Ok, no need to set origin.

#target illustrator // create artboards var CurrentDoc = app.documents.add ( DocumentColorSpace.CMYK, 595, 841, 12, DocumentArtboardLayout.GridByRow, 50, 6); var artboardRef = CurrentDoc.artboards; // loopt through all artboards for ( var i = 0; i < artboardRef.length; i++ )   {    // set page and ruler origin    var RulerLeft = artboardRef.artboardRect[0];    var RulerTop  = artboardRef.artboardRect[1] ;    //CurrentDoc.rulerOrigin = [Ruler

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Aug 25, 2011 Aug 25, 2011

Copy link to clipboard

Copied

Some Math operation is Ok, no need to set origin.

#target illustrator // create artboards var CurrentDoc = app.documents.add ( DocumentColorSpace.CMYK, 595, 841, 12, DocumentArtboardLayout.GridByRow, 50, 6); var artboardRef = CurrentDoc.artboards; // loopt through all artboards for ( var i = 0; i < artboardRef.length; i++ )   {    // set page and ruler origin    var RulerLeft = artboardRef.artboardRect[0];    var RulerTop  = artboardRef.artboardRect[1] ;    //CurrentDoc.rulerOrigin = [RulerLeft,RulerTop];    //CurrentDoc.pageOrigin  = [RulerLeft,RulerTop];      //add text to artboard    var cTextRef = CurrentDoc.textFrames.add();    cTextRef.textRange.characterAttributes.textFont=app.textFonts.getByName("Verdana");    cTextRef.textRange.characterAttributes.size = 27;    cTextRef.contents = "ArtBoard: "+ (i+1);    cTextRef.left = RulerLeft +55;    cTextRef.top = RulerTop -64;    redraw();   }

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
New Here ,
Aug 25, 2011 Aug 25, 2011

Copy link to clipboard

Copied

LATEST

That works, thanks,

Michel

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