Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi all,
in Creo3, I created a mapkey to put automatically a symbol in 2D drawings using "on entity" placement option and selecting a Csys in the 3D model tree.
But when you place a symbol, you must clic the mouse middle button to stop placement and to be able to select "OK" in the dialog box.
Unfortunately, the mouse middle button clic is not recorded in the mapkey. Running it, the mapkey stops at this step and do not end.
Mapkey sequence:
mapkey dup @MAPKEY_LABELdup;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Annotate_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgCrSymInstCust` ;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `csys_piping_iso.sym`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Select `main_dlg_cur` `PHTLeft.AssyTree` 1 `node23`;\
mapkey(continued) ~ Activate `drawing_sym` `OK_push`;
I tried to copy a middle clic sequence from a trail file but it doesn' t work. It's like the middle button was kept pressed.
trail file sequence:
~ MButtonArm `main_dlg_cur` `proe_win` 9 1439 512 0 2 1536 902 1920 1200 73284
~ MButtonDisarm `main_dlg_cur` `proe_win` 9 1439 512 0 0 1536 902 1920 1200 73489
Any idea folks ?
Try to create and play trail file to place a symbol
File > Manage Session > Play Trail File
When running or creating a mapkey that requires a left, right, or middle click the click is not recorded
hi DTC60,
You could add a 'pause' in the mapkey when you are recording it. In this pause you will clic the mouse middle button twice, then resume the mapkey to be able to select "OK" in the dialog box, and finish the recording.
Every time you run the mapkey you have to click the mouse middle button twice 'manually' and then click resume, but the job will be done.
Thanks for your answer but I know this process by heart !
What I try to find is an alternate solution to avoid the "pause" in mapkeys what is deadly boring!!
DCT60,
You can use an AutoIT script [https://www.autoitscript.com/site/autoit/] to send the mouse clicks to Creo Parametric.
Regards,
Dan N.
In theory... In real, no so easy. When script is runing, Creo open CMD window. In this time a focus will out from Creo window and the mouse click will miss.
With AutoIT, you can activate the Creo Parametric window before sending the mouse clicks, so there shouldn't be an issue with sending the mouse clicks to another window.
To run the AutoIT script in Creo Parametric, you'd simply create a mapkey similar to the one shown below.
mapkey mmb @MAPKEY_NAMEMiddle Mouse Button;\
mapkey(continued) @MAPKEY_LABELMiddle Mouse Button;\
mapkey(continued) @SYSTEMstart \/min \
mapkey(continued) C:\\PTC\\scripts\\mmb.exe;
The "start" command will launch the mmb.exe command and close out the DOS/CMD window giving focus back to the Creo Parametric window.
To incorporate this into the "dup" mapkey shown earlier in the discussion, simply add the mmb mapkey inside the original dup mapkey.
mapkey dup @MAPKEY_LABELdup;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Annotate_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgCrSymInstCust` ;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `csys_piping_iso.sym`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Select `main_dlg_cur` `PHTLeft.AssyTree` 1 `node23`;\
mapkey(continued) %mmb;\
mapkey(continued) ~ Activate `drawing_sym` `OK_push`;
The biggest concern I see with this method is the timing of mmb script and the OK_push. A delay may be needed between the two so the OK_push doesn't run before the mmb script has completed.
In AutoIT, look at the functions: MouseClick, WinActive, WinActivate, and WinWaitActive.
Regards,
Dan N.
Hi,
thanks a lot for this clear explanation.
I don't have enough time to do some trials for now but I keep it under my hat.
BR,
Didier.