Skip to main content
HenryStockCC
Inspiring
November 18, 2020
Answered

Need a script to round an object's width up (or down) to a 1/1000th inch from 1/10,000th inch

  • November 18, 2020
  • 1 reply
  • 527 views

I set type for highway signage, and the typefaces get very close to being perfectly at 1/1000th, but are always a few 10,000ths up or down from what I need when outlined. Each word has a specific exact width spec'ed in 1000ths. Currently I have to manually click in the measurements palette, select the last two numbers and change each width manually. A script to change the width up or down to the next 1000th would save me work every day.

This topic has been closed for replies.
Correct answer femkeblanco

This should round up/down the height and width of a selected path to 3 decimal places.

var h = ( app.selection[0].height ) / 72;
var w = ( app.selection[0].width ) / 72;
app.selection[0].height = ( h.toFixed(3) ) * 72;
app.selection[0].width = ( w.toFixed(3) ) * 72;

 

1 reply

femkeblanco
femkeblancoCorrect answer
Legend
November 18, 2020

This should round up/down the height and width of a selected path to 3 decimal places.

var h = ( app.selection[0].height ) / 72;
var w = ( app.selection[0].width ) / 72;
app.selection[0].height = ( h.toFixed(3) ) * 72;
app.selection[0].width = ( w.toFixed(3) ) * 72;

 

HenryStockCC
Inspiring
November 18, 2020

Works great, and I managed to puzzle out how to add 1000th or subtract 1000th in separate scripts. Thanks again!