cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

I am unable to fetch the latest cad drawing from part

AR_9920456
14-Alexandrite

I am unable to fetch the latest cad drawing from part

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 2
avillanueva
22-Sapphire II
(To:AR_9920456)

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

Announcements

Top Tags