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

visibleBounds seems to have changed behavior between 2014 and 2018

Community Beginner ,
Aug 22, 2018 Aug 22, 2018

Just installed our new PC and got Illy 2018 ( we have 2014 on the previous machine ).

We have a script that creates a document and then crops it to the visibleBounds rectangle.

That worked just fine in Illustrator 2014 but in 2018 instead of returning the real visual bound - it rather seems to return the Artboard bound of the document

I suspect there is a chance my approach may have been wrong at the first place but it worked before (by luck?).

Can someone please tell me how to deal with it ?

( I installed the 2014 on the new machine but now I am back to the dreadful PARM errors very often. I guess the new machine is too fast for the old Illy )

thanks in advance

TOPICS
Scripting
1.1K
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
Community Expert ,
Aug 22, 2018 Aug 22, 2018

can you share your script? can you share a test file?

It's very difficult to offer any advice or debugging at all unless we have something to work with.

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 ,
Aug 22, 2018 Aug 22, 2018

additionally, i'm confused about what you mean when you say that your script "creates a new document and then crops it to the visible bounds". If you're creating a new document, presumably there is no artwork in it, so there can be no visible bounds, as visibleBounds is a property of an art object.

if you can provide as much information as possible, we will have a much better chance of being helpful.

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
Valorous Hero ,
Aug 22, 2018 Aug 22, 2018
We have a script that creates a document and then crops it to the visibleBounds rectangle.

Yea, when a new document is created, there's nothing in it and there's no visualBounds of anything.

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 ,
Aug 26, 2018 Aug 26, 2018

Salut !

alert(app.documents[0].visibleBounds)

Retourne un tableau de 4 nombres

Lecture seule. Limites visibles du document, incluant l’épaisseur de contour de tous les objets de l’illustration.

- Si le document est vide

retourne

0,0,0,0

-------------------

en anglais

Read-only. The visible bounds of the document, including stroke width of any objects in the illustration.

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 Beginner ,
Aug 26, 2018 Aug 26, 2018

Hi

I was not precise in the original post. After creating a new doc, I, of course, put some data into it...

An example file is attached - https://kerenmaizlish-my.sharepoint.com/:b:/g/personal/keren_kerenmaizlish_onmicrosoft_com/EchyQuITY...

printing alert(app.documents[0].visibleBounds)

in Illustrator 2014 and 2018 prints out different results ...

Any ideas ?

thanks

Keren

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 ,
Aug 27, 2018 Aug 27, 2018

Salut !

Cela est peut-être dû à la position de l'origine des règles (globale),

en haut à gauche ou en bas à gauche

Sinon, applique le script suivant :

var thisDoc = app.documents[0];

var tb = thisDoc.visibleBounds;

    w = tb[2]-tb[0];

      h = tb[1]-tb[3];

      x = tb[0];

      y = tb[1];

      cadre = thisDoc.pathItems.rectangle(y,x,w,h);

      cadre.filled = false;

      cadre.strokeDashes = [3.5,2];

  alert(thisDoc.visibleBounds.join("\r"));

  alert("rulerOrigin = \r"+thisDoc.rulerOrigin);

de LR

PS

Si vous ouvrez le fichier .pdf dans Illustrator,

Il faut, avant de lancer le script supprimer le masque d'écrêtage.

202581_0.4.AddressNew-01.png

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 ,
Aug 27, 2018 Aug 27, 2018

"visibleBounds" is not a valid property of the document object.

visibleBounds is a property of PageItem

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
Valorous Hero ,
Aug 27, 2018 Aug 27, 2018

Actually believe it or not, it is!

When the document is blank, it alerts this: 0,0,0,0.

But when you have a square with a 1 pt stroke with its geo bounds (the path corner) at 0,0 the visibleBounds are:

-0.5,0.5,150.5,-150.5

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 Beginner ,
Aug 27, 2018 Aug 27, 2018
LATEST

Thanks everyone for the help.

I found the real problem and hence the difference between the Illustrator 2014 and 2018

When looked closely at my file, I noticed an empty Path object at the outer perimeter

In Illustrator 2014 an empty path object does not count for "visible" and thus the visible boundary was smaller while in 2018 version it does count even though it is empty and has no stroke or anything at all

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