Skip to main content
March 1, 2012
Question

artboard position

  • March 1, 2012
  • 1 reply
  • 1577 views

I need to add images in multiple artboards (each image in different artboards)

Initially i added an artboard and placed the image

Dim illus_doc As Illustrator.Document

Dim thisPlacedItem As Illustrator.PlacedItem

illus_doc = illus_app.Documents.Add(, 595.28, 841.49)

 

thisPlacedItem = illus_doc.PlacedItems.Add()

thisPlacedItem.File = "D:\temp\3.eps"

Then i added a second artboard and set the artboard rect.

Dim rect1() As Object = {0, 841.49, 595.28, 0}

illus_doc.Artboards.Add(rect1)

Let me know how to position the second artboard below the first and so on....

thanks,

Sashi

This topic has been closed for replies.

1 reply

Inspiring
March 1, 2012

Sashi, sorry I don't do VB… But your second artboard looks like you are trying to make the same size? Why are you NOT passing all the parameters to the new document creation? This is JS but you can see what to look up…

#target Illustrator

var mm = 2.83464567 // My metrichead as variable…

var doc = app.documents.add(

    DocumentColorSpace.CMYK,

    width = 297*mm,

    height = 210*mm,

    numArtboards = 6,

    DocumentArtboardLayout.GridByCol,

    artboardSpacing = 20*mm,

    artboardRowsOrCols = 2

    );

As you can see all your requirements are covered here so NO need to do all the bounds calculations…

March 6, 2012

Thanks for your reply.

I tried your option to include the artboard count initially while creating a new document.

When i place a image (below code), the placedItem is not placed in the first artbaord.

  

Dim illus_doc As Illustrator.Document

I should assign the top value of the placedItem inorder to place the image in the first artboard.

thisPlacedItem.Top = illus_doc.Height - 40

Is this method fine to place the image.  Please let me have your views

regards,

Sashi

Dim thisPlacedItem As Illustrator.PlacedItem

illus_doc = illus_app.Documents.Add(, 595.28, 841.49, 3, 1, 20)

 

thisPlacedItem = illus_doc.PlacedItems.Add()

thisPlacedItem.File = "D:\temp\3.eps"



Inspiring
March 6, 2012

OK as with the adding of artboards at document creation… There is also an easy short hand or long hand math way to work with your artboards and AI's co-ords… This sample function shows the same as above with some extras ( the easy route )… I hope you can make sence of my comments… These should explain when, where and why to set things up…

#target Illustrator

function filesToArtboards() {

          // My function variables…

          var aiFile, doc, fileList, i, inFolder, mm;

          // Get the user to select a folder

          inFolder = Folder.selectDialog( 'Please choose your Folder of files to place…' );

          // Check they ain't cancelled

          if ( inFolder != null ) {

                    // Gets just the AI files…

                    fileList = inFolder.getFiles( /\.ai$/i );

                    // Make sure it has AI files in it…

                    if ( fileList.length > 0 ) {

                              mm = 2.83464567 // Metric MM converter…

 

                              // Set the script to work with artboard rulers

                              app.coordinateSystem =

                              CoordinateSystem.ARTBOARDCOORDINATESYSTEM;

 

                              // Add new multi-page document

                              doc = app.documents.add(

                                         DocumentColorSpace.CMYK,

                                         width = 297*mm,

                                         height = 210*mm,

                                         numArtboards = fileList.length, // The number of AI files

                                         DocumentArtboardLayout.GridByCol,

                                         artboardSpacing = 20*mm,

                                         artboardRowsOrCols = 2

                              );

                              // Loop thru the counter

                              for ( i = 0; i < fileList.length; i++ ) {

                                        // Set the active artboard rulers based on this 

                                        doc.artboards.setActiveArtboardIndex( i );

                                        // Add a place holder

                                        aiFile = doc.placedItems.add();

                                        // Give it a file

                                        aiFile.file = fileList;

                                        // Move relative to this artboards rulers

                                        // Top Left in CS5

                                        aiFile.position = [ 0, 0 ];

                              };

                    };

          };

};

filesToArtboards();