Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How to download all visualizations

$
0
0

You can write custom java class file to download representation to Local disk

Below are the few API’s which may help you to write custom java class / utility.


 

 

To Get representation for EPMDocument/Drawing

 

VisualizationHelper helper = new VisualizationHelper();

QueryResult qr = helper.getRepresentations(epmm);

   

Write custom method to file correct and default representation


Representation representation = getLatestRepresentation(qr);



Use below code to download representation/PDF to folder Local Drive.


 

  ContentHolder holder = ContentHelper.service.getContents(representation);

  Vector contents = ContentHelper.getContentListAll(holder);

  ApplicationData data = null;

 

  for (int i = 0; i < contents.size(); i++) {

  if (contents.get(i) instanceof ApplicationData) {

  data = (ApplicationData) contents.get(i);


  if (data != null && data.getFileName().endsWith(".pdf")) {

  iDownloadDocuments++;

  String dLFile = data.getFileName();

  int index = dLFile.lastIndexOf("_");

  String dLFile_trim = dLFile.substring(0,index);

  //String out_path_dir = dlLoc + "\\" +dLFile;

  String path = dlLoc + "\\" + dLFile_trim+"_"

  + epmm.getVersionIdentifier().getValue()

  + "."

  + epmm.getIterationIdentifier().getValue()

  + ".pdf";

  ContentServerHelper.service.writeContentStream(

  data, path.toUpperCase());

  writelog(epmm.getCADName() + " : PDF downloaded");

 

  System.out.println("Download Executed.\n");

  System.out.println("File name is"+data.getFileName());

  break;

  }

  }

  }

 

 

 

Hope this helps !!!

 

Thanks

Shreyas


Viewing all articles
Browse latest Browse all 8876

Trending Articles