how can I access the list of “All Related Diagrams” as it is shown in the Semantic Browser? For example, I have a mission and I want to have its Mission Capabilities Blank diagram in my document. I checked other forum posts but either didnt find something that worked for me or didn’t really understand the solution (or if it was applicable for my case).
Could something like this work (where mission is a variable assigned before to correspond to a mission object)?
m:mission.representationByDescriptionName('Mission Capabilities Blank').asImage()
I also used the M2Doc interpreter of M2Doc 3.2.0 in order to find any references or properties that would give me a pointer to the MCB diagram.
Thanks and best regards,
In the release of M2Doc extensions for Capella 5.1.0, you can import the semantic browser services using the template properties wizard:
You can then use the getAllRelatedDiagrams() service:
For M2Doc extensions for older versions of Capella, you will need to list representations where the mission is represented because the
Missions Capabilities Blank diagram is defined on a CapabilityPkg and not a Mission.
You can list all diagrams where the mission object appears like this:
diagram::DSemanticDiagram.allInstances()->select(d | d.representationElements->select(re | if re.oclIsKindOf(diagram::DDiagramElement) then re.visible else true endif)->including(d).target->includes(mission)).name
It basically retrieve all diagrams and then creates a list of all diagram elements that are visible and retrieve the semantic element attached. Then it select only diagrams where the mission is in the previous computed list.
You will have to select only diagrams where its description name is
Missions Capabilities Blank:
...->select(d | d.description.name = 'Missions Capabilities Blank')
Thanks Yvan! You are making my life so much easier, one post at a time