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

Objects references issues

People's Champ ,
Oct 12, 2018 Oct 12, 2018

Hi,

I have a document hosting several groupItems objects. I have this loop trying to isolate them one by one onto a new document.

My main issue, is that one loop is run, the script seems to loose control over references. Eventually i can have a new document with a few objects instead of one.

I tried also to move them to a specific layer meaning one group per layer but then while the layers are created, some have some content, others don't.

Any idea why to avoid such reference issues ?

TIA

Loic

TOPICS
Scripting
976
Translate
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
Advocate ,
Oct 12, 2018 Oct 12, 2018

Salut !

Tu veux un groupe par document ?

Donne des explications en français.

Cordialement René

PS

Peut-être un exemple, mon adresse est sous mon profil.

Translate
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
People's Champ ,
Oct 12, 2018 Oct 12, 2018

Salut,

En gros, j'ai un document avec n groupItems. Quand je boucle sur cette collection, je m'attends à ce que ma référence point vers l'entité de rang n parmi cette collection.

Or quand je touche à l'objet, je m'aperçois que la référence n'est pas celle que je pensais. Illustrator a sélectionné d'autres objets. J'ai le sentiment qu'ayant touché un objet, la référence est corrompue.

Il m'est difficile de partager un fichier car ce sont ceux de mon client et si j'essaye d'en créer un similaire, il est possible que cela ne soit pas fidèle dans le scénario d'exécution.

Gosh Illustrator…

Translate
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 ,
Oct 12, 2018 Oct 12, 2018

Avec un boucle de ce type ?

var  nb = placeDoc.groupItems.length;    

      for (k = nb-1; k >= 0; k--) {

       .....
       }

Translate
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
People's Champ ,
Oct 12, 2018 Oct 12, 2018

exactement. Disons qu'il y a 100 groupe et que cherche à dupliquer chacun d 'entre eux dans un nouveau document. Au bout d'un moment Illu se met à prendre tout et n'importe quoi même si la référence de la boucle vaut app.activeDocument.groupItems.

La duplication se fait sur un doc temporaire donc ca ne devrait pas toucher les objets initiaux mais cela semble être le cas 😕

Translate
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 ,
Oct 12, 2018 Oct 12, 2018

I've seen this problem. I solved it by first duplicating all items and collecting any needed info ie, destination layer or position. Then after the duplication is done, I would switch to the destination document and do what I needed to do with the duplicates using info previously collected.

hope it helps

Translate
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
People's Champ ,
Oct 16, 2018 Oct 16, 2018

Hi everyone,

I think I got the culprit. Although my script initially didn't select anything, it appeared that reseting selection (doc.selection = null) at the beginning of every loop then selecting my specific object (obj.selected=true) helped Illustrator to not get lost in the references.

As a matter of fact, I could achieve my work.

Translate
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 ,
Oct 16, 2018 Oct 16, 2018

Bonjour Loïc,

As tu reçu le mail que j'ai envoyé sur Yahoo ?

Translate
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
People's Champ ,
Oct 16, 2018 Oct 16, 2018
LATEST

hello,

@renél80416020, non désolé mais je n'exploite plus cette boite mail même si elle reste mon id Adobe. Tu peux me contacter via mon site web : ozalto.com

Et désolé si jamais ton mail contenait une réponse valide. Au cas où poste la ici et je t'accorderai la réponse correcte.

Translate
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