Setting ID of a node in one model to another node in another model ?
Hi all,
I have a model A with list of nodes and model B with a list of nodes .
I take a node in model A and one in model B , i want to set the node id of node in model A as same as in Model B
Currently , i using node.setID() method to set the ID , but it is throwing an exception stating
can't set id to registered node .
Is there any way to do this ?Any help would be really appreciated .Thanks
Regards ,
Vignesh M
Please sign in to leave a comment.
I think you can set a node ID only before the node is part of a model. Have you tried to "detach" the node before changing the id and then adding it to the parent again? Not sure if this would work, but it feels like a kludgy solution I wouldn't really recommend.
What is your use case, exactly? Why would you want both nodes to have the same ID? Feels like there might be another way to what you actually try to achieve then changing a node's identity. I would shy away from such operations since I think it is hard to tell what the side effects would be...
Hi Robert ,
I created a copy of that node and set the id for it , since the copied node was not in the model , it was working. Actually my use case was to preserve the id of both nodes in their respective models , because when i transfer some contents of one model to another reference was breaking.One of the models is actually a temporary model.
Thanks for your help :)
Regards ,
Vignesh M