Submitted by xfer on Tue, 02/02/2016 - 06:31
Forums:
Hello,
is there a way to switch to the application module "modeling" from "drafting", when running an appliaction with the run_managed.exe of NX9.
The following doesn't work:
UI.GetUI().MenuBarManager.ApplicationSwitchRequest("UG_APP_MODELING")
I know that in NX10 there will be a new command for switching the appliaction module, but is there no workaround or alternate way to switch in NX9?
Thanks in advance
re: switch to modeling
What are you trying to accomplish?
Most of the time it is not necessary to switch the application to access a specific function. Most of the automation functions will work regardless of the application that you are currently in, assuming that you have the proper license to run the function. There are a few exceptions though...
Hello,
Hello,
thanks for the reply.
I want to create pictures of the 3D model, but the drafting application module is alyways active on start of this part of the application.
I take the pictures with the following function:
UFSession.GetUFSession().Disp.CreateImage("path_and_filename.png", NXOpen.UF.UFDisp.ImageFormat.Png, UFDisp.BackgroundColor.White)
Perhaps there is a better way to do this.
The license is not the problem, everything works fine in a normal NX session.
Thanks in advance
re: screenshots
In the drafting application, you can "turn off" the drawing sheet display so that you are looking at the 3D model much the same as in the modeling application. The code snippet below shows how to turn off the drawing sheet. You may want to expand on this example by saving the initial state (AskDisplayState method) and restoring the initial state at the end of your journal.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
'in drafting, turn off the drawing sheet display (3d modeling view in drafting)
'1 = modeling view (drawing sheet display off)
'2 = drawing view (drawing sheet display on)
ufs.Draw.SetDisplayState(1)
End Sub
End Module
Hello,
Hello,
thanks I think this is the solution for this problem.
Now I have a new problem, it seems, that I can not capture/create pictures when I run the application with run_managed in the console, without graphic window. :-)
Unbehandelte Ausnahme: System.Reflection.TargetInvocationException: Ein Aufrufzi
el hat einen Ausnahmefehler verursacht. ---> System.AccessViolationException: Es
wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist hä
ufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
bei NXOpen.UF.UFDisp._CreateImage(String filename, ImageFormat format, Backgr
oundColor color)
bei NXOpen.UF.UFDisp.CreateImage(String filename, ImageFormat format, Backgro
undColor color)
Any ideas to do this in without a "real" NX window?
Thanks in advance
re: screenshots
Unfortunately, I do not think it is possible to export a screenshot if there is no graphical window displayed.