Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hello All,
We have a requirement to copy Representation from CAD Document to its associated WTPart.
I want to do this through code because if I set preference Build Associated Parts to Yes it is creating Structure of the CAD Document on WTPart and this is not required.
I am trying this way and it is not working.
########################################################################
wtpart = (WTPart) factory.getReference("OR:wt.part.WTPart:414184331").getObject();
qr_new = PersistenceHelper.manager.navigate(wtpart, EPMBuildRule.BUILD_SOURCE_ROLE, EPMBuildRule.class,true);
if(qr_new.hasMoreElements())
{
epm = (EPMDocument) qr_new.nextElement();
Representation rep_pub = PublishUtils.getRepresentation(epm);
RepresentationHelper.service.storeRepresentation(rep_pub, wtpart, null, rep_pub.getDescription(), rep_pub.getRepresentationType());
PersistenceHelper.manager.refresh(wtpart);
}
########################################################################
Please let me know if any one has done copy of Representation from CAD Document to WTPart.
Thanks,
Niranjan M
Solved! Go to Solution.
Representations are always stored on EPM Documents when there are no owner associations to a WTPart. If an EPM Document has an owner association to a WTPart, the representation is stored on the WTPart. In such a case, the EPM Document and the WTPart are related via an EPM Build History Link.
Created EPMBuildHistoryLink to have representation on WTPart.
EPMBuildRule buildRule = EPMBuildRule.newEPMBuildRule(epmdocument, wtpart_wrkingcopy);
buildRule = (EPMBuildRule)PersistenceHelper.manager.save(buildRule);
long l = buildRule.getUniqueID();
EPMBuildHistory epmbuildhistory = EPMBuildHistory.newEPMBuildHistory(epmdocument, wtpart_wrkingcopy, l);
PersistenceServerHelper.manager.insert(epmbuildhistory);
Representations are always stored on EPM Documents when there are no owner associations to a WTPart. If an EPM Document has an owner association to a WTPart, the representation is stored on the WTPart. In such a case, the EPM Document and the WTPart are related via an EPM Build History Link.
Created EPMBuildHistoryLink to have representation on WTPart.
EPMBuildRule buildRule = EPMBuildRule.newEPMBuildRule(epmdocument, wtpart_wrkingcopy);
buildRule = (EPMBuildRule)PersistenceHelper.manager.save(buildRule);
long l = buildRule.getUniqueID();
EPMBuildHistory epmbuildhistory = EPMBuildHistory.newEPMBuildHistory(epmdocument, wtpart_wrkingcopy, l);
PersistenceServerHelper.manager.insert(epmbuildhistory);