To display a message box during placement of a part, you must not use the C#.NET MessageBox function. Instead, use the ToDoListMessage() constructor.
The ToDoListMessage() constructor can be used from Custom Support Definition C# .NET code and from Symbols C# .NET code of Hangers and Supports content.
The following methods in the CustomSymbolDefinition can use the ToDoMessageTypes() function:
-
BOMDescription
-
EvaluateWeightCG
-
ConstructOutputs
Functional Behavior of ToDoListMessages()
Signature
public ToDoListMessage(ToDoMessageTypes type, string text);
Summary
Constructs a very simple To Do List message that specifies only type and message text. This constructor is intended for custom content writers who do not localize messages. This constructor provides a default module name and message number.
Parameters
type - the type of the To Do List message (either ToDoMessageError or ToDoMessageWarning)
text - the To Do List message text, for example, localized message text from resource files
Exceptions
System.ArgumentException - raised if an empty string is used for the text argument.
Signature
public ToDoListMessage(ToDoMessageTypes type, string moduleName, int number, string text);
Summary
Constructs a simple To Do List message when the object-to-update is not needed. This constructor is intended for most application developers and content writers who localize messages and provide help topics.
Parameters
type - the type of the To Do List message (either ToDoMessageError or ToDoMessageWarning)
moduleName - name of the message module
number - message ID inside the message module, for example, the unique identifier in the resource file
text - the To Do List message text, for example, localized message text from resource files
Exceptions
System.ArgumentException - raised if an empty string is used for the moduleName or text argument.
Calling ToDoListMessage() from Symbol Code
You can call ToDoListMessage() to raise errors or warnings when you place or modify hanger components using the Hangers and Supports client command. The software concatenates warning messages raised by ToDoListMessage() before committing the component, and displays these warnings in one message box and in the To Do List. The software displays any error raised by ToDoListMessage() in a message box, and does not place the component.
Expected Behavior
Placement of the new symbol occurrences
If ToDoListMessage() raises an error during symbol placement, the software does not create the part occurrence and the placement is aborted. The software displays an error message.
If ToDoListMessage() raises a warning during symbol during placement, the software creates the part occurrence and displays a warning message.
During modification of placed occurrences
If the symbol is computed successfully during placement with one set of units, but receives invalid input from the property page that results in an error, a To Do List entry is added for the support component. The software displays an error message, and the compute is halted. The symbol occurrence retains the last set of successfully computed values.
If the symbol is computed successfully during placement with one set of units, but receives invalid input from the property page that results in a warning, a To Do List entry is added for the support component. The software displays a warning message, and the symbol occurrence is placed with the new values.
During synchronization
If source code modifications for a placed symbol occurrence raise a warning when the symbol is recomputed during synchronization, a To Do List entry is added for the warning. If such modifications raise an error during synchronization, the graphics for the occurrence are cleared and a To Do List entry is added for the error.
Interactive placement of a standard support
If ToDoListMessage() raises a warning during interactive assembly placement, the warning displays in the Smart 3D error log file and a To Do List entry is added for the warning. If ToDoListMessage() raises an error during interactive placement of an assembly, the software displays an error message and placement is aborted.
Computing standard support symbols from outside hanger environment
If you place a support component symbol that raises an error, Smart 3D adds the error to the To Do List. The software then places the support with the last set of successful values. If you place a support component symbol that raises a warning, the software displays the warning in the Smart 3D error log file and adds the warning to the To Do List.