Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Here i am trying to fetch the latest cad drawing from the part, i am getting cad but not the latest .
while (drawingQR.hasMoreElements()) {
System.out.println("Entering into the Drawing Loop");
EPMBuildRule link = (EPMBuildRule) drawingQR.nextElement();
Persistable epmP = link.getRoleAObject();
System.out.println("epmP: " + epmP);
if (epmP instanceof EPMDocument) {
epmDoc = (EPMDocument) epmP;
wt.epm.EPMDocConfigSpec epmConfigSpec = wt.epm.EPMDocConfigSpec.newEPMDocConfigSpec();
epmConfigSpec.setLatestActive();
epmConfigSpec.setWorkingIncluded(false);
System.out.println("epmDoc: " + epmDoc.getName() + " ---" + epmDoc.getNumber());
// Navigate to find references to this latest drawing
QueryResult referenceQR = PersistenceHelper.manager.navigate(latestDrawing.getMaster(), "referencedBy", EPMReferenceLink.class, false);
if (referenceQR.hasMoreElements()) {
EPMReferenceLink referenceLink = (EPMReferenceLink) referenceQR.nextElement();
drawing = (EPMDocument) referenceLink.getReferencedBy();
EPMDocumentMaster docMasterDrawing = (EPMDocumentMaster) drawing.getMaster();
QueryResult resultLatestEPM1 = wt.vc.config.ConfigHelper.service.filteredIterationsOf(docMasterDrawing, epmConfigSpec);
if (resultLatestEPM1.hasMoreElements()) {
latestDrawing = (EPMDocument) resultLatestEPM1.nextElement();
}
System.out.println("Referenced drawing: " + drawing.getName() + " ---" + drawing.getNumber());
} else {
System.out.println("No references found for the latest drawing.");
}
}
}
I think this is the code you heed:
Hi @AR_9920456
In the filteredIterationsOf method use the latest config spec...
If you use Drawing Master then latest config spec returns the latest one.
new wt.vc.config.LatestConfigSpec()
PetrH