May 31, 2009

Working With Symbols

The available scripting operations for symbol item are almost despairingly limited in AI CS3. As follows.

symbol properties -- name, parent, typename
symbol methods -- duplicate, remove

You can not even get coordinates of it directly.

One solution is to put a symbol into a group manually, and then you can manipulate the symbol through the group.

Suppose there's a grouped symbol on the artboard, like this.

Then you can get this image by running the following script.

// ----------------------------------------------
// places groups along a circle
const RADIUS = 120;
const DIV = 12;

var gr = activeLayer.groupItems[0];
var radian = Math.PI * 2 / DIV;

for(var i = 0; i < DIV; i++){
translate( RADIUS * Math.cos(i * radian),
RADIUS * Math.sin(i * radian) );
// ----------------------------------------------

May 30, 2009

What Is This?

I have a website mainly for placing scripts for graphics softwares. And sometimes I receive e-mails of questions, requests and proposals about them. I thought it would be better off sharing some contents in these messages which I wrote. That's why I created this blog page. (This doesn't mean that I'll post other person's message without permission.)

I'm Japanese and I think I need to study English. Writing something may be worth doing for me.