question

Sergio V6 avatar image
0 Likes"
Sergio V6 asked Sergio V6 edited

How create subnodes using DLL Maker

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!



FlexSim 21.2.3
developmentc++dllmaker
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Sergio V6 commented

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");
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sergio V6 avatar image Sergio V6 commented ·
Thank you Phil, it worked!
0 Likes 0 ·