How do I create a MTBF object via flexscript?
How do I create a MTBF object via flexscript?
To add a new MTBF object to the toolbox you can use this line of FlexScript
treenode table = applicationcommand("addmtbfmttr");
If you want to configure the tool at all it gets a little more tricky. We don't currently have a nice API for configuring the MTBF, although we are hoping to add one down the road. You can still do everything through FlexScript, but nothings documented or very discoverable at the moment.
If you want to add new members to the tool you would use code like this:
treenode obj = model().find("Processor1"); treenode members = getvarnode(table, "members"); treenode timetables = getvarnode(obj,"timetables"); createcoupling(members, timetables); members.last.name = obj.name; timetables.last.name = table.name;
If there are any other things you want to configure through code we can help you find the needed code.
Thanks,
A follow up question :
treenode table = applicationcommand("addmtbfmttr");
opens up the pop up window. How do I close it using flex script?
Add a 1 as a second parameter if you don't want the properties window to open:
applicationcommand("addmtbfmttr", 1)
The code to add the coupling gives me an error on the last two lines
exception: FlexScript exception: Property "last" accessed on invalid node. at MODEL:/Tools/UserCommands/addBreakDowns/code
exception: FlexScript exception: Property "last" accessed on invalid node. at MODEL:/Tools/UserCommands/addBreakDowns/code
exception: FlexScript exception: Property "last" accessed on invalid node. at MODEL:/Tools/UserCommands/addBreakDowns/code
exception: FlexScript exception: Property "name" accessed on invalid node. at MODEL:/Tools/UserCommands/addBreakDowns/code
how do I resolve this?
9 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved