Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: check if EPMDoc has owner link to WTPart using API

$
0
0

Simon,

 

It doesn't look like the APIs used for association are officially supported for customization. Because of that, anything you try is not guaranteed to work and cannot be supported by PTC tech support. With that said, I found this incomplete code snippet that may be helpful. I've not tested it out so, again, no guarantees....

 

//Get WTPart instance associated with EPMDocument

WTPart part=...;

//Get EPMDocument instance associated with WTPart
EPMDocument epm=...;

 

AssociationType assoctype = null;
String association = null;
WTArrayList epmDocArray = new WTArrayList();
epmDocArray.add((EPMDocument) epm);
ResultGraph assocResultGraph = AutoAssociateHelper.getAssociatedResultGraph(epmDocArray, true);
Map datum = AutoAssociateHelper.getAssociatedLinkToObjectsMap(assocResultGraph, epmDocArray,false);
Iterator iterator = datum.keySet().iterator();
while (iterator.hasNext()) {
     Object key = iterator.next();
     Object obj = datum.get(key);
     if (key instanceof BinaryLink && obj.equals(part)) {
          BinaryLink bLink = (BinaryLink) key;
          assoctype = AssociationType.getAssociationType(bLink);
          if assoctype.equals(AssociationType.ACTIVE) {
               <DO WHAT YOU NEED TO DO>
          }
     }
}
Good luck!

 


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>