m2doc

Capella M2DOC generation based on selected model entity


I am attempting to generate a m2doc template that generates a common documentation for logical components within the model. I would like to be able to select a Logical component within the model and then use the m2doc tool to generate documentation about the selected element based on the pre-defined template.

Looking at the m2doc documentation and using the m2doc interpreter I am able to use the selection command to gather information about the selected object, e.g. selection.name returns the name of the element that is selected within the current diagram (in Capella).

I am however unable to access this variable when using it within the word template. Within the m2doc word template I have tried using { m:selection.name } which produces the following error: <---Couldn't find the 'selection' variable

How do you access the "selection" variable from within the m2doc template?


Solution

  • The selection variable is only available form the M2Doc interpreter view for testing purpose.

    The first method could be to initialize a .genconf file and set a variable to the selected element. But it's not convenient.

    If you are familiar with Eclipse plugins, you can contribute a contextual menu to Eclipse. In the handler of your corresponding command, you can launch the generation programmatically.