好多资源哦

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

AI 纵尺寸脚本

[复制链接]
发表于 2024-8-26 13:50:28 | 显示全部楼层 |阅读模式
可以配合 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 line1 = g1.pathItems.add();
  24.     line1.setEntirePath(new Array(new Array(x - s, y), new Array(x - s, y - h)));
  25.     line1.strokeColor = redColor;
  26.     var line1 = g1.pathItems.add();
  27.     line1.setEntirePath(new Array(new Array((x - s) - (s / 2), y), new Array(x - (s / 2), y)));
  28.     line1.strokeColor = redColor;
  29.     var line1 = g1.pathItems.add();
  30.     line1.setEntirePath(new Array(new Array((x - s) - (s / 2), y - h), new Array(x - (s / 2), y - h)));
  31.     line1.strokeColor = redColor;
  32.     var ar1 = g1.pathItems.add();
  33.     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)));
  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 - s, y - h), new Array((x - s) - (asize / 2), (y - h) + asize), new Array((x - s) + (asize / 2), (y - h) + asize)));
  39.     ar1.strokeColor = NoColor;
  40.     ar1.fillColor = redColor;
  41.     ar1.closed = true;
  42.     var t1 = g1.textFrames.add();
  43.     t1.contents = (Math.round(h * 0.35277778 * 1000) / 1000) + " mm";
  44.     t1.textRange.characterAttributes.size = tsize;
  45.     t1.textRange.characterAttributes.fillColor = redColor;
  46.     t1.left = ((x - s) - s) - (t1.width / 2);
  47.     t1.top = (y - (h / 2)) + (t1.height / 2);
  48.     t1.rotate(90);
  49. }

复制代码




回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-18 18:29 , Processed in 0.100834 second(s), 14 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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