How create subnodes using DLL Maker

How create subnodes using DLL Maker

sergio_v6
Not applicable
32 Views
2 Replies
Message 1 of 3

How create subnodes using DLL Maker

sergio_v6
Not applicable

[ FlexSim 21.2.3 ]

I want to create a subnode using DLL Maker, using flexscript is like this:

treenode node = node("MODEL:/Tools");
node.subnodes.add();
node.subnodes[node.subnodes.length].name = "MTBFMTTR";

There is a command in c++ DLL Maker (like CreateInstance()) that i can use to do this?

Thanks and regards!



0 Likes
Accepted solutions (1)
33 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

This is the FlexScript API reference: FlexScript Class Reference (flexsim.com)

The FlexScript API is not accessible in C++ using the DLL Maker.

If you are using the DLL Maker, use the global Command Reference: Alphabetical Command Index (flexsim.com)

Those functions are visible to both FlexScript and C++.

To add a node, use nodeinsertinto() or nodeinsertafter(). To create an instance of a class object, use createinstance().

Your FlexScript code above would be the following C++ code in the DLL Maker:

treenode node = node("MODEL:/Tools");
nodeinsertinto(node);
setname(rank(node, content(node)), "MTBFMTTR");

or more succinctly:

setname(nodeinsertinto(node("MODEL:/Tools")), "MTBFMTTR");

or cleaner:

treenode toolNode = node("MODEL:/Tools");
treenode newNode = nodeinsertinto(toolNode);
setname(newNode, "MTBFMTTR");


Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 3 of 3

sergio_v6
Not applicable
Thank you Phil, it worked!
0 Likes