How to "Apply" existing PVGs and Property values to Capella elements that contain them?

Hello,
First of all, thanks for all the answers and help. I hope my feedback/questions can help back in debuging/testing… etc somehow.

Subject:
I just noticed something: the fact that a capella element “CONTAINS” a property value group or property value, does not mean necessarily that those pvgs and properties are APPLIED to that element.
Example:

Is there a function to apply on a variable holding a “property value group” (python object or java object) that can make it “applied” to another variable holding the capella element (for instance here a Component Exchange)?

Thanks a lot

Hi all,
My understanding is following:
When PV/PVG is under an item, this item owns it: this is a property of this item relating to its own build, this is an entry from design engineering or other stake holder.
When a PV/PVG applies to an item, this means that we state that the property drives the functional and logical design. This is then a system engineering decision or at least deduction. When we return our model to product design, the property or its conterparts has to be fulfilled by the product playing an applying PCN or even PL.
Regards
Thierry Poupon

1 Like

I love the way you explain everything with a system modeling mindset.
(Please remind me what is PCN)

The question I am struggling with is, how do you “apply” them with Python 4 Capella? I don’t want to do it manually → Open “extensions” tab → clic on the “+” button → choose the PVG/PV you are targeting.

I would like to know how to go from 2 variables:

  • Variable 1= a Capella Element (Component Exhange here)
  • Variable 2= The PVG

And then do this:
Variable1.applyPVG(Variable2)

Is there any function or Capella Query that does that?

You should be able to do this:

variable1.get_owned_property_value_groups().add(variable2)

You might also want to check the PVMT.py for more property value methods.

No that’s not the same thing Yvan, that code you shared is exactly the one I used, and its “adds” the element, but does not “apply” it:

Yes that only the first step, you are right. Then you will need:

variable1.get_applied_property_value_groups().add(variable2)

This should set the applied reference. Not you also have get_applied_property_value() for values.

1 Like