UI Class — NXOpen Python API Reference 12.0.0 documentation

# UI Class

class `NXOpen.``UI`

  Bases: `NXOpen.TaggedObject`

  This class contains the various elements that represent the NX User Interface.

  There is a single instance of this class per session. To obtain a reference to the current UI, call the static method `UI.GetUI()`.

  For Java, use SessionFactory::get(“UI”) to obtain the reference of the current UI.

  For language bindings that support remoting, the server must export it for this class to be obtained by a client.

  Use the static method in this class to obtain an instance.

  New in version NX3.0.0.

# Properties

Property | Description
--- | ---
Tag | Returns the Tag for this object.
NXMessageBox | the Uistyler for the current session.
Styler | the Uistyler for the current session.
SelectionManager | the SelectionManager for the current session.
ObjectPreferences | the UI based Object Preferences in the current session.
UserInterfacePreferences | the UI based User Interface Preferences in the current session
VisualizationVisualPreferences | the UI based Visualization Preferences under Visual Tab in the current session
VisualizationLinePreferences | the UI based Visualization Preferences under Line Tab in the current session
VisualizationShadingPreferences | the UI based Visualization Preferences under Shading Tab in the current session
MenuBarManager | Returns the `NXOpen.MenuBar.MenuBarManager` belonging to the current session
MovieManager | the Movie Manager class.
ResourceBarManager | Returns the `ResourceBarManager` for the current session
ViewUIManager | Returns the `ViewUIManager`

# Methods

Method | Description
--- | ---
AddUtilityFunctionVisibilityHandler | Registers a user defined method that is called whenever an utility function state changes.
AskLockStatus | Query NX lock status.
CanOpenPart | Returns a flag indicating whether the NX user interface is in a state where opening a part and making it the display part is supported.
CreateCustomPopupMenuHandler | Create a custom menu.
CreateDialog | Creates a block dialog.
JournalPause | Pauses execution of a journal.
LockAccess | Locks access to the NX User Interface.
RemoveUtilityFunctionVisibilityHandler | Unregisters a user defined method that is called whenever an utility function state changes.
UnlockAccess | Unlocks access for a UI that has been locked by a call to `LockAccess()`.

# Enumerations

UIStatus Enumeration | Indicates the Lock, Unlock status of NX functions.

## NXMessageBox

`UI.``NXMessageBox`

  the Uistyler for the current session.

  Signature `NXMessageBox`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.NXMessageBox`

## Styler

`UI.``Styler`

  the Uistyler for the current session.

  Signature `Styler`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.UIStyler.Styler`

## SelectionManager

`UI.``SelectionManager`

  the SelectionManager for the current session.

  Signature `SelectionManager`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Selection`

## ObjectPreferences

`UI.``ObjectPreferences`

  the UI based Object Preferences in the current session.

  Signature `ObjectPreferences`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Preferences.ObjectPreferences`

## UserInterfacePreferences

`UI.``UserInterfacePreferences`

  the UI based User Interface Preferences in the current session

  Signature `UserInterfacePreferences`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Preferences.SessionUserInterfaceUI`

## VisualizationVisualPreferences

`UI.``VisualizationVisualPreferences`

  the UI based Visualization Preferences under Visual Tab in the current session

  Signature `VisualizationVisualPreferences`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Preferences.SessionVisualizationVisual`

## VisualizationLinePreferences

`UI.``VisualizationLinePreferences`

  the UI based Visualization Preferences under Line Tab in the current session

  Signature `VisualizationLinePreferences`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Preferences.VisualizationLine`

## VisualizationShadingPreferences

`UI.``VisualizationShadingPreferences`

  the UI based Visualization Preferences under Shading Tab in the current session

  Signature `VisualizationShadingPreferences`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.Preferences.SessionVisualizationShade`

## MenuBarManager

