Showing results for 
Show  only  | Search instead for 
Did you mean: 

List all links of MetaClass Diagram

Occasional Contributor

List all links of MetaClass Diagram



We would like list with VB Script, all MetaClass that can be displayed on a diagram.

We use the instruction below :


Dim clMOAE                      ‘ Collection of MetaOppositeAssociationEnd

Dim oMOAE                      ‘  Object MetaOppositeAssociationEnd

Dim oMcDiag                    ‘  MetaClass Diagram

Set clMOAE = oMcDiag.Getcollection("MetaOppositeAssociationEnd")


--> 259 links are found

Then, we retreive the MetaClass of each link with the instruction below :



But in a diagram object, we see other links : for exemple « Elément d’un diagramme ». This link contains several metaclass : flow, site…


  • How can we retreive the link Elément dans diagramme for the Diagram MetaClass ?
  • How can we retreive all the metaclass of the link Elément dans diagramme for the Diagram MetaClass  then all objects of each metaclass of the link Elément dans diagramme in a diagram object ?

We thank you for advance



5 Replies

Re: List all links of MetaClass Diagram



This is a more general concern with Abstract metamodel

Use GetType to test the Sub MetaClass of the target MetaClass

See this page of MEGA Community


Occasional Contributor

Re: List all links of MetaClass Diagram



Thank you. I read the page and I tested the solution on my diagram object as below.

Dim cBE, cOP

Set cBE = oDiag.GetCollection("Elément dans diagramme")

Print "Number of Elément dans diagramme objects : " & cBE.count()

' Display all objects of "Elément dans diagramme"

For each oObjet in cBE

print oObjet.GetProp("Nom court")


' Display the number of objects of metaclass Flux in "Elément dans diagramme"

Set cOP = cBE.GetType("~CK0MCRcD9bV1[Flux]")

print Print "Number of Flux objects: " & cOP.count()


We would like to list all links (inherited or not) in order to avoid writing each name of link. Is it possible for a diagram metaclass ? for a diagram object ?

Then, for each link, we would like to know which is the metaclass.


A links can have several metaclass (ex « Elément dans diagramme »). Is it possible to identify such link ? Is it possible to list all metaclass of this link ?


Thank you


Re: List all links of MetaClass Diagram

Explore the MetaClass 'Element in diagram' and see its sub MetaClass

Occasional Contributor

Re: List all links of MetaClass Diagram

Thank you.


Is it possible to do that by VB Script ?

Occasional Contributor

Re: List all links of MetaClass Diagram

Finally, I wrote the script below which works.


Option Explicit
const ASCENDING = 1

Sub MainRoot(oRoot)

    Dim oMetaClass, oMAE, cMAE, oMtConcrete, cMtConcrete
  Dim iAbstractLevel

' Metaclas Diagramme
    oMetaClass = GetObjectFromId("~KekPBSs3iS10[Diagramme]")       ' Copy / Past of object
    oRoot.print " --> MetaAssociationEnd (with abstract MetaAssoicationEnd) "

    Set cMAE = oMetaClass.GetRoot.GetCollectionDescription(oMetaClass.GetID).Collections

    ' Access to "Elément dans diagramme" collection
    Set oMAE = oMetaClass.GetRoot.GetCollectionDescription(oMetaClass.GetID).Collections.Item("Elément dans diagramme")

  oRoot.print "Number MAE : " & cMAE.count
  oRoot.print " "

    For Each oMAE in cMAE
        ' Abstract level : 1 = abstract, 0 = concrete
        iAbstractLevel = oMetaClass.GetRoot.GetClassDescription(oMAE.megaField).GetProp("Abstraction")
                oRoot.Print oMAE.GetProp("Name") & " Abstract level : " & oMetaClass.GetRoot.GetClassDescription(oMAE.megaField).GetProp("Abstraction")

        If oMAE.GetProp("Name") = "Elément dans diagramme" Then
                ' Retreive concrete MetaAssociationEnd
                    set cMtConcrete =  oMetaClass.GetRoot.GetCollectionDescription(oMAE.megaField).Concretes
            oRoot.print "   Number concrete MAE : " & cMtConcrete.count
            ' Display concrete MAE
            For each oMtConcrete in cMtConcrete
               oRoot.print "   Name : " & oMtConcrete.GetProp("Name")  & " MegaField : " & oMtConcrete.megaField
                End If


  ' Free memory
  Set oMetaClass = Nothing
    Set oMAE = Nothing
    Set cMAE = Nothing
  Set oMtConcrete = Nothing
  Set cMtConcrete = Nothing

End Sub