So in order to programatically switch into the Modeling module, there's a function called ApplicationSwitchRequest in the MenuBarManager. It takes in an application button name like "UG_APP_MODELING" and will attempt to switch to the target application once the journal or program that calls it finishes. However, I need to switch into Modeling and keep my NX plug-in running. I have a journal file that uses ApplicationSwitchRequest, and I was wondering if there was a way to have NX run a journal file programatically. Then the journal file would complete, NX would switch to modeling, and I can go my merry way. Does anybody know of a way to run a journal file from an external application, or another entirely different way of switching applications programatically?
Currently we don't really have a way to do that, but I believe an enhancement is planned in a future release that will allow you to actually switch to a different application module while your program is running, and continue with execution.
For now though, would it help at all if you could turn off the drawing sheet in your program, or expand one of the member views? We have methods to do both of those. Please see UF_DRAW_set_display_state() in Open C or the .Net wrapper, UFDraw.SetDisplayState(), as well as NXOpen.View.Expand().
Well, I did find a way to do it, but it's a super hacky workaround. If you put a journal file in the applications folder of your executable and then put the name of that journal as one of the actions in the .men file entry for a custom button, it'll run the journal file when that button is pushed. So if you put applicationSwitchRequest in that journal, NX will switch applications when your journal completes. The problem now is that running a journal is so much slower than your application, if you want to do anything afterwards the timing is super hard to hit. Any suggestions on being able to flag your application after a journal completes?
The issue isn't actually switching from Drafting to Modeling or vice versa, it's switching from Gateway to Modeling. So SetDisplayState doesn't work in that case, I'm pretty sure. Thanks though!
Thinking along the lines of .men files.
Could you make your application change script a pre action?
This would then run and wait for it to complete before continuing the main action of the button?
The existing ER number for the application switch through API is 1817973.
Ask GTAC to add you to this ER, so it gets more importance.
As others have suggested, would it be possible to split your plug-in into application specific pieces?
Using PRE and POST actions would allow you to change applications at least twice:
I would try this approach.
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk Testing: NX11.0 EAP, NX12.0 EAP
How to Get the Most from Your Signature in the Community
Right, it's a /PRE action right now. Funny I didn't think about that, actually. I should just split up the second half of my action into the /POST action, huh. Good catch.