# UserMsg

Model ElementThe UserMsg element allows you to control the output of MotionSolve messages. Any message that MotionSolve prints to standard output goes through the

UserMsg

## Attribute Summary

Name Property Modifiable by command? Designable?
function Function No No
routine Routine ()

## Usage

# Defined in a Python function
UserMsg_0 = UserMsg (routine=onError)

## Attributes

User-subroutine defined in a compiled DLL
function
String defining a valid user function.
The list of parameters that are passed from the data file to the user defined subroutine where the UserMsg is defined.
The function attribute is optional.
routine
String
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by “∷”. The first is the pathname to the shared library containing the. The second is the name of the function in the shared library.
An example is: routine=”/staff/Altair/engine.dllmyMsgSub
• ”/staff/Altair/engine.dll is the DLL
• “myMsgSub” is the function within this DLL that is invoked by MotionSolve when writing messages
The attribute routine is optional.
When not specified, routine defaults to “MSGSUB”.
User-subroutine defined in a user-written Python script
function
String defining a valid user function.
The list of parameters that are passed from the data file to the user defined subroutine.
The function attribute is optional.
routine
Pointer to a callable function in Python.
An example is: routine=myMsgSub.
• myMsgSub is a Python function or method that can be called from wherever the model resides.
The attribute routine is optional.
When not specified, routine defaults to MSGSUB.

## Examples

Define a user_message to write to a file.
UserGraphic (function="USER(0)", routine=myMsgSub)

def myMsgSub (msgid, time, par, npar, msgtype, iflag, endflag, message, outname):
# implementation goes here...
return 0