Copy link to clipboard
Copied
Does Illustrator have a tool to quickly put measurements on a drawing so my customer can get an idea of how large there sign is?
Long answer: no.
There are some workarounds, like using scripts.
And there are plug-ins:
CADtools
VectorScribe
Both can do dimension lines, even in scale.
Copy link to clipboard
Copied
Long answer: no.
There are some workarounds, like using scripts.
And there are plug-ins:
CADtools
VectorScribe
Both can do dimension lines, even in scale.
Copy link to clipboard
Copied
Thanks Monica,
I'm running a trial version of VectorScribe right now and love it. Thanks for the help.
Copy link to clipboard
Copied
Try clicking on the ? item above (a workaround to allow downloading scripts), and then change the .jpg to .jsx for a script.
Copy link to clipboard
Copied
I'm not sure if that is a reliable workaround to provide .jsx files, Mike.
At least I don't see the ? item you mentioned and when I click the link above nothing happens.
(Using the latest version of Firefox)
Copy link to clipboard
Copied
Kurt,
It worked by clicking on the box and dragging it to the desktop. When renamed with the .jsx extension, it opens in the ESTK.
Copy link to clipboard
Copied
Thanks for the hint, Larry and Prepress.
I forgot that the forum software tries to mimic Illustrator's workaroundish nature …
Copy link to clipboard
Copied
I was able to get it by dragging and dropping the link onto my desktop and opening the .jpg file with a text editor to confirm it is a script. Then changed the extension and run the script.
Copy link to clipboard
Copied
On safari mac the link shows. if your browser does not show here si the location.
Hope noone at Adobe objects to providing file links this way.
Copy link to clipboard
Copied
oh, don't worry Mike, they're probably looking the other way
Copy link to clipboard
Copied
As an alternative download link this seems to be the same script, as well it appears to be the same version when I compared the files.
http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1676020
Copy link to clipboard
Copied
@W_J_T That link does not work any more since they updated their exchange linkage to the new "Adobe Add-Ons". For those looking for a Dimensions Tool, go here to download a working link:
You must create a color swatch (make any color you like) called "Cutter" or "cutter". Or if you're a little code savvy, go into the jsx file itself on line 40, and replace the two swatch names "Cutter" and "cutter" with "Black" and "black" (which, in most cases, your illustrator files have as a default swatch in the color palette).
I often have a different color for my dimension measurement lines so I make a specific CMYK color and call it Cutter, and I'm off measuring things.
Do NOT ask me how to change the measurement dimensions to a different unit like inches or feet. You'll have to do more editing to the jsx file to account for the conversion.
Copy link to clipboard
Copied
Mike, i am not too script savvy but would love to use your dimensioning script. I need it in inches. Can you tell me how to convert/ edit the file?
I know you said....
thank you
Copy link to clipboard
Copied
Inches:
/*
Dimensioning - Nick Blakey 2007
This will add measurement marks and dimensions to any selected item.
This script requires that a swatch already exist for the colour "Cutter" (or "cutter")
*/
var myDocument = app.activeDocument;
var selectedObject = myDocument.selection;
var activeLayer = app.activeDocument.activeLayer;
var layerName = activeLayer.name;
activeLayer.name = "Source4Measure";
// Get position of selection bounds
var myBounds = selectedObject[0].geometricBounds;
// Set up X and Y co-ordinates
var x1 = myBounds[0];
var x2 = myBounds[2];
var y1 = myBounds[1];
var y2 = myBounds[3];
// Set up data for the Measurements
var ptWidth = myBounds[2] - myBounds[0];
var ptHeight = myBounds[1] - myBounds[3];
var tmpWidth = Math.round(ptWidth);
var tmpHeight = Math.round(ptHeight);
var finalWidth = tmpWidth / 72;
var finalHeight = tmpHeight / 72;
//Find Centre of Object
var xCentre = x1 + (ptWidth / 2);
var yCentre = y1 - (ptHeight / 2);
// Find Cutter swatch position
var origSwatches = myDocument.swatches;
var swatchesLength = origSwatches.length;
for (i=0;i<swatchesLength;i++) {
if (origSwatches.name == "cutter" || origSwatches.name == "Cutter") {
var cutterSwatch = origSwatches;
}
}
// Check if Cutter swatch is defined
if (cutterSwatch == undefined) {
alert("Please create a cutter swatch");
}
else {
makeDimensions();
releaseLayer();
}
function makeDimensions() {
// Lock the active layer to prevent colour change
activeLayer.locked = true;
// Create Measurements Layer
//Now moved to separate function
/*var mLayer = myDocument.layers.add();
//mLayer.name = "Measurements";*/
mLayerCreate();
// Set Document colors to Cutter
myDocument.defaultFillColor = cutterSwatch.color;
myDocument.defaultStrokeColor = cutterSwatch.color;
// Create White Color Object for Measurement Boxes
newWhite = new CMYKColor();
newWhite.black = 0;
newWhite.cyan = 0;
newWhite.magenta = 0;
newWhite.yellow = 0;
// Create groups for measurements
var yMeasure = mLayer.groupItems.add();
yMeasure.name = "Height";
var xMeasure = mLayer.groupItems.add();
xMeasure.name = "Width";
// X Measurement Line and Endpoints
var xLine1 = xMeasure.pathItems.add();
xLine1.stroked = true;
xLine1.setEntirePath ([[x1,y1+36],[xCentre - 30,y1+36]]);
var xLine2 = xMeasure.pathItems.add();
xLine2.stroked = true;
xLine2.setEntirePath ([[xCentre + 30,y1+36],[x2,y1+36]]);
var xLineEnd1 = xMeasure.pathItems.add();
xLineEnd1.stroked = true;
xLineEnd1.setEntirePath ([[x1,y1+40],[x1,y1+32]]);
var xLineEnd2 = xMeasure.pathItems.add();
xLineEnd2.stroked = true;
xLineEnd2.setEntirePath ([[x2,y1+40],[x2,y1+32]]);
// Y Measurement Line and Endpoints
var yLine1 = yMeasure.pathItems.add();
yLine1.stroked = true;
yLine1.setEntirePath ([[x2+36,y1],[x2+36,yCentre + 30]]);
var yLine2 = yMeasure.pathItems.add();
yLine2.stroked = true;
yLine2.setEntirePath ([[x2+36,yCentre - 30],[x2+36,y2]]);
var yLineEnd1 = yMeasure.pathItems.add();
yLineEnd1.stroked = true;
yLineEnd1.setEntirePath ([[x2+32,y1],[x2+40,y1]]);
var yLineEnd2 = yMeasure.pathItems.add();
yLineEnd2.stroked = true;
yLineEnd2.setEntirePath ([[x2+32,y2],[x2+40,y2]]);
/* Create Box for X Measurement text
Deprecated by use of two lines in measurement line
var xBox = xMeasure.pathItems.rectangle (y1 + 46, xCentre - 30, 60, 20);
xBox.filled = true;
xBox.fillColor = newWhite;
xBox.fillOverprint = false;
xBox.stroked = false;*/
// Create Text for X Measurement
var xText = xMeasure.textFrames.add();
xText.contents = finalWidth + "in";
xText.top = y1 + 42;
xText.left = xCentre;
xText.paragraphs[0].paragraphAttributes.justification = Justification.CENTER;
for (i=0;i<xText.textRange.characters.length;i++) {
xText.characters.characterAttributes.fillColor = cutterSwatch.color;
}
/* Create Box for Y Measurement Text
Deprecated by use of two lines in measurement line
var yBox = yMeasure.pathItems.rectangle (yCentre + 30, x2 + 26, 20, 60);
yBox.filled = true;
yBox.fillColor = newWhite;
yBox.fillOverprint = false;
yBox.stroked = false;*/
// Create Text for Y Measurement
var yText = yMeasure.textFrames.add();
yText.contents = finalHeight + "in";
yText.rotate (-90); //, true, false, false, false, Transformation.CENTER);
yText.top = yCentre;
yText.left = x2 + 30;
yText.paragraphs[0].paragraphAttributes.justification = Justification.CENTER;
for (i=0;i<yText.textRange.characters.length;i++) {
yText.characters.characterAttributes.fillColor = cutterSwatch.color;
}
}
function mLayerCreate() {
var mLayerNotExists = true;
// Check if measurements layer exists
for(i = 0; i < activeDocument.layers.length; i++){
if(activeDocument.layers.name == "Measurements"){
mLayer = activeDocument.activeLayer = activeDocument.layers; // not using var to declare makes it global
mLayerNotExists = false;
}
}
// Create Measurements Layer
if(mLayerNotExists){
mLayer = myDocument.layers.add();// not using var to declare makes it global
mLayer.name = "Measurements";
}
}
function releaseLayer(){
for(i = 0; i < activeDocument.layers.length; i++) {
if(activeDocument.layers.name == "Source4Measure") {
activeDocument.layers.name = layerName;
activeDocument.layers.locked = false;
activeDocument.activeLayer = activeDocument.layers;
}
}
// Set Document colors back to Default
black = new CMYKColor();
black.black = 100;
myDocument.defaultFillColor = newWhite;
myDocument.defaultStrokeColor = black;
}
Copy link to clipboard
Copied
READ ME
OK Based on TinyWeenie's code for dimensioning in inches script for adobe illustrator, I tweaked it a bit and did the following CHANGES:
1. Set default swatch to black so that you guys don't need to create a "cutter" swatch.
2. Restricted the numbers after the decimal to only three instead of infinite since illustrator's precision only goes three numbers after the decimal.
3. Tidied up the code to make file smaller, feel free to delete all comments /**/ and use JavaScript Minifier to paste the code below to further make the file size even smaller.
BELOW IS THE SOURCE CODE:
/*
Dimensioning - Nick Blakey 2007
This will add measurement marks and dimensions to any selected item.
This script requires that a swatch already exist for the colour "Cutter" (or "cutter")
*/
var myDocument = app.activeDocument;
var selectedObject = myDocument.selection;
var activeLayer = app.activeDocument.activeLayer;
var layerName = activeLayer.name;
activeLayer.name = "Source4Measure";
// Get position of selection bounds
var myBounds = selectedObject[0].geometricBounds;
// Set up X and Y co-ordinates
var x1 = myBounds[0];
var x2 = myBounds[2];
var y1 = myBounds[1];
var y2 = myBounds[3];
// Set up data for the Measurements
var ptWidth = myBounds[2] - myBounds[0];
var ptHeight = myBounds[1] - myBounds[3];
var tmpWidth = Math.round(ptWidth);
var tmpHeight = Math.round(ptHeight);
var finalWidth = (tmpWidth/72).toFixed(3);
var finalHeight = (tmpWidth/72).toFixed(3);
//Find Centre of Object
var xCentre = x1 + (ptWidth / 2);
var yCentre = y1 - (ptHeight / 2);
// Find Cutter swatch position
var origSwatches = myDocument.swatches;
var swatchesLength = origSwatches.length;
for (i = 0; i < swatchesLength; i++) {
if (origSwatches.name == "Black" || origSwatches.name == "black") {
var cutterSwatch = origSwatches;
}
}
// Check if Cutter swatch is defined
if (cutterSwatch == undefined) {
alert("Please create a cutter swatch");
} else {
makeDimensions();
releaseLayer();
}
function makeDimensions() {
// Lock the active layer to prevent colour change
activeLayer.locked = true;
// Create Measurements Layer
//Now moved to separate function
/*var mLayer = myDocument.layers.add();
//mLayer.name = "Measurements";*/
mLayerCreate();
// Set Document colors to Cutter
myDocument.defaultFillColor = cutterSwatch.color;
myDocument.defaultStrokeColor = cutterSwatch.color;
// Create White Color Object for Measurement Boxes
newWhite = new CMYKColor();
newWhite.black = 0;
newWhite.cyan = 0;
newWhite.magenta = 0;
newWhite.yellow = 0;
// Create groups for measurements
var yMeasure = mLayer.groupItems.add();
yMeasure.name = "Height";
var xMeasure = mLayer.groupItems.add();
xMeasure.name = "Width";
// X Measurement Line and Endpoints
var xLine1 = xMeasure.pathItems.add();
xLine1.stroked = true;
xLine1.setEntirePath([
[x1, y1 + 36],
[xCentre - 30, y1 + 36]
]);
var xLine2 = xMeasure.pathItems.add();
xLine2.stroked = true;
xLine2.setEntirePath([
[xCentre + 30, y1 + 36],
[x2, y1 + 36]
]);
var xLineEnd1 = xMeasure.pathItems.add();
xLineEnd1.stroked = true;
xLineEnd1.setEntirePath([
[x1, y1 + 40],
[x1, y1 + 32]
]);
var xLineEnd2 = xMeasure.pathItems.add();
xLineEnd2.stroked = true;
xLineEnd2.setEntirePath([
[x2, y1 + 40],
[x2, y1 + 32]
]);
// Y Measurement Line and Endpoints
var yLine1 = yMeasure.pathItems.add();
yLine1.stroked = true;
yLine1.setEntirePath([
[x2 + 36, y1],
[x2 + 36, yCentre + 30]
]);
var yLine2 = yMeasure.pathItems.add();
yLine2.stroked = true;
yLine2.setEntirePath([
[x2 + 36, yCentre - 30],
[x2 + 36, y2]
]);
var yLineEnd1 = yMeasure.pathItems.add();
yLineEnd1.stroked = true;
yLineEnd1.setEntirePath([
[x2 + 32, y1],
[x2 + 40, y1]
]);
var yLineEnd2 = yMeasure.pathItems.add();
yLineEnd2.stroked = true;
yLineEnd2.setEntirePath([
[x2 + 32, y2],
[x2 + 40, y2]
]);
/* Create Box for X Measurement text
Deprecated by use of two lines in measurement line
var xBox = xMeasure.pathItems.rectangle (y1 + 46, xCentre - 30, 60, 20);
xBox.filled = true;
xBox.fillColor = newWhite;
xBox.fillOverprint = false;
xBox.stroked = false;*/
// Create Text for X Measurement
var xText = xMeasure.textFrames.add();
xText.contents = finalWidth + "in";
xText.top = y1 + 42;
xText.left = xCentre;
xText.paragraphs[0].paragraphAttributes.justification = Justification.CENTER;
for (i = 0; i < xText.textRange.characters.length; i++) {
xText.characters.characterAttributes.fillColor = cutterSwatch.color;
}
/* Create Box for Y Measurement Text
Deprecated by use of two lines in measurement line
var yBox = yMeasure.pathItems.rectangle (yCentre + 30, x2 + 26, 20, 60);
yBox.filled = true;
yBox.fillColor = newWhite;
yBox.fillOverprint = false;
yBox.stroked = false;*/
// Create Text for Y Measurement
var yText = yMeasure.textFrames.add();
yText.contents = finalHeight + "in";
yText.rotate(-90); //, true, false, false, false, Transformation.CENTER);
yText.top = yCentre;
yText.left = x2 + 30;
yText.paragraphs[0].paragraphAttributes.justification = Justification.CENTER;
for (i = 0; i < yText.textRange.characters.length; i++) {
yText.characters.characterAttributes.fillColor = cutterSwatch.color;
}
}
function mLayerCreate() {
var mLayerNotExists = true;
// Check if measurements layer exists
for (i = 0; i < activeDocument.layers.length; i++) {
if (activeDocument.layers.name == "Measurements") {
mLayer = activeDocument.activeLayer = activeDocument.layers; // not using var to declare makes it global
mLayerNotExists = false;
}
}
// Create Measurements Layer
if (mLayerNotExists) {
mLayer = myDocument.layers.add(); // not using var to declare makes it global
mLayer.name = "Measurements";
}
}
function releaseLayer() {
for (i = 0; i < activeDocument.layers.length; i++) {
if (activeDocument.layers.name == "Source4Measure") {
activeDocument.layers.name = layerName;
activeDocument.layers.locked = false;
activeDocument.activeLayer = activeDocument.layers;
}
}
// Set Document colors back to Default
black = new CMYKColor();
black.black = 100;
myDocument.defaultFillColor = newWhite;
myDocument.defaultStrokeColor = black;
}
Copy link to clipboard
Copied
I'm not sure what I am doing wrong here, but i get the pop up Please Create Cutter Swatch.
I created a two black swatches named them Cutter and cutter
I created a pallet and moved them in to that and name that cutter...
I know i am doing something wrong.
I put the .jsx file in the following folder
/Applications/Adobe Illustrator CC 2015/Scripting.localized/Sample Scripts.localized/JavaScript/Swatches/PRODUCTION-AddDimensions.jsx
thanks
Copy link to clipboard
Copied
Try Applications/Adobe Illustrator/Presets/en_US/Scripts.Then restart AI and access the script from File>Scripts.
Copy link to clipboard
Copied
thanks for the help, but no dice...
when i tried that it said the code was uncompiled.
so i tried copying the above code again, and saving it into the script.
Script editor didn't like the Notes at the front "/" so i removed them.
then it gave me a syntax error "a identifier can't go after this identifier" - Highlighting var myDocument
So I tried the Minify thing. and that gave me another error.
Copy link to clipboard
Copied
First find the Extendscript Toolkit which is installed by Adobe. Look in Utilities/Adobe Utilities. Open the Extendscript application. Copy and paste the text from above into the Extendscript window. At the top is a dropdown, set it to Illustrator. (Have a window open in AI with a simple object.) Click the green arrow above the script window in the Extendscript app to run the script. It should give you something like this
Save the script from the Extendscript app and place it as suggested above. Restart AI. It should be available to use.
Copy link to clipboard
Copied
Sorry about this. I've been using Ill and PS for 20 years so I should know this stuff, but I'm really beginning to feel like i am a noob here. is it because im on a Mac and your might be on a PC?
I have searched my Applications/Utilities folder and found no Extend script... I have:
/Adobe Application manager
/Adobe Creative Cloud
/Adobe installers
No ExtendScript in any of those, are you talking about Utilities/Script Editor ? because this is what I used
I looked in /Applications/Adobe Illustrator CC 2015 as well but nothing in there
I tried search the forum, but it's mostly help how to use it... Not FIND it... ugh...
I searched the applications for extendscript... nothing
I'm sorry.
Copy link to clipboard
Copied
HAH...
I'm glad i don't trust Search tools.
Ok so it's an app.
Adobe needs to fix there Search. using the Search in the Adobe installer sends you to their website with a Ne results. Go figure
I looked for it by eye and there it was.
I'll give it a try once it's done installing
Copy link to clipboard
Copied
Awesome Sauce!
works great.
Thank you Larry for you help and patients
Thank you Huans for your awesome code.
Copy link to clipboard
Copied
Is there any scripts out there measure in mm? Inches work great but a lot the clients I work with want mm.
Copy link to clipboard
Copied
I downloaded that script for long time ago and I am very happy about it. I changed inches to mm in the script and it works.
Copy link to clipboard
Copied
can a shortcut key be assigned? I mean other than the function keys?