Hello,
I am trying to create a mapkey that allows me to export a drawing as a PDF with the filename from a parameter I created. The parameter I created contains the part number and revision of the drawing being exported.
However, when I copy the 'FILENAME' parameter, the mapkey appears to only copy the 'FILENAME' parameter from the original session.
Is there any good way to copy a parameter from the active part while recording a mapkey?
Thank you!
Jeff H.
Solved! Go to Solution.
I do not think this is possible with mapkey functionality alone. Anything in the UI that requires a user to generate a string in the UI dialogue is not going to update automatically from a mapkey. One way to deal with this is have the mapkey call an external script that would rename the PDF file once saved using Windows OS functionality.
When using save as on a file you will get this dialogue and the default value is the current file name. The mapkey will record the mouse actions and keyboard entry in the field but mapkeys will not create a "variable" that will read from a parameter AFAIK.
I do not think this is possible with mapkey functionality alone. Anything in the UI that requires a user to generate a string in the UI dialogue is not going to update automatically from a mapkey. One way to deal with this is have the mapkey call an external script that would rename the PDF file once saved using Windows OS functionality.
When using save as on a file you will get this dialogue and the default value is the current file name. The mapkey will record the mouse actions and keyboard entry in the field but mapkeys will not create a "variable" that will read from a parameter AFAIK.
That's a shame, it would be a very nice feature to add for my use case.
I have never scripted before, but might be able to figure it out. How would you go about doing this - a batch file? I am unsure how to tie a batch file with Creo, so everytime I export the batch file knows to rename the PDF.
In any case, thanks for the quick response!
Hi,
I'm coming back to this. I realized that all I need to do is copy a parameter, and paste it as a suffix after the default generated filename.
Do mapkeys have the functionality to copy then paste text into the 'New File Name' box? I tried and I think the answer's no. I wanted to know your thoughts.
I will look into creating a script that renames after PDF generation. Thanks.
You can do it through python, I have something similar like this.
You need mapkey in creo which exports table of parameters + gets you to your naming screen + starts .bat file
for example this is how you start bat file
mapkey(continued)\ @SYSTEM "C:\\Users\\User\\Desktop\\personal\\autoimport\\tpv.bat";
+
simple python script which finds the correct parameter and just simulate keypress, try to find help from chatgpt
Thanks for your response, if I can find time/will to create such a mapkey & script combination, I'll be sure to post it here.