`UI.``MenuBarManager`

  Returns the `NXOpen.MenuBar.MenuBarManager` belonging to the current session

  Signature `MenuBarManager`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.MenuBar.MenuBarManager`

## MovieManager

`UI.``MovieManager`

  the Movie Manager class.

  Signature `MovieManager`

  New in version NX3.0.0.

  Returns: |
  Return type: | `NXOpen.MovieManager`

## ResourceBarManager

## ViewUIManager

`UI.``ViewUIManager`

  Returns the `ViewUIManager`

  Signature `ViewUIManager`

  New in version NX11.0.1.

  Returns: |
  Return type: | `NXOpen.ViewUIManager`

# Method Detail

## AddUtilityFunctionVisibilityHandler

`UI.``AddUtilityFunctionVisibilityHandler`

  Registers a user defined method that is called whenever an utility function state changes.

  Signature `AddUtilityFunctionVisibilityHandler(utilityFunctionVisibilityHandler)`

  Parameters: | utilityFunctionVisibilityHandler (CallableObject) –
  Returns: | identifier of registered method (used to unregister the method)
  Return type: | int

  New in version NX5.0.5.

  License requirements: None.

## AskLockStatus

`UI.``AskLockStatus`

  Query NX lock status.

  This function is useful when dismissing a custom dialog and you want to determine whether or not a lock has been set. Returns `NXOpen.UIStatus.Lock`, when NX is in lock status. Returns `NXOpen.UIStatus.Unlock`, when NX is in unlock status.

  Signature `AskLockStatus()`

  Returns: |
  Return type: | `NXOpen.UIStatus`

  New in version NX5.0.0.

  License requirements: None.

## CanOpenPart

`UI.``CanOpenPart`

  Returns a flag indicating whether the NX user interface is in a state where opening a part and making it the display part is supported.

  For example if certain dialogs are displayed or the system is in a task environment it is not supported

  Signature `CanOpenPart()`

  Returns: |
  Return type: | bool

  New in version NX8.5.0.

  License requirements: None.

## CreateCustomPopupMenuHandler

`UI.``CreateCustomPopupMenuHandler`

  Create a custom menu.

  Signature `CreateCustomPopupMenuHandler()`

  Returns: |
  Return type: | `NXOpen.CustomPopupMenuHandler`

  New in version NX6.0.4.

  License requirements: None.

## CreateDialog

`UI.``CreateDialog`

  Creates a block dialog.

  Use #undef CreateDialog in C++ programs to avoid confusion with Windows API

  Signature `CreateDialog(dialogName)`

  Parameters: | dialogName (str) – Dialog name
  Returns: |
  Return type: | `NXOpen.BlockStyler.BlockDialog`

  New in version NX6.0.0.

  License requirements: None.

## JournalPause

`UI.``JournalPause`

  Pauses execution of a journal.

  Signature `JournalPause()`

  New in version NX4.0.0.

  License requirements: None.

## LockAccess

`UI.``LockAccess`

  Locks access to the NX User Interface.

  This method may be used for a custom dialog that requires the session to remain in a known state. When this method is called, all menu items that would allow the user to edit the model are grayed out.

  Note that until `UnlockAccess()` is called, the user will not be able to interact with the session. You must ensure that the UI is unlocked when the custom dialog terminates.

  This method will throw an exception if the UI cannot be locked. Note that if the UI has already been locked, then it is safe to call this method again.

  Signature `LockAccess()`

  New in version NX3.0.0.

  License requirements: None.

## RemoveUtilityFunctionVisibilityHandler

`UI.``RemoveUtilityFunctionVisibilityHandler`

  Unregisters a user defined method that is called whenever an utility function state changes.

  Signature `RemoveUtilityFunctionVisibilityHandler(id)`

  Parameters: | id (int) – identifier for method to unregister

  New in version NX5.0.5.

  License requirements: None.

## UnlockAccess

`UI.``UnlockAccess`

  Unlocks access for a UI that has been locked by a call to `LockAccess()`. If the UI is already unlocked, this method has no effect.

  Signature `UnlockAccess()`

  New in version NX3.0.0.

  License requirements: None.