To display a message box during placement of a part, you must not use the C#.NET MessageBox function. Instead, use the ErrorLogger that is provided by Middle Services.
The ErrorLogger.Log() method 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 CustomSupportDefinition can use the ErrorLogger.Log() method:
-
Parts
-
ConfigureSupport
-
BOMDescription
Functional Behavior of ErrorLogger.Log()
Signature
public void Log(int iHResult, string sErrSource, string sDescription, string sErrContext, string sExtraInfo, string sDataSource, string sSourceFile, int iSourceLine);
Summary
Logs the error with the given information.
Parameters
iHResult - error code (HRESULT)
sErrSource - source where the error was trapped
sDescription - error description
sErrContext - context used to interpret custom error codes
-
"USERWARNINGMESSAGE"
-
"USERERRORMESSAGE"
sExtraInfo - any extra information logged with the error
sDataSource - fully qualified file name of the datasource associated with the error
sSourceFile - fully qualified file name of the source file where the error occurred
iSourceLine - line number in the source file where the error occurred
Exceptions
System.ArgumentNullException - oErrorInfo is null.
Calling ErrorLogger.Log() from Support Code
You can call ErrorLogger.Log() 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 ErrorLogger.Log() before committing the component, and displays these warnings in one message box. If ErrorLogger.Log() raises an error, the software displays an error message and does not place the component.
The software does not add warnings raised by ErrorLogger.Log() to the To Do List. The software only adds non-active errors to the To Do List (a change to a line size in the Piping task, for example).
Expected Behavior
Placing a new standard support
If the ErrorLogger.Log() raises an error when placing the support, the software displays an error message and does not place the support.
If the ErrorLogger.Log() raises a warning when placing the support, the software displays a warning message and places the support.
The software writes warning and errors to the Smart 3D error log file.
During modification of an existing standard support
If the support is computed successfully during placement with one set of units, but receives invalid input from the property page that results in an error, the software displays an error message and the compute is halted. The support occurrence retains the last set of successfully computed values.
If the support is computed successfully during placement with one set of units, but receives invalid input from the property page that results in a warning, the software displays a warning message the modification continues.
The software writes warning and errors to the Smart 3D error log file.
Computing standard supports from outside hanger environment
If the support raises an error during ErrorLogger.Log() compute, Smart 3D adds the error to the To Do List and stops computing the support. The support occurrence retains the last set of successful values.
If the support raises a warning, the software places the support.
The software writes warning and errors to the Smart 3D error log file.