Copy link to clipboard
Copied
Olá a todos, gostaria de saber se tem algum plugin grátis que faça cotas no illustrator, o ideal seria as cotas serem de centro a centro dos objetos e não dos cantos...
Obrigado...
Marcelo D. Oliveira
Oi Marcelo, eu modifiquei o Sr. William Ngan Script para incluir opções para obter medidas a partir do centro.
.../*
* Description: An Adobe Illustrator script that automates measurements of objects. This is an early version that has not been sufficiently tested. Use at your own risks.
* Usage: Select 1 to 2 page items in Adobe Illustrator, then run this script by selecting File > Script > Other Scripts > (choose file)
* License: GNU General Public License Version 3. (http://www.gnu.org/licenses/gpl-3.0-standalone.html
Copy link to clipboard
Copied
Olá Marcelo, tudo bem?
Pode, por favor, mostrar uma imagem do tipo de cota que você gostaria de produzir no Illustrator? Talvez elas possam ser feitas através de recursos já existentes no Illustrator, como cabeças personalizadas de flechas.
Estou aqui para te ajudar
Aguardo,
Grande abraço
Gustavo.
Copy link to clipboard
Copied
Olá Gustavo, e obrigado por responder, segue a imagem de como eu gostaria..porém gostaria de que fossem automáticas, Ex: eu selecionar dois objetos e o plugin me dar as cotas... Obrigado..
Copy link to clipboard
Copied
Oi Marcelo
Era o que eu estava pensando mesmo. No entanto, não conheço nenhum plugin gratuito que faça isso. Você já ouviu falar do CADTools? Ele é pago, mas talvez seja o que você procura. Veja: https://www.hotdoor.com/cadtools/overview
Ajuda?
Grande abraço
Gustavo.
Copy link to clipboard
Copied
Olá, eu ja tinha visto esse, obrigado... Achei esse http://joaofaraco.com.br/destaques/illustrator-scripts-scriptographer/ só que ele não faz de centro a centro..
Continuo na procura..rsrrsrsrs
Copy link to clipboard
Copied
Haha, então boa procura.
Se encontrar, por favor, publique aqui.
Caso eu encontre alguma coisa, também te aviso.
Um grabde abraço Marcelo.
Gustavo.
Copy link to clipboard
Copied
Oi Marcelo, eu modifiquei o Sr. William Ngan Script para incluir opções para obter medidas a partir do centro.
/*
* Description: An Adobe Illustrator script that automates measurements of objects. This is an early version that has not been sufficiently tested. Use at your own risks.
* Usage: Select 1 to 2 page items in Adobe Illustrator, then run this script by selecting File > Script > Other Scripts > (choose file)
* License: GNU General Public License Version 3. (http://www.gnu.org/licenses/gpl-3.0-standalone.html)
*
* Copyright (c) 2009. William Ngan.
*/
// EDITED by CarlosCanto to include options to get measurements from the center // 9/10/12
// Create an empty dialog window near the upper left of the screen
var dlg = new Window('dialog', 'Spec');
//dlg.frameLocation = [100,100]; // CC
dlg.size = [250,250];
dlg.intro = dlg.add('statictext', undefined /*[20,20,150,40]*/ ); // CC
dlg.intro.text = 'First select 1 or 2 items';
dlg.where = dlg.add('dropdownlist', undefined /*[20,40,150,60] */); // CC
dlg.where.selection = dlg.where.add('item', 'top');
dlg.where.add('item', 'bottom');
dlg.where.add('item', 'left');
dlg.where.add('item', 'right');
//--added - CC
dlg.grpFrom = dlg.add('group');
var radGap = dlg.grpFrom.add('radiobutton', undefined, 'Gap');
var radCenter = dlg.grpFrom.add('radiobutton', undefined, 'Center');
radGap.value = true;
dlg.alignChildren = 'left';
//--end added
dlg.btn = dlg.add('button', undefined/*[20,70,150,90]*/, 'Specify', 'spec'); // CC
// document
var doc = activeDocument;
// spec layer
try {
var speclayer =doc.layers['spec'];
} catch(err) {
var speclayer = doc.layers.add();
speclayer.name = 'spec';
}
// measurement line color
var color = new RGBColor;
color.green = 255;
color.blue = 0;
// gap between measurement lines and object
var gap = 2;
// size of measurement lines.
var size = 10;
// number of decimal places
var decimals = 0;
// pixels per inch
var dpi = 72;
/**
Start the spec
*/
function startSpec() {
if (doc.selection.length==1) {
specSingle( doc.selection[0].geometricBounds, dlg.where.selection.text );
} else if (doc.selection.length==2) {
specDouble( doc.selection[0], doc.selection[1], dlg.where.selection.text );
} else {
alert('please select 1 or 2 items');
}
dlg.close ();
}
/**
Spec the gap between 2 elements
*/
function specDouble( item1, item2, where ) {
var bound = new Array(0,0,0,0);
var a = item1.geometricBounds;
var b = item2.geometricBounds;
if (where=='top' || where=='bottom') {
if (b[0]>a[0]) { // item 2 on right,
// --added
if (radCenter.value) {
//alert('im in radcenter 2 on right');
a[2] = a[2]-(a[2]-a[0])/2;
b[0] = b[0]+(b[2]-b[0])/2;
}
//--end added
if (b[0]>a[2]) { // no overlap
bound[0] =a[2];
bound[2] = b[0];
} else { // overlap
bound[0] =b[0];
bound[2] = a[2];
}
} else if (a[0]>=b[0]){ // item 1 on right
// --added
if (radCenter.value) {
//alert('im in radcenter 1 on right');
a[0] = a[2]-(a[2]-a[0])/2;
b[2] = b[0]+(b[2]-b[0])/2;
}
//--end added
if (a[0]>b[2]) { // no overlap
bound[0] =b[2];
bound[2] = a[0];
} else { // overlap
bound[0] =a[0];
bound[2] = b[2];
}
}
bound[1] = Math.max (a[1], b[1]);
bound[3] = Math.min (a[3], b[3]);
} else {
if (b[3]>a[3]) { // item 2 on top
// --added
if (radCenter.value) {
//alert('im in radcenter 2 on top');
a[1] = a[1]-(a[1]-a[3])/2;
b[3] = b[3]+(b[1]-b[3])/2;
}
//--end added
if (b[3]>a[1]) { // no overlap
bound[3] =a[1];
bound[1] = b[3];
} else { // overlap
bound[3] =b[3];
bound[1] = a[1];
}
} else if (a[3]>=b[3]){ // item 1 on top
// --added
if (radCenter.value) {
//alert('im in radcenter 1 on top');
a[3] = a[1]-(a[1]-a[3])/2;
b[1] = b[3]+(b[1]-b[3])/2;
}
//--end added
if (a[3]>b[1]) { // no overlap
bound[3] =b[1];
bound[1] = a[3];
} else { // overlap
bound[3] =a[3];
bound[1] = b[1];
}
}
bound[0] = Math.min(a[0], b[0]);
bound[2] = Math.max (a[2], b[2]);
}
specSingle(bound, where );
}
/**
spec a single object
@param bound item.geometricBound
@param where 'top', 'bottom', 'left,' 'right'
*/
function specSingle( bound, where ) {
// width and height
var w = bound[2]-bound[0];
var h = bound[1]-bound[3];
// a & b are the horizontal or vertical positions that change
// c is the horizontal or vertical position that doesn't change
var a = bound[0];
var b = bound[2];
var c = bound[1];
// xy='x' (horizontal measurement), xy='y' (vertical measurement)
var xy = 'x';
// a direction flag for placing the measurement lines.
var dir = 1;
switch( where ) {
case 'top':
a = bound[0];
b = bound[2];
c = bound[1];
xy = 'x';
dir = 1;
break;
case 'bottom':
a = bound[0];
b = bound[2];
c = bound[3];
xy = 'x';
dir = -1;
break;
case 'left':
a = bound[1];
b = bound[3];
c = bound[0];
xy = 'y';
dir = -1;
break;
case 'right':
a = bound[1];
b = bound[3];
c = bound[2];
xy = 'y';
dir = 1;
break;
}
// create the measurement lines
var lines = new Array();
// horizontal measurement
if (xy=='x') {
// 2 vertical lines
lines[0]= new Array( new Array(a, c+(gap)*dir) );
lines[0].push ( new Array(a, c+(gap+size)*dir) );
lines[1]= new Array( new Array(b, c+(gap)*dir) );
lines[1].push( new Array(b, c+(gap+size)*dir) );
// 1 horizontal line
lines[2]= new Array( new Array(a, c+(gap+size/2)*dir ) );
lines[2].push( new Array(b, c+(gap+size/2)*dir ) );
// create text label
if (where=='top') {
var t = specLabel( w, (a+b)/2, lines[0][1][1] );
t.top += t.height;
} else {
var t = specLabel( w, (a+b)/2, lines[0][0][1] );
t.top -= t.height;
}
t.left -= t.width/2;
// vertical measurement
} else {
// 2 horizontal lines
lines[0]= new Array( new Array( c+(gap)*dir, a) );
lines[0].push ( new Array( c+(gap+size)*dir, a) );
lines[1]= new Array( new Array( c+(gap)*dir, b) );
lines[1].push( new Array( c+(gap+size)*dir, b) );
//1 vertical line
lines[2]= new Array( new Array(c+(gap+size/2)*dir, a) );
lines[2].push( new Array(c+(gap+size/2)*dir, b) );
// create text label
if (where=='left') {
var t = specLabel( h, lines[0][1][0], (a+b)/2 );
t.left -= t.width;
} else {
var t = specLabel( h, lines[0][0][0], (a+b)/2 );
t.left += size;
}
t.top += t.height/2;
}
// draw the lines
var specgroup = new Array(t);
for (var i=0; i<lines.length; i++) {
var p = doc.pathItems.add();
p.setEntirePath ( lines );
setLineStyle( p, color );
specgroup.push( p );
}
group(speclayer, specgroup );
}
/**
Create a text label that specify the dimension
*/
function specLabel( val, x, y) {
var t = doc.textFrames.add();
t.textRange.characterAttributes.size = 8;
t.textRange.characterAttributes.alignment = StyleRunAlignmentType.center;
var v = val;
switch (doc.rulerUnits) {
case RulerUnits.Inches:
v = val/dpi;
v = v.toFixed (decimals);
break;
case RulerUnits.Centimeters:
v = val/(dpi/2.54);
v = v.toFixed (decimals);
break;
case RulerUnits.Millimeters:
v = val/(dpi/25.4);
v = v.toFixed (decimals);
break;
case RulerUnits.Picas:
v = val/(dpi/6);
var vd = v - Math.floor (v);
vd = 12*vd;
v = Math.floor(v)+'p'+vd.toFixed (decimals);
break;
default:
v = v.toFixed (decimals);
}
t.contents = v;
t.top = y;
t.left = x;
return t;
}
function setLineStyle(path, color) {
path.filled = false;
path.stroked = true;
path.strokeColor = color;
path.strokeWidth = 0.5;
return path;
}
/**
* Group items in a layer
*/
function group( layer, items, isDuplicate) {
// create new group
var gg = layer.groupItems.add();
// add to group
// reverse count, because items length is reduced as items are moved to new group
for(var i=items.length-1; i>=0; i--) {
if (items!=gg) { // don't group the group itself
if (isDuplicate) {
newItem = items.duplicate (gg, ElementPlacement.PLACEATBEGINNING);
} else {
items.move( gg, ElementPlacement.PLACEATBEGINNING );
}
}
}
return gg;
}
// ----------------------------------------------------------------------------------------------------------------------------------------
dlg.btn.addEventListener ('click', startSpec );
dlg.show();
Copy link to clipboard
Copied
Olá Carlos, tudo bem? e obrigado pelo retorno, vou testar e logo coloco aqui como foi.... E mais uma vez, muito obrigado..
Até mais....
Marcelo
Copy link to clipboard
Copied
Olá, testei aqui e funcionou perfeitamente....
Muito Obrigado...
Marcelo
Copy link to clipboard
Copied
Muito bom, Carlos.
Parabéns.
Gustavo.
Copy link to clipboard
Copied
de nada, Marcelo
thanks Gustavo, I'll try to come here often to see if there are other scripting needs I can help with...I'll leave the "easy" answers for you ...just kidding, you're doing a great job.
Copy link to clipboard
Copied
hahahaha Com certeza, Carlos.
Será um prazer. Deixe as perguntas mais fáceis comigo. Acho que consigo respondê-las
Grande abraço
Copy link to clipboard
Copied
onde mudo para milimetros?
Copy link to clipboard
Copied
Olá.
Há dois caminhos:
1. Clicar com o botão direito em cima da régua (vertical ou horizontal) da
área de trabalho e escolher a unidade desejada.
2. File/Document Setup - Clique na caixa de diálogo (Units) e escolha a
unidade desejada.
Copy link to clipboard
Copied
Fantastic the Script! It's Perfect!!!!
Thanks Carlos
Copy link to clipboard
Copied
Excelente debate. Me ajudou bastante tb. Valeuuu!
Copy link to clipboard
Copied
Olá a todos!
Aproveitando a discussão, gostaria de saber se tem como colocar cotas em todos os lados ao mesmo tempo e se é possível colocar cotas na diagonal conforme imagem abaixo.
Abraço!
Copy link to clipboard
Copied
CarlosCanto ou alguem que entenda de scripts.. rs Para acrescentar o decimal após a virgula, consegui mudar o script, mas agora alguem pode ajudar para ao invez de ponto, aparecer virgula e a menção que a regua está ajustada no documento ? por ex.. 2,34mm 2,34pontos etc etc ?
Copy link to clipboard
Copied
Boa tarde!
Illustrator tem a função de cotas simples? Preciso adicionar medidas para enviar para o cliente!
Copy link to clipboard
Copied
@Olavo354584433sow schrieb:
Boa tarde!
Illustrator tem a função de cotas simples? Preciso adicionar medidas para enviar para o cliente!
This is an old thread. The newest version has this functionality.
https://helpx.adobe.com/illustrator/using/measure-and-show-dimensions.html