Skip to main content
12-Amethyst
May 4, 2016
Question

Copy parameter in Mapkey won't work after re-booting Creo

  • May 4, 2016
  • 7 replies
  • 16770 views

Hello,

I have tried to record a Mapkey in which I want to copy a specific parameter of a selected component in a assembly. The steps are:

-> right mouse click

-> Edit Parameters

-> left mouse clik on the wanted parameter value

-> Edit menu

-> Copy

-> close parameters window

Here below a video of the mapkey record:

Video Link : 6854

The Mapkey works if I run it in the session where it has been recorded, with other components and other assemblies too, but doesn't work when I restart (after having saved it obviously) Creo, as if there is something in the recording related to a specific session (but that I can't see from the config.pro). (Also, the parameter whose to copy the value is present is every assembly and part we have).

Anyone can tell what is it due to and if there is something I can modify in the mapkey config.pro code to make it working forever?

(Here below the code I recorded (where codice_disegno is the parameter name):

mapkey 7 ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\

mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;~ Activate `rmb_popup` `EditParameters`;\

mapkey(continued) ~ Arm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

mapkey(continued) ~ Disarm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `Edit`;\

mapkey(continued) ~ Close `relation_dlg` `MenuBar1`;~ Activate `relation_dlg` `PBCopy`;\

mapkey(continued) ~ Close `relation_dlg` `relation_dlg`;

(I am trying to record this mapkey to then use it to open a selected component drawing with the help of an external software and it would be much more useful to have the copy value inside Creo).

thanks

Tommaso


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

7 replies

1-Visitor
May 4, 2016

if i want to select a specific parameter i dont select it but use the search function in the parameter window.

If you da a search it selects the parameter you want and you can continue with the rest of the mapkey.

I found it to be difficult to consistently select the right parameter.

tleati12-AmethystAuthor
12-Amethyst
May 4, 2016

Hi Hans,

thanks for your reply. Indeed it can be a way. How can I tell the program to select and copy the value after the search? (what code string I should insert).

Because If I select the value with the mouse click, it falls back to the situation of my original mapkey and it won't work at next sessions...

Thanks

Greetings

Tommaso

1-Visitor
May 4, 2016

What i would  do:

-model intent

-parameters

-edit

-find

-enter parameter name you need to find "CODICE_DISEGNO"

-add

-find

-close

// it now selected your parameter name

- 2x right arrow button

// now you have your value selected

-edit

-copy

Hope this helps for you.

Isnt it beter to use your external software ( jlink,Web.link) to read out the open model and open its drawing?

7-Bedrock
May 13, 2016

I think, in fact, do you want to add specific parameters to the parts?

If so, the fastest way is to use modelcheck

Menu - -modelcheck-modelcheck-Analysis interractive-all levels-enter

It will check if you have the parameters you need, if not, it can automatically help you write to the parts, of course, this must go through the configuration of the config file.

here:

D:\Program Files\proeWildfire 5.0\modchk\text\usascii\config\check-create a file (like:0.mch)

&

D:\Program Files\proeWildfire 5.0\modchk\text\usascii\config\start-create a file (like:0.mcs)

Use Notepad to open it

To be continued...

tleati12-AmethystAuthor
12-Amethyst
May 17, 2016

Hello Chenwei,

Thanks for your reply. Indeed I don't need to add parameters to the parts, in fact all the CAD stored in our system already have the parameter I need for running the mapkey, and the problem in my case is that the mapkey recorded isn't working in Creo sessions other than the one where I recorded the mapkey itself...

Bye

Tommaso

7-Bedrock
May 23, 2016

Unable to copy the current value.

In this case we are trying to use the shortcut key to achieve the DRW name = PRT name consistent, already know.

1-Visitor
May 23, 2016

Perhaps an easier way you can try is to export the parameter info to a file and then have the external software extract the value of the parameter directly from this file...

tleati12-AmethystAuthor
12-Amethyst
May 23, 2016

Hi Paul,

thanks for your reply, yes indeed that could be a way. However for the usage I have to do of it in my case (open drw mapkey as wrote to Chen), I have already found a solution with an external Autohotkey script recalled by a mapkey, and instead by using this technique of copying the parameter value remaining inside Creo would allow to avoid external sourcing thus speeding up the mapkey execution...(and maybe also its stability in case other programs windows pop up suddenly, as Windwos updatings or Outlook messages).

Bye

1-Visitor
May 23, 2016

I find that mapkeys that use the "Timer" commands or that rely on the right-mouse button menu, don't work reliably when session is restarted.  The code below avoids this issue by using the ProCmd... like commands to get the parameter ui to show up for the component in question.

Try this mapkey, it seems to work for me:

mapkey 99 @MAPKEY_LABELGet_CODICE_DISEGNO (99);\

~ Command `ProCmdMakeActive`;\

~ Command `ProCmdMmParams` ;\

~ Select `relation_dlg` `MenuBar1` 1 `Edit`;\

~ Close `relation_dlg` `MenuBar1`;~ Activate `relation_dlg` `PBSearch`;\

~ Update `param_search` `PrmFilterPHLay.FilterRuleValueOptEditableMenu` \

`CODICE_DISEGNO`;~ Activate `param_search` `PrmFilterPHLay.FilterRuleAddPush`;\

~ Activate `param_search` `PrmSearchFindPush`;\

~ Activate `0_std_confirm` `OK`;\

~ Activate `param_search` `PrmSearchClosePush`;\

~ FocusIn `relation_dlg` `ParamsPHLay.ParTable`;\

~ Arm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `type`;\

~ Disarm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `type`;\

~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `type`;\

~ Arm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

~ Disarm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

~ Select `relation_dlg` `MenuBar1` 1 `Edit`;\

~ Close `relation_dlg` `MenuBar1`;~ Activate `relation_dlg` `PBCopy`;\

~ Close `relation_dlg` `relation_dlg`;

how to use:

select the component in the assembly.

press 99

- the text in the model's parameter "CODICE_DISEGNO" is copied to the clipboard.

Note: works whether the parameter "CODICE_DISEGNO" is 1st in the list or not - using the Find functionality as described elsewhere in this thread

Note: component remains as the "active model".

Perhaps you can adapt this further to your needs...

12-Amethyst
May 23, 2016

This is my try, not much different, but used Ctrl+F to find the parameter. Maybe this way it can be more consistent:

mapkey 7 ~ Command `ProCmdEditParameters@PopupMenuGraphicWinStack` ;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 38141958 `Ctrl+F`;\

mapkey(continued) ~ Activate `relation_dlg` `PBSearch`;\

mapkey(continued) ~ FocusIn `relation_dlg` `ParamsPHLay.ParTable`;\

mapkey(continued) ~ Update `param_search` `PrmFilterPHLay.FilterRuleValueOptEditableMenu` \

mapkey(continued) `CODICE_DISEGNO`;\

mapkey(continued) ~ Activate `param_search` `PrmFilterPHLay.FilterRuleValueOptEditableMenu`;\

mapkey(continued) ~ Activate `param_search` `PrmFilterPHLay.FilterRuleAddPush`;\

mapkey(continued) ~ Activate `param_search` `PrmSearchFindPush`;\

mapkey(continued) ~ Activate `param_search` `PrmSearchClosePush`;\

mapkey(continued) ~ FocusIn `relation_dlg` `ParamsPHLay.ParTable`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 589833 `Tab`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 589833 `Tab`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 37945347 `Ctrl+C`;\

mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;

Also, if your mapkey doesn't work, stop and inspect your trailfile to see what is causing the failure.

Jose

1-Visitor
May 24, 2016

Hmm, that one doesn't work for me (Creo 2, M210).


But I did manage to simplify my mapkey:

mapkey 99 @MAPKEY_LABELGet_CODICE_DISEGNO (99);\

~ Command `ProCmdMakeActive`;\

~ Command `ProCmdMmParams` ;\

~ Activate `relation_dlg` `PBSearch`;\

~ Update `param_search` `PrmFilterPHLay.FilterRuleValueOptEditableMenu` \

`CODICE_DISEGNO`;~ Activate `param_search` `PrmFilterPHLay.FilterRuleAddPush`;\

~ Activate `param_search` `PrmSearchFindPush`;\

~ Activate `0_std_confirm` `OK`;\

~ Activate `param_search` `PrmSearchClosePush`;\

~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

~ Activate `relation_dlg` `PBCopy`;\

~ Close `relation_dlg` `relation_dlg`;\

~ Command `ProCmdWinActivate`;

I'm curious how the OP then uses mapkey commands to open the drawing named according to the string now in the clipboard...

tleati12-AmethystAuthor
12-Amethyst
May 25, 2016

I tried with this last script but it doesn't work either unfornutately. In the execution, I don't see anything on the screen as if not even the first step is done.

Concerning the paste action in the open model, yes it's a major problem and for it I had thought I could eventually run an external program for these two last short steps (paste+middle mouse button), which is not the desired solution but would speed up the execution time and also improve the reliability: obviously being able to do it still in Creo would be perfect.

1-Visitor
May 24, 2016

Only two things occur to me:

1) Record another mapkey to do the same thing in a separate session and see what differences show up

