I've written a journal file that I want to run every time an entity is deleted when in the Drafting module. Right now I've created a Menuscript that modifies with ACTION/POST the UG_EDIT_DELETE function. This works great except that it's also running any time something is deleted in any application, which is a waste of resources.
What i'm wondering is, if there is a way to use Menuscripts to change the UG_EDIT_DELETE action between my Post function when in Drafting and simply the Standard function when in all other modules.
Or, how would you unregister a callback/re-register when the user switches between applications to achieve the same result.
Edit : It should also be noted that I'm running NX18.104.22.168 on Windows 7 64x programming in C#
If nothing else, you can check (in your code) what application you are in, and if not drafting, exit.
Production: NX10.0.3.5 MP5 + patch/TC11.2
Apparently I've turned into a gearhead
I have something like that in the code already.
if (appModule != 1)
It seem's like there's still a little lag between when I delete something and when it updates.
You can have one custom .MEN file in the startup folder that is used to specify that you want to run another custom .MEN file from the application folder when you enter a particular application.
Search for the keyword "MENU_FILES" in the Menuscript docs.
In your custom file in the application folder, you would modify the behavior of the delete button, just when you are in Drafting.
For example, to specify menu changes that only happen in Drafting, put this in a file in startup:
Then in the application folder, add a pre and post action for update view:
(I realize you need a different action, but this was handy and it sound like you already know what the menu mods should look like.)
I was trying to use the MENU_FILES function without success. I've made it work in the past but I can only seem to get it to work when it's modifing application specific functions. Like if I use it on APPLICATION_BUTTON UG_APP_DRAFTING then the menu file specified with MENU_FILES can then modify functions like UG_DRAFT_DRW_MODIFY or UG_DRAFT_DRW_INCREMENT_REVISION. That works fine but when I try to have it modify UG_EDIT_DELETE it doesnt work.
Below is my drafting customize .men from Startup
Then I have the following em_custom_draft.men in Application...
The others work but the UG_EDIT_DELETE does not. Am I missing something?
Your menus look fine. Please report this to GTAC so we can investigate, and submit a PR if we can reproduce it. Thanks!