Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance Illustrator应用脚本:如何制作多个项目?_Performance_Applescript_Adobe Illustrator - Fatal编程技术网

Performance Illustrator应用脚本:如何制作多个项目?

Performance Illustrator应用脚本:如何制作多个项目?,performance,applescript,adobe-illustrator,Performance,Applescript,Adobe Illustrator,我正在使用Applescript在Adobe Illustrator中添加大量多边形。然而,这个程序相当慢。是否可以一次添加所有项目的列表 当前代码(工作正常但速度较慢): 在X

我正在使用Applescript在Adobe Illustrator中添加大量多边形。然而,这个程序相当慢。是否可以一次添加所有项目的列表

当前代码(工作正常但速度较慢):

在X<2000时重复
当Y<2000时重复
设置myPath以在第1层中创建具有属性{中心点:{Y,-1*X}的新多边形
将Y设置为Y+1
结束重复
将X设置为X+1
结束重复
我想建立一个列表,并创建一个命令,将多边形放置在列表中的每个位置


有什么想法吗?

如果您愿意牺牲可编辑性,那么如果您经常光栅化以删除所有对象,速度可能会更快:

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个形状左右运行一次(内部循环将每2000次运行一次)。这是您必须在这里进行的权衡,因为您的循环将创建400万个对象


你到底想干什么?告诉我们您想要的结果,我们可能会为您找到更好、更快的解决方案。

该代码生成400万个多边形,难怪速度会减慢。你确定这就是你想要的吗?是的!这是正确的。构建由非常特定的多边形组成的大型图像。但我可以一次批量生产1000个,等等。我认为这会更快,因为限速代码似乎与Illustrator artboard交互。它们的形状都一样吗?如果是这样,请在新的组项目中创建多个组,然后重复复制组。冲洗并重复。否则,试试Adobe的嵌入式JavaScript;至少这样可以避免苹果事件的开销。是的,它们都是相同的,但位置不同。这听起来似乎可行,但正确的语法是什么?我不熟悉AppleScript,因此不确定如何使用组/复制功能。
在第1层创建新的组项来创建组。修改
makenewpolygon
命令,以在其中创建形状。例如,将组中的这些形状制作一个10x10的网格,然后使用属性{position:…}
将组复制到第1层,同时重新定位。
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