Hello,
I am so confused with this, I just discovered that my Logical Components in my LAB had 2 ID’s, Capellas ID’s…
This is never the case for Requirements, let’s see:
Selecting the item from the “Project Explorer”:
Vs selecting it from the diagram:
It’s literally the SAME ID.
However when it comes to Logical Components (or cs:Part’s?), let’s look at this:
Cheking the ID for this Logical Component/actor leads us to find 2 DIFFERENTS ID’s!
-
The second set of properties shown in the image contains the id you get from the element in the project explorer.
-
The first set contains the id of the TARGETED element by the node in the diagram:
And here we have 2 ID’s.
I thought the “self.target” applied to a graphical element, was supposed to point out to the element shown when we click on “Show In Project Explorer”:
But it is not the case. Was my supposition wrong?
This is very confusing when using Python 4 Capella, since P4C deals mostly with items in the project explorer it seems.
I don’t know if this post fits better here or in the scripting sub forum, If there is no answer I could move it there. Thanks
2 other questions:
- Is there any way to show both ID’s in the interpreter (aql) from the element in the project explorer?
(I would like to show (b15762d2-8f00-434e-9e48-6660e6bf4812) and (2f845c32-f4bd-4f9b-b1b0-00b95c081ca4) even if the “self” in aql is pointing at the item from project explorer)
→ Edit: Found the solution:
aql:self.eInverse(cs::Part)->asSequence()->at(1).id
Allowed me to get the second id.
- Is there a way to obtain the element of my project explorer with aql, starting from the corresponding element shown in the diagram? Example:
This image shows the ID of the element in the diagram, how can I go from here (self.target) to find the corresponding element in project explorer? Thanks in advance
Edit: Found the solution:
aql:self.target.eContainer().eContents()->select(a|a.eInverse(cs::Part)->asSequence()->at(1).id=self.target.id)->at(1)
I wonder if there is a simpler way to do this.