Dear all,
Is there a way of triggering the same update as when clicking on"Recompute failure rates in the selected project" by script?
Thanks!
Cheers, Andre
Andre,
there has been a dedicated script library for that purpose named frp.js which offers such a thing.
It was ever published and is still work in progress but does the job. I did not test it with latest tool versions though.
Regards
Jan
Hello Andre,
this is currently not (yet) supported.
Eckhardt
Hi Jan,
It seems to works (tested in the v2020R2).
I just found this and it seems to work in 2025R2.
If the download is not possible due to company security restrictions, please just use the code snippets attached below.
// $EXPERIMENTAL$ $STRICT_MODE$ $WARNING_AS_ERROR$/* * Copyright (c) 2016 ANSYS medini Technologies AG * All rights reserved. */load(".lib/ui.js");load(".lib/frp.js");var status = FRP.recomputeAll(finder.project);if (!status.OK) { alert(status);}
/* * Copyright (c) 2016 medini Technologies AG * All rights reserved. */if (!bind) { throw "This script requires extended API";}// bind classes (NOT OFFICIAL API YET)var RecomputeProjectFailureRatesHandler = bind( "de.ikv.analyze.failureratecatalogs", __tool_version_number < 400 ? // changed in 4.0.0 "de.ikv.analyze.failureratecatalogs.handlers.RecomputeProjectFailureRatesHandler" : "de.ikv.analyze.failureratecatalogs.handlers.RecomputeFailureRatesHandler", false);var MediniNonPublicFieldAccessor = bind( "de.ikv.medini.util.core.plugin", "de.ikv.medini.util.core.MediniNonPublicFieldAccessor", false);var MediniNumberUtil = bind( "de.ikv.medini.util.core.plugin", "de.ikv.medini.util.core.MediniNumberUtil", false);var FRP = { recomputeAll : function (project) { // we use the handler but we cannot call the handler in UI thread normally --> deadlock var handler = new RecomputeProjectFailureRatesHandler(); setHandlerSelection(handler, project); // get the operation via reflection (protected method) var getOperation = MediniNonPublicFieldAccessor.getNonPublicMethod(handler.getClass(), "getOperation"); var op = getOperation.invoke(handler); var status = op.execute(null, null); return status; }, /** * In medini, 0 is PERMANENT, 1 is TRANSIENT. * * @param {Object} * object a number (0 or 1) or an instance of FailureType * @returns */ failureType : function (object) { if (object == 1) { return Metamodel.safetyModel.FailureType.TRANSIENT.instance; } else if (object == 0) { return Metamodel.safetyModel.FailureType.PERMANENT.instance; } else if (Metamodel.safetyModel.FailureType.TRANSIENT.instance) { return 1; } else if (Metamodel.safetyModel.FailureType.PERMANENT.instance) { return 0; } else if (object instanceof number) { return undefined; } }};