我想问一下AI怎么可以才自动添加度量出来的尺寸?
illustrator吧
全部回复
仅看楼主
level 4
lulion5 楼主
各位大神,想问一下AI怎么才能做到能像cdr一样自动把量出来的尺寸显示在画布上,我的版本是:AI cc的,之前安装了cadtools插件,但cadtools的测量工具不能使用,谁有解决方法,因为工作中很多地方都需要这个可以把尺寸显示在画布上,万分感谢!
2016年12月15日 04点12分 1
level 1
doc = app.activeDocument;
var u=2.834646
theSelect = doc.selection;
for (i=0;i<theSelect.length;i++){ //批处理多个选择物体
x=theSelect[i].left;
y=theSelect[i].top;
w=theSelect[i].width;
h=theSelect[i].height;
s=50;//标尺距离物体边沿宽度
asize=20;//箭头大小
if(h<50 || w<50){asize=10;}//简单的自适应,太小的物体用小箭头
tsize=48; //标尺字体大小
redColor = new CMYKColor();//标尺用红色
redColor.black = 00;
redColor.cyan = 100;
redColor.magenta =100;
redColor.yellow = 0;
var g1 = doc.groupItems.add();//将标尺群组
var line1=g1.pathItems.add(); //画高度标尺
line1.setEntirePath( new Array(
new Array(x-s, y),
new Array(x-s, y-h),
)
) ;
line1.strokeColor= redColor;
var line1=g1.pathItems.add();
line1.setEntirePath( new Array(
new Array(x-s-s/2, y),
new Array(x-s/2, y),
)
) ;
line1.strokeColor= redColor;
var line1=g1.pathItems.add();
line1.setEntirePath( new Array(
new Array(x-s-s/2, y-h),
new Array(x-s/2, y-h),
)
) ;
line1.strokeColor= redColor;
//画箭头
var ar1=g1.pathItems.add();
ar1.setEntirePath( new Array(
new Array(x-s, y),
new Array(x-s-asize/2,y-asize),
new Array(x-s+asize/2,y-asize),
)
) ;
ar1.strokeColor= NoColor;
ar1.fillColor= redColor;
ar1.closed=true;
var ar1=g1.pathItems.add();
ar1.setEntirePath( new Array(
new Array(x-s, y-h),
new Array(x-s-asize/2,y-h+asize),
new Array(x-s+asize/2,y-h+asize),
)
) ;
ar1.strokeColor= NoColor;
ar1.fillColor= redColor;
ar1.closed=true;
var t1 = g1.textFrames.add();
t1.contents = (h/u).toFixed(1)+" mm";
t1.textRange.characterAttributes.size=tsize;
t1.textRange.characterAttributes.fillColor= redColor;
t1.textRange.textFont=app.textFonts[textFonts.name="MicrosoftYaHei"];//字型:微软雅黑
t1.left = x-t1.width;
t1.top = y-h/2+t1.height/2;
t1.rotate(90); //文字旋转90度
var line2=g1.pathItems.add(); //画长度标尺
line2.setEntirePath( new Array(
new Array(x, y-h-s),
new Array(x+w, y-h-s),
)
) ;
line2.strokeColor= redColor;
var line2=g1.pathItems.add();
line2.setEntirePath( new Array(
new Array(x, y-h-s-s/2),
new Array(x, y-h-s/2),
)
) ;
line2.strokeColor= redColor;
var line2=g1.pathItems.add();
line2.setEntirePath( new Array(
new Array(x+w, y-h-s-s/2),
new Array(x+w, y-h-s/2),
)
) ;
line2.strokeColor= redColor;
//画箭头
var ar1=g1.pathItems.add();
ar1.setEntirePath( new Array(
new Array(x,y-h-s),
new Array(x+asize,y-h-s-asize/2),
new Array(x+asize,y-h-s+asize/2),
)
) ;
ar1.strokeColor= NoColor;
ar1.fillColor= redColor;
ar1.closed=true;
var ar1=g1.pathItems.add();
ar1.setEntirePath( new Array(
new Array(x+w,y-h-s),
new Array(x+w-asize,y-h-s-asize/2),
new Array(x+w-asize,y-h-s+asize/2),
)
) ;
ar1.strokeColor= NoColor;
ar1.fillColor= redColor;
ar1.closed=true;
var t2 = g1.textFrames.add();
t2.contents = (w/u).toFixed(1)+" mm";
t2.textRange.characterAttributes.size=tsize;
t2.textRange.characterAttributes.fillColor= redColor;
t2.textRange.textFont=app.textFonts[textFonts.name="MicrosoftYaHei"]; //字型:微软雅黑
t2.left = x+w/2-t2.width/2;
t2.top = y-h-s-s/2;
}
2017年03月31日 08点03分 2
腻害了!然后呢,怎么用?
2017年06月15日 03点06分
这…………
2018年06月29日 06点06分
level 1
自动标注.jsx
2017年03月31日 08点03分 3
level 10
将jsx脚本文件复制到\Illustrator XX\Presets\zh_CN\脚本文件夹下,重新启动ai,就可以在"文件"-"脚本"下看见ai脚本菜单,运行即可。
2017年06月15日 04点06分 4
不行啊,我的AI CC2017
2018年06月28日 10点06分
可以了。
2018年06月28日 11点06分
回复
great����
:可否告知如何操作的吗,**作了一下,脚本还是失败了,我用的CS5
2018年08月14日 13点08分
这个脚本通用的吗 我的是CS6
2018年11月06日 02点11分
level 1
老铁如何搞
2018年07月06日 11点07分 6
level 1
AI怎么可以才自动添加度量出来的尺寸?
2018年07月06日 11点07分 7
level 1
可以是可以用,但是不能像CDR一样自动更新数据,CADtools可以做到,但是功能又太强大............
2018年07月19日 06点07分 8
你好,能教我搞下吗
2018年08月12日 03点08分
@dangang2008 百度搜:measure 插件,用这个吧,下载的地方有教程,简单实用
2018年08月12日 07点08分
为什么我的不行
2018年09月17日 09点09分
可以教我怎么安装吗?
2018年09月17日 09点09分
level 1
搞不了,谁帮下忙!
2018年08月12日 03点08分 9
level 1
2018年08月12日 07点08分 11
求助,谢谢大神
2018年11月02日 08点11分
百度亿品元素,在网站里面再搜索这个插件,链接发不了
2018年11月02日 15点11分
😳
2018年11月02日 15点11分
level 6
顶顶顶顶顶
2018年08月12日 12点08分 12
level 1
我也在找CADtools插件工具哎
2018年11月06日 02点11分 14
level 1
1
2021年01月13日 18点01分 15
level 1
给力
2022年11月14日 13点11分 16
level 5
用11楼推荐的插件就行了,我也是在用那个插件
2022年11月18日 20点11分 17
1