Chapter 25. Code Engineering

  1. Home
  2. Docs
  3. Chapter 25. Code Engineering
  4. 7. State Machine Diagram Generation
  5. How to generate UML from state machine code

How to generate UML from state machine code

Download PDF

If you have a state machine definition (.sm) and you want to visualize the state machine with a UML state machine diagram, you can make use of the reverse function to produce the class and state diagram essential to visually represent the definition.

To reverse state machine definition (.sm):

  1. Select Tools > Code > Reverse State Machine Code… from the toolbar.
  2. Specify the class, state diagram and the .sm file in the input field. Click OK to continue.
    Reverse state machine

    Field Description
    Class The controller class for managing the state. Only classes that have a state machine diagrams as sub-diagrams would be listed in the drop down menu. You can select an existing class for managing the state machine. If such a class is not available, leave the option Auto create class model selected.
    State Diagram The diagram where the state machine definition to be reversed will be visually presented at. State machine diagrams that are sub-diagram of classes are listed in the drop down menu. You can select the one for visualizing the state machine definition or create a new one by selecting Auto create state diagram.
    Input File The state machine definition (.sm) file to be visualized.