前言:
今天姐妹们对“拼版算法”大致比较关注,咱们都想要分析一些“拼版算法”的相关内容。那么小编同时在网络上汇集了一些对于“拼版算法””的相关知识,希望同学们能喜欢,大家一起来学习一下吧!1.算法程序
illustrator是矢量编辑软件,在印刷方面的一个重要功能就是拼版,开发一个印前角线功能,源代码如下所示:
Ver = "v7.3";var platFormType = Folder.fs;if (platFormType == "Windows") { gArgG = decodeURI(new File($.fileName).path) + "/AutoMark_" + Ver + ".xml";} else { gArgG = Folder.myDocuments + "/AutoMark_" + Ver + ".xml";}function function1 () {NewFileVal = new File(gArgG); if (NewFileVal.exists == false) {function2 (); } AutoMarkinfo = function3 ("read", gArgG); AutoMarkXml = new XML(AutoMarkinfo); regWin = new Window("dialog", "角线X " + Ver + " tiandiyiqi 89766284", [0, 0, 475, 385], { resizeable: true, resizeable: false }); caiqiezu = regWin.add("group", [0, 0, 390, 122], "undefined"); caiqiexian = caiqiezu.add("panel", [12, 8, 387, 116], "裁切线"); lineLengh = caiqiezu.add("statictext", [24, 37, 94, 57], "长度:"); linewide = caiqiezu.add("statictext", [24, 64, 94, 84], "宽度:"); outSpace = caiqiezu.add("statictext", [155, 34, 225, 54], "出血:"); lineSpace = caiqiezu.add("statictext", [155, 61, 225, 81], "偏移:"); lLValue = caiqiezu.add("edittext", [58, 34, 138, 54], AutoMarkXml.lLValue); lwValue = caiqiezu.add("edittext", [58, 60, 138, 80], AutoMarkXml.lwValue); lSValue = caiqiezu.add("edittext", [186, 60, 266, 80], AutoMarkXml.lSValue); oSValue = caiqiezu.add("edittext", [186, 34, 266, 54], AutoMarkXml.oSValue); doubleLine = caiqiezu.add("checkbox", [312, 33, 382, 53], "双角线"); doubleLine.value = AutoMarkXml.doubleLine - 0; JPLine = caiqiezu.add("checkbox", [312, 61, 382, 81], "日式角线"); JPLine.value = AutoMarkXml.JPLine - 0; havebleed = caiqiezu.add("statictext", [25, 93, 95, 113], "模式:"); buhanchuxue = caiqiezu.add("radiobutton", [74, 90, 164, 110], "不含出血"); buhanchuxue.value = AutoMarkXml.buhanchuxue - 0; quanbuchuxue = caiqiezu.add("radiobutton", [195, 90, 285, 110], "全部出血"); quanbuchuxue.value = AutoMarkXml.quanbuchuxue - 0; dabanchuxue = caiqiezu.add("radiobutton", [312, 90, 402, 110], "大版出血"); dabanchuxue.value = AutoMarkXml.dabanchuxue - 0; yansezu = regWin.add("group", [0, 120, 230, 215], "undefined"); yansexian = yansezu.add("panel", [12, 0, 225, 92], "颜 色"); CMYK = yansexian.add("radiobutton", [12, 11, 102, 31], "英文"); CMYK.value = AutoMarkXml.CMYK - 0; mingcheng = yansexian.add("radiobutton", [58, 11, 156, 31], "中英文"); mingcheng.value = AutoMarkXml.mingcheng - 0; wu = yansexian.add("radiobutton", [118, 11, 205, 31], "无"); wu.value = AutoMarkXml.wu - 0; boolCx = yansexian.add("checkbox", [13, 33, 83, 53], "C"); boolCx.value = AutoMarkXml.boolCx - 0; boolMx = yansexian.add("checkbox", [65, 33, 137, 53], "M"); boolMx.value = AutoMarkXml.boolMx - 0; boolYx = yansexian.add("checkbox", [115, 33, 185, 53], "Y"); boolYx.value = AutoMarkXml.boolYx - 0; boolKx = yansexian.add("checkbox", [159, 33, 229, 53], "K"); boolKx.value = AutoMarkXml.boolKx - 0; colorLable = yansexian.add("checkbox", [159, 10, 229, 30], "色条"); colorLable.value = AutoMarkXml.colorLable - 0; ptReplace = yansexian.add("statictext", [10, 59, 110, 79], "Pantone代替:", { multiline: true }); prValue = yansexian.add("edittext", [95, 57, 198, 73], AutoMarkXml.prValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); CMYK.onClick = mingcheng.onClick = function() { if (CMYK.value == true || mingcheng.value == true) { boolCx.value = true; boolMx.value = true; boolYx.value = true; boolKx.value = true; } }; wu.onClick = function() { if (wu.value == true) { CMYK.value = false; mingcheng.value = false; boolCx.value = false; boolMx.value = false; boolYx.value = false; boolKx.value = false; colorLable.value = false; } }; boolCx.onClick = boolMx.onClick = boolYx.onClick = boolKx.onClick = function() { if (boolCx.value == false && boolMx.value == false && boolYx.value == false && boolKx.value == false) { wu.value = true; } if (boolCx.value == true && boolMx.value == true && boolYx.value == true && boolKx.value == true) { CMYK.value = true; } }; xinxizu = regWin.add("group", [230, 120, 390, 258], "undefined"); xinxixian = xinxizu.add("panel", [0, 0, 157, 123], "信息"); haveFN = xinxizu.add("checkbox", [11, 18, 81, 38], "文件名"); haveFN.value = AutoMarkXml.haveFN - 0; haveTM = xinxizu.add("checkbox", [11, 43, 81, 63], "日期"); haveTM.value = AutoMarkXml.haveTM - 0; havePT = xinxizu.add("checkbox", [11, 68, 81, 88], "路径"); havePT.value = AutoMarkXml.havePT - 0; bite = xinxizu.add("checkbox", [11, 92, 81, 112], "咬 口"); bite.value = AutoMarkXml.bite - 0; littleSize = xinxizu.add("checkbox", [83, 18, 153, 38], "单模尺寸"); littleSize.value = AutoMarkXml.littleSize - 0; bigSize = xinxizu.add("checkbox", [83, 43, 153, 63], "拼版尺寸"); bigSize.value = AutoMarkXml.bigSize - 0; paperSize = xinxizu.add("checkbox", [83, 69, 153, 89], "角线尺寸"); paperSize.value = AutoMarkXml.paperSize - 0; paperSize1 = xinxizu.add("checkbox", [83, 92, 153, 112], "纸张尺寸"); paperSize1.value = AutoMarkXml.paperSize1 - 0; beizhuzu = regWin.add("group", [0, 214, 230, 241], "undefined"); otherInfo = beizhuzu.add("statictext", [21, 7, 91, 27], "备注:", { multiline: true }); oiValue = beizhuzu.add("edittext", [60, 3, 225, 23], AutoMarkXml.oiValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); CTPzu = regWin.add("group", [0, 239, 390, 387], "undefined"); CTPxian = CTPzu.add("panel", [12, 5, 387, 135], "CTP"); paperInfo = CTPzu.add("statictext", [23, 29, 93, 49], "纸张:", { multiline: true }); paperW = CTPzu.add("edittext", [60, 25, 110, 45], AutoMarkXml.paperW, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); X1 = CTPzu.add("statictext", [115, 29, 185, 49], "X", { multiline: true }); paperH = CTPzu.add("edittext", [130, 25, 180, 45], AutoMarkXml.paperH, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); paper3 = regWin.add("statictext", [195, 267, 238, 287], "咬口:"); paperB = CTPzu.add("edittext", [238, 25, 275, 45], AutoMarkXml.paperB, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); platoInfo = CTPzu.add("statictext", [22, 54, 92, 74], "版材:", { multiline: true }); platoW = CTPzu.add("edittext", [60, 50, 110, 70], AutoMarkXml.platoW, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); X2 = CTPzu.add("statictext", [115, 55, 185, 75], "X", { multiline: true }); platoH = CTPzu.add("edittext", [130, 50, 180, 70], AutoMarkXml.platoH, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); plate3 = CTPzu.add("statictext", [195, 53, 238, 73], "咬口:"); platoB = CTPzu.add("edittext", [238, 50, 275, 70], AutoMarkXml.platoB, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); cxdb = CTPzu.add("statictext", [283, 53, 353, 73], " 去 边:", { multiline: true }); cxdbkuang = CTPzu.add("edittext", [336, 50, 376, 70], AutoMarkXml.cxdbkuang, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); autopage = regWin.add("checkbox", [27, 320, 97, 340], "自动页面"); autopage.value = AutoMarkXml.autopage - 0; ABtrans = regWin.add("checkbox", [130, 320, 200, 340], "版纸设定"); ABtrans.value = AutoMarkXml.ABtrans - 0; gird = regWin.add("checkbox", [230, 320, 300, 340], "辅助线"); gird.value = AutoMarkXml.gird - 0; onlyCTP = regWin.add("checkbox", [318, 320, 388, 340], "仅 CTP"); onlyCTP.value = AutoMarkXml.onlyCTP - 0; autopage.onClick = function() { if (autopage.value == true) { ABtrans.value = false; gird.value = false; onlyCTP.value = false; } }; ABtrans.onClick = gird.onClick = onlyCTP.onClick = function() { if (ABtrans.value == true || gird.value == true || onlyCTP.value == true) { autopage.value = false; } }; selectFile = regWin.add("button", [27, 345, 77, 365], "链 接:"); sfValue = regWin.add("edittext", [85, 345, 230, 365], AutoMarkXml.sfValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); selectFile.onClick = function() { vará = File.openDialog("选择脚本", "PDF:*.pdf,EPS:*.eps,AI:*.ai", false); if (á != null) { sfValue.text = á.fsName } }; linkMove = regWin.add("statictext", [239, 350, 309, 367], "位 移:", { multiline: true }); lmValue = regWin.add("edittext", [280, 345, 316, 365], AutoMarkXml.lmValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); embed = regWin.add("checkbox", [330, 345, 400, 368], "嵌入"); embed.value = AutoMarkXml.embed - 0; zelanzu = regWin.add("group", [390, 0, 475, 385], "undefined"); okBt = zelanzu.add("button", [3, 16, 76, 36], "确定"); cancleBt = zelanzu.add("button", [3, 46, 76, 66], "取消"); yuzhi = zelanzu.add("button", [3, 75, 76, 95], "预置"); yushe1 = zelanzu.add("button", [3, 125, 76, 145], "预设一"); yushe2 = zelanzu.add("button", [3, 153, 76, 173], "预设二"); yushe3 = zelanzu.add("button", [3, 181, 36, 201], "三"); yushe4 = zelanzu.add("button", [43, 181, 76, 201], "四"); yushe5 = zelanzu.add("button", [3, 210, 36, 230], "五"); yushe6 = zelanzu.add("button", [43, 210, 76, 230], "六"); yushe7 = zelanzu.add("button", [3, 240, 36, 260], "七"); yushe8 = zelanzu.add("button", [43, 240, 76, 260], "八"); yushe9 = zelanzu.add("button", [3, 270, 36, 290], "九"); yushe10 = zelanzu.add("button", [43, 270, 76, 290], "十"); yushe11 = zelanzu.add("button", [3, 300, 36, 320], "11"); yushe12 = zelanzu.add("button", [43, 300, 76, 320], "12"); baocunshezhi = zelanzu.add("button", [3, 330, 76, 370], "保存设置"); okBt.onClick = function() {function4 (); regWin2.close();function7 (); v = 2.83464566929134; linelength = lLValue.text * v; lw = lwValue.text * v; linespace = lSValue.text * v; outspace = oSValue.text * v; qubian = cxdbkuang.text * v; if (boolCx.value == true) { boolC = true; } else { boolC = false; } if (boolMx.value == true) { boolM = true; } else { boolM = false; } if (boolYx.value == true) { boolY = true; } else { boolY = false; } if (boolKx.value == true) { boolK = true; } else { boolK = false; } cspace = csValue.text * v; ptRe = prValue.text; od = rdValue.text * v; cw = cwValue.text * v; ch = chValue.text * v; level = clValue.text; Plate_width = platoW.text * v; Plate_heigth = platoH.text * v; Plate_bite = platoB.text * v; Paper_width = paperW.text * v; Paper_heigth = paperH.text * v; Paper_bite = paperB.text * v; if (CMYK.value == true) { colormodul = 0; } if (mingcheng.value == true) { colormodul = 1; } if (wu.value == true) { colormodul = 2; } if (buhanchuxue.value == true) { bleeded = false; bleeded2 = false; } if (quanbuchuxue.value == true) { bleeded = true; bleeded2 = true; } if (dabanchuxue.value == true) { bleeded = true; bleeded2 = false; } if (doubleLine.value == true) { shuangjiaoxian = true; } else { shuangjiaoxian = false; } if (JPLine.value == true) { rishicaiqie = true; } else { rishicaiqie = false; } for (vari = 0;i < textFonts.length;i += 1) { if (textFonts[i].family == fnValue.text && textFonts[i].style == "Regular" || textFonts[i].style == "常规体" || textFonts[i].style == "L" || textFonts[i].style == "R") { Textfontname = textFonts[i]; } } textfontsize = fsValue.text * v; regWin.close();function6 (); }; cancleBt.onClick = function() { regWin.close(); }; yuzhi.onClick = function() {function4 (); regWin2.center(); regWin2.show(); }; baocunshezhi.onClick = function() { function5 (); regWin3.center(); regWin3.show(); }; regWin.center(); regWin.show();}function function4 () { regWin2 = new Window("dialog", "预置", [0, 0, 380, 180], { resizeable: true, resizeable: false }); group111 = regWin2.add("panel", [8, 8, 313, 171], "设置"); fontname = group111.add("statictext", [10, 21, 80, 41], "字体:", { multiline: true }); fnValue = group111.add("edittext", [50, 18, 140, 38], AutoMarkXml.fnValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); fontsize = group111.add("statictext", [160, 21, 230, 41], "大小:", { multiline: true }); fsValue = group111.add("edittext", [200, 18, 290, 38], AutoMarkXml.fsValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); colorWide = group111.add("statictext", [10, 56, 80, 76], "色标长度:", { multiline: true }); cwValue = group111.add("edittext", [70, 53, 140, 73], AutoMarkXml.cwValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); colorHigh = group111.add("statictext", [10, 90, 80, 110], "色标高度:", { multiline: true }); chValue = group111.add("edittext", [70, 88, 140, 108], AutoMarkXml.cwValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); colorSpace = group111.add("statictext", [159, 56, 229, 76], "色标间距:", { multiline: true }); csValue = group111.add("edittext", [220, 53, 290, 73], AutoMarkXml.csValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); roundD = group111.add("statictext", [159, 90, 233, 110], "圆形直径:", { multiline: true }); rdValue = group111.add("edittext", [220, 88, 290, 108], AutoMarkXml.rdValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); colorlevel = group111.add("statictext", [10, 125, 84, 145], "色条层阶:", { multiline: true }); clValue = group111.add("edittext", [70, 123, 290, 143], AutoMarkXml.clValue, { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); yuzhiOK = regWin2.add("button", [320, 18, 370, 38], "确定"); yuzhiquziao = regWin2.add("button", [320, 56, 370, 76], "取消"); yuzhiSave = regWin2.add("button", [320, 138, 370, 158], "保存"); yuzhiOK.onClick = function() {function7 (); regWin2.close(); }; yuzhiquziao.onClick = function() { regWin2.close(); }; yuzhiSave.onClick = function() {function7 (); };}function function5 () { regWin3 = new Window("dialog", "保存设置", [0, 0, 370, 135], { resizeable: true, resizeable: false }); yushe2 = regWin3.add("panel", [8, 8, 298, 123], "预设"); yusheweizhi = yushe2.add("statictext", [9, 21, 79, 41], "位置:", { multiline: true }); weizhi1 = yushe2.add("radiobutton", [55, 17, 145, 37], "1"); weizhi1.value = 1; weizhi2 = yushe2.add("radiobutton", [95, 17, 185, 37], "2"); weizhi2.value = 0; weizhi3 = yushe2.add("radiobutton", [135, 17, 225, 37], "3"); weizhi3.value = 0; weizhi4 = yushe2.add("radiobutton", [172, 17, 262, 37], "4"); weizhi4.value = 0; weizhi5 = yushe2.add("radiobutton", [210, 17, 300, 37], "5"); weizhi5.value = 0; weizhi6 = yushe2.add("radiobutton", [250, 17, 340, 37], "6"); weizhi6.value = 0; weizhi7 = yushe2.add("radiobutton", [55, 47, 145, 67], "7"); weizhi7.value = 0; weizhi8 = yushe2.add("radiobutton", [95, 47, 185, 67], "8"); weizhi8.value = 0; weizhi9 = yushe2.add("radiobutton", [135, 47, 225, 67], "9"); weizhi9.value = 0; weizhi10 = yushe2.add("radiobutton", [172, 47, 262, 67], "10"); weizhi10.value = 0; weizhi11 = yushe2.add("radiobutton", [210, 47, 300, 67], "11"); weizhi11.value = 0; weizhi12 = yushe2.add("radiobutton", [250, 47, 340, 67], "12"); weizhi12.value = 0; mingcheng2 = yushe2.add("statictext", [9, 79, 79, 99], "名称:", { multiline: true }); mingcheng2kuang = yushe2.add("edittext", [55, 75, 205, 95], "预设一", { readonly: 0, noecho: 0, borderless: 0, multiline: 0, enterKeySignalsOnChange: 0 }); yusheOK2 = regWin3.add("button", [302, 21, 362, 41], "确定"); yushequxiao2 = regWin3.add("button", [302, 58, 362, 78], "取消"); yusheOK2.onClick = function() { regWin3.close(); }; yushequxiao2.onClick = function() { regWin3.close(); };}function function6 () { doc = activeDocument; cutlayer = doc.layers.add(); cutlayer.name = "角线图层"; g = cutlayer.groupItems.add(); for (vari = 0;i < doc.spots.length;i += 1) { if (doc.spots[i].typename == "Spot" && doc.spots[i].colorType == ColorModel.REGISTRATION) { regColor = new SpotColor(); regColor.spot = doc.spots[i]; break; } } theSelect = doc.selection; if (theSelect.length == 0) { doc.selectObjectsOnActiveArtboard(); theSelect = doc.selection; } lmin = theSelect[0].geometricBounds[0]; tmax = theSelect[0].geometricBounds[1]; lmax = theSelect[0].geometricBounds[2]; tmin = theSelect[0].geometricBounds[3]; if (bleeded2 == true) { w1 = theSelect[0].width - (outspace * 2); h1 = theSelect[0].height - (outspace * 2); } else { w1 = theSelect[0].width; h1 = theSelect[0].height; } for (vari = 1;i < theSelect.length;i += 1) { if (lmin > theSelect[i].geometricBounds[0]) { lmin = theSelect[i].geometricBounds[0]; } if (tmax < theSelect[i].geometricBounds[1]) { tmax = theSelect[i].geometricBounds[1]; } if (lmax < theSelect[i].geometricBounds[2]) { lmax = theSelect[i].geometricBounds[2]; } if (tmin > theSelect[i].geometricBounds[3]) { tmin = theSelect[i].geometricBounds[3]; } } if (bleeded == true) { lmin = lmin + outspace; tmax = tmax - outspace; lmax = lmax - outspace; tmin = tmin + outspace; } if (onlyCTP.value == false) { w = []; for (vari = 0;i < theSelect.length;i += 1) { if (bleeded2 == true) { w.push(theSelect[i].geometricBounds[0] + outspace); w.push(theSelect[i].geometricBounds[2] - outspace); } else { w.push(theSelect[i].geometricBounds[0]); w.push(theSelect[i].geometricBounds[2]); } } if (shuangjiaoxian == true) { if (bleeded == true) { w.push(lmin); w.push(lmax); w.push(lmin - outspace); w.push(lmax + outspace); } else { w.push(lmin - outspace); w.push(lmax + outspace); } } ww = []; for (vari = 0, var ôÏà = w.length;i < ôÏÃ;i++) { !RegExp(w[i], "g").test(ww.join(",")) && ww.push(w[i]); } Array.prototype.indexOf = function(Þbc) { for (vari = 0;i < this.length;i += 1) { if (this[i] == Þbc) { returni; } } return -1; }; Array.prototype.remove = function(ml) { if (isNaN(ml) || ml > this.length) { return false; } for (vari = 0, varÍ = 0;i < this.length;i++) { if (this[i] != this[ml]) { this[Í++] = this[i]; } } this.length -= 1; }; a = ww.indexOf(15279); if (a == 0) { ww.remove(a); } a = ww.indexOf(-17487); if (a == 0) { ww.remove(a); } h = []; for (vari = 0;i < theSelect.length;i += 1) { if (bleeded2 == true) { h.push(theSelect[i].geometricBounds[1] - outspace); h.push(theSelect[i].geometricBounds[3] + outspace); } else { h.push(theSelect[i].geometricBounds[1]); h.push(theSelect[i].geometricBounds[3]); } } if (shuangjiaoxian == true) { if (bleeded == true) { h.push(tmax); h.push(tmin); h.push(tmax + outspace); h.push(tmin - outspace); } else { h.push(tmax + outspace); h.push(tmin - outspace); } } hh = []; for (vari = 0, var ôÏà = h.length;i < ôÏÃ;i++) { !RegExp(h[i], "g").test(hh.join(",")) && hh.push(h[i]); } a = hh.indexOf(-1105); if (a == 0) { hh.remove(a); } a = hh.indexOf(31660); if (a == 0) { hh.remove(a); } if (colormodul != 2) { text = g.textFrames.add(); text.contents = ""; text.textRange.characterAttributes.textFont = Textfontname; if (colormodul == 0) { varÔ = 1; if (boolC) { text.contents = text.contents + "C"; } if (boolM) { text.contents = text.contents + "M"; } if (boolY) { text.contents = text.contents + "Y"; } if (boolK) { text.contents = text.contents + "K"; } } else { if (colormodul == 1) { varÔ = 5; if (boolC) { text.contents = text.contents + "青色(C)"; } if (boolM) { text.contents = text.contents + "洋红(M)"; } if (boolY) { text.contents = text.contents + "黄色(Y)"; } if (boolK) { text.contents = text.contents + "黑色(K)"; } } } for (vari = 0;i < doc.spots.length;i += 1) { if (doc.spots[i].typename == "Spot" && doc.spots[i].colorType != ColorModel.REGISTRATION && doc.spots[i].colorType != ColorModel.PROCESS) { spotName = doc.spots[i].name.replace("PANTONE ", ptRe); text.contents = text.contents + spotName; } } textl = 0; colorArr = []; if (boolC) { c_Color = new CMYKColor(); c_Color.black = 0; c_Color.cyan = 100; c_Color.magenta = 0; c_Color.yellow = 0; colorArr.push(c_Color); for (i = textl;i < (textl + Ô);i++) { text.textRanges[i].characterAttributes.fillColor = c_Color; text.textRanges[i].characterAttributes.stroked = false; text.textRanges[i].characterAttributes.size = textfontsize; } textl = textl + Ô; } if (boolM) { m_Color = new CMYKColor(); m_Color.black = 0; m_Color.cyan = 0; m_Color.magenta = 100; m_Color.yellow = 0; colorArr.push(m_Color); for (i = textl;i < (textl + Ô);i++) { text.textRanges[i].characterAttributes.fillColor = m_Color; text.textRanges[i].characterAttributes.stroked = false; text.textRanges[i].characterAttributes.size = textfontsize; } textl = textl + Ô; } if (boolY) { y_Color = new CMYKColor(); y_Color.black = 0; y_Color.cyan = 0; y_Color.magenta = 0; y_Color.yellow = 100; colorArr.push(y_Color); for (i = textl;i < (textl + Ô);i++) { text.textRanges[i].characterAttributes.fillColor = y_Color; text.textRanges[i].characterAttributes.stroked = false; text.textRanges[i].characterAttributes.size = textfontsize; } textl = textl + Ô; } if (boolK) { k_Color = new CMYKColor(); k_Color.black = 100; k_Color.cyan = 0; k_Color.magenta = 0; k_Color.yellow = 0; colorArr.push(k_Color); for (i = textl;i < (textl + Ô);i++) { text.textRanges[i].characterAttributes.fillColor = k_Color; text.textRanges[i].characterAttributes.stroked = false; text.textRanges[i].characterAttributes.size = textfontsize; } textl = textl + Ô; } for (vari = 0;i < doc.spots.length;i += 1) { if (doc.spots[i].typename == "Spot" && doc.spots[i].colorType != ColorModel.REGISTRATION && doc.spots[i].colorType != ColorModel.PROCESS) { Color = new SpotColor(); Color.spot = doc.spots[i]; colorArr.push(Color); spotName = doc.spots[i].name.replace("PANTONE ", ptRe); textl = textl + spotName.length; for (varø = 0;ø < spotName.length;ø += 1) { text.textRanges[(textl - spotName.length) + ø].characterAttributes.fillColor = Color; text.textRanges[(textl - spotName.length) + ø].characterAttributes.stroked = false; text.textRanges[(textl - spotName.length) + ø].characterAttributes.size = textfontsize; } } } text.left = lmin + 8.503938; text.top = (tmin - linespace) - 2; OpacityArr = level.split(","); var WÕº = Math.ceil((lmax - lmin) / ((cw + cspace) * OpacityArr.length * colorArr.length)); var 㦻Ē = parseInt((lmax - lmin) / (cw + cspace)); varoaVal = 0; var äìÇKgiǬw = ((lmax - lmin) - ((cw + cspace) * 㦻Ē)) / 2; temp = colorArr; for (varÍ = 1;Í < 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 + äìÇKgiǬ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 < arrayVal.length;i += 1) { var tPathVal = g1.pathItems.add(); tPathVal.setEntirePath(arrayVal [i]); tPathVal.filled = false; tPathVal.stroked = true; tPathVal.strokeColor = regColor; tPathVal.strokeWidth = 1; tPathVal.strokeDashes = [5, 1, 1]; tPathVal.guides = true; tPathVal.locked = true; } } if (autopage.value == true) { Ab = doc.artboards[doc.artboards.getActiveArtboardIndex()]; Ab.artboardRect = g.geometricBounds; } if (ABtrans.value == true && sfValue.text != "") { linkfile = g.placedItems.add(); linkfile.file = new File(sfValue.text); var xVal = ((refB[2] + refB[0]) / 2) - (linkfile.width / 2); var yVal = refB[3] + linkfile.height + ((lmValue.text - 0) * v); linkfile.position = [xVal, yVal]; if (embed.value == true) { linkfile.embed() } }}function function3 (modeVal, gArgG, fileReadVal) { var NewFileVal = new File(gArgG); NewFileVal.lineFeed = "Windows"; if (modeVal == "read") { NewFileVal.open("r"); var fileReadVal = NewFileVal.read(); return fileReadVal; } if (modeVal == "write") { NewFileVal.open("w", "TEXT", "????"); NewFileVal.write(fileReadVal); NewFileVal.close(); }}function function8 () {NewFileVal = new File(gArgG); if (NewFileVal.exists == true) { AutoMarkinfo = function3 ("read", filePath, filename); AutoMarkXml = new XML(AutoMarkinfo); }}function function2 () {NewFileVal = new File(gArgG); AutoMarkXml = new XML("<AutoMark></AutoMark>"); AutoMarkXml.lLValue = 5; AutoMarkXml.lwValue = 0.1; AutoMarkXml.lSValue = 3; AutoMarkXml.oSValue = 3; AutoMarkXml.doubleLine = 1; AutoMarkXml.JPLine = 1; AutoMarkXml.buhanchuxue = 0; AutoMarkXml.quanbuchuxue = 1; AutoMarkXml.dabanchuxue = 0; AutoMarkXml.CMYK = 0; AutoMarkXml.mingcheng = 1; AutoMarkXml.wu = 0; AutoMarkXml.colorLable = 1; AutoMarkXml.boolCx = 1; AutoMarkXml.boolMx = 1; AutoMarkXml.boolYx = 1; AutoMarkXml.boolKx = 1; AutoMarkXml.prValue = ""; AutoMarkXml.haveFN = 1; AutoMarkXml.haveTM = 1; AutoMarkXml.havePT = 1; AutoMarkXml.littleSize = 1; AutoMarkXml.bigSize = 1; AutoMarkXml.paperSize = 1; AutoMarkXml.paperSize1 = 1; AutoMarkXml.bite = 1; AutoMarkXml.oiValue = "溪边那浣衣少女是谁?"; AutoMarkXml.paperW = 400; AutoMarkXml.paperH = 300; AutoMarkXml.paperB = 20; AutoMarkXml.platoW = 600; AutoMarkXml.platoH = 400; AutoMarkXml.platoB = 60; AutoMarkXml.cxdbkuang = 0; AutoMarkXml.autopage = 0; AutoMarkXml.ABtrans = 1; AutoMarkXml.gird = 1; AutoMarkXml.onlyCTP = 1; AutoMarkXml.sfValue = ""; AutoMarkXml.lmValue = 15; AutoMarkXml.embed = 0; AutoMarkXml.fnValue = "微软雅黑"; AutoMarkXml.fsValue = 4; AutoMarkXml.chValue = 5; AutoMarkXml.cwValue = 5; AutoMarkXml.rdValue = 3; AutoMarkXml.csValue = 0; AutoMarkXml.clValue = "100,75,50,25"; Contents = AutoMarkXml;function3 ("write", gArgG, Contents);}function function7 () { AutoMarkXml.lLValue = lLValue.text; AutoMarkXml.lwValue = lwValue.text; AutoMarkXml.lSValue = lSValue.text; AutoMarkXml.oSValue = oSValue.text; AutoMarkXml.doubleLine = doubleLine.value - 0; AutoMarkXml.JPLine = JPLine.value - 0; AutoMarkXml.buhanchuxue = buhanchuxue.value - 0; AutoMarkXml.quanbuchuxue = quanbuchuxue.value - 0; AutoMarkXml.dabanchuxue = dabanchuxue.value - 0; AutoMarkXml.CMYK = CMYK.value - 0; AutoMarkXml.mingcheng = mingcheng.value - 0; AutoMarkXml.wu = wu.value - 0; AutoMarkXml.colorLable = colorLable.value - 0; AutoMarkXml.boolCx = boolCx.value - 0; AutoMarkXml.boolMx = boolMx.value - 0; AutoMarkXml.boolYx = boolYx.value - 0; AutoMarkXml.boolKx = boolKx.value - 0; AutoMarkXml.prValue = prValue.text; AutoMarkXml.haveFN = haveFN.value - 0; AutoMarkXml.haveTM = haveTM.value - 0; AutoMarkXml.havePT = havePT.value - 0; AutoMarkXml.littleSize = littleSize.value - 0; AutoMarkXml.bigSize = bigSize.value - 0; AutoMarkXml.paperSize = paperSize.value - 0; AutoMarkXml.paperSize1 = paperSize1.value - 0; AutoMarkXml.bite = bite.value - 0; AutoMarkXml.oiValue = oiValue.text; AutoMarkXml.paperW = paperW.text - 0; AutoMarkXml.paperH = paperH.text - 0; AutoMarkXml.paperB = paperB.text - 0; AutoMarkXml.platoW = platoW.text - 0; AutoMarkXml.platoH = platoH.text - 0; AutoMarkXml.platoB = platoB.text - 0; AutoMarkXml.cxdbkuang = cxdbkuang.text - 0; AutoMarkXml.autopage = autopage.value - 0; AutoMarkXml.ABtrans = ABtrans.value - 0; AutoMarkXml.gird = gird.value - 0; AutoMarkXml.onlyCTP = onlyCTP.value - 0; AutoMarkXml.sfValue = sfValue.text; AutoMarkXml.lmValue = lmValue.text; AutoMarkXml.embed = embed.value - 0; AutoMarkXml.fnValue = fnValue.text; AutoMarkXml.fsValue = fsValue.text; AutoMarkXml.chValue = chValue.text; AutoMarkXml.cwValue = cwValue.text; AutoMarkXml.rdValue = rdValue.text; AutoMarkXml.csValue = csValue.text; AutoMarkXml.clValue = clValue.text; Contents = AutoMarkXml;function3 ("write", gArgG, Contents);}function1 ();2.作者答疑
代码长度过长,如需全部项目或有疑问,请留言。
提示: 作者联系方式
提示: 插件开发流程 - 知乎
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #拼版算法