Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi guys.
We have some old mapkeys, and I am trying to update/ optimize them.
I've made a ton of map keys with no problems, but for some reason I cannot get this to work.
I want to make a map key that creates a datum point, then open up a UDF.
The map key runs the datum point, but does not open the UDF.
Does it need a pause somewhere?
If i make 2 seperate mapkeys, each one will work indipendantly, but i want them in one mapkey. I know I can have a mapkey call up mulitple mapkeys, but i'd like to get this to work without making a bunch of individual mapkeys. (I have a TON of older mapkeys that i want to update that are all pretty similar to this one. )
mapkey test @MAPKEY_NAMEcreates point /runs udf 2 plns;\
mapkey(continued) @MAPKEY_LABELcreates point /runs udf 2 plns;\
mapkey(continued) ~ Command `ProCmdDatumPointGeneral` ;@PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) ~ Focus `Odui_Dlg_00` `t1.OffsetRefsTable`;\
mapkey(continued) ~ FocusIn `Odui_Dlg_00` `t1.OffsetRefsTable`;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `` ``;\
mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `CollectorWdg_FocusTimer`;\
mapkey(continued) ~ FocusOut `Odui_Dlg_00` `t1.OffsetRefsTable`;@PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;~ Activate `Odui_Dlg_00` `stdbtn_1`;\
mapkey(continued) ~ Command `ProCmdUserDefined` ;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `hole_2pln.gph`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `udf_place_insert_dialog` `ok_but`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `0` \
mapkey(continued) `used_by_feats`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `` ``;
Solved! Go to Solution.
I think the issue here is related to the pauses. When you're collecting offset references, Creo doesn't really get an indication that you're done. It seems the way this selection works is ending your mapkey. I copied your code over and cleaned it up quite a bit. I've also added a manual pause/resume instead of the screen picks. Give this one a try. This could be related to how the point command works in that if you keep clicking, it makes more points.
Here is a cleaned up version of just the point creation portion in your original code. I believe the issue is the text you see in red.
mapkey TEST @MAPKEY_LABELCREATES POINT RUNS 2PLN UDF;\
mapkey(continued) ~ Command `ProCmdDatumPointGeneral` ;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.RefsTable` 0;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Activate `Odui_Dlg_00` `stdbtn_1`;\
Here is the mapkey I made. It should be ready to work for you.
mapkey TEST @MAPKEY_LABELCREATES POINT RUNS 2PLN UDF;\
mapkey(continued) ~ Command `ProCmdDatumPointGeneral` ;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.RefsTable` 0;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) @MANUAL_PAUSESELECT OFFSET REFERENCES. CLICK RESUME TO CONTINUE.;\
mapkey(continued) ~ Activate `Odui_Dlg_00` `stdbtn_1`;\
mapkey(continued) ~ Command `ProCmdUserDefined` ;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `hole_2pln.gph`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `udf_place_insert_dialog` `ok_but`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `0` \
mapkey(continued) `used_by_feats`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `` ``;
It takes a bit of time to get used to cleaning up mapkey code. I typically use my trail file to pick out just the stuff I want added to the mapkey. Then I make two copies. One to reference and one to trim. This helps makes the mapkey smaller and easier to debug.
As for nesting mapkeys, I prefer to do this as well. From the debug perspective is makes a lot of sense. It also ensures that you've got the smallest/most robust mapkey possible.
Hope this helps!
Ty
I can not debug the mapkey by looking at the posted sequence. Perhaps if you posted pseudo code for the command sequence you are attempting that would help.
With the ribbon interface I have found that it is much easier to debug mapkey issues by breaking them to the smallest block of commands. Nesting mapkeys may not be preferred but it may be the most expedient solution. You mention that you have many similar mapkeys to this one to update so it may be to your advantage to make a reference UDF load mapkey for example and then just change the path for the file in a text editor to create others.
In this example Im trying to create a datum Point on a surface. (just open the datum point creation box, and allow me to populate surface, and offset references. Then run a UDF.
It doesn't matter what UDF I try to run, I cannot seem to get it to open and run any UDF.
All it will do is open up the datum point creation box. (which is what I want, but also to run a UDF afterward.)
Jay
I just tested this in Creo 4 M150 and got the same result. The point creation works but the UDF is not working in a single mapkey as you have experienced. I have recorded the command sequence using two different methods of accessing the UI in the ribbon, neither works.
I can't tell why the mapkey will not continue, could be a bug. I think it is Ribbon UI related. If it were me I would use a nested mapkey calling the two separate mapkeys. I have many nested mapkey sequences in use and as I said it makes it easier to debug when they change the UI and the mapkeys are failing.
I also tested this sequence by using a nested mapkey and it does not work, same behavior as recording it as a single mapkey. At lease it is consistent. For some reason the mapkey is not able to invoke the UDF dialogue which is in the ribbon.
You can open a call with PTC Support, if you do please post the outcome here.
I think the issue here is related to the pauses. When you're collecting offset references, Creo doesn't really get an indication that you're done. It seems the way this selection works is ending your mapkey. I copied your code over and cleaned it up quite a bit. I've also added a manual pause/resume instead of the screen picks. Give this one a try. This could be related to how the point command works in that if you keep clicking, it makes more points.
Here is a cleaned up version of just the point creation portion in your original code. I believe the issue is the text you see in red.
mapkey TEST @MAPKEY_LABELCREATES POINT RUNS 2PLN UDF;\
mapkey(continued) ~ Command `ProCmdDatumPointGeneral` ;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.RefsTable` 0;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Activate `Odui_Dlg_00` `stdbtn_1`;\
Here is the mapkey I made. It should be ready to work for you.
mapkey TEST @MAPKEY_LABELCREATES POINT RUNS 2PLN UDF;\
mapkey(continued) ~ Command `ProCmdDatumPointGeneral` ;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.RefsTable` 0;\
mapkey(continued) @PAUSE_FOR_SCREEN_PICK;\
mapkey(continued) ~ Select `Odui_Dlg_00` `t1.OffsetRefsTable` 2 `DuMmY` `c1`;\
mapkey(continued) @MANUAL_PAUSESELECT OFFSET REFERENCES. CLICK RESUME TO CONTINUE.;\
mapkey(continued) ~ Activate `Odui_Dlg_00` `stdbtn_1`;\
mapkey(continued) ~ Command `ProCmdUserDefined` ;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `hole_2pln.gph`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `udf_place_insert_dialog` `ok_but`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `0` \
mapkey(continued) `used_by_feats`;\
mapkey(continued) ~ Trigger `Odui_Dlg_00` `t1.udfplace_used_by_feat_table` 2 `` ``;
It takes a bit of time to get used to cleaning up mapkey code. I typically use my trail file to pick out just the stuff I want added to the mapkey. Then I make two copies. One to reference and one to trim. This helps makes the mapkey smaller and easier to debug.
As for nesting mapkeys, I prefer to do this as well. From the debug perspective is makes a lot of sense. It also ensures that you've got the smallest/most robust mapkey possible.
Hope this helps!
Ty
YES! Thank you!
I figured that it had something to do with the pauses.
If I've got some time today, I want to really look into how you cleaned up the mapkey as well. Comparing mine and yours.
Thanks again!
Jay
I think you will find this post pretty helpful. It's definitely worth a read.
https://community.ptc.com/t5/System-Administration/Mapkey-Writing-Editing-Tips/td-p/443729
Writing mapkeys with the trail file is a pretty nice way to do things in my opinion. Creo really just needs to have commands and associated clicks inside of mapkeys. It doesn't need a lot of the stuff that gets recorded. For example, some mapkeys recorded in the GUI require extra clicks to switch tabs so that you can access other commands. Clicking to other commands isn't necessary because Creo can just run the command from anywhere. When I write mapkeys, I open the trail in Notepad ++ and then click through the commands as I think they should be. Then I harvest out the lines I know that need to be there (like ~ Command 'blah blah'). Just rinse and repeat for subsequent lines. If you're unsure if a line needs to be included, you can add it and try the mapkey and then try it without. You get the hang of it after a while.
Notepad++ is nice because it'll tell you to update the trail every time you perform an action in Creo. I've also got a mapkey that reimports my personal config so that I can try the mapkey out as I put it together. After a while, you'll end up with robust mapkeys that can be used as modules in other mapkeys.