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.

Return type:

None

Parameters:

value (str)

discard(value)

Remove the filter with the given value from the diagram.

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

Return type:

None

Parameters:

value (str)

class capellambse.aird.DRepresentationDescriptor

A representation descriptor.

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

alias of _Element

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[NewType(DRepresentationDescriptor, _Element)]

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

_Element

Parameters:
capellambse.aird.get_styleclass(descriptor)
Return type:

str | None

Parameters:

descriptor (DRepresentationDescriptor)

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.

Return type:

Iterator[Diagram]

Parameters: