capellambse.aird package

Functions for parsing and interacting with diagrams in a Capella model.

class capellambse.aird.ActiveFilters

Bases: MutableSet[str]

A set of active filters on a Diagram.

Enable access to set, add and remove active filters on a Diagram.

__init__(model, diagram)
Parameters:
Return type:

None

add(value)

Add an activated filter to the diagram.

Writes a new <activatedFilters> XML element to the <diagram:DSemanticDiagram> XML element. If the value is not apparent in capellambse.aird.GLOBAL_FILTERS as a key it can not be applied when rendering. It should still be visible in the GUI.

Parameters:

value (str)

Return type:

None

discard(value)

Remove the filter with the given value from the diagram.

Deletes <activatedFilters> XML element from the diagram element tree.

Parameters:

value (str)

Return type:

None

class capellambse.aird.DRepresentationDescriptor

A representation descriptor.

These are specific _Elements found in AIRD files, which contain metadata about diagrams.

alias of _Element

class capellambse.aird.DiagramDescriptor

Bases: NamedTuple

DiagramDescriptor(fragment, name, styleclass, descriptor, uid, viewpoint, target)

descriptor: _Element

Alias for field number 3

fragment: PurePosixPath

Alias for field number 0

name: str

Alias for field number 1

styleclass: str | None

Alias for field number 2

target: _Element

Alias for field number 6

uid: str

Alias for field number 4

viewpoint: str

Alias for field number 5

capellambse.aird.enumerate_descriptors(model, *, viewpoint=None)

Enumerate the representation descriptors in the model.

Parameters:
  • model (MelodyLoader) – The MelodyLoader instance

  • viewpoint (str | None) – Only return diagrams of the given viewpoint. If not given, all diagrams are returned.

Return type:

Iterator[DRepresentationDescriptor]

capellambse.aird.enumerate_diagrams(model)

Enumerate the diagrams in the model.

Parameters:

model (MelodyLoader) – The MelodyLoader instance

Return type:

Iterator[DiagramDescriptor]

capellambse.aird.find_target(model, descriptor)
Parameters:
Return type:

_Element

capellambse.aird.get_styleclass(descriptor)
Parameters:

descriptor (DRepresentationDescriptor)

Return type:

str | None

capellambse.aird.iter_visible(model, descriptor)

Iterate over all semantic elements that are visible in a diagram.

This is a much faster alternative to calling parse_diagram() and iterating over the diagram elements, if you only need to know which semantic elements are visible, but are not otherwise interested in the layout of the diagram.

Parameters:
Raises:

ValueError – If the corresponding data or style element can’t be found in the *.aird file.

Yields:

etree._Element – A semantic element from the *.capella file.

Return type:

Iterator[_Element]

capellambse.aird.parse_diagram(model, descriptor, **params)

Parse a single diagram from the model.

Parameters:
Return type:

Diagram

capellambse.aird.parse_diagrams(model, **params)

Parse all diagrams from the model.

Parameters:
Return type:

Iterator[Diagram]