Copyright (C) 2009. EDMGROUP Pty Ltd. All rights reserved

penkov.id.au/ezy-software

ePC Model Explorer - ARIS report (Home)

ePC Model Explorer uses ARIS script to generate input data for analysis.

Report requires that all ARIS diagrams will be organized under VAD diagram. ARIS script performs the following tasks:

  1. Writes information about diagram and it's objects

  2. Writes information about linked diagrams

  3. Saves images of the diagram as JPEG (or WMF) files in corresponding directory

ARIS Script structure

  1. Main - prepares variables and performs main loop on selected models

  2. write_model - writes model information
    - image
    - model attributes
    - calls write_object to write object attributes

  3. write_object - writes object attributes and loads decomposition diagram for write_model

  4. write_link - register link between objects

  5. write_decomposition - register decomposition link

Text script:

'--------------------------------------------------------
' Aris 7 - Report Script, Model
' By Sergei Penkov, EDMGROUP (Australia) Pty Ltd
'--------------------------------------------------------


'global declarations


' selected language (localeId)

Global
g_nLoc As Long
' declare the output Object

Global
oOutFile As Object

' this is the main subroutine.
' called, when the script is being executed

Sub
Main
    Dim oSelectedModels1 As Object
    Dim i_Model_Index As Long
    Dim sPath As String
    Dim iLevel As Long
    Dim nDepth As Long
    iLevel = 0
    nDepth = 8

' create and initialize the output Object and variable for selected language

    Set oOutFile = New OutputClass
    g_nLoc = SelectedLanguage
    oOutFile.Init(SelectedFormat, g_nLoc)

    sPath = "C:\\Apache2.2\\htdocs\\Models\\EPC_LABORATORY\\ARIS_Export\\"
'iterate through oSelectedModels1

    Set oSelectedModels1 = SelectedModels
' iterate through models

    For i_Model_Index = 0 To oSelectedModels1.Count()-1
        Set oSelectedModels1Obj = oSelectedModels1.Get(i_Model_Index)
    ' output Model definitions
        write_model i_Model_Index, iLevel, nDepth, oSelectedModels1Obj,sPath
        Set oSelectedModels1Obj = Nothing
    Next i_Model_Index
    Set oSelectedModels1 = Nothing
    oOutFile.WriteReport(SelectedPath, SelectedFile)
End
Sub
' writes model definitions

