论坛帮助 |
社区圈子 |
日历事件 |
2020-05-29, 09:40 | #1 | ||
|
|||
正式会员
等级: 五袋长老
|
#target 'illustrator' #targetengine com.adobe.illustrator.demo.flashplayer if ( app.documents.length > 0 && app.activeDocument.pathItems.length > 0 ){ var doc = app.activeDocument; var lw=0.15*2.834646; //刀线粗 0.15 mm var docSpots = activeDocument.spots; var isExist=false; for(var j=0;j < docSpots.length; j++){ if (docSpots[j].name.toString() =="die"){ spot1=docSpots[j]; isExist=true; break } } if (!isExist){newCMYKColor = new CMYKColor(); newCMYKColor.cyan = 85; newCMYKColor.magenta = 100; newCMYKColor.yellow = 0; newCMYKColor.black = 0; // Create the new spot var newSpot = app.activeDocument.spots.add(); newSpot.name = "die"; newSpot.color = newCMYKColor; newSpot.colorType = ColorModel.SPOT var newSpotColor = new SpotColor(); newSpotColor.spot = newSpot; // Use the spot color to set the fill color } else{ var newSpotColor = new SpotColor(); newSpotColor.spot = spot1; } var isExist=false; for(i=0;i<doc.layers.length;i++){ if(doc.layers[i].name=='刀模'){ cutlayer=doc.layers[i]; isExist=true; break} } if(!isExist){ cutlayer=doc.layers.add(); cutlayer.name = '刀模'; } g = cutlayer.groupItems.add(); var frontPath = app.activeDocument.selection; for(var i=0;i<frontPath.length;i++){ apply_G_DC(frontPath[i]); frontPath[i].move(g,ElementPlacement.PLACEATEND) } function apply_G_DC(the_Obj){ if (the_Obj.constructor.name=="GroupItem"&&the_Obj.clipped==false){ try { var N_sub_obj = the_Obj.pageItems.length; for (var i = 0; i < N_sub_obj; i += 1) { apply_G_DC(the_Obj.pageItems[i]); } } catch(error) { return; } } else if (the_Obj.constructor.name=="CompoundPathItem"){ try { var N_sub_obj1 = the_Obj.pathItems.length; for (var i = 0; i < N_sub_obj1; i += 1) { apply_G_DC(the_Obj.pathItems[i]); } } catch(error) { return; } } apply_S_DC(the_Obj); return; } function apply_S_DC(the_Obj){ the_Obj.stroked = true; the_Obj.filled = false; the_Obj.strokeColor = newSpotColor; the_Obj.strokeWidth= lw; the_Obj.strokeOverprint = true; } } |
||
2020-05-29, 10:03 | 只看该作者 #2 | ||
|
|||
正式会员
等级: 三袋长老
|
引用:
|
||
2020-05-29, 10:37 | 只看该作者 #3 | |||
|
||||
VIP会员
等级: 七袋长老
|
引用:
#target 'illustrator' if ( app.documents.length > 0 && app.activeDocument.pathItems.length > 0 ){ var doc = app.activeDocument; var lw=0.15*2.834646; //刀线粗 0.15 mm var docSpots = activeDocument.spots; var isExist=false; for(var j=0;j < docSpots.length; j++){ if (docSpots[j].name.toString() =="die"){ spot1=docSpots[j]; isExist=true; break } } if (!isExist){newCMYKColor = new CMYKColor(); newCMYKColor.cyan = 85; newCMYKColor.magenta = 100; newCMYKColor.yellow = 0; newCMYKColor.black = 0; // Create the new spot var newSpot = app.activeDocument.spots.add(); newSpot.name = "die"; newSpot.color = newCMYKColor; newSpot.colorType = ColorModel.SPOT var newSpotColor = new SpotColor(); newSpotColor.spot = newSpot; // Use the spot color to set the fill color } else{ var newSpotColor = new SpotColor(); newSpotColor.spot = spot1; } var isExist=false; for(i=0;i<doc.layers.length;i++){ if(doc.layers[i].name=='刀模'){ cutlayer=doc.layers[i]; isExist=true; break} } if(!isExist){ cutlayer=doc.layers.add(); cutlayer.name = '刀模'; } var frontPath = app.activeDocument.selection; for(var i=0;i<frontPath.length;i++){ apply_G_DC(frontPath[i]); } function apply_G_DC(the_Obj){ if (the_Obj.constructor.name=="GroupItem"&&the_Obj.clipped==false){ try { var N_sub_obj = the_Obj.pageItems.length; for (var i = 0; i < N_sub_obj; i += 1) { apply_G_DC(the_Obj.pageItems[i]); } } catch(error) { return; } } else if (the_Obj.constructor.name=="CompoundPathItem"){ try { var N_sub_obj1 = the_Obj.pathItems.length; for (var i = 0; i < N_sub_obj1; i += 1) { apply_G_DC(the_Obj.pathItems[i]); } } catch(error) { return; } } apply_S_DC(the_Obj); return; } function apply_S_DC(the_Obj){ the_Obj.stroked = true; the_Obj.filled = false; the_Obj.strokeColor = newSpotColor; the_Obj.strokeWidth= lw; the_Obj.strokeOverprint = true; } } |
|||
右列会员因为此帖价值甚高向 calvin530126 表示感谢: |
rgb0109 (2020-05-29)
|
2020-05-29, 11:16 | 只看该作者 #5 | |||
|
||||
VIP会员
等级: 七袋长老
|
引用:
var doc=app.activeDocument;//当前文件 var newSpotColor_1=doc.spots.add();//建立专色色板 newSpotColor_1.colorType=ColorModel.SPOT;//指定专色样式 var newColor_1=new CMYKColor();//建立新色值 newColor_1.cyan=0;//指定C色值 newColor_1.magenta=100;//指定M色值 newColor_1.yellow=100;//指定Y色值 newColor_1.black=0;//指定K色值 newSpotColor_1.color=newColor_1;//指定专色色值 newSpotColor_1.name='Emboss';//指定专色名 |
|||