I have needed to calculate the area of a shape in order to determine the acreage of a perspective property plot, and to measure the length of a pen-tool-traced transgenic seedling root. Measuring area, perimeter, and length is not built into Illustrator, but there is an easy work around.
This technique should work for all recent (perhaps all) versions of Adobe Illustrator. Telegraphics makes a nice plug-in for finding area and lengthlength in Illustrator, but it doesn’t work for the lastest versions: Adobe Illustrator CS6 nor Adobe Illustrator CC. The technique I will describe here is just as easy to use, and more universal.
alert("Area & Length (inches)\nArea: " + (Math.abs(app.activeDocument.selection.area/5184).toFixed(3)) + "\nLength: " + (app.activeDocument.selection.length/72).toFixed(3));Save the file as AreaLength.JS
Then you might want this script to appear on the quick menu within illustrator so that you don’t have to navigate through your files every time you use it.
Here is where I put it on my PC to successfully make it show up in the menu:
C:\Program Files\Adobe\Adobe Illustrator CC (64 Bit)\Presets\en_US\Scripts
This script rounds the decimal points to 3. If you want more or less, you can open AreaLength.JS in notepad/text editor and change “toFixed(3)” to a different number. I would like to thank the Adobe community for the tips on rounding.
Change the text in the file.
alert("Area & Length (centimeters)\nArea: " + (Math.abs(app.activeDocument.selection.area/80.3521617).toFixed(3)) + "\nLength: " + (app.activeDocument.selection.length/28.346567).toFixed(3));
alert("Area & Length (millimeters)\nArea: " + (Math.abs(app.activeDocument.selection.area/8.03521617).toFixed(3)) + "\nLength: " + (app.activeDocument.selection.length/2.8346567).toFixed(3));
You can change it other units too. The default would give you the units in px, and there are 72 px per inch. Thus, in the ‘inch’ unit script we take the length is divided by 72, and the area is divided by 5184, which is 72 squared. If you make a new script, I recommend testing it on a shape of known size. You can do this by selecting the rectangle tool, single clicking once on the canvas. A dialog will pop up. Type in “1 cm” for width and “1 cm” for height (for example).
|Free forum by Nabble - JMeter user||Edit this page|