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

Using Spreadsheet Data to transform Illustrator objects

Community Beginner ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Hi All,

 

I am no programmer by any means nor am I a speadsheet guru but I have recently got some data on Google Sheets that I want to use to make life MUCH easier. I want to tell Illustrator to look at the spreadsheet know how many object to create, how far to move them and then how much to rotate them by on a given coordinate … but I don't know the first thing about how to tackle it.

 

I have been using Illustrator since I was 16 (I'm now 40!) and I have never touched Variable Data, importing spreadsheets data, or Actions (I used Actions in PShop years ago) … and I suspect I probably have to use one or a combination of these to get my desired result. Can any kind soul point me in the right direction?

 

My convivial thanks in advance!

TOPICS
Draw and design , Import and export , Scripting , Tools

Views

4.4K

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
Community Beginner ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Thanks René but I believed the clarity of my request was there from the start. You are the first to suggest illustrating it, earlier suggestions referred to files that I don't have.

 

In the spirit of your example, I attach the process which explains the process visually, as that appears to be the preferred means of communication.

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Thanks pixel, yes that is what I was describing. My focus has been on how you script that. I have a list of data that needs to be read and an object, of whatever description, be plotted repeatedly around. I think I have exhausted explaining now, I cannot put it any other way. I have just posted another response with an attachment which hopefully articulates the process I described earlier.

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Things are moving slowly forwards.


Scripts (and actions) are efficient - but both are stupid. They do exactly as they are told. But exactly that. Nothing more and nothing less. A precisely described workflow is therefore essential.

 

It makes a big difference whether the object is at 0.0 (that is, mostly at the top left) or whether the center of the object is at 0.0.

 

Then it is important to know which objects are involved. You also need to know if the objects already exist in the file or if the script needs to create them too. If so, where did the information for creating the objects come from?

 

If they are already in the file, you need to know what the layer structure looks like. Is each object in its own layer, or all in one layer, or each in its own group, etc., etc.

 

 

With a meaningful sample file, the scripter or action writer can usually answer all of these questions by himself without having to ask each individual question.

 

That is the only background for all the annoying counter-questions. We're here to help. But reluctant for the trash can.

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

now you're talking Simon, that image is worth a lot more than the files provided...and definitely not what I had understood from your explanations.

 

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

here you go, select your object before running the script

transformObjectFromData_simon2.JPG

// tranform selection based on csv data
// carlo canto - 05/04/2021

// https://community.adobe.com/t5/illustrator/using-spreadsheet-data-to-transform-illustrator-objects/td-p/12001685

function main() {
    var idoc = app.activeDocument;
    if (idoc.selection.length == 1) {
        var ro = idoc.rulerOrigin;

        var sel = idoc.selection[0];
        idoc.rulerOrigin = [sel.position[0] + sel.width/2 + ro[0], sel.position[1] - sel.height/2 + ro[1]];

        selection = null;
        
        var csvfile = File.openDialog("Select a valid CSV file","CSV:*.csv", false);
        if(csvfile != null) {
            csvfile.open("r");
            var csvstring = csvfile.read();
            csvfile.close();
            csvfile = null;
        } else {
            alert("Error opening CSV file.");
            return;
        }

        var obj, delta, angle;
        
        var rows = csvstring.split('\n');
        
        for (var a = 1; a<rows.length; a++) {
            cols = rows[a].split(',');
            
            obj = cols[0];
            delta = cols[1];
            angle = cols[2];
            
            dup = sel.duplicate();
            dup.name = obj;
            
            dup.translate(delta);
            dup.rotate(angle, true,true,true,true, Transformation.DOCUMENTORIGIN);
        }
    
        idoc.rulerOrigin = ro;
    }
    else {
        alert("select one object and try again");
    }
}

main();

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
Advocate ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Bonjour!

Merci Carlos de m'avoir rafraichi la mémoire, Transformation.DOCUMENTORIGIN était pour moi partie dans les oubliettes.

J'admire votre générosité.

René

Ps Le poste de Simon m'a donné l'idée de faire un script à ma façon que je posterai quand il sera prêt.

Capture tyau juste.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 ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

you're welcome Rene, looking forward to seeing your script.

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
Advocate ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

LATEST

Bonjour!

Dans mon exemple, l'objet de base étant un cercle, sachant que l'aspect d'un cercle qui tourne ne change pas.

On obtient le même résultat avec un dégradé de forme comportant le même nombre d'étapes, à condition de connaître la trajectoire...

Autre exemple:

Capture degrade de forme.PNG

Quelle est la figure la plus réaliste ?

Si je peux libérer un peu de temps je vous fais parvenir le script avec explications.

René

 

 

 

 

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 ,
May 09, 2021 May 09, 2021

Copy link to clipboard

Copied

It is a real shame that OP @Simon Templar did not provide any feedback on @CarlosCanto's goal-oriented contribution.

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 ,
May 09, 2021 May 09, 2021

Copy link to clipboard

Copied

indeed, but not all is lost, the script might help future generations reading this post.

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
Valorous Hero ,
May 09, 2021 May 09, 2021

Copy link to clipboard

Copied

My favorite one is a long-time customer of mine who upon unzipping the script said the following (as copy pasted from an email dated 2016)

 

I’m having trouble understanding how to install the tool, and how to incorporate it into our templates. Using scripts is something that I’m unfamiliar with, and this tool seems pretty archaic for what I was expecting to get from you.
 
So far I haven’t been able to incorporate anything that we’ve had you do, and I’ve been having trouble following the long emails that come with the files that you send.
 
Haha, well I did a screen-sharing walkthrough and how suddenly it went from "zero to hero" when it actually did 100% of what he needed and he immediately fell in love with it once he knew how to "install" it. It has been the backbone of his business operations for 5+ years now and everyone is still super-pleased with it.
 
Communication back and forth can make or break an otherwise well-planned workflow, on both ends!

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