Find PhysicalPath from PhysicalLink

Hello everyone,

I’m a beginner with Py4C and I need to do a script who re-transcribe a PAB to an Xlxs file.

So script will define all information about Node, Physical Link, Physical Port.
And I want to know how to find the PhysicalPath associated to a specific physical port.

I tried the function pl.get_involving_physical_paths() but it doesn’t work.

“py4j.protocol.Py4JError: An error occurred while calling o33998.getInvolvingPhysicalPaths. Trace:
py4j.Py4JException: Method getInvolvingPhysicalPaths([]) does not exist”

Is somebody has a solution to find a PhysicalPath from a PhysicalLink ?

Moreover, is it possible to set false the visibility of an item with Python4Capella? (or to filter the displaying of all links in a physicalpath?)

Thanks in advance

You can replace the method with the following implementation:

    def get_involving_physical_paths(self) -> List[PhysicalPath]:
        res = []
        involvements = self.get_java_object().getInvolvingInvolvements()
        physical_path_involvement_e_class = get_e_classifier("http://www.polarsys.org/capella/core/cs/" + capella_version(), "PhysicalPathInvolvement")
        physical_path_e_class = get_e_classifier("http://www.polarsys.org/capella/core/cs/" + capella_version(), "PhysicalPath")
        for involvement in involvements:
            if physical_path_involvement_e_class.isInstance(involvement) and physical_path_e_class.isInstance(involvement.getInvolver()):
                res.append(PhysicalPath(involvement.getInvolver()))
        return res

I opened the following issue:

For the second question, I suppose you want to programmatically show/hide elements from the diagram. It’s not possible for the moment. But we have an issue opened on this topic:

1 Like

Thank you for your reply !
The new function works !

About the displaying of a component, is there a tool to display or undisplay all physicals links associated to a physical path? (So without script)

Hi,

Yes of course. You just have to switch to the right tool in the palette.
In Node Component, change Physical Paths by Physical Links

image=>

=>image

The behaviour is then the same as for functional chains