Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello there,
Is there a way to programmatically apply the Related Assembly Filter to the ProcessPlan Structure (Process plan > MPMOperation > Allocated Parts) displayed ?
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)
}
