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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Downloading EPM documents

ptc-5657640
1-Newbie

Downloading EPM documents

From 10.1 version the download option for EPM has been removed by PTC. Here i'm trying to add an action which will execute the 'download action' , kindly review the java code and see if thats enough

package ext;

import java.io.*;

import java.util.*;

import java.rmi.RemoteException;

import java.net.URL;

import wt.util.*;

import wt.content.*;

import wt.epm.*;

import wt.fc.*;

import wt.query.*;

import wt.representation.*;

import wt.method.RemoteAccess;

public class dlRep

implements RemoteAccess, Serializable

{

private static String extractContent(EPMDocument EPMDoc, String dlLoc, String conType)

{

String rtnStg="NO Data Found (extractContent)";

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(conType))

{

if (dlLoc.equals("C:\shared")) {

URL url = data.getViewContentURL(holder);

String urlStg = data.getFileName()+"|C:\shared|"+url.toString();

String mtData = ContentServerHelper.service.getMimeType(data);

System.out.println("\ndata MimeType: "+mtData+"\n");

System.out.println("\nurlStg (getViewContentURL): "+urlStg+"\n");

return urlStg;

}

else {

String path = dlLoc+"\\"+data.getFileName();

rtnStg ="Download Step Executed To: "+dlLoc;

ContentServerHelper.service.writeContentStream(data, path);

System.out.println(rtnStg+".\n");

return rtnStg;

}

}

}

else {

rtnStg = "No App Data associated to current Object.";

System.out.println("\n"+rtnStg+"\n");

return rtnStg;

}

}

}

}

catch(Exception exception)

{

exception.printStackTrace();

}

return rtnStg;

}

public static String getEPMDoc(String dlLoc, String drwNo, String conType)

{

String rtnStg="NO Data Found (getEPMDoc)";

try

{

QuerySpec qs = new QuerySpec(EPMDocument.class);

qs.appendWhere(new SearchCondition(EPMDocument.class,EPMDocument.NUMBER,SearchCondition.LIKE, drwNo));

qs.appendAnd();

qs.appendWhere(new SearchCondition(EPMDocument.class, "iterationInfo.latest", "TRUE"));

System.out.println("Now Querying for Doc Using:\n " + qs.toString());

final QueryResult qr = PersistenceHelper.manager.find(qs);

while (qr.hasMoreElements()) {

EPMDocument epmm = (EPMDocument)qr.nextElement();

if (epmm.getNumber().endsWith(".DRW") || epmm.getNumber().endsWith(".CATpart") || epmm.getNumber().endsWith(".CATProduct") ) {

System.out.println( "\nEPMDoc - Number: " + epmm.getNumber() + " - Name: " + epmm.getName()+ " - CadName: " + epmm.getCADName() );

System.out.println( " - Version: " + epmm.getVersionIdentifier().getValue() + " - Iteration:"+epmm.getIterationIdentifier().getValue()+"\n - Life Cycle State: "+epmm.getLifeCycleState().toString());

rtnStg = extractContent(epmm, dlLoc, conType);

return rtnStg;

}

}

}

catch(Exception exception)

{

exception.printStackTrace();

}

return rtnStg;

}

}

7 REPLIES 7

I don't want to divert energy from the main thread but have a tangential question, if someone could address it in addition to Vicky's question.

We recently discussed the absence of a Download option in 10.1 as well. In our use case some AutoCAD drawings will be migrated as EPMDocuments for historical record, but not revised after the migration. The business felt that there would be value in having the ability to download and open in AutoCAD for quick reference, rather than adding to Workspace and opening in AutoCAD through the Workgroup Manager. Could someone from PTC verify that the absence of download on EPMDocuments is intended and that we've not overlooked an alternative?

I'm looking for this answer, how can our customer download an AutoCAD drawing? They use DWG TrueView to view the file. We plan to migrate from 9.1 to 10.2 but we need our users to be able to download the EPM document. They will not be using Workgroup Manager. This was missing from 9.1 but someone found a work around to add back in the download icon and function to the Content Table of the CAD information page. So where is this function in 10.2? Or how do we get it there? This will be a BIG showstopper (no upgrade to 10.2) if we can't download CAD files.

rml
5-Regular Member
5-Regular Member
(To:ptc-5657640)

Can some one please help !

I used the same utility above shared by Vicky to download EPMDocument. But seems hard luck for me, its not working properly as expected. In my case it's more simpler as I want to download all the EPMDocument. When I execute this utility from the shell it downloads the EPMDocument, i.e. ".asm" file format into .ol format and ".prt" files into .log(text) format to my local drive. Whereas I do not want the file format to get changed once it gets downloaded on my local drive.

Can some one please help me out on this.

Thanks!

The ability to download CAD content directly from Windchill was intentionally removed in Windchill 9.1 M060. See the following for detail:

CS22813 - How to export CAD Documents in Windchill PDMLink documents the various ways one can get CAD content back out of Windchill. Probably the easiest way would be to use Packages:

  • Go to Product or Library > Packages
  • Create a new Package
  • Add the desired CAD content to the package
  • Lock the Package content
  • Create a new Delivery
  • Select Zip Package for Delivery in the Delivery actions (OOTB it will be processed by a CAD worker updating filename references if content copied or renamed or saved from other models. Filesync can be disabled in Package preferences if you don't have a CAD worker)
  • Download zip from Deliver Attachments

The archive will have a html page showing the package content and one can get the model content directly out of the archive\CONTENTS directory, for example:

Package - 000021, test2, PTC, A


Name:test2
Description:
State:In Work
Type:Package
Owner:admin
Context:cpater0d_101m040_lib1
Created On:Feb 3, 2015 7:15:42 PM
Recipient Instructions:

Package Content (34 objects)Current View:


bicep.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-32.htmlBICEP_LH.PRTA.3cpater0d_101m040_lib1

bicep_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-10.htmlBICEP_RH.PRTA.3cpater0d_101m040_lib1

body.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-24.htmlBODY.ASMA.3cpater0d_101m040_lib1

body.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-2.htmlBODY.PRTA.4cpater0d_101m040_lib1

buzz1.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-8.htmlBUZZ1.ASMA.3cpater0d_101m040_lib1

fingers_lh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-23.htmlFINGERS_LH.PRTA.3cpater0d_101m040_lib1

fingers_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-17.htmlFINGERS_RH.PRTA.3cpater0d_101m040_lib1

foot.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-22.htmlFOOT.PRTA.3cpater0d_101m040_lib1

forarm_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-21.htmlFORARM_LH.PRTA.3cpater0d_101m040_lib1

forarm_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-9.htmlFORARM_RH.PRTA.3cpater0d_101m040_lib1

hand_lh.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-1.htmlHAND_LH.ASMA.3cpater0d_101m040_lib1

hand_lh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-11.htmlHAND_LH.PRTA.3cpater0d_101m040_lib1

hand_rh.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-3.htmlHAND_RH.ASMA.3cpater0d_101m040_lib1

hand_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-16.htmlHAND_RH.PRTA.3cpater0d_101m040_lib1

head.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-29.htmlHEAD.PRTA.3cpater0d_101m040_lib1

hinge.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-26.htmlHINGE.PRTA.3cpater0d_101m040_lib1

hip_hinge.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-15.htmlHIP_HINGE.PRTA.3cpater0d_101m040_lib1

leg.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-5.htmlLEG.PRTA.3cpater0d_101m040_lib1

sound_button.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-33.htmlSOUND_BUTTON.PRTA.3cpater0d_101m040_lib1

sound_button.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-12.htmlSOUND_BUTTON_BLUE.PRTA.3cpater0d_101m040_lib1

sound_button.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-7.htmlSOUND_BUTTON_GREEN.PRTA.3cpater0d_101m040_lib1

sound_button.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-20.htmlSOUND_BUTTON_RED.PRTA.3cpater0d_101m040_lib1

test3.dwgfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-31.htmlTEST3.DWGA.1cpater0d_101m040_prod2_no_autonumbering

thigh_ref.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-18.htmlTHIGH_LH.ASMA.3cpater0d_101m040_lib1

thigh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-14.htmlTHIGH_LH.PRTA.3cpater0d_101m040_lib1

thigh_rh.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-27.htmlTHIGH_RH.ASMA.3cpater0d_101m040_lib1

thigh_rh.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-28.htmlTHIGH_RH.PRTA.3cpater0d_101m040_lib1

visor.asmfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-19.htmlVISOR.ASMA.3cpater0d_101m040_lib1

visor1.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-4.htmlVISOR1.PRTA.3cpater0d_101m040_lib1

visor_2.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-6.htmlVISOR_2.PRTA.3cpater0d_101m040_lib1

waist.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-25.htmlWAIST.PRTA.3cpater0d_101m040_lib1

wing1.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-13.htmlWING1.PRTA.3cpater0d_101m040_lib1

wing2.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-34.htmlWING2.PRTA.3cpater0d_101m040_lib1

wings_button.prtfile:///D:/Users/cpater/Desktop/package/Resources/html/TAG-EPMDocument-30.htmlWINGS_BUTTON.PRTA.3cpater0d_101m040_lib1

package+contents2.gif

TomU
23-Emerald IV
(To:rml)

Here are two other possible options if you're not interested in packages:

3rd Party Solution - "Direct CAD Download"

http://www.wincom-consulting.com/solutions/cad/cad-direct-download/

Simple Customization (from the PTCUser "Solutions" list)

- See attached .zip file.

rml
5-Regular Member
5-Regular Member
(To:ptc-5657640)

Thanks for the help !

The above techniques are helpful to download EPM Document from the standalone Windchill browser. Can any one please help me to download it from the server side.

I tried with the same code, for downlaoding the default rep. I got it from a different source. i could download if default rep is plt or pdf. now im trying for dxf in Windchill 10.1

You can refer the link : http://www.datajett.com/windchill/wc_dev/Download_PDF_or_PLT.zip

 

Top Tags