2) You have a mapkey with the same name being restored after the one you recorded and so of course it won't work.

For the second one, check all the config.pro files that you are loading to see if that mapkey is being saved elsewhere. You should also be able to use the pull-down and see which files are being loaded in the Option dialog. At least one of them should have mapkey 7.

tleati12-AmethystAuthor
12-Amethyst
May 25, 2016

Hi David,

thanks for your reply.

-concerning the point 1), I didn't understand really what you mean. The mapkey I created and posted here as first, does not work in other sessions and that's the problem I am trying to solve.

-Concerning the point 2, the mapkey posted by me is exactly the one visible in the screen recording video, under the name 7 in mapkeys list window.

Bye

1-Visitor
May 25, 2016

Point 1 - re-record the mapkey with a different name in a new session and compare it to the existing one for differences.

Point 2 - you need to look at all the config files that get loaded to make sure that there is only one copy of the mapkey. The mapkey window only shows a portion of the recorded mapkey and if you or someone else introduced one with the same name that loads after the one you created, then the one you want to run won't be the one that runs.

I would also recommend not using a single letter or number. You can edit the config to change the name later, but until then, give them a longer name each time you record it - test1, test2, test3, et al until it actually works correctly. You can run them by clicking on the desired one in the mapkey window, which can stay open, and then picking Run.

