NX Journal Character string input dialog
2019/12/05 categories:NX Journal| tags:NX Journal|Python|
I have created a program that displays a dialog for entering a character string and displays the entered character string.
Without “theUI.LockAccess ()” and “theUI.UnlockAccess ()”, the dialog might disappear in an instant, but nothing was displayed so I added it.
Python Code
import NXOpen
import NXOpen.UF
def main():
theSession = NXOpen.Session.GetSession()
theUfSession = NXOpen.UF.UFSession.GetUFSession()
theUI = NXOpen.UI.GetUI()
text = "default"
theUI.LockAccess()
ret = theUfSession.Ui.AskStringInput("Enter String", text)
theUI.UnlockAccess()
theUfSession.Ui.DisplayMessage(ret[0], 1)
if __name__ == '__main__':
main()