MDK User's Guide: 5 Selected Modeling Tutorials

Create and Generate Documents

The following views focus on foundational training to get any user to be able to interact with the MMS and subsequently View Editor. The goal at the end of these views is for the MDK user to be able to Create Document with View , Generate Views and Commit to MMS , and Manually Generate Views and Validate with MMS .

Create A Document With A View

In these instructions, the user creates a new (blank) document in MagicDraw using MDK's tools for Documents and Views. Committing these new elements is required for proceeding to the next step, Generate Views and Sync with MMS, where the user will generate the document so it appears on View Editor.

Setup: Model has been synced to it's own Alfresco site (See Create MD Project for Syncing. for more information on this process) A new package is created for the purpose of simple organization. Each modeler should follow the modeling practices of his/her project.

Actions:

  • Create a new View Diagram

    • Right click the package in the containment tree where you would like to create the view diagram > create diagram > select "view diagram" from the MDK section of the diagram list

    • New diagram is created and is displayed in the middle pane

Generate Views

Actions:

Generate select documents:

  1. Generate Views by right clicking the document (in diagram or containment tree) > MMS > "Generate View Contents" or "Generate View Contents Recursively".

  2. Results of generation appear in a message in the notification window

  3. Navigate to document on view editor

  4. Updated Document and views should be visible

  5. Save changes in MagicDraw

Insert Diagram as Image

The following instructions show one of the most basic ways of using viewpoints and viewpoint methods to construct contents of a view. For more information about what viewpoints and viewpoint method are, refer to Viewpoints and Viewpoint Methods . More detailed information about creating specific viewpoints and methods can be found in the DocGen User's Guide.

 

Actions:

  1. Create a new View as described in Create A Document With A View

  2. Create new View Point by selecting "Viewpoint" from the menu to the lower left of the view diagram and clicking on open space in the diagram. Name the View Point. 

  3. Create a "Conforms" relation from the new View to the new View Point.

    • Select "Conform" relationship from the menu to the lower left of the view diagram.

    • Click the view, then the view point. 

    • Conform relationship is displayed as a white arrow pointing to the view point.

  4. Select a diagram from the containment tree (to insert as an image) and drag it into the view diagram

  5. Create an "Expose" relation from the chosen view to the diagram

    • Select "Expose" relationship from the menu to the lower left of the view diagram

    • Click the view, then the diagram

    • Expose relationship is displayed as a dotted line pointing towards the diagram

NOTE: If the viewpoint method diagram is created by other methods (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method. There are two ways to check for this error before view generation:

  • Right click a View > DocGen > Validate View

    • Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method

  • Select "MDK" from the top ribbon > Validate > Views

    • Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method

  1. Create the View Point activity on the viewpoint method diagram

    • Insert "Initial Node" (from menu to left of diagram, under the Common section)

    • Insert ”Image" (from menu to left of diagram, under the Templates section)

    • Insert “Activity Final" (from menu to left of diagram, under the Common section)

    • Connect activity flow by clicking the element, selecting "Control Flow" from the popup menu (icon is an arrow), and clicking of the subsequent element

  1. Commit Changes

  2. From the View Diagram, right click on the document > MMS >  “Generate Views Contents Recursively"

  3. Diagram should now be visible on View Editor

Create and Generate a Rapid Table

For more detailed information, about using viewpoints and viewpoint methods refer to  Viewpoints and Viewpoint Methods and the DocGen User's Guide user guide.

Actions:

  1. Create a new View in the Document for the table as described in Create A Document With A View

  2. Create new Viewpoint as described in Insert Diagram as Image

    • Name new Viewpoint

    • Connect Viewpoint to new View via "Conforms" relationship

  3. Drag existing package of blocks onto diagram

    • Connect package and view via "Expose" relationship

  4. Create View Point Method Diagram

    • Right click the "operations" section of the Viewpoint > Create Method > Diagram >  "Viewpoint Method Diagram" under the MDK section

    • NOTE: If the viewpoint method diagram is created by other methods (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method

  1. Start building the activity - the end result will create a table that has the name of the blocks.

    • Create “Initial Node” from left menu

    • Create “CollectOwnedElements” from left menu

    • Create “FilterByStereotypes” from left menu

      • Double click FilterByStereotypes or right click > specification

      • Find “Stereotypes” under StereotypeChoosable > search for "Block" and select Block[Class] Sysml::Blocks

    • Create “Table Structure” from left menu

      • Name the table. This name will display in the view

      • Create “Initial Node” inside the table.

      • Create “TableAttributeColumn” inside the table.

        • Name the column. This name will display in the view

        • Double click TableAttributeColumn or right click > specification

        • Find “Desired Attribute” > select desired attribute from options (ex. name)

      • Create “Activity Final” inside the table.

    • Create “Activity Final” outside the table, in the activity.

    • Connect all control flows

  1. From the View Diagram, right click document > MMS >  “Generate View Contents Recursively"

  2. Table should be visible in view editor

Tables with additional columns may be created by adding more TableAttributeColumn elements into the Table Structure. 

Generate Views Locally

A user can generate Views locally as DocBook XML by right clicking a View > "DocGen" > "Generate Document". The DocBook XML can then be converted to other file formats, such as PDF, Word document, etc., with third-party tools. An example of such a tool is Oxygen XML Editor.