Illustrator腳本開(kāi)發(fā)標(biāo)注橫向尺寸
發(fā)布時(shí)間:2024-11-08 11:38 [ 我要自學(xué)網(wǎng)原創(chuàng) ] 發(fā)布人: 快樂(lè)小女 閱讀: 108

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);
}

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