Access elements in Functional chain description (FCD) diagrams

I didn’t find any predefined classes in capella.py for accessing Sequence links & Control Nodes in the FCD diagram below:

How should I move forward in such case, when accessing that element with P4C is must for me…

Thank you.

There is no API in Python for Capella, but you can use the Java API directly from your Python script. You will need to import Capella source code in your environment to be able to navigate Java type references etc… You can also explore the corresponding ecore metamodel (see the FunctionalAnalysis.ecore).
You probably want to retrieve SequenceLink and ControlNode using semantic browser queries:

listOfJavaObjects = getSBQuery(MyCapellaElement.get_java_object(), 'query_name')
print(listOfJavaObjects.get(0).getName())

The get_java_object() returns a reference to the Java object corresponding to the Python for Capella object. The method ‘getSBQuery()’ calls the semantic browser query and return a Java List with the result. Then you can call Java methods like get() and getName().

1 Like

After I get the .ecore files in the system,

Is this the proper way to explore the Ecore files?

Yes, this is one way. You can also use Ecore tools to have a graphical representation. Note that you won’t be able to save Ecore tools diagrams for the Capella meta-models inside of Capella. You will need to install it in an other Eclipse and import the project.