Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hey
if I try to execute the following macro (clicking the "Switch Dimensions"-Button in Tools ribbon):
ProMacroLoad(L"~ Command `ProCmdInfoSwitchDims` ;");
ProMacroExecute();
I get "PRO_TK_NOT_VALID" - The specified macro is not valid as error. But I don't understand why?
Am I violating any of those four restrictions??
Note that this function is not supported for the following situations and tasks
1.Activating windows or setting the current model
2.Erasing the current model
3.Completing dialog commands ending with an "OK" button press. It will cancel some dialogs after showing them.
4.Executing macros during a trail file replay.
Best regards
Solved! Go to Solution.
I think he had solved that issue by changing the work mode of the dialog.
So the dialog is now modeless and there is an extra button to run only that mapkey.
We have same problems with the macro: ~ Command `ProCmdInfoSwitchDims`;
It can't be used inline inside of a synchronous process. So you need to use it standalone, and that's possible with the modeless window and a button that runs the mapkey without do stuff after it.
Br,
Eike
Luis,
is Tools tab active, when application executes a mapkey ?
MH
Yes it is (because i start the application from the Tools tab).
But just to make sure I already tested:
ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");
...and got the same error
//edit1: I forgot to mention that right before the Macro I do use a ProUIDialog....
... I am really confused now...
Following MyFunction is working:
int MyFunction(uiCmdCmdId command, uiCmdValue *pValue, void *pPushCommandData){
status = ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");
status = ProMacroExecute();
return 0;
}
This version is not working ?????
int MyFunction(uiCmdCmdId command, uiCmdValue *pValue, void *pPushCommandData){
status = ProMacroLoad(L"~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;~ Command `ProCmdInfoSwitchDims`;");
status = ProMacroExecute();
...do other stuff...
return 0;
}
//edit2: ok MacroExecute is still throwing an error but creo somewhat still executes the macro...
I think he had solved that issue by changing the work mode of the dialog.
So the dialog is now modeless and there is an extra button to run only that mapkey.
We have same problems with the macro: ~ Command `ProCmdInfoSwitchDims`;
It can't be used inline inside of a synchronous process. So you need to use it standalone, and that's possible with the modeless window and a button that runs the mapkey without do stuff after it.
Br,
Eike
One could use ProDisplaymodeSet instead of macro...
Uh ok ... I don't know that.
Thx Felix