我正在使用Applescript在Adobe Illustrator中添加大量多边形。但是,该程序速度很慢。是否可以一次添加所有项目列表?
当前代码(可以,但是很慢):
repeat while X < 2000
repeat while Y < 2000
set myPath to make new polygon in layer 1 with properties {center point:{Y, -1*X}}
set Y to Y + 1
end repeat
set X to X + 1
end repeat
我想建立一个列表,并创建一个单个命令,以便将多边形放置在列表上的每个位置。
有什么想法吗?
Illustrator将无法处理那么多绘制的对象。如果经常进行栅格化以删除所有对象,则速度会更快:
tell application id "com.adobe.illustrator"
tell current document
rasterize source art every page item with options {resolution:150, antialiasing method:art optimized, color model:grayscale rasterization}
end tell
end tell
以某种方式将其添加到您的代码中,使其每1000个形状左右运行一次。这样,它永远不会放慢速度。您必须在这里进行权衡,因为您的循环将创建400万个对象(2000 x 2000)。
您到底想做什么?您确定AppleScript是此处的正确工具吗?告诉我们您想要的结果,我们也许可以找到一个更好,更快的解决方案。