Scripting Adobe Illustrator. How to apply an effect?

守給你的承諾、 提交于 2019-12-08 01:44:31

问题


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

I use JavaScript in AI CS6.

Thanks.

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

-- 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.


回答1:


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.

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

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])

Unfortunately, the documentation does say

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…



来源:https://stackoverflow.com/questions/17448553/scripting-adobe-illustrator-how-to-apply-an-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!