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: 199
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    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: 240
    First Anniversary First Comment 5 Likes Ansys Employee

    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