To Do Record Messages - Intergraph Smart 3D - Reference Data - Hexagon PPM

Intergraph Smart 3D Reference Data

Language
English
Product
Intergraph Smart 3D
Subproduct
Reference Data
Search by Category
Reference Data
Smart 3D Version
13

A content writer developing a symbol must write the code to create the output objects. In some cases, the given set of input values might be invalid or semi-valid. In such a case, the content writer can create a To Do Record (TDR) associated with the symbol occurrence. The TDR causes the symbol to be added to the To Do List with a message. An error message would be displayed for an invalid set of inputs. A warning message would be displayed for a semi-valid set of inputs.

Prior to Version 2011 R1 (9.1), a TDR for a symbol requires the message to be defined in a codelist table. The codelist table name and codelist index must be passed into the function by raising an exception that creates the TDR. The existing exception classes are: SymbolErrorException and SymbolWarningException. The exception contains the data that is needed to create a TDR. This method of creating a TDR is still supported, but is deprecated and should no longer be used when writing new .NET symbols.

Posting errors from .NET symbols using exceptions has an important drawback in that after the exception is raised, the remaining code within the .NET symbol is not executed. This does not work well for warnings which need to continue execution after the warning is posted.

Beginning in Version 2011 R1 (9.1), a TDR with a string message can be created by setting the new ToDoListMessage property on the base class of the symbol. The new messages are uniquely identified by the combination of the message module name and the message number. A message module is a logical collection of messages. The names of modules must be unique across the entire product. Every message is identified with a message number. Message numbers must be unique within a module.

The recommended conventions are:

  • Each component defines one or more message modules. Each message module corresponds to a resource file containing localized messages.

  • Customers who add error messages for their custom content should use message module names that identify the company name (for example, AcmeErrorMsgs).

  • Use the resource ID as the message number.

A new property has been added to the CustomSymbolDefinition base class. To create a TDR, the symbol code must set this new property and should not raise an exception.

public abstract class CustomSymbolDefinition

{

public ToDoListMessage ToDoListMessage

{

get { return m_oTDLMessage; }

set { m_ oTDLMessage = value; }

}

The data type of the new property is a class as shown below.

public class ToDoListMessage

{

// Constructors

// Construct a very simple ToDoListMessage specifying only type and message text.

// This constructor is intended for custom content writers that do not localize

// their messages. A default module name and message number are supplied by this

// constructor.

// ArgumentException is raised if an empty string is passed for text.

public ToDoListMessage(ToDoMessageTypes type, string text)

// Construct a simple ToDoListMessage when the objectToUpdate is not needed.

// This constructor is intended for most application developers and content writers

// who localize their messages and provide a help topic.

// ArgumentException is raised if an empty string is passed for moduleName or text.

public ToDoListMessage(ToDoMessageTypes type, string moduleName, int number, string text)

// Construct a ToDoListMessage including an objectToUpdate.

// This constructor is intended for the rare case where an object to update that is

// different from the symbol must be specified.

// ArgumentException is raised if an empty string is passed for moduleName or text.

// ArgumentNullException is raised if objectToUpdate is Null.

public ToDoListMessage(ToDoMessageTypes type, string moduleName, int number, string text,

BusinessObject objectToUpdate)

// Properties

// The Type property identifies the message as an error or a warning.

public property ToDoMessageTypes Type { get; }

// The ModuleName property identifies a logical grouping of messages.

// Each component/customer defines their own module name.

// Module names must be unique across the product.

public property string ModuleName { get; }

// The Number property identifies a specific message within a module.

// The combination of module name and message number uniquely identifies the message.

public property int Number { get; }

// The Text property holds the localized message text including any contextual data.

public property string Text { get; }

// The ObjectToUpdate property holds a reference to the object to be updated when

// the user clicks on the Update command in the To Do List dialog.

// If the object to update is not specified, the symbol occurrence itself is updated.

public property BusinessObject ObjectToUpdate { get; }

}

// Describes the possible types of to do messages.

public enum ToDoMessageTypes

{

// The symbol failed to compute the output objects.

ToDoMessageError = 1,

// The symbol encountered problems while computing the output objects.

ToDoMessageWarning = 4,

}

Sample Usage

To create an error To Do Record:

string strMessageModule = “EquipProcessMsgs”;

int nMessageNumber = 5;

string strMessageText = ”Unable to construct tank geometry due to conflicting parameter values”;

oSymbol.ToDoListMessage = new ToDoListMessage(ToDoMessageTypes.ToDoMessageError, strMessageModule, nMessageNumber, strMessageText);

To create a warning To Do Record:

string strMessageModule = “StructStairMsgs”;

int nMessageNumber = 43;

string strMessageText = ”Warning: stair pitch is too steep”;

oSymbol.ToDoListMessage = new ToDoListMessage(ToDoMessageTypes. ToDoMessageWarning, strMessageModule, nMessageNumber, strMessageText);