|
可以配合 ai_scriptmix-master 插件使用方便
复制已下内容到记事本打开就行 另存jsx格式
- doc = app.activeDocument;
- theSelect = doc.selection;
- for (var i = 0; i < theSelect.length; i += 1) {
- x = theSelect[i].left;
- y = theSelect[i].top;
- w = theSelect[i].width;
- h = theSelect[i].height;
- s = 30;
- asize = 20;
- if (h < 50 || w < 50) {
- asize = 5;
- }
- tsize = 36;
- if (h < 60 || w < 60) {
- tsize = 12;
- }
- redColor = new CMYKColor();
- redColor.black = 1;
- redColor.cyan = 1;
- redColor.magenta = 100;
- redColor.yellow = 100;
- var g1 = doc.groupItems.add();
- 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 = (Math.round(w * 0.35277778 * 1000) / 1000) + " mm";
- t2.textRange.characterAttributes.size = tsize;
- t2.textRange.characterAttributes.fillColor = redColor;
- t2.left = (x + (w / 2)) - (t2.width / 2);
- t2.top = ((y - h) - s) - (s / 2);
- }
复制代码
|
|