• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can the SDK access user preferences for stroke weight?

Engaged ,
Jan 24, 2021 Jan 24, 2021

Copy link to clipboard

Copied

The user preferences for the constrain angle can be read through the SDK's AIPreference suite using the keyword "constrain/angle" but cannot find the keyword to get the user preferences for the chosen unit of measure for stroke weight. Also, would the value there reflect any changes the user may have made since startup? Any suggestions would be much appreciated.

TOPICS
SDK

Views

235

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

1. In SDK all units are in points. I guess that preference you want is also stored in points to avoid storing multiple values. You can convert values to get value in desired unit.

2. With AIPreference you can get current value, but values in preference file are stored only upon AI shutdown process

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Thanks, Milos, that's related but not quite what I'm looking for. Until recently, my plugins only needed input on very small distances, so points were adequate for getting measurements. A more recent plugin uses larger values to measure or move an object, so it's much easier for users to use inches or mm. For this, I use sAIUser->IUAIRealToStringUnits and sAIUser->IUStringToAIReal to convert between the points the SDK needs and whatever units the user wants to work in.

 

Now when users who use mm also specify stroke widths, they want to specify it in mm as well. If I simply capture user units, then other users may be left specifying a stroke weight in inches. Adobe was wise to have a separate preference for stroke weight, aside from the general unit preference.

 

What I did in the meantime is that the plugin saves its own user preference and does its own math to convert to/from pt/mm when needed. The value in the text field gets "mm" or "pt" appended to it, and when it reads it again, it looks for those same characters to interpret the value.

 

I just thought it would be a better user experience to just blend in with whatever Illustrator's prefs for strokes were set to.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

As far as I can see there is "strokeUnits" property inside preferences with integer value. Is this preference you are looking for?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 14, 2021 Feb 14, 2021

Copy link to clipboard

Copied

LATEST

Thanks, Milos. I don't see that property in my Adobe Illustrator Prefs file, even when I quit Illustrator 25 with a value other than points. I'll try calling it in code and see what happens. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines