Author Topic: [EA15.2] Generate code from a StateMachine diagram  (Read 2796 times)

YannM

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
[EA15.2] Generate code from a StateMachine diagram
« on: November 18, 2020, 02:05:09 am »
Hi all,

I hope you are doing well  ;D

I read here https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/theautomationinterface.html the following
Quote
The Automation Interface provides a way of accessing the internals of Enterprise Architect models. Examples of things you can do using the Automation Interface include:

[...]
Generate code from a StateMachine diagram
[...]

Does it mean I could have a service - let's say Jenkins - calling a script which opens a *.eapx file and executes what is necessary to generate code from a State Machine ?
Where could I find more information on this ?

Thanks

Yann

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: [EA15.2] Generate code from a StateMachine diagram
« Reply #1 on: November 18, 2020, 02:17:05 am »
Yann,

What information are you looking for exactly? There's so much to tell...

Anyway, you are going to have trouble using a script from a service. EA really only works in user sessions, partly because it needs to validate your license.

I know some people have been able to somehow find a workaround to be able to use EA in a service, where other have resorted to having a dedicated "always on" computer for automation tasks.
Others (such as myself) have taken the low-tech approach and set a reminder for a weekly task in their calendar; and then simply doubleclick on a .vbs to execute something like a project transfer.

Geert

YannM

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: [EA15.2] Generate code from a StateMachine diagram
« Reply #2 on: November 18, 2020, 03:22:49 am »
So far I am manually generating C code from a state machine described in C.
The generated code is copied by the EA build scripts in a specific place in order to be compiled with other source code.
Then all the source code is compiled on a Jenkins server.

I would like to have a way to launch the C code generation from a script in order to bypass the manual action in EA.
Thus my Jenkins server could automatically open, generate code from EA.
The whole compilation of my project could be automatically done on a periodic basis.

I don't know if that clarify my question  ;)



Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: [EA15.2] Generate code from a StateMachine diagram
« Reply #3 on: November 18, 2020, 05:26:29 am »
I think you need EA.Project.BuildExecutableStatemachine() in that case, see
https://www.sparxsystems.com/enterprise_architect_user_guide/15.2/automation/project_2.html

But as I mentioned, it might be difficult to get it to work from your Jenkins server.
Worst case you'd have a script that you need to doubleclick to generate your code; still better than the manual option.

Geert