cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Converting IBA UNIT Values as per Measuring System in Client Preference

nmahajan-2
1-Newbie

Converting IBA UNIT Values as per Measuring System in Client Preference

Hi,

I am working on a requirement where i am pulling the Classification Attributes values (IBA) from Windchill 10.2. When a user enter these IBA vlaues, these values are stored in the database as per the base unit. But when you change the Measuring system in preference, Windchill does the converstion for these IBA values. When you read the values from Database you receive IBA values in their base unit and not as per the Preference Measuring system selected by user or admin.

For example: Length: (default unit is mm) for SI measuring system. Now if i change the Measuring system to USCS the mm unit changes to inches and windchill does the value conversion to inches.

In mycase i am gettting only the base unit value. I need some API's to convert the values as per the preference measuring system.

Please see the attached documents.

Can anyone please guide me how to achive this.

1 ACCEPTED SOLUTION

Accepted Solutions

I found the solution on how to convert the Classificaiton unit values to a different measuring system as per selected preference at Org Level.

attrValue is AbsrtractValue from a IBA holder like WTPart.

classAttr is the Classification Attribute.

orgPreference is the Measuring System selected at org Prefence.

Solution:

value=IBAValueUtility.getLocalizedIBAValueDisplayString(attrValue, locale);

String preferenceUOM = classAttr.getDisplayUnits(orgPreference);

value=value.replaceAll(classAttr.getQoM().getBaseUnit(), "");

value= value.trim();

Unit u= new Unit(value, classAttr.getQoM().getBaseUnit());

DecimalFormat df = new DecimalFormat("####.####");

double dd=u.convert(preferenceUOM);

value=df.format(dd);

value = value.concat(" "+preferenceUOM);

View solution in original post

1 REPLY 1

I found the solution on how to convert the Classificaiton unit values to a different measuring system as per selected preference at Org Level.

attrValue is AbsrtractValue from a IBA holder like WTPart.

classAttr is the Classification Attribute.

orgPreference is the Measuring System selected at org Prefence.

Solution:

value=IBAValueUtility.getLocalizedIBAValueDisplayString(attrValue, locale);

String preferenceUOM = classAttr.getDisplayUnits(orgPreference);

value=value.replaceAll(classAttr.getQoM().getBaseUnit(), "");

value= value.trim();

Unit u= new Unit(value, classAttr.getQoM().getBaseUnit());

DecimalFormat df = new DecimalFormat("####.####");

double dd=u.convert(preferenceUOM);

value=df.format(dd);

value = value.concat(" "+preferenceUOM);

Top Tags