Illustrator腳本開發(fā)標注縱向尺寸
發(fā)布時間:2024-11-08 11:39 [ 我要自學網(wǎng)原創(chuàng) ] 發(fā)布人: 快樂小女 閱讀: 84

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 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 = (Math.round(h * 0.35277778 * 1000) / 1000) + " mm";
    t1.textRange.characterAttributes.size = tsize;
    t1.textRange.characterAttributes.fillColor = redColor;
    t1.left = ((x - s) - s) - (t1.width / 2);
    t1.top = (y - (h / 2)) + (t1.height / 2);
    t1.rotate(90);
}

Illustrator腳本開發(fā)教程
我要自學網(wǎng)商城 ¥70 元
進入購買
文章評論
0 條評論 按熱度排序 按時間排序 /350
添加表情
遵守中華人民共和國的各項道德法規(guī),
承擔因您的行為而導致的法律責任,
本站有權(quán)保留或刪除有爭議評論。
參與本評論即表明您已經(jīng)閱讀并接受
上述條款。
V
特惠充值
聯(lián)系客服
APP下載
官方微信
返回頂部
分類選擇:
電腦辦公 平面設(shè)計 室內(nèi)設(shè)計 室外設(shè)計 機械設(shè)計 工業(yè)自動化 影視動畫 程序開發(fā) 網(wǎng)頁設(shè)計 會計課程 興趣成長 AIGC