I wanted to raise 2 issues I met with Capella Requirements.
Sometimes, the model would contain “hidden” Capella Modules. By “hidden”, i mean capela modules that cannot be seen by the user, somehow. So we could have 1 single viewable capella module in our model (Viewable in the project explorer), the python script could rely on getting the first element of a list, yet somehow the list of capella modules could be containing another “secret” capella module, which could produce an error. I was able to find a solution to this. I would love to share with you a model that present this unique feature but I don’t know which of my numerous experimental modules contains it.
Even more interesting, this Capella module containing exactly one single requirement yet somehow during my script compilation inside a LOOP that goes throught the content of the capella module, I observed that the variable “I” (iteration) jumped from 0 to 1 without any reason.
With a script like this one:
print(ExistingOP_PVG_Bottom_names) print(len(ExistingOP_PVG_Bottom_names)) for i in range(len(ExistingOP_PVG_Bottom_names)): print("ITERATION is:") print(i)
ExistingOP_PVG_Bottom_names being the list of requirement under that module.
Executing the script provides this:
['56c323d3-bfea-472f-9d87-783ebb635d32'] 1 ITERATION is: 0
We can clearly see the list contains only ONE element.
Somewhere later in the script, i jumps from 0 to 1, without even finithing the first iteration.
You might suspect that one of my codes is using “i” though interacting with it and provoking this action? Well no not really.
If I delete the “Test” requirement from that capella module and then create Another one. The problem somehow does not appear again.
Now it never jumps again from 0 to 1.
I had a very hard time debugging it until i tried this. it’s quite a rare thing, I am not sure you can reproduce it but maybe this could help someday for a similar problem, and maybe you could be able to identify where the bug comes from if enough people experiment this issue.