I created a few test property-values and applied them to some System Functions of the IFE model. I want to be able to export all PVMT data using P4C. I am able to export the domain, extension, name, type and value details with ease but the description returned is always “null” or “None”.
for sysFun in allSysFun:
for item in sysFun.get_owned_property_value_groups():
print(item.get_name()) #Domain.Extension
for item2 in item.get_owned_property_values():
print(item2.get_name()) #Property
print(item2.get_description())
print(item2.get_type().get_name()) #PropertyType
print(item2.get_value().getName()) #PropertyValue
print(item2.get_value().getDescription())
Could somebody help me out and guide me in the right direction?
Thanks!
Already included the .capella file that shows the property definition.
If my property creation and application are correct, I am unable to understand why I can’t fetch the description. I am using Capella 5.2 if that helps…
I don’t have a Capella 5.2.0 installeb but I tried the following script on Capella 6.0.0 and 5.1.0:
# name : Print description in console
# script-type : Python
# description : Print description in console
# popup : enableFor(org.polarsys.capella.core.data.capellacore.CapellaElement)
# include needed for the Capella modeller API
include('workspace://Python4Capella/simplified_api/capella.py')
if False:
from simplified_api.capella import *
# Retrieve the Element from the current selection and its aird model path
selected_elem = CapellaElement(CapellaPlatform.getFirstSelectedElement())
print(selected_elem.get_description())
Adding this script to the sample script folder, you should be able to right click on your EnumerationPropertyValue and select the Print description in console menu. It will print the description on the console. Let me know if it works. I edited the description using the rich text editor from the property view.
I am thinking I will try the same property-value setup in a Capella 5.1 installation and see if I’m able to fetch the description. Would greatly appreciate your advise/suggestions/help!
The name of the EAttribute name is description. Maybe you need to navigate from the applied property value in the Capella model to its definition in the vpd model…
The description you are referring to is describing the definition of the attribute you are defining in the vpd file (Viewpoint definition).
Like if you were defining a “mass” attribute in a vpd file and you could read a text like “this attribute will be used on PCs to store the weight of physical components on the system”.
Why would you want to get this description?
Oh okay, I completely misunderstood the purpose of the description field in that case. I thought this description is tagged to the element (as part of the PV) the property is applied on and can be accessed through the property value while exporting for better documentation.