Specify PV kind when it's created

Hi all,
First of all thanks for python4capella. I’m working to create PVG, PV with the values read from file, for that I used the commands :

pc = PhysicalComponent()
pvg = PropertyValueGroup()
pv = PropertyValue()

when creating the default PVs they’re of kind StringPropertyValue, which I’d like to change to another type (either EnumerationPropertyValue, BooleanPropertyValue, etc.). Does anyone know how to specify the kind of PV when it’s created in python4capella ?.
Another question I have is that when I create new component I’d like to reuse existing PVGs, PVs like SafetyLevel and not create new PVGs. How can I apply an existing PVGs,PVs to a newly created component ?
Thank you!

Thank you.

You can create different types of property value:

pv = PropertyValue(None, “StringPropertyValue”)

Is the default value but you can use: “BooleanPropertyValue”, “EnumerationPropertyValue”, “FloatPropertyValue”, “IntegerPropertyValue”, or “StringPropertyValue”.

To get the existing property value group, I think you first need to connect your PhysicalComponent to your model and then use get_applied_property_value_groups(). But I’m not sure…

Thanks Yvan for your replay. I confirm that it works using pv = PropertyValue(None, “StringPropertyValue”)