Skip to main content
Inspiring
November 12, 2018
Question

Place Legend based on Art not x y Coordinates

  • November 12, 2018
  • 1 reply
  • 566 views

Hello,

Is there a script out there that I have not been able to find that will allow you to place a Symbol, Centered and slightly below in relation to the selected art?  Everything that I have tried places the Symbol based on x y coordinates.

Thank you!

This topic has been closed for replies.

1 reply

subieguy2
Inspiring
November 12, 2018

What about this script by Jet?

  1. /*
  2. JET_ReplaceWithSymbol.jsx
  3. A Javascript for Adobe Illustrator
  4. Purpose: Replaces selected items with Instances of a Symbol from the Symbols Panel.
  5. The desired Symbol can be defined by its index number (its number of occurrance in the Panel).
  6. */ 
  7. var docRef=app.activeDocument; 
  8. var symbolNum=prompt("Enter the number of the Symbol you want to replace each selected object",1); 
  9. for(i=0;i<docRef.selection.length;i++){ 
  10.           var currObj=docRef.selection
  11.           var currLeft=currObj.left; 
  12.           var currTop=currObj.top; 
  13.           var currWidth=currObj.width; 
  14.           var currHeight=currObj.height; 
  15.           var currInstance=docRef.symbolItems.add(docRef.symbols[symbolNum-1]); 
  16.           currInstance.width*=currHeight/currInstance.height; 
  17.           currInstance.height=currHeight; 
  18.           currInstance.left=currLeft; 
  19.           currInstance.top=currTop; 
  20.           currInstance.selected=true
  21.           currObj.remove(); 
  22.           redraw(); 
  23. }
Inspiring
November 12, 2018

I'm not sure on this one because I am not replacing anything.

The most important thing is that the "ART" not move at all.

Right now I am Placing the Symbol (Generic Cyan Shape)

Selecting Both

Clicking on the "ART" so that I can center to that object

Center Horizontally

Align Bottom

Then with the Symbol Selected I am doing a "Transform Each" with the below settings twice.

renél80416020
Inspiring
November 13, 2018

Salut !

// JavaScript Document for Illustrator

var space = 10;  // pt

var symbIndex = 0;

function slign(dec,index) {

  var  currObj, VBounds, currInstance;

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

      currObj =selection;

      VBounds =currObj.visibleBounds;

      currInstance= activeDocument.symbolItems.add(activeDocument.symbols[index]);

      currInstance.position = [(VBounds[0]+VBounds[2])/2-currInstance.width/2,VBounds[3]-dec];

    }

}

if (app.documents.length) {

  slign(space,symbIndex);

}

de LR elleere