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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

WTPartUsage link creation using API

KU_10670946
6-Contributor

WTPartUsage link creation using API

How to create WtPartUsageLink in windchill 11. 1 through API. I am looking for one Sample.

 

ACCEPTED SOLUTION

Accepted Solutions

 

// work in process parent
// WorkInProgressHelper.service.checkout
WTPart parent;
WTPart component;

// create a Quantity
Quantity qty = new Quantity();
qty.setAmount(1);
qty.setUnit(QuantityUnit.EA);

// create the usagelink
WTPartUsageLink usageLink = WTPartUsageLink.newWTPartUsageLink(parent, component.getMaster());

// set the usagelink quantity
usageLink.setQuantity(qty);

// persist the usagelink
usageLink = (WTPartUsageLink) PersistenceHelper.manager.save(usageLink);

 

View solution in original post

1 REPLY 1

 

// work in process parent
// WorkInProgressHelper.service.checkout
WTPart parent;
WTPart component;

// create a Quantity
Quantity qty = new Quantity();
qty.setAmount(1);
qty.setUnit(QuantityUnit.EA);

// create the usagelink
WTPartUsageLink usageLink = WTPartUsageLink.newWTPartUsageLink(parent, component.getMaster());

// set the usagelink quantity
usageLink.setQuantity(qty);

// persist the usagelink
usageLink = (WTPartUsageLink) PersistenceHelper.manager.save(usageLink);

 

Announcements
Top Tags