Applying Capella filters🔗
With release v0.4.11 of py-capellambse
you can apply filters headlessly. Since an instance of a ContextDiagram is not stored in
the .aird file of your Capella model there is no way to apply
filters via Capella/GUI. The filters implementation bridge
the filter functionality of py-capellambse such that the labels are
adjusted without needing diagram elements from within the .aird file.
Capella filters🔗
Currently the supported filters are:
Show ExchangeItems
from capellambse import MelodyModel
from capellambse_context_diagrams import filters
lost = model.by_uuid("a5642060-c9cc-4d49-af09-defaa3024bae")
diag = obj.context_diagram
assert filters.EX_ITEMS == "show.exchange.items.filter"
diag.filters.add(filters.EX_ITEMS)
diag.render("svgdiagram").save(pretty=True)
EX_ITEMS_FILTERShow FunctionalExchanges and ExchangeItems
from capellambse import MelodyModel
from capellambse_context_diagrams import filters
lost = model.by_uuid("a5642060-c9cc-4d49-af09-defaa3024bae")
diag = obj.context_diagram
assert filters.SHOW_EX_ITEMS == "show.functional.exchanges.exchange.items.filter"
diag.filters = {filters.SHOW_EX_ITEMS}
diag.render("svgdiagram").save(pretty=True)
SHOW_EX_ITEMSCustom filters🔗
Custom Filter - Show FunctionalExchanges or ExchangeItems
from capellambse import MelodyModel
from capellambse_context_diagrams import filters
lost = model.by_uuid("a5642060-c9cc-4d49-af09-defaa3024bae")
diag = obj.context_diagram
assert filters.EX_ITEMS_OR_EXCH == "capellambse_context_diagrams-show.functional.exchanges.or.exchange.items.filter"
diag.filters.add(filters.EX_ITEMS_OR_EXCH)
diag.render("svgdiagram").save(pretty=True)
EX_ITEMS_OR_EXCHMake sure to check out our Stylings feature as well.