Skip to main content
1-Visitor
May 10, 2016
Question

Are there any Windchill APIs to convert EPMDocument contents into IGES file format.

  • May 10, 2016
  • 2 replies
  • 1819 views

In one of the Workflow process activity we are asking the user the manually convert the EPMDocuments into IGES file format using Creo.

Are there any Windchill APIs to convert EPMDocument contents into IGES file format, so that we can get rid of the manual intervention.

Please suggest how can I handle the Family table instace use case, as they don't have physical files associated to them.

2 replies

13-Aquamarine
May 10, 2016

In 10.1 and later, you can use additional file type publishing to create the IGES file: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS81396. You can use something like this to get the IGES file from the published representation: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS113634.

This is what we use to get the plt/hpgl and dxf from the default drawing rep:

private static boolean extractContent(EPMDocument EPMDoc, String dlLoc, Date currentTS, String drwNo, String drwRev) {

  boolean fileFound = false;

  try {

   Representation defaultRep = RepresentationHelper.service.getDefaultRepresentation(EPMDoc);

   System.out.println("Obtained Representation");

  

   if(defaultRep != null) {

    //drwRev is actually the version (revision.iteration), e.g. 00.1. Uncomment the following lines to remove the iteration.

    //if(drwRev.contains(".")){

    // drwRev = drwRev.substring(0, drwRev.indexOf("."));

    //}

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

    Vector contents=ContentHelper.getContentListAll(holder);

    ApplicationData data=null;

    System.out.println("Size of all contents: "+contents.size());

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

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

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

      String empRepfileName = data.getFileName();

      String fileName = drwNo;

      if (data!=null && (empRepfileName.endsWith("plt") || empRepfileName.endsWith("dxf") || empRepfileName.endsWith("_dxf.zip"))) {

       Date docTS = toDate(data.getModifyTimestamp());

       System.out.println("doc timestamp--"+data.getModifyTimestamp()+" current timestamp :"+currentTS);

       System.out.println("file name before change: "+empRepfileName);

       if (docTS.after(currentTS)) {

        fileFound = true;

         if (empRepfileName.endsWith("plt")) {

         fileName = fileName+".hpgl";

        }

        else if (empRepfileName.endsWith("dxf")) {

         fileName = fileName+"_"+drwRev+".dxf";

        }

        else if (empRepfileName.endsWith("_dxf.zip")){

          fileName = fileName+"_"+drwRev+"_dxf.zip";

        }

        System.out.println("file name after change: "+fileName);

        File saveAsFile = new java.io.File(dlLoc+"\\",fileName); // input your location and file name

        ContentServerHelper.service.writeContentStream((ApplicationData)data, saveAsFile.getCanonicalPath());

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

       }

      }

     }

    }

   }

  } catch(java.lang.Exception exception) {

   exception.printStackTrace();

  }

  return fileFound;

}

asingh1-VisitorAuthor
1-Visitor
May 10, 2016

Thanks, Darrell

Will give a try.

Regards,

Aditya