{"id":1027,"date":"2022-04-26T12:30:00","date_gmt":"2022-04-26T12:30:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=1027"},"modified":"2022-04-26T12:30:00","modified_gmt":"2022-04-26T12:30:00","slug":"1027","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/04\/26\/1027\/","title":{"rendered":"Adobe Illustrator \u81ea\u52a8\u7fa4\u7ec4\u811a\u672c\u5b66\u4e60\u4e0d\u5b8c\u5168\u89e3\u6790"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/03\/2124898041.webp\" alt=\"\" title=\"\"><\/p>\n<h3>\u7f51\u4e0a\u641e\u6765\u4e2aAdobe Illustrator \u81ea\u52a8\u7fa4\u7ec4\u811a\u672c\u6e90\u7801\uff0c\u4e5f\u6ca1\u6709\u4ee3\u7801\u6ce8\u91ca\uff0c\u4e5f\u4e0d\u77e5\u9053\u4f5c\u8005\u662f\u8c01\uff0c\u6240\u4ee5\u9605\u8bfb\u8d77\u6765\u5c31\u56f0\u96be\u4e86\u3002<\/h3>\n<p>\u4ee3\u7801\u6267\u884c\u4f1a\u6709\u4e9b\u5c0f\u95ee\u9898\uff0c\u4e5f\u4e0d\u77e5\u9053\u600e\u4e48\u89e3\u51b3\u3002<\/p>\n<h2>\u5148\u628a\u6e90\u7801\u5949\u4e0a  \u81ea\u52a8\u7fa4\u7ec4.jsx<\/h2>\n<pre><code>\ufeffvar AD = activeDocument;\nvar S = selection;\nvar len = S.length;\nfor (var i = len; i--;) {\n    S[i]._order = i;\n}\nwhile (len &gt; 1) {\n    var groupArr = [];\n    var a = S.pop();\n    var pa = !a.clipped ? a.visibleBounds : a.pathItems[0].visibleBounds;\n    groupArr[0] = a;\n    len--;\n    point: do {\n        var exchange = 0;\n        for (var i = len; i--;) {\n            var b = S[i];\n            var pb = !b.clipped ? b.visibleBounds : b.pathItems[0].visibleBounds;\n            if (pb[0] &gt;= pa[0] &amp;&amp; pb[0] &lt;= pa[2] || pa[0] &gt;= pb[0] &amp;&amp; pa[0] &lt;= pb[2] &amp;&amp; pb[1] &lt;= pa[1] &amp;&amp; pb[1] &gt;= pa[3] || pa[1] &lt;= pb[1] &amp;&amp; pa[1] &gt;= pb[3]) {\n                groupArr.push(S.splice(i, 1)[0]);\n                len--;\n                pa = [Math.min(pa[0], pb[0]), Math.max(pa[1], pb[1]), Math.max(pa[2], pb[2]), Math.min(pa[3], pb[3])];\n                exchange = 1;\n                continue point;\n            }\n        }\n    } while (exchange)\n    g_len = groupArr.length;\n    g_len &gt; 1 &amp;&amp; E_G(groupArr, g_len);\n}\nAD.selection = null;\n\nfunction E_G(arr, L) {\n    var tempGroup = AD.groupItems.add();\n    arr.sort(function(x, y) {\n        return x._order &gt; y._order;\n    });\n    for (var i = 0; i &lt; L; i += 1) {\n        arr[i].moveToEnd(tempGroup);\n    }\n}<\/code><\/pre>\n<h3>\u4e00\u5934\u96fe\u6c34\uff0c\u770b\u50bb\u4e86\uff0c\u5728\u5b66\u4e60\u4e0a\u9762\u811a\u672c\u524d\uff0c\u5148\u5230\u7f51\u4e0a\u67e5\u4e0b\u7fa4\u7ec4\u76f8\u5173\u6587\u7ae0\u67e5\u5230\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c<\/h3>\n<pre><code>\/\/create group   \u5efa\u7acb\u7fa4\u7ec4\nvar group = activeDocument.groupItems.add();\n\n\/\/add all path items to group  \u6dfb\u52a0\u6587\u6863\u4e2d\u6240\u6709\u7269\u4ef6\u5230\u7fa4\u7ec4\nfor (i = 0; i &lt; activeDocument.pathItems.length; i++) {\n   \/\/ \u4f7f\u7528 moveToEnd \u628a\u7269\u4ef6\u6dfb\u52a0\u5230\u7fa4\u7ec4\u4e2d\n  activeDocument.pathItems[i].moveToEnd(group);\n}\n\n\/\/move group 50 mm to left  \u79fb\u52a8\u7fa4\u7ec450mm\ngroup.translate(-50*2.835, 0);<\/code><\/pre>\n<h3>\u4f7f\u7528\u8fd9\u4e2a\u80fd\u628a\u6587\u6863\u6240\u6709\u7269\u4ef6\u7fa4\u7ec4\uff0c\u7528\u5230\u4e86 <code>groupItems.add<\/code> \u5efa\u7acb\u7fa4\u7ec4, <code>moveToEnd<\/code> \u628a\u7269\u4ef6\u6dfb\u52a0\u5230\u7fa4\u7ec4\uff0c\u6240\u4ee5\u4e0a\u9762\u7684\u4ee3\u7801E_G \u51fd\u6570\u662f\u7fa4\u7ec4\u51fd\u6570<\/h3>\n<pre><code>\/\/ E_G \u51fd\u6570\u662f\u7fa4\u7ec4\u51fd\u6570\uff0c\u628a\u5bf9\u5e94\u6570\u7ec4\u7684\u7f16\u53f7\u548c\u4e2a\u6570\u4f20\u5165\u51fd\u6570\u8fdb\u884c\u7fa4\u7ec4\nfunction E_G(arr, L) {\n    var tempGroup = AD.groupItems.add();\n    arr.sort(function(x, y) {\n        return x._order &gt; y._order;\n    });\n    for (var i = 0; i &lt; L; i += 1) {\n        arr[i].moveToEnd(tempGroup);\n    }\n}<\/code><\/pre>\n<h3>\u811a\u672c\u5f00\u5934\u51e0\u884c\uff0c<code>AD<\/code> \u662f\u5f53\u524d\u6fc0\u6d3b\u6587\u6863\uff0c<code>S<\/code> \u662f\u9009\u62e9\u5bf9\u8c61, <code>len<\/code> \u662f\u7269\u4ef6\u603b\u6570, \u4f7f\u7528 <code>for<\/code> \u5faa\u73af\u7ed9\u7269\u4ef6\u7f16\u53f7\uff0c\u8bb0\u5f55\u5230 <code>S[x]._order<\/code> \u4e2d<\/h3>\n<pre><code>\ufeffvar AD = activeDocument;  \/\/ \u5f53\u524d\u6fc0\u6d3b\u6587\u6863\nvar S = selection;     \/\/ \u9009\u62e9\u5bf9\u8c61\nvar len = S.length;     \/\/ \u7269\u4ef6\u603b\u6570\n\/\/ \u7ed9\u7269\u4ef6\u7f16\u53f7\uff0c\u8bb0\u5f55\u5230S[x]._order\u4e2d\nfor (var i = len; i--;) {\n    S[i]._order = i;\n}<\/code><\/pre>\n<h3>\u7a0b\u5e8f\u9009\u6cd5\u90e8\u5206 \u904d\u5386\u7269\u4ef6\u8ba1\u6570 <code>len<\/code>\uff0c\u628a\u5404\u4e2a\u7269\u4ef6\u7f16\u53f7\u5206\u522b\u653e\u4e00\u7ec4\uff0c\u8c03\u7528<code>E_G\u51fd\u6570<\/code>\u7fa4\u7ec4<\/h3>\n<pre><code>while (len &gt; 1) {\n    var groupArr = [];\n    var a = S.pop();\n    \/\/ \u7269\u4ef6\u7684\u8fb9\u754c\u8d4b\u503c\u7ed9pa\n    var pa = !a.clipped ? a.visibleBounds : a.pathItems[0].visibleBounds;\n    groupArr[0] = a;\n    len--;\n  ... ...<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u4e0a\u641e\u6765\u4e2aAdobe Illustrator \u81ea\u52a8\u7fa4\u7ec4\u811a\u672c\u6e90\u7801\uff0c\u4e5f\u6ca1\u6709\u4ee3\u7801\u6ce8\u91ca\uff0c\u4e5f\u4e0d\u77e5\u9053\u4f5c\u8005\u662f\u8c01\uff0c\u6240 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12],"tags":[68],"class_list":["post-1027","post","type-post","status-publish","format-standard","hentry","category-soft","category-learn","tag-jsx"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1027"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1027\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}