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:
model (MelodyModel)
diagram (Diagram)
- 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 thevalue
is not apparent incapellambse.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
- class capellambse.aird.DRepresentationDescriptor¶
A representation descriptor.
These are specific
_Element
s 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)
- fragment: PurePosixPath¶
Alias for field number 0
- 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:
- capellambse.aird.enumerate_diagrams(model)¶
Enumerate the diagrams in the model.
- Parameters:
model (MelodyLoader) – The MelodyLoader instance
- Return type:
- capellambse.aird.find_target(model, descriptor)¶
- Parameters:
model (MelodyLoader)
descriptor (DRepresentationDescriptor)
- Return type:
- 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:
model (MelodyLoader) – A loaded model.
descriptor (DRepresentationDescriptor | DiagramDescriptor) – A DiagramDescriptor as obtained from
enumerate_diagrams()
.
- 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:
- capellambse.aird.parse_diagram(model, descriptor, **params)¶
Parse a single diagram from the model.
- Parameters:
model (MelodyLoader) – A loaded model.
descriptor (DRepresentationDescriptor | DiagramDescriptor) – A DiagramDescriptor as obtained from
enumerate_diagrams()
.params (Any)
- Return type:
- capellambse.aird.parse_diagrams(model, **params)¶
Parse all diagrams from the model.
- Parameters:
model (MelodyLoader)
params (Any)
- Return type: