Copy link to clipboard
Copied
So I've been working with my good friend ChatGpt to write some script for illustrator to streamline a very small part of my workflow on a specific project and in trying to get the artboard bounds/width I'm getting rounded numbers instead of the accurate decimals. I'm creating renders of walls using a ratio of 1 inch : 10 pixels because accuracy is very important. The purpose of this script is to "print" (create and place text) the width in inches of the active artboard. For example, if an artboard is 1032 pixels wide it's converted to inches by dividing by 10 and it should create text that says ' 103.2" '. The issue is that the value assigned to the artboardWidth variable is rounded and inaccurate, instead of 1032 being the pixel count of the artboard bounds, 1030 is returned. Here's the script:
Hi @Mikey_Englar1374, try changing line 9 to
var artboardWidth = abBnds[2] - abBnds[0];
(In any case, all that parseFloat stuff it for Strings, not Numbers.)
- Mark
Copy link to clipboard
Copied
Hi @Mikey_Englar1374, try changing line 9 to
var artboardWidth = abBnds[2] - abBnds[0];
(In any case, all that parseFloat stuff it for Strings, not Numbers.)
- Mark
Copy link to clipboard
Copied
That was what the original code was, and it wasn't working, but for some reason I went back to it and it toally worked this time, thanks!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now