how to create a dialog box or message box in mechanical without ok and cancel button

karthik
karthik Member Posts: 6
Name Dropper First Comment
**

how to create a dialog box or message box in mechanical without ok and cancel button

Answers

  • M
    M Member, Employee Posts: 244
    50 Answers 100 Comments 100 Likes Second Anniversary
    ✭✭✭✭

    MessageSeverityType.Warning

    msg ='Hello Kitty'
    msg = Ansys.Mechanical.Application.Message(msg , MessageSeverityType.Warning)
    ExtAPI.Application.Messages.Add(msg)
    
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 361
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    This is another example:

    import clr
    clr.AddReference("Ans.UI")
    from Ansys.UI import *
    clr.AddReference("Ans.Utilities")
    clr.AddReference('Ans.UI.Toolkit')
    clr.AddReference("Ans.UI.Toolkit.Base")
    import Ansys.UI.Toolkit
    import Ansys.Utilities
    
    def GiveUserFeedback(Title, Message, MsgTypeStr="Info"):
        try:
            exec("MsgType= Ansys.UI.Toolkit.MessageBoxType."+MsgTypeStr)
        except:
            MsgType= Ansys.UI.Toolkit.MessageBoxType.Info
        MsgBut = Ansys.UI.Toolkit.MessageBoxButtons.OK
        MsgBox = Ansys.UI.Toolkit.MessageBox
        Result = MsgBox.Show(Ansys.UI.Toolkit.Dialog(),Message,Title,MsgType,MsgBut)
        return Result