Skip to main content
12-Amethyst
November 5, 2015
Solved

Set custom UOM while creating a new Part with using code.

  • November 5, 2015
  • 2 replies
  • 1797 views

I have custom UOM in Windchill loaded to QuantityUnitRB, but I am not able to create a new Part with custom UOM using code.

getting the values via

QuantityUnit[] qu = QuantityUnit.getQuantityUnitSet();

but when I set to part, getting null pointer .

Has anyone come across this. Please suggest the way to do this.

Thank You,

Best answer by apatil-2

Hi,

Got Solution.

I tried,part.setDefaultUnit(QuantityUnit.toQuantityUnit("custom UOM"));

Thank you for you response

2 replies

1-Visitor
November 12, 2015

Set it via LWCNormalizedObject, using this class to create the part, get the pointer, and then setting that attribute before checking in. Covered in the javadoc.

For the future, if you are going to say you get a NPE, you have to post the stacktrace, or the actual java code, providing details about how it is executed/invoked, or you will not typically get a lot of help.

apatil-212-AmethystAuthorAnswer
12-Amethyst
November 22, 2015

Hi,

Got Solution.

I tried,part.setDefaultUnit(QuantityUnit.toQuantityUnit("custom UOM"));

Thank you for you response