Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi.
How can i operate by java code with associations between WTPart and CAD document? How can i distinguish Owner, Contributing Image, Image, Contributing Content and Content assocations?
What classes these associations are presented by? Are they differ by some attribute?
Thanks.
Solved! Go to Solution.
Hello,
Owner, Contributing Image, Image, Contributing Content are the same link (dual link EPMBuildRule & EPMBuildHistory - may be 3 links since 10.0 ). just an attribute "BUILD_TYPE" to distinguish the type of link. Used mainly for 3D model
and Content link is the epmdescribelink. Used mainly for CAD drawings
regards
Hello,
Owner, Contributing Image, Image, Contributing Content are the same link (dual link EPMBuildRule & EPMBuildHistory - may be 3 links since 10.0 ). just an attribute "BUILD_TYPE" to distinguish the type of link. Used mainly for 3D model
and Content link is the epmdescribelink. Used mainly for CAD drawings
regards
Gregory,
can you say something about "Calculated" association?
Calculated associations are not "real links" persited in database between WTpart and EPMdoc
They are calculated: from the WTpart, through the owner link to the 3D CADdoc, then to all Drawings that are linked by reference to this 3D model. But with a filter based on "As stored configspec"
I do not use this calculated links, and made some enhancement request to PTC to hide them (or overload them if both a calculated or a real content link exists). As depending of user scenario, (notably when revising / modifying Drawing alone), it changes the calculated link without any iteration or revision at the WTpart level . which is a non sense when using windchill with a part centric approach.
Do you know how get EPMDocument from WTPart by java code if they are linked with "Calculated" association?
Have a look to EPMNavigateHelper.navigate .
But not sure if supported ... ask to PTC TSupport for the best API
Next code works fine:
List<EPMDocument> documents = new ArrayList<EPMDocument>();
AssociatedCADDocs relationship = new AssociatedCADDocs();
relationship.setTypes(AssociatedCADDocs.Type.IMPLICIT);
List<Object[]> epmDocs = EPMNavigateHelper.navigate(wtPart, relationship, CollectItem.SEED_ID, CollectItem.OTHERSIDE).getRawResults();
if(epmDocs != null)
{
for(Object[] objects : epmDocs)
{
for(Object o : objects)
{
if(o instanceof EPMDocument)
{
documents.add((EPMDocument) o);
}
}
}
}
And in other direction (not checked):
WTPart wtPart = null;
CADAssociatedParts relationship = new CADAssociatedParts();
relationship.setTypes(CADAssociatedParts.Type.IMPLICIT);
List<Object[]> epmDocs = EPMNavigateHelper.navigate(epmDocument, relationship, CollectItem.SEED_ID, CollectItem.OTHERSIDE).getRawResults();
if(epmDocs != null)
{
for(Object[] objects : epmDocs)
{
for(Object o : objects)
{
if(o instanceof WTPart)
{
WTPart tempPart = (WTPart) o;
if(tempPart.isLatestIteration())
{
wtPart = tempPart;
break;
}
}
}
}
}