Welcome !
The following script will set the status of a new created object to REVIEWED, you might need to get another literal in your case:
# 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)
def get_progress_status_enum(se):
progress_status_enum = None
for enumeration in se.get_java_object().eContainer().getOwnedEnumerationPropertyTypes():
if enumeration.getName() == 'ProgressStatus':
progress_status_enum = EnumerationPropertyType(enumeration)
return progress_status_enum
return progress_status_enum
se = model.get_system_engineering()
progress_status_enum = get_progress_status_enum(se)
new_status = None
for literal in progress_status_enum.get_owned_literals():
if literal.get_name() == 'REVIEWED':
new_status = literal
capella_element = LogicalComponentPkg()
capella_element.get_java_object().setStatus(new_status.get_java_object())
print(capella_element.get_status())
To change an existing object from your Capella model you will need to navigate to this element in your model. You will also need to do the change in a transaction for the change to take effect.