M PLUS Plug-in

C++/Python/Ruby/Swift/VDM++ code generator for Astah


M PLUS is a Model-driven development (MDD) plug-in for Astah which enables you to generate C++/Python/Ruby/Swift/VDM++ Source Code from UML Classes. Like Acceleo, MOFScript and Xpand, the M PLUS Plugin has the ability to preserve the code you directly add into generated code. So you can generate the code from the same model while preserving the code you add to the previously-generated code.

How to install

  1. Download M PLUS Plug-in from Developer's Page.
  2. Run Astah and go to [Help] - [Plugin List] menu and click [Install] button.
    Astah Plugin install
  3. Select the "m_plus-x.x" file you downloaded at step.1 and then restart Astah.
    Astah Plugin Install
  4. Install is complete if [M+] tab is added in the "Extra View" below the diagram editor. (If Extra View is not opened, go to [View] - [Show/Hide Extra View].)
    M+ source code generate

How to use

  1. First specify a directory where you want to generate the source code to.
  2. MPLUS plugin, Astah's C++ Source Code Generator
  3. Now choose a programming language you'd like export into.
  4. MPLUS plugin, Astah's C++ Source Code GeneratorMPLUS plugin, Astah's C++ Source Code Generator
  5. Create a model or open .asta file.
  6. Astah MPLUS Plugin C++ source code generator
  7. In the structure tree, select the model(s) - Class, Package or a root project that you want to generate the source code of. If your selected models contain sub-packages and models, all of those models will be generated.
  8. Astah UML models in the tree
  9. Click [Generate Code] button in the [M+] view or use shortcut key [Alt + C] if you are on Windows or Linux.
  10. C++ source code generate
  11. Once the source code is generated, the result appears in the view. Directly double-clicking the file path will open the file in an editor.
  12. C++ source code generate
  13. Modify the code in the "User Code Area" - which is an area quoted with "// ˅" and "// ˄". (Lines in lime green in the figure below.)
    The code you add in the User Code Area will be preserved for subsequent code generations just like how "User Code Blocks" with Acceleo, "Unprotected Blocks" with MOFScript and "Protected Regions" with Xpand work.
    C++ source code generate
    Attention-1: Do not add code other area than "User Code Area", it might clear out all the codes in the "User Code Area".
    C++ source code generate
    Attention-2: Do not add code in the line where "// ˅" and "// ˄" are.
    C++ source code generate

    Source code will be generated in UTF-8 without a BOM.
  14. Repeat step 3-7. If the code was modified from previous generation, the file path will appear in black and unmodified files will appear in grey.
  15. C++ source code generate
  16. Close your project. When the file is saved after code generation, the configuration file (m_plus.conf) will be automatically saved in the same directory where the .asta file is saved. Keeping this configuration file means you don't have to re-set the target directory every time you generate the code. You may want to save this configuration file in version control such as Git or Subversion.
  17. C++ source code generate

This Plug-in works with Astah Professional, Community and SysML





If you have any questions and feedback to M-PLUS, please use this contact form.