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', max_messages=None) None#

Print all messages with full details.

Parameters:
filterstr, optional

Semicolon separated list of message attributes to display. Default is "Severity;DisplayString". If filter is "*", all available attributes will be displayed.

max_messagesint, optional

Maximum number of messages to display. The default is None, in which case all messages are shown.

Examples

>>> app.messages.show()
... Severity: INFO
... DisplayString: Sample message.
>>> app.messages.show(max_messages=5)
MessageManager.clear()#

Clear all messages.