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

How to Make Repeat grid in Illustrator using extendscript

Community Beginner ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Hi, 

Can anyone let me know how to make repeat grid in illustraor using Extendscript? Please provide me the extendscript code to make repeat grid.

Thank You..!! 

TOPICS
Experiment , How-to , Scripting

Views

503

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
Adobe
Enthusiast ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

There are no details about what you need to grid and what the settings should be. I will assume that the script will be sufficient for you: https://github.com/sky-chaser-high/adobe-illustrator-scripts/blob/main/scripts/stepAndRepeat.js

stepandRepeat.png

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 Beginner ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

I Need a script to repeat the pattern, Like grid, mirror etc. I have one object as rectangle and want to repeat this rectangle in the document then,
Object->repeat-> grid, mirror etc.
Please provide me the extendscript for this.
Thank You..!!Screenshot 2023-06-26 at 9.09.54 PM.png 

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 ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

LATEST
There is a scripting API for the repeat grid, but probably no one has seen it working correctly. Just a null pointer waiting for you.

However, repeat grid spacing, flipping, etc. are under the control of preferences and can be handled with setRealPreference, and so on.

 

/**
  * @File make repeat grid from selection
  * @version 1.0.0
  * @author sttk3.com
  * @copyright © 2023 sttk3.com
*/

(function() {
  if(app.documents.length <= 0) {return ;}
  var doc = app.documents[0] ;
  var sel = doc.selection ;
  if(sel.length <= 0) {return ;}

  // define repeat grid pattern types value
  var GridPatternTypes = {
    'GRID': 0, 
    'BRICK_BY_ROW': 1, 
    'BRICK_BY_COLUMN': 2
  } ;
  
  // define preference keys
  var pref = app.preferences ;
  var keyHorizontalSpacing = 'plugin/Adobe Repeat Arts UI/HorizontalSpacing' ;
  var keyVerticalSpacing = 'plugin/Adobe Repeat Arts UI/VerticalSpacing' ;
  var keyGridPatternType = 'plugin/Adobe Repeat Arts UI/GridPatternType' ;
  var keyFlipRowHorizontal = 'plugin/Adobe Repeat Arts UI/FlipRowY' ;
  var keyFlipRowVertical = 'plugin/Adobe Repeat Arts UI/FlipRowX' ;
  var keyFlipColumnHorizontal = 'plugin/Adobe Repeat Arts UI/FlipColumnY' ;
  var keyFlipColumnVertical = 'plugin/Adobe Repeat Arts UI/FlipColumnX' ;

  var oldHorizontalSpacing, oldVerticalSpacing, oldGridPatternType, oldFlipRowHorizontal, oldFlipRowVertical, oldFlipColumnHorizontal, oldFlipColumnVertical ;
  try {
    // store original settings
    oldHorizontalSpacing = pref.getRealPreference(keyHorizontalSpacing) ;
    oldVerticalSpacing = pref.getRealPreference(keyVerticalSpacing) ;
    oldGridPatternType = pref.getIntegerPreference(keyGridPatternType) ;
    oldFlipRowHorizontal = pref.getBooleanPreference(keyFlipRowHorizontal) ;
    oldFlipRowVertical = pref.getBooleanPreference(keyFlipRowVertical) ;
    oldFlipColumnHorizontal = pref.getBooleanPreference(keyFlipColumnHorizontal) ;
    oldFlipColumnVertical = pref.getBooleanPreference(keyFlipColumnVertical) ;

    // set horizontal spacing
    pref.setRealPreference(keyHorizontalSpacing, 40.0) ;

    // set vertical spacing
    pref.setRealPreference(keyVerticalSpacing, 20.0) ;

    // set grid type
    pref.setIntegerPreference(keyGridPatternType, GridPatternTypes.GRID) ;
    
    // set flip rows
    pref.setBooleanPreference(keyFlipRowHorizontal, true) ;
    pref.setBooleanPreference(keyFlipRowVertical, false) ;

    // set flip column
    pref.setBooleanPreference(keyFlipColumnHorizontal, false) ;
    pref.setBooleanPreference(keyFlipColumnVertical, true) ;

    // make repeat grid from selection
    app.executeMenuCommand('Make Grid Repeat') ;
  } catch(e) {
    alert(e) ;
  } finally {
    // restore original settings
    pref.setRealPreference(keyHorizontalSpacing, oldHorizontalSpacing) ;
    pref.setRealPreference(keyVerticalSpacing, oldVerticalSpacing) ;
    pref.setIntegerPreference(keyGridPatternType, oldGridPatternType) ;
    pref.setBooleanPreference(keyFlipRowHorizontal, oldFlipRowHorizontal) ;
    pref.setBooleanPreference(keyFlipRowVertical, oldFlipRowVertical) ;
    pref.setBooleanPreference(keyFlipColumnHorizontal, oldFlipColumnHorizontal) ;
    pref.setBooleanPreference(keyFlipColumnVertical, oldFlipColumnVertical) ;
  }
})() ;

 

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