MessageManager#

class ansys.mechanical.core.embedding.messages.MessageManager(app)#

Message manager for adding, fetching, and printing messages.

Overview#

add

Add a message and update the cache.

remove

Remove a message by index.

show

Print all messages with full details.

clear

Clear all messages.

__repr__

Provide a DataFrame representation of all messages.

__str__

Provide a custom string representation of the messages.

__getitem__

Allow indexed access to messages.

__len__

Return the number of messages.

Import detail#

from ansys.mechanical.core.embedding.messages import MessageManager

Method detail#

MessageManager.__repr__()#

Provide a DataFrame representation of all messages.

MessageManager.__str__()#

Provide a custom string representation of the messages.

MessageManager.__getitem__(index)#

Allow indexed access to messages.

MessageManager.__len__()#

Return the number of messages.

MessageManager.add(severity: str, text: str)#

Add a message and update the cache.

Parameters:
severitystr

Severity of the message. Can be “info”, “warning”, or “error”.

textstr

Message text.

Examples

>>> app.messages.add("info", "User clicked the start button.")
MessageManager.remove(index: int)#

Remove a message by index.

Parameters:
indexint

Index of the message to remove.

Examples

>>> app.messages.remove(0)
MessageManager.show(filter='Severity;DisplayString')#

Print all messages with full details.

Parameters:
filterstr, optional

Semicolon separated list of message attributes to display. Default is “severity;message”. if filter is “*”, all available attributes will be displayed.

Examples

>>> app.messages.show()
... severity: info
... message: Sample message.
>>> app.messages.show(filter="time_stamp;severity;message")
... time_stamp: 1/30/2025 12:10:35 PM
... severity: info
... message: Sample message.
MessageManager.clear()#

Clear all messages.