How to create or navigate an equivalence link via API in Windchill MPMLink

How to create or navigate an equivalence link via API in Windchill MPMLink

Add Comment
1 Answer(s)
    • Navigating an equivalence link (wt.associativity.EquivalenceLink)
// navigate downstream, returns link and downstream part
wt.fc.PersistenceHelper.manager.navigate(reference.getObject(),wt.associativity.EquivalenceLink.DOWNSTREAM_ROLE, wt.associativity.EquivalenceLink.class);
 
// navigate downstream, returns only downstream part
wt.fc.PersistenceHelper.manager.navigate(reference.getObject(),wt.associativity.EquivalenceLink.DOWNSTREAM_ROLE, wt.associativity.EquivalenceLink.class, true);
 
// navigate upstream, returns link and upstream part
wt.fc.PersistenceHelper.manager.navigate(reference.getObject(),wt.associativity.EquivalenceLink.UPSTREAM_ROLE, wt.associativity.EquivalenceLink.class);
 
// navigate upstream, returns only upstream part
wt.fc.PersistenceHelper.manager.navigate(reference.getObject(),wt.associativity.EquivalenceLink.UPSTREAM_ROLE, wt.associativity.EquivalenceLink.class, true);

 

    • Creating an equivalence link (wt.associativity.EquivalenceLink)
//create a new view version for part
WTPart mPart = (WTPart) ViewHelper.service.newBranchForView(part, "Manufacturing");
mPart = (WTPart) PersistenceHelper.manager.store(mPart);
 
//create equivelencelink between these 2 parts
EquivalenceLink link1 = EquivalenceLink.newEquivalenceLink(part,mPart);
link1.setIsConsumable(true);
link1.setUpstreamContextRef(part.getView());
link1.setDownstreamContextRef(mPart.getView());
link1 = (EquivalenceLink) PersistenceHelper.manager.save(link1);

 


Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.