Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
How to create WtPartUsageLink in windchill 11. 1 through API. I am looking for one Sample.
Solved! Go to Solution.
// 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);
// 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);