Part id vs CapellaElement id

I’ve recently been trying to work through a scripting task that requires me to know both the id of a CapellaElement (e.g. a PhysicalComponent) and the corresponding id/s for the part/s. Is there a way to get the id for the part using Python4Capella?

From a Component you can get its list of representing Part using the Java API:

parts = myComponent.get_java_object().getRepresentingParts()

Then you can get the id from the Java Object Part:

id = myPart.getId()

Thanks Yvan. That worked perfectly.

1 Like