Output Element’s Layer Information using Doc. Composer

In Visual Paradigm you can put your diagram elements into different layers. This allows you to partition your diagram data into different levels and present them only when needed. Starting from version 16.1 build 20200630ax Visual Paradigm now support output element’s layer information into document. In this article we will teach you how to create custom template to output this information.

Assume we have a diagram like below. This diagram contains two layers. The ArchiMate Application Component G is contained in both layers L1 & L2. There are another two ArchiMate Application Component A & B which only exist in layer L1 or L2 respectively.

ArchiMate Application Components show in different layers

ArchiMate Application Components show in different layers

To output element’s layer information:

  1. Go to Tools > Doc. Composer.

    Create Doc. Composer

    Create Doc. Composer

  2. Select Build Doc. From Scratch.

    Select Build Doc from Scratch

    Select Build Doc from Scratch

  3. Select the diagram we created (in our case it is an ArchiMate diagram).

    Select diagram in Diagram Navigator

    Select diagram in Diagram Navigator

  4. Right click on any template in Template pane and select Duplicate from popup menu.

    Duplicate a template

    Duplicate a template

  5. Name the template as Element Layer Name.

    Name the tempalte as Element Layer Name

    Name the tempalte as Element Layer Name

  6. Replace the content of template as follow.
    <?xml version="1.0" encoding="UTF-8"?>
    <AnyBaseInitiationBlock>
      <Inline template="Basic"/>
      
      <IterationBlock>
        <Sortings>
          <Sorting by="modelType"/>
        </Sortings>		
        <Inline template="General/Element Basic"/>
        <ForEach property="layerNames" ignoreLastSeparator="true">
          <Property property="name"/>
          <Text>, </Text>
        </ForEach>
        <ParagraphBreak/>
      </IterationBlock>
    </AnyBaseInitiationBlock>
  7. Press OK button and close the Edit template dialog.
  8. Drag the Element Layer Name template into document editor.

    Drag the template into document editor

    Drag the template into document editor

Now the name of the layer containing the elements in selected diagram are being listed out.

Layer information being output to document

Layer information being output to document

Explanation of the Template

This template is start from calling the built-in Basic template to output the general information of a diagram, including its name and image.

<?xml version="1.0" encoding="UTF-8"?>
<AnyBaseInitiationBlock>
  <Inline template="Basic"/>

Next we loop through all elements in the diagram according to their model type and output its basic information. Again it reuse the General/Element Basic template for outputting the information.

<IterationBlock>
  <Sortings>
    <Sorting by="modelType"/>
  </Sortings>		
  <Inline template="General/Element Basic"/>

Now we retrieve the layerNames property of the element as a collection and walk through the item using the ForEach loop, and then output its name into document.

<ForEach property="layerNames" ignoreLastSeparator="true">
  <Property property="name"/>
  <Text>, </Text>
</ForEach>
<ParagraphBreak/>

 

Related Know-how

Related Link

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply