Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hello ED (ALL), I could have been wrong about where the customRB.rbInfo file should be located,
in order to be seen & compiled properly by ResourceBuild:
create "repsave" folder in:
<wt_home>\codebase\com\ptc\windchill\enterprise
then create another "repsave" folder in the src area:
<wt_home>\src\com\ptc\windchill\enterprise\
then place a customRB.rbInfo in the repsave folder
(<wt_home>\src\com\ptc\windchill\enterprise\repsave)
the contents of the customRB.rbInfo file should be:
repsave.REPSAVEAS.title.value=Download DRW PDF or PLT
repsave.REPSAVEAS.icon.value=download.gif
repsave.REPSAVEAS.tooltip.value=Download DRW PDF or PLT
repsave.REPSAVEAS.description.value=Download DRW PDF or PLT
repsave.REPSAVEAS.moreurlinfo.value=height=400,width=700, scrollbars=yes
I have attached that RB file (customRB.rbInfo.txt where you rename without .txt).
Then to build the resource, run this in windchill shell:
ResourceBuild com.ptc.windchill.enterprise.repsave.customRB
Then make sure you custom-actions.xml reads as below:
<listofactions>
<objecttype name="repsave" class="wt.epm.EPMDocument" resourcebundle="com.ptc.windchill.enterprise.repsave.customRB">
<action name="REPSAVEAS">
<description>Download DRW PDF or PLT</description>
<command windowtype="popup"" url="wtcore/jsp/repsave/REPSAVEAS.jsp"/">
</action>
</objecttype>
</listofactions>
Hope this is right. Actually, this might be better than inserting in wvs RB file, since
we are doing custom work anyway & custom actions files are being used. Why nota customRB also.
Let me know if there are any errors &/or if it works.
Lawrence, I followed the instructions in your last post but I cant get past the resourcebuild, still fails. Its getting late in the day here,so I'll double check everything tomorrow morning.
Hey ED, I have not actually tried to get the customRB.rbInfo to work, as I had specified in my last post.
I mainly went on my previous setup & on Swami's post, where he suggested customRB. His post looked good, but he does not specify where to place the .rbInfo file. So I assumed <wt_home>\src\com\ptc\windchill\enterprise\repsave, because of the previous location of the .rbInfo file I edited & its path: <wt_home>\src\com\ptc\windchill\enterprise\wvs\WVSactionsResource.rbInfo
But let me actually place a customRB.rbInfo file in that repsave folder under enterprise & see if it will compile with ResourceBuild.
I of course will change the contents of the .rbInfo file to something like:
repsave.REPSAVEAS.title.value=TEST Download DRW PDF or PLT
repsave.REPSAVEAS.icon.value=download.gif
repsave.REPSAVEAS.tooltip.value=TEST Download DRW PDF or PLT
repsave.REPSAVEAS.description.value=TEST Download DRW PDF or PLT
repsave.REPSAVEAS.moreurlinfo.value=height=400,width=700, scrollbars=yes
Then if it compiles & build class, I will maybe add to my actions xml files, where I already have repsave & 2 test entries to test code.
If any gurus want to test the customRB.info concept or suggest other, let us know.
The other route I suggest is to place it in one of the wvs rb info files that you did find on wc9.0 & then point y9our custom actions xml to that rb file, of course after you get a successful ResourceBuild.
I think you could put those rb info contents in most any rb info file, just so you actions xml file points to it. But then again, I am still in rookie mode, so I dont know.
Ed, I will let you know what I find.
L Jett
Hey ED (ALL), My Bad. I missed the header content for the customRB.rbInfo file:
Contents should be:
ResourceInfo.class=wt.tools.resource.StringResourceInfo
ResourceInfo.customizable=true
ResourceInfo.deprecated=false
repsave.REPSAVEAS.title.value=Download DRW PDF or PLT
repsave.REPSAVEAS.icon.value=download.gif
repsave.REPSAVEAS.tooltip.value=Download DRW PDF or PLT
repsave.REPSAVEAS.description.value=Download DRW PDF or PLT
repsave.REPSAVEAS.moreurlinfo.value=height=400,width=700, scrollbars=yes
I have attached an updated customRB.rbInfo.txt file (remove.txt).
I ran the update on my vmware & the ResourceBuild response was:
BUILD SUCCESSFUL
L Jett
I added the latest customRB.rbInfo to the codebase\com\ptc\windchill\enterprise\repsave folder and I now have a successful resource build. I guess the next question is, what xml files do I need to edit at this point ? Also for the last step, do I still add the four java and class files to the folder specified ( <wt_home>\codebase\ext) ?
You are not far away from it allworking.
Just follow the readme file:
http://www.datajett.com/windchill/wc_dev/saverep/saverep_readme.txt
If you have not edited the xml files, they are custom-actions.xml & custom-actionModels.xml.
In the custom-actions.xml, make sure to change the resourceBundle value from:
com.ptc.windchill.enterprise.wvs.WVSactionsResource
to
com.ptc.windchill.enterprise.repsave.customRB
Then copy the REPSAVEAS.jsp to (<wt_home>\codebase\wtcore\jsp\repsave)
Then copy the dlRep.class to the(<wt_home>\codebase\ext)folder.
If you run into any errors, maybe look at deleting my class & compiling the java your self.
You only need to copy the dlRep_main.class to the ext,if you want to run it from command line.
Some folks place the java files in the src area, I place them in ext & compile there.
Bad habit, but thats what I am used to. Less command line compile args.
If you have your system publishing DRW's to pdf, then you are good to go.
If they are instead set to plt, then change the jsp:
Change the jsp line:
String conType = "pdf";
to
String conType = "plt";
Then stop/start method server. Let me know if you run into any issues.
L Jett
OK, Im getting very close to this working now:
Inow get the download pdf or plt option in the actions menu.Choosing that action,I next get awindowsscreen as follows:
PDF or PLT Object/Download Info:
CAD Doc Number: 18056.DRW
CAD Doc Name: 18056.drw
Revision: F.1
Container: wt.pdmlink.PDMLinkProduct:14790
Product/Libray: OR:wt.pdmlink.PDMLinkProduct:14790
Download Location: c:\TEMP (Configurable)
Representation/Content Type: plt (Configurable)
Problem is, no file appears in the c:\temp folder.
If I run from the command line, here is what I get:
C:\PTC\Windchill_9.0\Windchill>java ext.dlrep_main ctemp 1800% plt
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Any ideas what to rty next ?
Ed, try these tests/changes:
1) recompile, like Antonio suggests:
cd /d C:\PTC\Windchill_9.0\Windchill\codebase\ext
compile both:
javac dlRep.java
javac dlRep_main.java
Then run again:
java ext.dlRep_main c:\\temp 1800% plt
2) maybe message typo or command line error:
C:\PTC\Windchill_9.0\Windchill>
java ext.dlrep_main ctemp 1800% plt
should be:
java ext.dlRep_main c:\\temp 1800% plt (as shown above).
3) see that yor JSP has: C:\\temp (with 2 \'s)
4) did you look for the plt in the C:\\temp on your windchill server, because if the dlLoc is not URL, it will download/save to the folder on windchill server.
5) set your dlLoc in JSP to URL. dlLoc = "URL"; Then your popup should have the plt download hyperlinked within, which allows the plt to be downloaded towhere you want it.
Try these & let us know what happens.
L Jett
Lawrence,
thanks for the help again. Looks like the recompiling did the trick, although I did get a warning message when recompiling the dlRep_main.java file. Now both the windchill app and command line version work which is very neat. Next Im going to look for a utility to automatically convert .plt files to pdfs, this way windchill users can just download the plt and hoepfully convert automatically to pdf. Anyone out there know of such a utility ? We currently use cutepdf with product viewlite where users have to open the drawing then print to pdf.
Hey ED,
Glad to see you had some success with the tool.
As far as generating PDF's vs PLT's, unless you can't, I would just run your recipe editor & change output to PDF.
To change to PDF output, you go to "Advanced" tab, then "Miscellaneous", then "Drawing Output" to PDF.
That alone wont create great PDF's, but it should generate PDF's, where the saverep will then see PDF's instead of PLT's.
I might be missing a step or 2, because its been a little while since I had to configure for cad worker to generate PDF's.
Now I do recall viewing a Tristar webcast on productview, which helped heavily:
http://www.tristar.com/webcasts/productviewarchives.asp
If you are still bent on converting the PLT's to PDF;s, there is the old route of using ghostscript. Ages ago, I used it & it worked, but since proe & cad worker will create the PDF & associate it to a DRW, I quit using the ghostscript. But if you want to try it, the download on my site is:
http://www.datajett.com/Cadd/ProE/pro2pdf/pro2pdf.zip
The original page is also on my site:
http://www.datajett.com/Cadd/ProE/pro2pdf/pro2pdf.htm
I have no idea whether the links there are any good anymore.
If all else fails, I hear there are a few free plt viewers that yo can point your vendor to. Or whoever you want to send your plt's to.
Hope you get what you need.
L Jett
Summary: Update of finalized procedure, for the folks who have been following this thread, here is the procedure that worked for me. I'm running 9.0 M050. The basic outline is what Lawrence worked out, I've just added some comments etc.
Instructions for download .plt or .pdf
1) Create folder "repsave" in <wt_home>\codebase\wtcore\jsp
copy REPSAVEAS.jsp to that "repsave" folder:
JSP contains 2 strings that are configurable:
dlLoc = "URL" or location, example c:\\temp (must use two \\ characters)
String conType = "pdf";
URL (for dlLoc) can be changed to a server side folder or shared folder,
accessible by user and their client machines.
2) customRB.rbInfo (text file, see below for code) goes here:
<wt_home>\src\com\ptc\windchill\enterprise\repsave
(may need to create repsave directory)
to compile:
<shell> ResourceBuild com.ptc.windchill.enterprise.repsave.customRB
compiled file is customRB.class located at:
<wt_home>\codebase\com\ptc\windchill\enterprise\repsave
--------------------------------------------------------------------------------------
customRB.rbInfo
ResourceInfo.class=wt.tools.resource.StringResourceInfo
ResourceInfo.customizable=true
ResourceInfo.deprecated=false
repsave.REPSAVEAS.title.value=Download DRW PDF or PLT
repsave.REPSAVEAS.icon.value=download.gif
repsave.REPSAVEAS.tooltip.value=Download DRW PDF or PLT
repsave.REPSAVEAS.description.value=Download DRW PDF or PLT
repsave.REPSAVEAS.moreurlinfo.value=height=400,width=700, scrollbars=yes
----------------------------------------------------------------------------------------
3) Backup original custom-actions.xml and custom-actionmodels.xml located at:
<wt_home>\codebase\config\actions
(can rename existing .xml files to .xml.original or copy to backup folder etc)
Copy new custom-actions.xml and custom-actionmodels.xml into specified folder
4) Copy java files, recompile to class etc
(note: supplied class files did not run, therefore
must recompile java files, only need to copy java files)
java files go here:
<wt_home>\codebase\ext
to recompile files:
cd <wt_home>\codebase\ext
javac dlRep.java
javac dlRep_main.java
Command Line from Windchill Shell is:
java ext.dlRep_main <download folder="> <filename> <content type=">
example;
java ext.dlRep_main c:\\temp 12345% plt
I amrunning 9.1 M50, and have the cad worker setup to do pdf's. I followed the instructions. I did not have a C:\PTC\Windchill_9.1\Windchill\codebase\ext folder so I had to create it. I was able to complie no problem.I do not see the new menu item in the actions menu. If I run command line I can see the query in the method server log, but it is not creating the pdf files.
Any advice on where to check what is going wrong?
Thanks
Hi Keith,
I am looking to do the same thing in 9.1. M050. Did you figure out a way to do this?
looks like step 2 customRB.rbInfo did not work for me. I had to do it this way
Add content to
<wt_home>\src\com\ptc\windchill\enterprise\wvs\WVSactionsResource.rbInfo
append with:
repsave.REPSAVEAS.title.value=Download DRW PDF or PLT
repsave.REPSAVEAS.icon.value=download.gif
repsave.REPSAVEAS.tooltip.value=Download DRW PDF or PLT
repsave.REPSAVEAS.description.value=Download DRW PDF or PLT
repsave.REPSAVEAS.moreurlinfo.value=height=400,width=700, scrollbars=yes
Then from windchill shell: <wt_home>
ResourceBuild com.ptc.windchill.enterprise.wvs.WVSactionsResource
This seems to work very well. Thank you all for your work. Is there a way to schedule this to run automaticly? I can do it from WC shell, but cant seem to write a batch file that will run it
Thanks
Has anyone else had a problem with loosing the option "Open in ProductView" from the actions menu ?
After setting up this utility, I lost this option in the actions menu located in a search result and also in the information page.
ED:
We spoke shortly about your "Open in ProductView" option not showing.
But it shows for me. It might be my wc9.1 vs your wc9.0, but I would think
not. I sent you my recipe file, so I don't know if that showed to be different
than yours. But I got my productview to create PDF's after reading / viewing
all of the list below:
PVAdaptersInstallConfigGuide.pdf
RecipeEditorQuickReference.pdf
http://community.tristar.com/
http://www.tristar.com/webcasts/productviewarchives.asp
http://www.tristar.com/software/productview.asp
http://www.tristar.com/webcasts/windchillarchives.asp
=======================================
Keith
when you appended rbInfo content to:
<wt_home>\src\com\ptc\windchill\enterprise\wvs\WVSactionsResource.rbInfo
That was in the readme that way. We adjusted in this forum area for Ed, because
he was on wc9.0 & not on wc9.1. wc9.0 might not have that rbInfo file.
Both have worked.
You had posted that the actions menu did not show "Download DRW PDF or PLT"
Does it show now & work?
As far as a batch/automated route to do multiples, there are maybe several routes.
Play with the <number search=" string="> argument.
java ext.dlRep_main <download folder="> <number search=" string="> <content type=">
Do individual runs or create a batch bat:
java ext.dlRep_main C:\TEMP 19001% pdf
java ext.dlRep_main C:\TEMP 27001% pdf
java ext.dlRep_main C:\TEMP 31001% pdf
If you want to maybe run the program from a text file that includes all
the DRW's you desire to download a pdf of. Here is an idea.
Create a LIST.TXT file & place only DRW numbers on each line like:
1900110.DRW
1900113.DRW
1900119.DRW
2100104.DRW
3900010.DRW
Then create a bat which includes this content:
for /f %%x in (LIST.TXT) do java ext.dlRep_main C:\TEMP %%x pdf
pause
Now I don't know if the straight 1900110.DRW or if 1900110% works better.
I have not checked anything but %, because I don't have that many DRW's in
my wc database to worry about.
Now as far as the bat & LIST.TXT, I have not tested this for dlRep_main,
so step lightly & test with only1-2 at 1st.
Now some one could maybe create a actions bar icon/program in wc that would
allow users to collect many DRWS (from search or ?), but that would be a lot of
work & not likely do be done on free time..ha..ha
=======================================
Shaylyn
Go through all pages of this post & you should be able to get yours to work also.
You might save time going right to the readme.txt & zip on my site:
http://www.datajett.com/windchill/wc_dev/saverep/saverep_readme.txt
http://www.datajett.com/windchill/wc_dev/saverep/dlRep_REPSAVEAS.zip
Lawrence,
I checked my recipe editor and it has the same settings as yours. Publishing to pdf is successful, its just that
on the actions menu (in search and information page) I no longer have the choice "open in ProductView", maybe its a 9.0 issue ?
If I go through the list representations menu I can open the published pdf in productview, I've noticed this issue after modifying the
two xml files, if I change the xml files back to their original versions, the menu pick "Open in ProductView" returns but of course
then there is no more download plt or pdf option. I'm going to try to contact tech support to see if this is a 9.0 issue. I'll post any
findings back to the forum.
I
Did anyone experiment with retrieving multiple files through a batch file ?Particularly what is the syntax needed to retrieve
the files through the windchill shell ? I've noticed the command java ext.dlRep_main <location> <filename> <plt or=" pdf="> only runs through the windchill shell. Its been quite a while since I worked with batch files, my windchill shell command looks like this:
C:\>PTC\Windchill_9.0\Windchill\bin\windchill.exe -w "C:\ptc\Windchill_9.0\Windchill" --java="C:\ptc\Windchill_9.0\Java\jre\bin\java.exe" shell
Adding this line to bach file, calls up the windchill shell but the problem isgetting additional lines in the batch file to execute,
any ideas ?
lawarence
Thanks for the response. I do have the menu working, even changed the icon to use a little PDF icon. What I am having an issue with is the batch file. I can run it through windchill shell with no problem, but creating a batch file I can not get to work. Java can not find the class
C:\PTC\Windchill_9.1\Windchill\codebase\ext>C:\PTC\Windchill_9.1\Java\bin\java.exe ext.dlRep_main c:\\share\drawings % pdf
Exception in thread "main" java.lang.NoClassDefFoundError: ext/dlRep_main
Caused by: java.lang.ClassNotFoundException: ext.dlRep_main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: ext.dlRep_main. Program will exit.
I have even tied setting the class path as well. Have you been able to run a batch file?
in a batch file you need to use %% instead of %
ED, as far as running any batch file that includes executing the windchill (wc) shell before executing the dlRep_main java class.
Just run your bat from a windchill shell. If your wc shell cant find the bat, add the path to the bat to your PATH var.
Keith: Same thing, run you dlRep_main from a wc shell window.
java ext.dlRep_main c:\share\drawings% pdf
should run fine from wc shell. from the wc shell, you dont need to add classpath (-cp or -classpath), you dont need to enter full path of java in command line,the windchill shell knows where java is. It also knows where ext.dlRep_main is.
L Jett
Keith,
Here is what worked for me:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
batch file - print_list_bat0
PTC\Windchill_9.0\Windchill\bin\windchill.exe -w "C:\ptc\Windchill_9.0\Windchill" --java="C:\ptc\Windchill_9.0\Java\jre\bin\java.exe" shell
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thisjust calls up the windchill shell
Then inside the windchill shell,
type "print_list_bat"
contents of print_list_bat:
for /f %%i in (c:\print_list.txt) do java ext.dlRep_main C:\TEST %%i.DRW plt
The one thing I still cant get to work isto how to have print_list_batautomatically runonce the windchill shell opens, any ideas ?
I am so close now. If I type at a command prompt
C:\PTC\Windchill_9.1\Java\bin\java -cp C:\PTC\Windchill_9.1\Windchill\codebase ext.dlRep_main
I get what is expexted the usage text. Which means it does see it.
Usage: windchill dlRep_Main <path-where-file-should be=" saved="> <number search=" string="> <content type=">
But if I add the Paramaters I get the following errors:
C:\PTC\Windchill_9.1\Java\bin>C:\PTC\Windchill_9.1\Java\bin\java -cp C:\PTC\Windchill_9.1\Windchill\codebase ext.dlRep_main c:\ % pdf
wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at java.io.ObjectStreamClass.getExternalizableConstructor(ObjectStreamClass.java:1297)
at java.io.ObjectStreamClass.access$1400(ObjectStreamClass.java:52)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:435)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at wt.method.MethodArgs.writeExternal(MethodArgs.java:193)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1418)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at wt.method.MethodServerImpl_Stub.invoke(Unknown Source)
at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:647)
at ext.dlRep_main.main(dlRep_main.java:111)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 22 more
I have tried this command from different starting points, using double backslash in pathsetc...
If I open WC Shell and type
java ext.dlRep_main c:\\share\drawings % pdf
It works no problem. What am I missing?
thanks
That is IT!!!!
Thank you very much Igor The key is you can not run a command from within shell through a batch file, so you have load all of the correct class in order for it to run.
The only thing I had to change was running the java from the java\bin directory, becasue I do not have a system path setup.
Thanks everyone for all the help.