Skip to content

Interfaces (aka ComponentExchanges)🔗

The data is collected by get_elkdata_for_exchanges which is using the InterfaceContextCollector underneath.

You can render an interface context view just with context_diagram on any of the following Model elements:

  • fa.ComponentExchange:
    import capellambse
    
    model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
    diag = model.by_uuid("3ef23099-ce9a-4f7d-812f-935f47e7938d").context_diagram
    diag.render("svgdiagram").save(pretty=True)
    

    Interface context diagram of Left to right Logical ComponentExchange with type [LAB]

  • cs.PhysicalLink:

    Per default port labels are enabled with port label position set to OUTSIDE. See PORT_LABEL_POSITION for more information about the available options for port label positioning.

    import capellambse
    
    model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
    diag = model.by_uuid("da949a89-23c0-4487-88e1-f14b33326570").context_diagram
    diag.render("svgdiagram").save(pretty=True)
    

    Interface context diagram of Cable 1 PhysicalLink with type [PAB]

Exclude the interface itself in the context🔗

Exclude the interface in the Interface Context

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("fbb7f735-3c1f-48de-9791-179d35ca7b98").context_diagram
diag.render("svgdiagram", include_interface=False).save(pretty=True)
Interface context diagram of Interface Logical ComponentExchange with type [LAB]

Hide functional model elements from the context🔗

Hide functions and functional exchanges in the Interface Context

import capellambse

model = capellambse.MelodyModel("tests/data/ContextDiagram.aird")
diag = model.by_uuid("fbb7f735-3c1f-48de-9791-179d35ca7b98").context_diagram
diag.render("svgdiagram", hide_functions=True).save(pretty=True)
Interface context diagram of Interface Logical ComponentExchange with type [LAB]

Interface context only supported for System and Logical ComponentExchanges