简体   繁体   中英

How can I work with cm units in illustrator CC extendscript?

I would like to draw a simple rectangle in cm.

So far I have done that :

var units = 4; 
app.preferences.setIntegerPreference("rulerType", units);
app.preferences.setIntegerPreference("strokeUnits", units)

And indeed when I check in edit/preferences/unit menu, it shows units in cm

But When I draw a rectangle :

var rectangle1 = doc.pathItems.rectangle(posTop, posLeft, myWidth, myHeight); 

myWidth and myHeight don't fit the cm rules.

Any help ?

thanks

Fransua

Here is my solution :

var ptToCm = 0.0353;
myWidth/=ptToCm;
myHeight/=ptToCm;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM