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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

MPMLink - Related Assembly Filter - API

gboucle
6-Contributor

MPMLink - Related Assembly Filter - API

Hello there, 

 

Is there a way to programmatically apply the Related Assembly Filter to the ProcessPlan Structure (Process plan > MPMOperation > Allocated Parts) displayed ?

 

Capture_Filter.JPG

1 REPLY 1
gboucle
6-Contributor
(To:gboucle)

If it can help, i post what I've effectively done : a wizard to launch the retrieval of MPMLink objects (like operations) (PDMLink 11.0), from a Part Structure with a Related Assembly Filter.

 

Here is some code (groovy) :

 

Get a Structure Parts with Filter :

 

//starts from an oid of a saved filter
NavigationCriteria navCriteria = (NavigationCriteria) BasicWebjectDelegate.getObjectByUfid(navCriteriaID)

if (navCriteria) {

WTCollection wtSet = new WTHashSet()
wtSet.add(startingPart)

// get all the parts of the structure with filter applied
PartCollector.Builder builder = new PartCollector.Builder(wtSet, navCriteria)
PartCollector initialCollector = builder.build()
PartCollectedResult initialResult = initialCollector.collect()

 

Then, for the starting part of the structure (it was the customer data model for this implementation), get ProcessPlan then Operations, with same filter (with ncserverholder):

NavigationCriteriaHolder nch  = NavigationCriteriaHolder.buildEmptyNavigationCriteriaHolder()
nch = NavigationCriteriaHolderServerHelper.buildNavigationCriteriaFromConfigSpec(nch, navCriteria.configSpec)

NCServerHolder ncServerHolder = new NCServerHolder(nch.getCollectorId(), navCriteria)

QueryResult qrProcesssPlans = IteratedNavigationCriteriaHelper.service.navigateInternalIteratedLinks(ncServerHolder, part, MPMPartToProcessPlanLink.PROCESS_PLAN_ROLE, MPMPartToProcessPlanLink.class, true, true)

if (qrProcesssPlans.size() >0){
    
    MPMProcessPlan gamme = (MPMProcessPlan)qrProcesssPlans.nextElement()

    QueryResult qrOperations = MPMProcessPlanHelper.service.getOperationsFromOperationHolder(gamme, ncServerHolder, false)
    
}

 

Top Tags