Silly-V / Adobe-Illustrator

Some useful Adobe Illustrator scripts
413 stars 297 forks source link

Import Script takes long to run #28

Open hermify opened 4 years ago

hermify commented 4 years ago

Hi there, in some cases with illustrator files greater than 70 MB, the import script takes really long time (>5min), after clicking on import.

Has it something to do with the complexity of the design and the number of paths? Illustrator takes about 2500 MB RAM. It has something to do with autobinding, if i disable it, it works quickly without autobind..

If it is to complex, i would like to only autobind specific layers, or to exclude layers. How is this possible in code?

(If i run test --> Art Bindings --> Refresh test, it takes very long, too. But my csv-file has no art bindings!)

Silly-V commented 4 years ago

(If i run test --> Art Bindings --> Refresh test, it takes very long, too. But my csv-file has no art bindings!)

Do you mean your csv has no header? Your csv has no art bindings, that's something that happens inside of Illustrator.

Yes - when doing art bindings as it is allowed to apply one variable to multiple items. the binding algorithm goes through every single item in your document which will definitely take a long time in cases where there are a lot of paths.

If you are not concerned with automatically binding variables, just use no autobinding option.

cedriclalouette commented 4 years ago

Hello, I am using this wonderful script for some times on the same document and now that all my variables are set in my .csv, when I try to load the .csv with all my variables (more than 700) Illustrator crashes with the message "The operation cannot complete because of an unknown error. []". I think it is related to the memory usage because when the message appears Illustrator takes a very high memory usage (more than 23GB) which makes my computer fully loaded. When I had only 500 variables it was ok (it took a long time to load data, but it was ok). Now that my .csv is complete I can't load it :(

hermify commented 4 years ago

I just corrected it for myself manually by changing line 1966 from

this.namedArtCollection = this.getAllDocumentNamedItems(doc, AUTOBINDING[SETTINGS.selectedAutobinding]);

to

` this.namedArtCollection = this.getAllDocumentNamedItems(doc.layers.getByName('var'), AUTOBINDING[SETTINGS.selectedAutobinding]);

to only take layer "var". Would be great to have this as a setting in backend to choose, which layers shall be taken for searching for objects for autobinding. Weather "whole document, layer "x".... `

cedriclalouette commented 4 years ago

Hello @hermify , and thank you for your feedback. I tried to adjust the script the way you did but in my case I got an error message :( hermify

If I click "Yes" I go all variables in my document very quickly but none of them is binded with my layers.

Any idea ?

Silly-V commented 4 years ago

@hermify : the idea is good, but you must be aware that in Illustrator scripting, it will only choose the 1-level-nested objects in your chosen layer. This would be advantageous in a document with a multitude of art but only some top-level art in a layer is desired to be variable. However, if your art inside the layer has groups or nested layers and then in those structures you'd like to maintain a variable object, it will ignore those items which are not top-level inside their layer! This is still a good idea if I can find a way to put it into the options box and give users the heads-up warning. But still, this shall invite other users to ask for multiple layers to choose from and support for nested items, etc.

And, my friends, this is why I'm going to start on a pro-level extension of the VariableImporter where UI space is much more available and malleable for various user requests.