12-Amethyst
May 25, 2016

That hasn't worked? Strange, works on Creo 3...

Here is another try, I cleaned all the junk on this one:

mapkey 7 ~ Command `ProCmdEditParameters`;\

mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCODICE_DISEGNO` `value`;\

mapkey(continued) ~ Activate `relation_dlg` `PBCopy`;~ Activate `relation_dlg` `PB_OK`;

If the mapkey finds something unexpected it may ignore it and continue until the end. This way you will never know what went wrong.

Unless you take a look at the trailfile, Creo registers everything there. Open the trailfile, run the mapkey, reload the trailfile and search for error lines in the end of the file.

That's it.

Note: this mapkey will only work if a component is selected.

Jose

tleati12-AmethystAuthor
12-Amethyst
May 26, 2016

Hi Jose,

thanks. I have the Creo 2.0 M110, if this may make some difference.

Yes I also have in mind to make the mapkey once the component is already selected.

I posted in response to Paul's last post all the mapkeys proposed in this topic and the relative trail file recordings after they have been played.

Bye

1-Visitor
May 28, 2016

Mapkeys are version sensitive, so any Creo 3 mapkeys are not guaranteed to work. If they do it is by accident as PTC does not make them backwards compatible.

Also see my other response.Re: Copy parameter in Mapkey won't work after re-booting Creo

1-Visitor
May 30, 2016

Just add the parameter as a column in the model tree. You can then directly copy or change the value.

No need for a mapkey.



The above would work great except for a peculiar glitch in the Creo selection process. Sigh.

If the item is locked in the Workspace or is otherwise in a non-modifiable state, Creo first prompts the User that the item can't be changed and after that dialog box is dispatched, rewards the user by replacing the line with a blank line, so there is nothing to copy. When anything else is selected, Creo then replaces the blank with the original value. Look, but don't touch.

That aside, in reproducing the steps above I had no trouble, which leads me back to thinking this has more to do with not correctly loading the desired mapkey. It may also be failing because the models on later days are being locked and the mapkey as created is not working with the locked parts. I notice the part that says 'Edit' just before "Copy', but I think the right mouse button produces a menu with Copy on it that does not involve an Edit.

tleati12-AmethystAuthor
12-Amethyst
June 6, 2016

Hi David,

the fact of putting the parameter in the model tree is that in this case I would like to make this mapkey for the purpose of copying the parameter, and than use this value to open its drw. (and not to change it).

I know the message you are referring to, and the item I am testin the mapkey on doesn't show it, nor it did in the mapkey test6 recording action.

Yes I think so also, as you said the software doesn't load the mapkey properly, this happens with some mapkeys such as these in the topic, and another one (replace components in an asm). That's also why it's weird.

The fact of the locked components, I don't think it's the cause since they don't even start running...they should at least show the parameters window...

thanks

bye