Jun 17, 2018, 4:30 PM

Hi Elisa,

The SBNode::IsType class is a node predicate (i.e. a class with a member function bool operator()(SBNode*)) that checks the enum returned by the SBNode::getType() function and compares it to the type passed to the constructor of SBNode::IsType. The list of node types is predefined and you cannot change it at the moment (since SBNode::Type is an enum).

One possibility might be to hack the system: you can try to overload the getType function of your node to write something like

SBNode::Type MyNode::getType() const { return (SBNode::Type)3216546; // return a unique identifier for this node type }

I'm not sure this is gonna work on all compilers (will the cast convert the number to another one?). Moreover, you don't know what other developers are going to do, and if your SAMSON Element is used in conjunction with one that also adopts this hack and, unfortunately, because of bad luck you use the same identifier, then this might create issues.

Normally, it seems you should be able to use other existing node predicates. For example, a SAMSON Element UUID is supposed to be unique (this is imposed on SAMSON Connect), and the name of an exposed class inside a SAMSON Element is unique as well. So the pair (class name, element UUID) should be unique. Thus, you should be able to find your nodes with something like this:

SBMStructuralModelNodeRoot* root = getStructuralRoot();
SBNodeIndexer nodeIndexer;
root->getNodes(nodeIndexer, (SBNode::GetClass() == std::string("MyNode")) && (SBNode::GetElementUUID() == SBUUID("F03D2ED2-C93B-C86E-C66E-01A776229839")));

Hope this helps. If you indeed need to write new predicates let me know and I'll give some details.

Stephane