编写 Adob​​e Illustrator 脚本.如何应用效果? [英] Scripting Adobe Illustrator. How to apply an effect?

查看:42
本文介绍了编写 Adob​​e Illustrator 脚本.如何应用效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的脚本应该选择一些项目并对它们应用效果->3D->挤出和斜角.应该使用哪些对象和方法?

My script should select some items and apply Effect->3D->Extrude&bevel to them. Which objects and methods should be used?

我在 AI CS6 中使用 JavaScript.

I use JavaScript in AI CS6.

谢谢.

--更新:我需要在脚本中设置效果参数(角度、深度等)的值.

-- Update: I need to set the values for effect parameters (angles, depth etc.) in script.

--更新 2:可能可以使用 GraphicStyle 所需的值修补 AI 文件,然后打开它并在需要的地方应用样式.但我想知道是否有不那么脏的解决方案.

-- Update 2: Probably it's possible to patch an AI file with needed values for the GraphicStyle, and then open it and apply the style where needed. But I'd like to know if there is less dirty solution.

推荐答案

使用 ExtendScript 工具包中的 documents[0].selection[0].reflect.properties 找出基本路径具有的属性,我没有看到任何直接设置此效果的方法.

Using documents[0].selection[0].reflect.properties in ExtendScript toolkit to find out what properties basic paths have, I don’t see any way to set this effect directly.

当我搜索 适用于 Illustrator 的 JavaScript 参考,我看到的唯一提及外观是在谈到图形样式时.

When I search the JavaScript Reference for Illustrator, the only mention I see of appearance is when it talks about graphic styles.

所以我尝试绘制两个矩形,将 3D 效果应用于其中一个,并将其保存为新的图形样式:

So what I tried was drawing two rectangles, applying the 3D effect to one of them, and saving it as a new graphic style:

然后在脚本中,您可以选择另一个矩形,然后使用

Then in the script, you can select the other rectangle and then apply the graphic style with

documents[0].graphicStyles[6].applyTo(documents[0].selection[0])

不幸的是,文档确实说

脚本无法创建新的图形样式.

Scripts cannot create new graphic styles.

可能可行的一件事是分发包含您可能想要应用的所有图形样式的脚本的文档,然后将它们应用到目标文档中的对象......

One thing that might be work would be to distribute a document with the script that has all the graphic styles you might want to apply, and then apply them to objects in the target document…

这篇关于编写 Adob​​e Illustrator 脚本.如何应用效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