How to export Library objets with P4C

Hello,
I would like to know how to export the objects (functions, components, exchanges …) of a library referenced to a project together with the objects of the project?
thanks,

image

david

What do you mean by “export?” Export to what?

A sample script that will list all logical components from a Capella project and its libraries in the console:

# include needed for the Capella modeller API
include('workspace://Python4Capella/simplified_api/capella.py')
if False:
    from simplified_api.capella import *

aird_path = '/In-Flight Entertainment System/In-Flight Entertainment System.aird'
model = CapellaModel()
model.open(aird_path)

# gets the SystemEngineering and print its name
se = model.get_system_engineering()

print("Project System:", se.get_name())
for lc in se.get_all_contents_by_type(LogicalComponent):
    print("  - Logical Component:", lc.get_name())

for lib in model.get_referenced_libraries():
    lib_se = lib.get_system_engineering()
    print("Library System:", lib_se.get_name())
    for lc in lib_se.get_all_contents_by_type(LogicalComponent):
        print("  - Logical Component:", lc.get_name())

hi,
I meant “extract data with py4C” and the script is exactly what I needed!
thanks
have a good summer
david

1 Like