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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

PDF creation of drawing

jmayer
10-Marble

PDF creation of drawing

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.

Any ideas?

Thanks,

Jason

5 REPLIES 5
dgschaefer
21-Topaz II
(To:jmayer)

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:

  1. Create a temporary folder on the server. (This provides a consistent path for working with the exported files. It also helps insure that files don't get overwritten.)
  2. Output the file in the desired format to the temporary folder.
  3. Save the parameter information for the file to the temporary folder as a text file (not HTML) using a consistent file name.
  4. Use a batch file to parse the text file for the desired parameter (‘revision’ on our case) and extract that parameter value to a variable.
  5. Use a batch file to find the name of the file that was exported and extract that to a variable.
  6. Use a batch file to create an final output folder named with the date and the file type (111027_IGES for example).
  7. Use a batch file to rename the output file <filename>_<revision>.<type> and move it into the final output folder
  8. Use a batch file to clean up all the temp files and folders

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

del dir.txt

del %type%.txt

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

SET destination_folder=%long_type%_%YEAR:~-2%%MONTH%%DAY%

md %destination_folder%

del fulldate.txt

del date.txt

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

del rev.txt

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.

Good luck!

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

For the 3rd point, i tried doing this:
1. Opened the assembly model in creo
2. Select Tools- parameters
3. In parameters dialog box: file- save configuration as..
I saved the file in xml format at the desired location.
4. Opened the .xml file with notepad and saved it as .txt file with the same name.
Is this how it is supposed to get the paramter values in a text file??
Actually I'm not getting the word 'revision' or any other paramter name in the converted .txt file

Can you please tell me how to extract the parameter information in a text file. I have been trying this since a week but could not get it.
Peter1
7-Bedrock
(To:jmayer)

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...

Good luck!

jmayer
10-Marble
(To:Peter1)

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.

epan
1-Visitor
(To:jmayer)

Hi, Jason.

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. 

Best regards,

Pan

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags