As API developer, you can add new electrotechnical messages to EPLAN and to write them to the message management.
In order to create a new message, add a class to your project, which implements the interface IMessage.
The IEplMessage interface declares 3 functions:
A registered message can be written to the message database with help of the MessageManager class.
It is not possible to change an existing verification by overriding it via API (by setting the same name and a higher Ordinal number). You can however override an existing message and by this change the standard message text to your own text. You need to implement a message with the dame number and region, but use a higher iOrdinal, e.g. 50. Other properties of the message are not influenced.
The following example shows, how to override the existing 007005 "Device without main function." message:
C# |
Copy Code
|
---|---|
/// /// This function returns the message text. /// One verification needs always exactly one message text. /// public string GetMessageText() { return "This device has absolutely no main function!!!!"; } /// /// This is the registration function of the message belonging to the verification. /// Parameters: /// message region /// message number /// classification: error, message, or info. /// overload priority public void OnRegister(ref String strCreator, ref Eplan.EplApi.EServices.IMessage.Region eRegion, ref int iMessageId, ref Eplan.EplApi.EServices.IMessage.Classification eClassification, ref int iOrdinal) { strCreator = "de.Eplan.Demo"; eRegion = IMessage.Region.Devices; iMessageId = 5; eClassification = IMessage.Classification.Error; iOrdinal = 50; // higher than 20 } |