Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add revision to publish filename (pdf and dxf) 1

Status
Not open for further replies.

Davemccan

Mechanical
May 3, 2011
4
0
0
GB
Hi,

I'm wondering if it is possible to automatically include a parameter value in a published filename,

00001.drw , parameter REVISION = 03

output PDF as :

00001-R03.pdf

I've tried this using macros without any success, has anyone done anything like this, do you need to use pro-toolkit?

Thanks

Dave.
 
Replies continue below

Recommended for you

Hi

I have made something similar using a mapkey and a small
program and using batch script doint the rename

It result in the pdf to be named 00001_03.pdf
We are using letters i.e. it would be 00001_A.pdf

It has been used with both Ilink 34 and PDM Link 91

The mapkey export a file with all parameters
plot the pdf, then the parameter value is read and
used for a dos rename of the file.

Currently it works for WF5 but has also worked with WF2 & WF4
but with a slightly different mapkey (change in UI in WF5)

BR Niels
 
Hi NeilsC,

That sounds like what I'm trying to do, I'm new to scripts though,

can the batch script be run as part of the macro or does it have to be run separately? The parameter file exported from the part is quite large, how does the script pick out the correct value?

could you post a copy the mapkey code and script that I could modify to suit my system? I should be able to pick up enough from tutorials to change a batch script but am a bit lost on how I would start from scratch.

Thanks for your help,

Dave.
 
Hi

I have attached a zip with 4 files - working with WF5 (do have for WF4 also)

It is simple and home made and could be improved but it works.
The idea is to read the parameter from an exported file and
generate a simple bat file that renames the pdf file


You will need to have 'standard' pdf creation ala ghost script
installed (i think - at least i have)

I use the pdf.pcf for printer definition that calls the makepdf.bat normally placed in a plot_config folder

The config.pro is the mapkey for creating a export file with the temp name @rev_info.txt with the parameters into a folder called C:\PLOT
then printing the pdf file into the C:\PLOT\ folder (i think this can be done without ghost script pdf but have not tried)

but the current pdf is created through calling the makepdf.bat
that execute the ilink_revision.exe file (my own gooffy program)

that search the @rev_info.txt (hard coded) for the parameter
(any choise) using the filename (%OUTNAME%) from the creation of the pdf

ilink_revision.exe %OUTNAME% PTC_WM_REVISION C:\PLOT

This create a simple bat file called c:\plot\@rev.bat
that must be executed for renaming to filename_rev.pdf

I do not know if this is clear and i have not checked
without ghostscript but feel free to play :)

BR NielsC
 
 http://files.engineering.com/getfile.aspx?folder=d9c06892-58f2-4df8-9af8-df939c49edd1&file=pdf_rev.rar
Hi NielsC,

I've been doing a bit of work on this and have managed to get it to work using a .BAT file that will add the revision to the filename on .dxf and .pdf files for it to work you have to

-create folders c:\dxf, c:\pdf and c:\publish_workspace


-create revname.bat(see below), and copy to c:\publish_workspace\

-record a mapkey that is set to export a dxf or pdf or both files to c:\publish_workspace (or any name that ties up with the batch file)also exporting the drawing parameters in .txt format to the same folder finish the mapkey by manually adding this line to its end :

mapkey(continued) @SYSTEMstart c:\\publish_workspace\\revname.BAT;



REVNAME.BAT
----------

for /F "usebackq tokens=2" %%a IN (`findstr PTC_WM_REVISION C:\PUBLISH_WORKSPACE\*.txt`) do (
SET Rev=%%a
)

FOR %%S IN ( c:\publish_workspace\*.DXF) DO (SET FILE=%%S)
set noext=%file:~21,-4%
ren %file% %noext%-R%REV%.dxf
REN C:\PUBLISH_WORKSPACE\*.PDF ?????????-R%REV%.pdf
move c:\publish_workspace\*.dxf c:\dxf
move c:\publish_workspace\*.pdf c:\pdf
del c:\publish_workspace\*.txt
del c:\publish_workspace\*.log*
EXIT

---------

Thanks for all your help on this, I would never have got it done otherwise.
 
Hi Dave

impressive batch programming - was not aware that i could search
for the parameter throuh batch.

I would prefer to do this for one file only and not all in the folder.

Guess i can alter the makepdf.bat to do that

NielsC
 
Status
Not open for further replies.
Back
Top