I have defined a set of capella native requirements (i.e. without the use of any addon such as Requirements Viewpoint) and I am finding trouble to write a script that effectively extracts requirement-related information, as it seems capella.py does not cover them specifically.
For example, I am trying to retrieve the Requirement Package in which requirements are contained, but differently from other packages which are indeed defined in capella.py (e.g. OperationalCapabilityPkg), the RequirementsPkg is not defined and therefore the following is displayed:
AttributeError: âOperationalAnalysisâ object has no attribute âget_requirements_pkgâ
Indeed, when I retrieve the type of the contents of the model, I have cross-checked that Requirements are typed as EObject (rather than having its own type as for many other model elements such as OperationalActivity, FunctionalExchangeâŠ).
Is there any workaround to address this issue and have an easy access to modelled requirements information?
include('workspace://Python4Capella/simplified_api/capella.py')
if False:
from simplified_api.capella import *
aird_path = '/In-Flight Entertainment System/In-Flight Entertainment System.aird'
model = CapellaModel()
model.open(aird_path)
se = model.get_system_engineering()
req= se.get_operational_analysis()
req_pkg = req.get_all_contents_by_type(RequirementsPkg)
for requirements_pkg in req_pkg:
print(requirements_pkg.get_name())
for reqs in requirements_pkg.get_owned_requirements():
print(reqs.get_name())
id=reqs.get_requirement_id()
print(id)