I have a HW model with ca. 2k components that I've developed a FMEDA with a number of entries in the "Comments on this failure" column. I've derived a new HW model off this original and the FMEDA, but my notes are largely lost with the new derived FMEDA. I'd like to programmatically move the notes over. To this end, I've been working with the JS capability.
I am new to scripting with medini, but haven't found anything to help me with this problem. I've gotten to the point that I can obtain the notes from a selected failure mode from the first FMEDA, but I'm not able to see the Failure Mode name or the container that Failure Mode is in.
// select parts
if (selection && selection.length && selection[0] instanceof Metamodel.dc.DCFailureModeEntry) {
var elements = Global.getFinder(selection).findByType(Metamodel.dc.DCFailureModeEntry);
if (elements.isEmpty()) {
console.error("No elements to proceed - bail out");
}
console.log("Found {0} elements", elements.size());
}
// Iterate over elements
elements.forEach(function reportComment(element) {
if (element instanceof Metamodel.dc.DCFailureModeEntry){
console.log("element: {0}", element.name);
console.log("comment: {0}", element.user_comment);
console.log("parent: {0}", element.mediniGetContainer());
}
});
I figure that I will need this information in order to move the notes to the second FMEDA.
The element name is returned as DCFailureModeEntry and the parent name is returned as DCComponentEntry
I'd like to know:
- Why I cannot see the names for the element's name or the parent's name?
- Is there an easy way to copy these notes over from one FMEDA to another once?
For question 2 I'm wondering if the approach I'm taking is even worth the effort.
Using 2023.R1