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

A mapkey routine for saving .pdf file of a drawing using part parameters

SOLVED
Crostolo
Visitor

A mapkey routine for saving .pdf file of a drawing using part parameters

Hi all, 

 

I have to wite a routine that save a .pdf file of a drawing using the p/n, version and revision parameters specified for that part. 

 

Thanks to a lot of informations listed in this forum I was able to resolve part of the problem. I have written a mapkey routine that save the pdf, after loading a specific Profile, with a fixed name XXX and a .txt file with listed all the prameters of the part. Than I've written a batch file that use the informations listed in the .txt file and rename the pdf. file accordingly.

 

What I wasn't able to do was to launch consequently the batch file inside the mapkey routine. Here is my code of the mapkey:

 

 

 

 

mapkey $F3 @MAPKEY_NAMESave the active drawing as .pdf file;\
mapkey(continued) @MAPKEY_LABELSavePDF;~ Select `main_dlg_cur` `PHTLeft.AssyTree` 1 `node0`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `PHTLeft.AssyTree` `node0`;\
mapkey(continued) ~ PopupOver `main_dlg_cur` `PM_PHTLeft.AssyTree` 1 `PHTLeft.AssyTree`;\
mapkey(continued) ~ Open `main_dlg_cur` `PM_PHTLeft.AssyTree`;\
mapkey(continued) ~ Close `main_dlg_cur` `PM_PHTLeft.AssyTree`;\
mapkey(continued) ~ Trail `MiniToolbar` `MiniToolbar` `UIT_TRANSLUCENT` `NEED_TO_CLOSE`;\
mapkey(continued) ~ Command `ProCmdOpenModel@PopupMenuTree` ;\
mapkey(continued) ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdMmModelProperties` ;\
mapkey(continued) ~ Activate `mdlprops_dlg` `PARAMETERS_lay_Controls.push_Change.lay_instance`;\
mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `File`;\
mapkey(continued) ~ Select `relation_dlg` `CascadeExport`;~ Close `relation_dlg` `MenuBar1`;\
mapkey(continued) ~ Activate `relation_dlg` `PBExportTXT`;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\
mapkey(continued) ~ Input `file_open` `Inputname` `parameters`;\
mapkey(continued) ~ Update `file_open` `Inputname` `parameters`;\
mapkey(continued) ~ Activate `file_open` `desktop_pb`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `PREVIEW_POPUP_TIMER` \
mapkey(continued) `file_open:Ph_list.Filelist:<NULL>`;\
mapkey(continued) ~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
mapkey(continued) ~ FocusIn `relation_dlg` `ParamsPHLay.ParTable`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_Cancel`;\
mapkey(continued) ~ Activate `mdlprops_dlg` `DlgClose_push`;~ Command `ProCmdWinCloseGroup` ;\
mapkey(continued) ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdExportPreview` ;\
mapkey(continued) ~ Command `ProCmdDwgPubSettings` ;~ Open `intf_profile` `opt_profile`;\
mapkey(continued) ~ Close `intf_profile` `opt_profile`;\
mapkey(continued) ~ Select `intf_profile` `opt_profile` 1 `PDF_PROFILE`;\
mapkey(continued) ~ Activate `intf_profile` `pdf_export.pdf_launch_viewer` 0;\
mapkey(continued) ~ Activate `intf_profile` `OkPshBtn`;~ Command `ProCmdDwgPubExport` ;\
mapkey(continued) ~ Activate `file_saveas` `desktop_pb`;\
mapkey(continued) ~ Update `file_saveas` `Inputname` `XXX`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Command `ProCmdDwgPubCloseExportPvw`;
mapkey(continued) @SYSTEMc:\\Users\\completepathofthebatchfile\\renamePDF.bat;

 

 

 

 

From a drawing file it opens the part of the drawing, save in a folder YYYY on the Desktop a file called "parameters" where there a listed all the parameters set in the part file, then it loads the "PDF_PROFILE" previously defined and then save in the same folder YYYY the pdf of the drawing with name XXX. In the last line it calls, well should call, the batch file.

 

Here is the code of the batch

 

 

 

findstr /I DRAWING_NO C:\pathofthefile\parameters.txt > name.txt
findstr /I VERSION C:\pathofthefile\parameters.txt > vers.txt
for /F "tokens=2 delims= " %%g in (vers.txt) do set VERS=%%g
for /F "tokens=2 delims= " %%i in (name.txt) do set NAME=%%i
ren C:\pathofthefile\XXX.pdf %NAME%-%VERS%.pdf
del vers.txt
del name.txt
del C:\pathofthefile\parameters.txt

 

 

 

It extract the DRAWING_NO and VERSION parameters, and rename the XXX.pdf.

 

They both perfectly work themself, alone... but I wasn't able to figure out how to call the batch file just at the end of the mapkey routine. If any of you could give me any hint, or suggestions...

 

thanks a lot.

 

I'm using Creo 7.0.0.0

1 ACCEPTED SOLUTION

Accepted Solutions

Re: A mapkey routine for saving .pdf file of a drawing using part parameters

You need add a "\" in your mapkey on the second to last line.

 

mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Command `ProCmdDwgPubCloseExportPvw`;\   <-- Add the "\"
mapkey(continued) @SYSTEMc:\\Users\\completepathofthebatchfile\\renamePDF.bat;

 

Regards,

 

Dan N.

View solution in original post

2 REPLIES 2

Re: A mapkey routine for saving .pdf file of a drawing using part parameters

You need add a "\" in your mapkey on the second to last line.

 

mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `YYYY`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Command `ProCmdDwgPubCloseExportPvw`;\   <-- Add the "\"
mapkey(continued) @SYSTEMc:\\Users\\completepathofthebatchfile\\renamePDF.bat;

 

Regards,

 

Dan N.

View solution in original post

Re: A mapkey routine for saving .pdf file of a drawing using part parameters

Thanks a lot! 

Announcements