Enter measurements your way in AxoTools
With the latest update to AxoTools, you can enter measurements in whatever units you’re comfortable with. Here’s an example:
Say your document ruler units is set to inches, but you need to extrude something to a distance you have in mm. Illustrator supports that within the app, but it’s not automatically there for plugins. Measurement fields in AxoTools now do that conversion for you. I really hadn’t planned at first on adding that — there’s a back story here.
First, all art in Adobe Illustrator is measured internally in points. Fortunately, Adobe’s interface for plugins includes a function that takes measurements from text typed by the user in the current ruler units and converts it to a numeric value calculated as points. Then another function converts numeric point values used within the plugin to text that plugins can give back to the user, calculated and formatted using their current ruler units. That’s great, but there are a lot of users in other parts of the world that use a comma as a decimal separator. Fortunately, Adobe added a variation of these functions that support international number formats. Unfortunately, the one that parses text with commas in decimals doesn’t see the commas, and the values get multiplied by ten, a hundred, or a thousand! Adobe’s bug became my bug.
To support my European customers, I wrote a function that parses the numbers typed, and honors commas as decimal separators, and wondered “Why not look at the units specified, as well?” All values need to be converted to points anyway for the plugin to work with, so it wasn’t a great leap code-wise.
As an extension of that, I wrote a function to convert values back to text with a caveat of my own. In AxoTools’ Draw Settings panel, users can specify standard stroke weights, but we don’t all use points for strokes — many use mm. Stroke measurements have little to do with our current ruler units, so the plugin lets you specify pt or mm, does the math when needed, then remembers your preference to always display it your way.
It can be frustrating dealing with bugs, but sometimes bugs can become butterflies!