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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Mapkey Copy & Paste

JiffiPop
13-Aquamarine

Mapkey Copy & Paste

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.

ACCEPTED SOLUTION

Accepted Solutions
tbraxton
22-Sapphire I
(To:JiffiPop)

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.

 

tbraxton_0-1705524841538.png

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

View solution in original post

6 REPLIES 6
tbraxton
22-Sapphire I
(To:JiffiPop)

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.

 

tbraxton_0-1705524841538.png

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric
JiffiPop
13-Aquamarine
(To:tbraxton)

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!

tbraxton
22-Sapphire I
(To:JiffiPop)

Mapkey operations include the ability to do the following actions:
Pause for user interaction.
Handle message window input more flexibly.
Run operating system scripts and commands. The Record Mapkey dialog box contains the OS Script tabbed page, whose options allow you to run OS commands instead of Creo Parametric commands.

 

 

tbraxton_0-1705529852815.png

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric
JiffiPop
13-Aquamarine
(To:tbraxton)

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.

Radovan_DT
13-Aquamarine
(To:JiffiPop)

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

RH_8252267_0-1709115308183.png

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

JiffiPop
13-Aquamarine
(To:Radovan_DT)

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.

Announcements


Top Tags