As an API developer, you can add new electrotechnical messages to EPLAN and write them to the message management.
In order to create a new message, add a class to your project that inherits from the Eplan.EplApi.EServices.Message class.
The Eplan.EplApi.EServices.Message class declares 3 functions:
It is also possible to create such classes automatically using the EPLAN API Add-in Wizard.
A registered message can be now added to the message management of EPLAN using the PrjMessagesCollection 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). However, you can override an existing message and change the default message text to your own text. You need to implement a message with the same iMessageId and eRegion, but use a higher iOrdinal, e.g. 50. Other properties of the message will not be affected.
The following example shows how to override the existing message 007005 "Device without main function.":
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 } |