0
votes

I have a large set of classes in my Enterprise Architect design model from which I want to generate source code. The goal is to keep the source code consistent with the design model.

So far, I trigger the source code generation manually from the tool. Is there a way to trigger the source code generation via the Enterprise Architect object model? In this case, I could integrate source code generation into our CI pipeline.

1
See the help: projectInterface.GeneratePackage (string PackageGUID, string ExtraOptions)qwerty_so

1 Answers

0
votes

You can use the methods

EA.Project.GenerateClass(string ElementGUID, string ExtraOptions)

or

EA.Project.GeneratePackage(string PackageGUID,string ExtraOptions)

To generate code from your model. This is documented in the manual

Unfortunately EA can't really be used in a headless mode. You need a user with a valid license to use the API.

But on the other hand, the code won't change unless the model is changed, and the model cannot be changed unless a user is using EA.

This means that you could build an add-in that detects when the model has changed, and automatically generates the code needed. This will ensure your code always corresponds to your model.