Sub
write_model(i_Model_Index As Long, nCurrentDepth As Long, nDepth As Long, oSelectedModels1Obj As Object,sPath As String)
    Dim sModelPicture As String
    Dim sModelName    As String
    Dim ObjDefList1 As Object
    Dim ObjDefinition As Object
    Dim oAttributes As Object 'List of attributes.
    Dim iAttribute As Long
    Dim iObject As Long
    Dim oCxnList1 As Object
    Dim oCxnList1Obj As Object
    Dim i_Link_index As Long
    Dim iNextLevel As Long
    If nCurrentDepth < nDepth Then
    ' SAVE INDEXED MODEL NUMBER
        sImage_Index = "image"+Str(i_Model_Index) +".jpg"
        sModelPicture = sPath + sImage_Index
        oSelectedModels1Obj.Graphic(True, False, g_nLoc).Save(sModelPicture)    
    ' REPLACE QUOTE SIGN
        sModelPicture = sPath + oSelectedModels1Obj.Name(g_nLoc) + ".jpg"
        oSelectedModels1Obj.Graphic(True, False, g_nLoc).Save(sModelPicture)    

        sModelName = Replace(oSelectedModels1Obj.Name(g_nLoc),Chr(34),"\"+Chr(34))

        oOutFile.Output("diagram(model("+Chr(34)+sModelName+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("img("+Chr(34)+sImage_Index +Chr(34)+","+Chr(34)+sModelPicture+Chr(34)+"),[", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)

'iterate through model attributes

        Set oAttributes = oSelectedModels1Obj.AttrList(nLoc)
        For iAttribute = 0 To oAttributes.Count()-1
            Set oCurrentAttribute = oAttributes.Get(iAttribute)
            oOutFile.Output("attr("+Chr(34)+oCurrentAttribute.Type()+Chr(34)+","+Chr(34)+CStr(oCurrentAttribute.GetValue(True))+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        Next iAttribute
        oOutFile.OutputLn("attr("+Chr(34)+"end"+Chr(34)+","+Chr(34)+Chr(34)+")])", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        Set oAttributes = Nothing ' destroy created object
    'iterate through ObjDefList() - list of object definitions
        Set ObjDefList1 = oSelectedModels1Obj.ObjDefList()
        iNextLevel = nCurrentDepth + 1
        For iObject = 0 To ObjDefList1.Count()-1
            Set ObjDefinition = ObjDefList1.Get(iObject)
            write_object i_Model_Index, iNextLevel, nDepth, sModelName, ObjDefinition, sPath
            Set oModelsList = Nothing ' destroy created object
        Next iObject
    'iterate through oCxnList1 -  list of links
        Set oCxnList1 = oSelectedModels1Obj.CxnList
        For i_Link_index = 0 To oCxnList1.Count()-1
            Set oCxnList1Obj = oCxnList1.Get(i_Link_index)
            write_link sModelName, oCxnList1Obj
            Set oCxnList1Obj = Nothing
        Next i_Link_index
        Set oCxnList1 = Nothing
End
If
End
Sub

Sub
write_link(sModelName As String, oCxnList1Obj As Object)
    Dim oTypeArray1(0) As Long
    Dim oTypeArray2(0) As Long
    Dim oAttrList1 As Object
    Dim oAttrList1Obj As Object
    Dim i_Index_Attribute As Long
        oOutFile.Output("link(", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("model("+Chr(34)+sModelName+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("epc_object("+Chr(34)+oCxnList1Obj.SourceObjDef.Name(g_nLoc)+Chr(34)+",", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("type("+Chr(34)+oCxnList1Obj.SourceObjDef.Type(False)+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("guid("+Chr(34)+oCxnList1Obj.SourceObjDef.guid+Chr(34)+")),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
    
        oTypeArray1(0) = AT_TYPE_6
        oTypeArray2(0) = AT_TYPE_6
        'iterate through oAttrList1
        Set oAttrList1 = oCxnList1Obj.AttrList(g_nLoc, oTypeArray2)
        For i_Index_Attribute = 0 To oAttrList1.Count()-1
            Set oAttrList1Obj = oAttrList1.Get(i3)
            oOutFile.Output("relation(type("+Chr(34)+oAttrList1Obj.GetValue(True)+Chr(34)+")),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
            Set oAttrList1Obj = Nothing
        Next i_Index_Attribute
        Set oAttrList1 = Nothing

        oOutFile.Output("epc_object("+Chr(34)+oCxnList1Obj.TargetObjDef.Name(g_nLoc)+Chr(34)+",", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("type("+Chr(34)+oCxnList1Obj.TargetObjDef.Type(False)+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.OutputLn("guid("+Chr(34)+oCxnList1Obj.TargetObjDef.guid+Chr(34)+")))", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)

End
Sub

Sub
write_object(i_Model_Index As Long, nCurrentDepth As Long, nDepth As Long,sModelName As String, ObjDefinition As Object,sPath As String)
    Dim iAttribute As Long
    Dim iModels As Long
    Dim iNextLevel As Long

        oOutFile.Output("object_def(model("+Chr(34)+sModelName+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("type("+Chr(34)+ObjDefinition.Type(False)+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("name("+Chr(34)+Replace(ObjDefinition.Name(g_nLoc),Chr(34),"\"+Chr(34))+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("guid("+Chr(34)+ObjDefinition.guid()+Chr(34)+"),[", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)

        'Now print attributes of the object
        Set oAttributes = ObjDefinition.AttrList(nLoc)
        For iAttribute = 0 To oAttributes.Count()-1
            Set oCurrentAttribute = oAttributes.Get(iAttribute)
            oOutFile.Output("attr("+Chr(34)+oCurrentAttribute.Type()+Chr(34)+","+Chr(34)+CStr(oCurrentAttribute.GetValue(True))+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        Next iAttribute
        Set oAttributes = Nothing ' destroy created object
        Set oModelsList = ObjDefinition.AssignedModels()
        For iModels = 0 To oModelsList.Count()-1
            ' iterate through assigned models
            Set oModelsListObj = oModelsList.Get(iModels)
            oOutFile.Output("attr("+Chr(34)+"link"+Chr(34)+","+Chr(34)+Replace(oModelsListObj.Name(g_nLoc),Chr(34),"\"+Chr(34))+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        Next iModels
        oOutFile.OutputLn("attr("+Chr(34)+"total_links"+Chr(34)+","+Chr(34)+oModelsList.Count()+Chr(34)+")])", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        If nCurrentDepth < nDepth Then
            iNextLevel = nCurrentDepth + 1
            For iModels = 0 To oModelsList.Count()-1
        ' iterate through assigned models
                Set oModelsListObj = oModelsList.Get(iModels)
                i_Model_Index = i_Model_Index + 1
                write_decomposition i_Model_Index, iNextLevel, nDepth, sModelName,oModelsListObj,ObjDefinition,sPath
            Next iModels
        End If
End
Sub
' writes decomposition term

Sub
write_decomposition(i_Model_Index As Long, nCurrentDepth As Long, nDepth As Long, sModelName As String, oModelsListObj As Object,ObjDefinition As Object, sPath As String)
Dim
iDepthNext As Long
    If nCurrentDepth < nDepth Then

        oOutFile.Output("object_decomposition(model("+Chr(34)+sModelName+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("epc_object("+Chr(34)+Replace(ObjDefinition.Name(g_nLoc),Chr(34),"\"+Chr(34))+Chr(34)+",", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("type("+Chr(34)+ObjDefinition.Type(False)+Chr(34)+"),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.Output("guid("+Chr(34)+ObjDefinition.guid()+Chr(34)+")),", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)
        oOutFile.OutputLn("model("+Chr(34)+Replace(oModelsListObj.Name(g_nLoc),Chr(34),"\"+Chr(34))+Chr(34)+"))", "Arial",10,C_BLACK,COLOR_TRANSPARENT,FMT_LEFT,0)

        iDepthNext = nCurrentDepth + 1
        write_model i_Model_Index, iDepthNext, nDepth, oModelsListObj, sPath
    End If
End
Sub