illustrator插件-拼版功能开发-印前角线-js脚本开发-ai插件( 四 )

< W??+= 1) {colorArr = colorArr.concat(temp);}if (colorLable.value == true) {for (var i = 0;i < colorArr.length;i += 1) {oaVal = OpacityArr.length * i;if (i == 0) {left = lmin + ?igrave;荎gi?w;} else {left = left + cw + cspace;}for (var?= 0;?< OpacityArr.length && oaVal < ?ē;?+, oaVal++) {if (?== 0) {left = left;} else {left = left + cw + cspace;}if (linespace > outspace) {var?= linespace;} else {var?= outspace;}rect = g.pathItems.rectangle(tmax + ch + ? left, cw, ch);rect.filled = true;rect.fillColor = colorArr[i];rect.opacity = OpacityArr[鴀;rect.stroked = false;}}}}myDate = new Date();year = myDate.getFullYear();month = myDate.getMonth() + 1;date = myDate.getDate();w = year + "-" + month + "-" + date;if (haveFN.value == true && havePT.value == true) {docname = new File(doc.fullName).fsName;} else {if (haveFN.value == true) {docname = doc.name;}}if (haveFN.value == true || haveTM.value == true) {text = g.textFrames.add();if (haveFN.value == true && haveTM.value == true) {text.contents = docname + "" + w;} else if (haveFN.value == true) {text.contents = docname;} else {if (haveTM.value == true) {text.contents = w;}}text.textRange.characterAttributes.textFont = Textfontname;text.textRange.characterAttributes.fillColor = regColor;text.textRange.characterAttributes.stroked = false;text.textRange.characterAttributes.size = textfontsize;text.left = (lmax - (text.geometricBounds[2] - text.geometricBounds[0])) - 8.503938;if (linespace > outspace) {var?= linespace;} else {var?= outspace;}text.top = tmin - ?}if (bite.value == true) {text = g.textFrames.add();text.contents = "咬口";text.textRange.characterAttributes.textFont = Textfontname;text.textRange.characterAttributes.fillColor = regColor;text.textRange.characterAttributes.stroked = false;text.textRange.characterAttributes.size = textfontsize;if ((lmax - lmin) < (tmax - tmin)) {text.rotate(90);text.left = (lmax + linespace + (linelength / 2)) - (text.width / 2);text.top = ((tmax + tmin) / 2) + (text.height / 2);} else {text.left = ((lmax + lmin) / 2) - (text.width / 2);text.top = ((tmin - linespace) - (linelength / 2)) + (text.height / 2);}}if (oiValue.text != "") {text = g.textFrames.add();text.contents = oiValue.text;text.textRange.characterAttributes.textFont = Textfontname;text.textRange.characterAttributes.fillColor = regColor;text.textRange.characterAttributes.stroked = false;text.textRange.characterAttributes.size = textfontsize;text.rotate(270);text.left = ((lmin - linespace) - (linelength / 2)) - (text.width / 2);text.top = tmin + text.height;}for (var i = 0;i < ww.length;i += 1) {tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];if (shuangjiaoxian == true && rishicaiqie == true && outspace == linespace) {if (ww[i] == (lmin - outspace) || ww[i] == (lmax + outspace)) {tPathVal.setEntirePath([[ww[i], tmin],[ww[i], (tmin - linelength) - outspace]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.strokeDashes = [];tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[ww[i], tmax],[ww[i], tmax + linelength + outspace]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;} else {tPathVal.setEntirePath([[ww[i], tmin - linespace],[ww[i], (tmin - linespace) - linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[ww[i], tmax + linespace],[ww[i], tmax + linespace + linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;}} else {tPathVal.setEntirePath([[ww[i], tmin - linespace],[ww[i], (tmin - linespace) - linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[ww[i], tmax + linespace],[ww[i], tmax + linespace + linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;}}for (vari = 0;i < hh.length;i += 1) {tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];if (shuangjiaoxian == true && rishicaiqie == true && outspace == linespace) {if (hh[i] == (tmin - outspace) || hh[i] == (tmax + outspace)) {tPathVal.setEntirePath([[lmin, hh[i]],[(lmin - linelength) - outspace, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmax, hh[i]],[lmax + linelength + outspace, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;} else {tPathVal.setEntirePath([[lmin - linespace, hh[i]],[(lmin - linespace) - linelength, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmax + linespace, hh[i]],[lmax + linespace + linelength, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;}} else {tPathVal.setEntirePath([[lmin - linespace, hh[i]],[(lmin - linespace) - linelength, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmax + linespace, hh[i]],[lmax + linespace + linelength, hh[i]]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;}}tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmin - linespace, tmax - ((tmax - tmin) / 2)],[(lmin - linespace) - linelength, tmax - ((tmax - tmin) / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[(lmin - linespace) - (linelength / 2), (tmax - ((tmax - tmin) / 2)) + (linelength / 2)],[(lmin - linespace) - (linelength / 2), (tmax - ((tmax - tmin) / 2)) - (linelength / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmax + linespace, tmax - ((tmax - tmin) / 2)],[lmax + linespace + linelength, tmax - ((tmax - tmin) / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmax + linespace + (linelength / 2), (tmax - ((tmax - tmin) / 2)) + (linelength / 2)],[lmax + linespace + (linelength / 2), (tmax - ((tmax - tmin) / 2)) - (linelength / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[(lmin + ((lmax - lmin) / 2)) - (linelength / 2), tmax + linespace + (linelength / 2)],[lmin + ((lmax - lmin) / 2) + (linelength / 2), tmax + linespace + (linelength / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmin + ((lmax - lmin) / 2), tmax + linespace],[lmin + ((lmax - lmin) / 2), tmax + linespace + linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[(lmin + ((lmax - lmin) / 2)) - (linelength / 2), (tmin - linespace) - (linelength / 2)],[lmin + ((lmax - lmin) / 2) + (linelength / 2), (tmin - linespace) - (linelength / 2)]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;tPathVal = g.pathItems.add();tPathVal.strokeDashes = [];tPathVal.setEntirePath([[lmin + ((lmax - lmin) / 2), tmin - linespace],[lmin + ((lmax - lmin) / 2), (tmin - linespace) - linelength]]);tPathVal.strokeColor = regColor;tPathVal.strokeWidth = lw;tPathVal.filled = false;o = g.pathItems.ellipse((tmax - ((tmax - tmin) / 2)) + (od / 2), ((lmin - (od / 2)) - linespace) - (linelength / 2), od, od);o.strokeColor = regColor;o.strokeWidth = lw;o.strokeDashes = [];o.filled = false;o = g.pathItems.ellipse((tmax - ((tmax - tmin) / 2)) + (od / 2), (lmax - (od / 2)) + linespace + (linelength / 2), od, od);o.strokeColor = regColor;o.strokeWidth = lw;o.strokeDashes = [];o.filled = false;o = g.pathItems.ellipse(tmax + linespace + (od / 2) + (linelength / 2), (lmin + ((lmax - lmin) / 2)) - (od / 2), od, od);o.strokeColor = regColor;o.strokeWidth = lw;o.strokeDashes = [];o.filled = false;o = g.pathItems.ellipse(((tmin - linespace) + (od / 2)) - (linelength / 2), (lmin + ((lmax - lmin) / 2)) - (od / 2), od, od);o.strokeColor = regColor;o.strokeWidth = lw;o.strokeDashes = [];o.filled = false;if (littleSize.value == true || bigSize.value == true || paperSize.value == true || paperSize1.value == true) {gw = g.width / v;gh = g.height / v;text = g.textFrames.add();text.textRange.characterAttributes.textFont = Textfontname;if (littleSize.value == true) {text1 = "单模:" + Math.round(parseInt((w1 / 2.834646) * 100) / 100) + "x" + Math.round(parseInt((h1 / 2.834646) * 100) / 100) + "mm ; ";} else {text1 = "";}if (bigSize.value == true) {text2 = "拼版:" + Math.round(parseInt(((lmax - lmin) / 2.834646) * 100) / 100) + "x" + Math.round(parseInt(((tmax - tmin) / 2.834646) * 100) / 100) + "mm ; ";} else {text2 = "";}if (paperSize.value == true) {text3 = "角线:" + Math.round((gw * 100) / 100) + "x" + Math.round((gh * 100) / 100) + "mm ; ";} else {text3 = "";}if (paperSize1.value == true) {text4 = "纸张:" + paperW.text + "x" + paperH.text + "mm ; ";} else {text4 = "";}text.contents = text1 + text2 + text3 + text4;text.textRange.characterAttributes.fillColor = regColor;text.textRange.characterAttributes.stroked = false;text.textRange.characterAttributes.size = textfontsize;text.left = (lmax - (text.geometricBounds[2] - text.geometricBounds[0])) - 8.503938;text.rotate(90);text.left = (lmax + linespace + (linelength / 2)) - (text.width / 2);text.top = tmin + text.height;}}if (ABtrans.value == true || gird.value == true) {g1 = cutlayer.groupItems.add();}lmin = lmin + qubian;tmax = tmax - qubian;lmax = lmax - qubian;tmin = tmin + qubian;if (autopage.value == false && ABtrans.value == true) {Ab = doc.artboards[doc.artboards.getActiveArtboardIndex()];refB = [lmin, tmax, lmax, tmin];refB_width = refB[2] - refB[0];refB_heigth = refB[1] - refB[3];var yVal = refB[0] - ((Paper_width - refB_width) / 2);var xVal = refB[1] + ((Paper_heigth - refB_heigth) - Paper_bite);paper = g1.pathItems.rectangle(xVal, yVal, Paper_width, Paper_heigth);paper.filled = false;paper.stroked = true;paper.strokeColor = regColor;paper.strokeWidth = 1;paper.strokeDashes = [5, 1, 1];paper.guides = true;paper.locked = true;refB[0] = refB[0] - ((Plate_width - refB_width) / 2);refB[2] = refB[2] + ((Plate_width - refB_width) / 2);refB[1] = refB[1] + ((Plate_heigth - refB_heigth) - Plate_bite);refB[3] = refB[3] - Plate_bite;Ab.artboardRect = refB;}if (autopage.value == false && gird.value == true) {var arrayVal = [];arrayVal [0] = [[-66666, tmin],[66666, tmin]];arrayVal [1] = [[-66666, tmin - Paper_bite],[66666, tmin - Paper_bite]];arrayVal [2] = [[(lmin + lmax) / 2, 66666],[(lmin + lmax) / 2, -66666]];arrayVal [3] = [[-66666, tmin - Plate_bite],[66666, tmin - Plate_bite]];for (vari = 0;i


推荐阅读