Skip to main content
1-Visitor
April 7, 2014
Solved

Build link between cad and part in Windchill through code

  • April 7, 2014
  • 3 replies
  • 3616 views

I have loaded the cad file first in Windchill and the associated part later.So cad part and the part do not have link.

I need to create the link for each epm document.This can be done manually using "Edit Association" for each EPM Document by opening in Windchill .

I need this to be done through java code.

Anyone can give a method how to build the link through code?

Thanks.

Best answer by VasiliyRepecki

EPMDescribeLink link = EPMDescribeLink.newEPMDescribeLink(wtPart, epmDocument);

PersistenceHelper.manager.save(link);

3 replies

1-Visitor
April 7, 2014

EPMDescribeLink link = EPMDescribeLink.newEPMDescribeLink(wtPart, epmDocument);

PersistenceHelper.manager.save(link);

1-Visitor
April 7, 2014

Use code below to connect Cad and Part with Owner Link (Pass 4 in parameter for creating Image build type)

ReferenceFactory factory=

new ReferenceFactory();

WTPart wtpart = (WTPart)factory.getReference(

"<WT Part Obid>").getObject();

EPMDocument doc=(EPMDocument)factory.getReference(

"<cad Doc Obid>").getObject();

EPMBuildRuleAssociationLink link = EPMBuildRuleAssociationLink.newEPMBuildRuleAssociationLink(doc, wtpart, 0, 4);

PersistenceHelper.

manager.store(link);

1-Visitor
April 8, 2014

Thanks for the quick Response.

Cad to part link got built after using the above methods.

Thanks.