Lisa, that should be feasible. I think in this article it was explained, see Draw FTA diagram using javascript : Ansys medini analyze Support
In short: you have to use the factory.js to create/exchange the model, then set any configuration data on the model like:
event.probabilityData = Factory.createElement(event, Metamodel.FTA.RiskTimeProbabilityModel);event.probabilityData.lambdaDerived = true;event.represents = p1; // some part
Jan
If you already have the probabilityData, you need to delete it first with the Trashbin lib.
Trashbin.deleteElement(e.probabilityData)
Are yu sure Ka-lip? I thought it is not necessary, but okay. Lisa, maybe you can confirm or not after you get it working.
Hello Jan,
I just tried again and it did pop out an error message. When I run the script second time without using Trashbin. (Or maybe I used an old factory lib?)
// $EXPERIMENTAL$ $STRICT_MODE$ $ENHANCED_CONTAINMENT_ACCESS$ $ENHANCED_JAVA_ACCESS$load(".lib/factory.js");var event = selection[0].event;event.probabilityData = Factory.createElement(event, Metamodel.FTA.RiskTimeProbabilityModel);event.probabilityData.lambdaDerived = true;
The factory is released with the latest log below.
* v2025-03-14 - MW added support for creating security mechanisms
Thanks Ka-lip, you are absolutely right!
So bottom line for Lisa is: if the event has no custom probability modle set (event.probabilityData is null aka "Fixed Model") you simply can create a model.
If there is one, it must be destroyed upfront as Ka-lip mentioned.