Skip to main content
Known Participant
October 8, 2012
Answered

Create Fitted Artboards from layers?

  • October 8, 2012
  • 1 reply
  • 6781 views

Hey everyone,

Does anyone know of a script that will create artboards for each separate layer?

Thanks in advance,

Andy

This topic has been closed for replies.
Correct answer Muppet Mark

While I think this is possible ( not actually tried this out ) it would only make sence to do… if each layer's art does not over lap in any way?

#target illustrator

main();

function main() {

 

          if ( app.documents.length == 0 ) { return; }

          var doc = app.activeDocument;

 

          doc.layers[0].hasSelectedArtwork = true;

 

          doc.fitArtboardToSelectedArt( 0 );

 

          doc.selection = null;

          for ( var  i = 1; i < doc.layers.length; i++ ) {

 

                    doc.artboards.add( [0,0,72,-72] );

 

                    doc.layers.hasSelectedArtwork = true;

 

                    doc.fitArtboardToSelectedArt( i );

 

                    doc.selection = null;

          };

};

1 reply

Muppet MarkCorrect answer
Inspiring
October 9, 2012

While I think this is possible ( not actually tried this out ) it would only make sence to do… if each layer's art does not over lap in any way?

#target illustrator

main();

function main() {

 

          if ( app.documents.length == 0 ) { return; }

          var doc = app.activeDocument;

 

          doc.layers[0].hasSelectedArtwork = true;

 

          doc.fitArtboardToSelectedArt( 0 );

 

          doc.selection = null;

          for ( var  i = 1; i < doc.layers.length; i++ ) {

 

                    doc.artboards.add( [0,0,72,-72] );

 

                    doc.layers.hasSelectedArtwork = true;

 

                    doc.fitArtboardToSelectedArt( i );

 

                    doc.selection = null;

          };

};

Participant
March 20, 2017

Thanks for making this!