Message Window

The Message window API uses a collection called Messages. You can use this API to access individual messages and their data and operate on the collection to add and remove messages:

  • Access a messages and its data:

    thirdMsg = ExtAPI.Application.Messages[2]
    for msg in ExtAPI.Application.Messages:
        obj = msg.Source 
        stringId = msg.StringID
        caption = msg.DisplayString
        scoping = msg.Location
        time = msg.TimeStamp
        objs = msg.RelatedObjects
        severity = msg.Severity

  • Add a message:

    msg = Ansys.Mechanical.Application.Message("Problem!", MessageSeverityType.Error)
    ExtAPI.Application.Messages.Add(msg)