I currently have a mapkey setup to create pdf files. A mapkey is used so all users will have consistent pdf's.
The filename of the pdf defaults to the filename of the drawing.
I would like the filename of the pdf to be in the following format: item number_ALL_revision.pdf (using real numbers it would be 1234-5678_ALL_5.pdf.
The model/drawing knows this information already, I'm just not sure how to make it use it.
We do so here to append the revision parameter automatically. It’s not a simple process. We use a series of nested mapkeys along with nested batch files to process the output.
Our method goes something like this:
I use a series of nested batch files and nested mapkeys that let me export a variety of formats - PDF, IGES, STEP, STL, etc. There are a lot of free batch file resources out there to help you create what you need.
My batch files have grown and gotten more sophisticated over time, to the point where it’s hard to share because they are so interrelated. One thing that makes it tough is that I use a ‘set_vars’ batch file to set a bunch of variables that are used downstream. I also have to accommodate typically 3 versions of Pro/E at a time and work with a variety of export formats and exporting with and without the rev parameter. That said, here are some snippets that may help you.
This captures the file name of the exported file type (%long_type%). Assumes only one file is present in the directory.
rem ** generate list of %long_type% files
dir /b *.%type% > dir.txt
rem ** extract the %long_type% file name
findstr ".%type%" dir.txt > %type%.txt
for /F "tokens=1 delims=. " %%i in (%type%.txt) do set FILENAME=%%~ni
This creates a folder based on the file type and the date:
rem ** create destination folder
date /t > fulldate.txt
for /F "tokens=2 delims= " %%i in (fulldate.txt) do set today=%%i
set today > date.txt
for /F "tokens=2 delims=/=" %%i in (date.txt) do set MONTH=%%~i
for /F "tokens=3 delims=/=" %%i in (date.txt) do set DAY=%%~i
for /F "tokens=4 delims=/=" %%i in (date.txt) do set YEAR=%%~i
This will find the revision in a text based (not HTML) parameter output file and rename the exported file:
rem ** extract the revision
findstr "REVISION" dc_param_temp.txt.1 > rev.txt
for /F "tokens=3 delims= " %%i in (rev.txt) do set REVISION=%%~i
rem ** rename %long_type% file to include revision
rename %FILENAME%.%type% %FILENAME%_%REVISION%.%type%
The ‘tokens’ value above may need to be 2. With 2001 it was 2 and with Wildfire it was 3, I think, but I may have that backwards. I had to add a section in my files to determine which version it came from and it’s still there even though we stopped using 2001 years ago. I didn’t document which was which, unfortunately.
That should help you out. Keep in mind there are likely variables in there that won’t work in your situation, be on the lookout for those.
I would try something silly like create a Creo Parameter/variable that stitches your other parameters together: item number_ALL_rev into one string. I am not sure if that is even possible, but if it is... Maybe you can then put in your PDF mapkey the mouse clicks that look up the parameter and copy the information into windows copy/paste memory. Then when you get to the save dialog box for the PDF, paste it in as the file name. This is an ugly windows hack but it might work...
I tried something similar to what you mentioned Peter. The copy/paste command is where it would fail. The mapkey would remember the original copied text. I was hoping that it would copy whatever information was in the parameter but it didn't...
I have our IT group looking into Doug's method.
Thank you for the replies.
Thanks for sharing your problem. As for me, I have seldom tried to deal with pdf creation or that kind of problem before. Have you ever worked it out? I wonder whether you have any exprience about pdf extraction? process. Because there is something wrong with my pdf reader. I need convert pdf into text or other formats. Any suggestion will be appreciated. Thanks in advance.