好多资源哦

 找回密码
 立即注册
查看: 265|回复: 0

AI 横尺寸脚本

[复制链接]
发表于 2024-8-26 10:37:15 | 显示全部楼层 |阅读模式
可以配合 ai_scriptmix-master 插件使用方便

复制已下内容到记事本打开就行  另存jsx格式

  1. doc = app.activeDocument;
  2. theSelect = doc.selection;
  3. for (var i = 0; i < theSelect.length; i += 1) {
  4.     x = theSelect[i].left;
  5.     y = theSelect[i].top;
  6.     w = theSelect[i].width;
  7.     h = theSelect[i].height;
  8.     s = 30;
  9.     asize = 20;
  10.     if (h < 50 || w < 50) {
  11.         asize = 5;
  12.     }
  13.     tsize = 36;
  14.     if (h < 60 || w < 60) {
  15.         tsize = 12;
  16.     }
  17.     redColor = new CMYKColor();
  18.     redColor.black = 1;
  19.     redColor.cyan = 1;
  20.     redColor.magenta = 100;
  21.     redColor.yellow = 100;
  22.     var g1 = doc.groupItems.add();
  23.     var line2 = g1.pathItems.add();
  24.     line2.setEntirePath(new Array(new Array(x, (y - h) - s), new Array(x + w, (y - h) - s)));
  25.     line2.strokeColor = redColor;
  26.     var line2 = g1.pathItems.add();
  27.     line2.setEntirePath(new Array(new Array(x, ((y - h) - s) - (s / 2)), new Array(x, (y - h) - (s / 2))));
  28.     line2.strokeColor = redColor;
  29.     var line2 = g1.pathItems.add();
  30.     line2.setEntirePath(new Array(new Array(x + w, ((y - h) - s) - (s / 2)), new Array(x + w, (y - h) - (s / 2))));
  31.     line2.strokeColor = redColor;
  32.     var ar1 = g1.pathItems.add();
  33.     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))));
  34.     ar1.strokeColor = NoColor;
  35.     ar1.fillColor = redColor;
  36.     ar1.closed = true;
  37.     var ar1 = g1.pathItems.add();
  38.     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))));
  39.     ar1.strokeColor = NoColor;
  40.     ar1.fillColor = redColor;
  41.     ar1.closed = true;
  42.     var t2 = g1.textFrames.add();
  43.     t2.contents = (Math.round(w * 0.35277778 * 1000) / 1000) + " mm";
  44.     t2.textRange.characterAttributes.size = tsize;
  45.     t2.textRange.characterAttributes.fillColor = redColor;
  46.     t2.left = (x + (w / 2)) - (t2.width / 2);
  47.     t2.top = ((y - h) - s) - (s / 2);
  48. }

复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|好多资源哦

GMT+8, 2024-11-21 17:24 , Processed in 0.090018 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表