论坛帮助 |
社区圈子 |
日历事件 |
2020-01-30, 09:04 | #1 | |||
|
||||
VIP会员
等级: 七袋长老
|
引用:
doc = app.activeDocument; theSelect = doc.selection; sizelayer=doc.layers.add(); sizelayer.name = 'Rulerlayer'; for (i=0;i<theSelect.length;i++){ selInfo=theSelect[i].geometricBounds; selL=selInfo[0]; selT=selInfo[1] selW=Math.abs(selInfo[2]-selInfo[0]) selH=Math.abs(selInfo[3]-selInfo[1]) lineL=8; asize=10; var u=2.834645 var spa=5*u //这里数字可修改距离 tsize=30; redColor = new CMYKColor(); redColor.black = 00; redColor.cyan = 100; redColor.magenta = 00; redColor.yellow = 00; greenColor = new CMYKColor(); greenColor.black = 00; greenColor.cyan = 00; greenColor.magenta = 100; greenColor.yellow = 100; var g1 = doc.groupItems.add(); var line1=g1.pathItems.add(); line1.setEntirePath( new Array( new Array(selL-(lineL/2)-spa, selT), new Array(selL-(lineL/2)-spa, selT-selH), ) ) ; line1.strokeColor= redColor; var line1=g1.pathItems.add(); line1.setEntirePath( new Array( new Array(selL-lineL-spa, selT), new Array(selL-spa, selT), ) ) ; line1.strokeColor= redColor; var line1=g1.pathItems.add(); line1.setEntirePath( new Array( new Array(selL-lineL-spa, selT-selH), new Array(selL-spa, selT-selH), ) ) ; line1.strokeColor= redColor; var ar1=g1.pathItems.add(); ar1.setEntirePath( new Array( new Array(selL-spa-(lineL/2), selT), new Array(selL-spa-(lineL/2)-asize/2, selT-asize), new Array(selL-spa-(lineL/2)+asize/2, selT-asize), ) ) ; ar1.strokeColor= NoColor; ar1.fillColor= redColor; ar1.closed=true; var ar1=g1.pathItems.add(); ar1.setEntirePath( new Array( new Array(selL-spa-(lineL/2), selT-selH), new Array(selL-spa-(lineL/2)-asize/2, selT-selH+asize), new Array(selL-spa-(lineL/2)+asize/2, selT-selH+asize), ) ) ; ar1.strokeColor= NoColor; ar1.fillColor= redColor; ar1.closed=true; var t1 = g1.textFrames.add(); t1.contents = (selH/u).toFixed(2)+" mm"; t1.textRange.characterAttributes.size=tsize; t1.textRange.characterAttributes.fillColor= greenColor; t1.textRange.textFont=app.textFonts[textFonts.name="MicrosoftYaHei"]; t1.rotate(90); t1.left = (selL-lineL-spa-t1.width)+5; t1.top = selT-selH/2+t1.height/2; } doc.selection=null; //////////////////////////////////////////////////////////////////////////////////////////////// |
|||
右列会员因为此帖价值甚高向 calvin530126 表示感谢: |
yzx0120 (2020-01-30)
|