Skip to main content
14-Alexandrite
March 14, 2024
Question

I am unable to fetch the latest cad drawing from part

  • March 14, 2024
  • 2 replies
  • 746 views

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.");

}

}

}

2 replies

avillanueva
23-Emerald I
23-Emerald I
March 14, 2024
HelesicPetr
22-Sapphire II
22-Sapphire II
March 21, 2024

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