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

We are happy to announce the new Windchill Customization board! Learn more.

PDF publish outside of Windchill PDMLink

kgwmu
1-Newbie

PDF publish outside of Windchill PDMLink

Hi,

We are in the middle of implementing PDM Essentials and Creo here. Until we are fully up and running, we need to be able to publish pdfs of drawing to a folder outside of PDMlink/windchill. We would like only production state drawings to publish to the specified folder once the state is changed. So first question is how do I publish a pdf'd drawing outside of windchill? where/how do I write a rule that makes it publish when the state is changed? The plan is to save all the drawing history in Windchill, but only the latest production drawing will be visible in the network folder.

7 REPLIES 7

Etrage makes a tool that will do this for you. Its called "plot services" and will do exactly what you are talking about. They even have a special viewer tool that will give users a nice tool that will allow them to view this data easily and search it.

so Windchill can't do anything like this on it's own? I have to get a 3rd party application?

AL_ANDERSON
5-Regular Member
(To:kgwmu)

We do this publishing of Creo DRW files to PDF using the Creo publisher on dedicated CAD Worker servers. We did a lot of programming to make it all work, but here is how it works.

Someone makes a Windchill WTDocument light type Drawing of number 1234567. They set it to "Pending Release Stamp" either manually or via a Change Transition on a Completed ECT/ECN. That state has a workflow. That workflow sees that the Drawing is "PRO-E" (we made this a long time ago) by an IBA for Drawing Source. It searches the database for a Released Creo DRW numbered 1234567.DRW (and throws an error in the task complete of the ECN/ECT releasing the drawing if it does not exist or is not released). In the workflow we kick off a server side publishing job. We queue up the job to publish the Creo DRW to PDF, and then save the PDF as primary content on the WTDocument. Once the program sees that the file is complete and uploaded, then we set the WTDocument Drawing to Released.

At this point, we have an auto-published PDF file from the Creo DRW that is primary content on the Released WTDocument Drawing object.

Al

emetzger
3-Visitor
(To:kgwmu)

We have the need to save PDF's outside of Windchill also.

PDMlink will save the viewable as a PDF, but its not the easiest to save the file out to email for example. Doable, just not fluid.

We are currently saving our PDF files out of the database manually and exploreing Etrage and other applicaitons to save the PDF externally in a specified location. This can be set to occur automatically when the object is checked in or when the state changes to production or released, but I cannot tell you exactly how to set this up right now, as I have not done it yet.

You can download with the code below

private static String dlContent(EPMDocument EPMDoc) {
  rtnStg="NO Data Found (dlContent)";
  try {
   Representation defaultRep=RepresentationHelper.service.getDefaultRepresentation(EPMDoc);

   if(defaultRep != null) {
    ContentHolder holder=ContentHelper.service.getContents(defaultRep);
    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")) {
       String path = dlLoc+"\\"+data.getFileName();
       rtnStg = data.getFileName();
       ContentServerHelper.service.writeContentStream(data, path);
       System.out.println("Download Step Executed For: "+data.getFileName());
       break;
      }
     }
    }
   }
  }
  catch(Exception exception) { System.out.println("Exception (BOM_REP_DL_32.dlContent): "+exception.toString()); }
  return rtnStg;
}

static String dlLoc = "D:\\ptc\\Windchill\\codebase\\wtcore\\jsp\\repsave\\DL\\"; \\ or can be to users local machine, if you run through jsp

you can also get the url of the pdf

private static String extractContent(EPMDocument EPMDoc) {
  rtnStg="NO Data Found";
  try {
   Representation defaultRep=RepresentationHelper.service.getDefaultRepresentation(EPMDoc);

   if(defaultRep != null) {
    ContentHolder holder=ContentHelper.service.getContents(defaultRep);
    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);
      //System.out.println("data.getFileName(): "+data.getFileName()+" & data.getRole(): "+data.getRole());

      //if (data!=null && data.getRole().equals("SECONDARY")) {
      if (data!=null && data.getFileName().endsWith(".pdf")) {
       URL url = data.getViewContentURL(holder);
       rtnStg = data.getFileName()+"|"+url.toString();
       return rtnStg;
      }
     }
     else {
      rtnStg = "NO Data Found (No Associated PDF)";
      System.out.println("\n"+rtnStg+"\n");
      return rtnStg;
     }
    }
   }
  }
  catch(Exception exception) { rtnStg = "NO Data Found: Exception = "+exception.toString(); }
  return rtnStg;
}

Hi Kevin,

Did you manage to publish the pdf's outside Windchill? I am trying to do the same thing. Hope you have the aswer to it? Maybe you could share it wirh me. Thanks in advance!

Kind regards,

Michiel

Top Tags