Python4capella - Import VP requirements

Hi,

Is it possible to import VP requirements (from the addons VP requirements and not native CAPELLA requirement model) using python4capella.

If positive, do you have any python file template?

thanks

david

Yes, it is possible I think.
You’ve got an example for exporting VP Requirements in Python4Capella: Export_list_of_Requirements_to_xlsx.py
It uses the API defined in requirements.py and the API does have set functions.
For inspiring yourself on importing elements in Capella, you may look at this example script: Import_physical_components_from_xlsx.py

Stephane

Hi David,

It is possible to import textual requirements using the requirements VP add-on. However, the only requirement is that is the file format should be “.reqif”.

If you want to know more, please visit ReqIF import Capella.
I hope that helps.
Alternatives, might well be using Python4Capella scripts.

Hélder Castro

1 Like

Hi,
Many thanks for your answers. I already used the reqIF Import capella using .reqif format. The main difficulty is that I don’t use DOORS tool and so I have to generate a .reqif from a .CSV or .xls. I used to do this with “ReqIF Studio” platform but it is really complex… so I would like to try to import requirements with Python4Capella.

see you
dvd

Hi,
one more question,
I try to define a Capella Requirement Module using simplified API/ requirement.py in Python4capella.

it’s written in requirement.py:
→ def get_requirement_modules(capellaElement):
“”"
status: KO
“”"
#: :type capellaElement: CapellaElement
res = []
se = RequirementAddOn.get_system_engineering(capellaElement)
for modelArchitecture in se.get_java_object().getOwnedArchitectures():
for extension in modelArchitecture.getOwnedExtensions():
if extension.eClass().getName() == “CapellaModule” and extension.eClass().getEPackage().getNsURI().startswith(“http://www.polarsys.org/capella/requirements”):
res.append(CapellaModule(extension))
return res"" ←

does "status: KO " mean that the python doesn’t work yet so that i can’t access to a capella module item?

if it works, how can I use this function?

thanks
dvd