Assume you have imported a large BOM into your medini project. All elements have been correctly typed and inherited a set of variables from their type, depending on the used reliability catalog of course and only if those variables have been set to "Derived" at the type. Lets assume further that you plan to not set them at each element instance but instead just once at the container, e.g. a PCB or just a virtual container. Clicking through the BOM and checking each variable as "Derived" is painful. And here the attached script helps: it sets all variables in all selected elements to "Derived".
Note the following part:
// only handle parts
if (element.prototype != Metamodel.sysml.SysMLPart) {
return;
}
This part ensures that only Elements in the selection get modified. You may use this script as a blueprint for other similar use cases.