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..!!
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
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..!!
Copy link to clipboard
Copied
/**
* @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) ;
}
})() ;