Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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;
}
}
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.
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:
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
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.
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