Python4Capella - Exporting information from a diagram

A model I need to export information from has property value groups and values assigned to many elements. In addition, there are diagrams that display property value groups and property values without being assigned to any elements. They are located there as being specific to the system(s) displayed in the diagram in general.
I have succesfully got all of the information of the property value groups and values that have been assigned to any element. The problem is getting the ones that are ‘floating’ in the diagrams, unassigned.

The goal of my script:
Retrieve Property Value Groups and their contained Property Values from PAB diagrams that are relevant to different systems.

My question:
Is there a known method for exporting diagrams and their information from the ‘Representations per category’ section of a model as opposed to the system engineering? (I understand I may have to get the system engineering anyway as the diagrams display the system engineering)

Alternatively I could attempt to run a script on a specific diagram however I’m not sure how to get the popup to recognise a Diagram. The right click option obviously works for CapellaElements but I don’t know how to target a specific diagram to then export contained elements.

Hi Angus

I’m wondering why you intend to catch data from diagram and not from items… in which you may ask for representing diagrams.
About floating PV and PVG why not assigning to system? Anyway if they are in a diagram, it should be possible to call them in a list dedicated to this diagram.
I use this: (after project header)


for attr in dir(State):

print (attr)

I get the attribute list for the Capella class I put instead of State in the console.
I copy paste to a notepad. I did not yet for PV and PVG… look for diagram info there.

Hi Thierry,

Sorry for the delayed response, I thought I had replied sooner.
I’ll have a go at using this technique, thank you so much!

Many Thanks,