Adding node reference

Hi,

I’m trying to understand how can I use SetAndObserveNodeReferenceID().

For example I have a model node and a markups node.
The markups node is some kind of a “child” node of a model and and it is going to be located under a model node within subject hierarchy module.

I would like to keep relative position (relative to the model node) of markups node to be constant.
Thus whenever model/markups node gets transformed I need to apply the same transform to the markups/model node.

I understand that I can use SetAndObserveNodeReferenceID("MyRole", "markups node Id") but I dont understand where to process the events?
I have some experience of working with vtk observers and vtk callback command and I guess there should be some method/function that I need to implement…

You could try to investigste this usecase:

Source:

I would interested in knowing how did you solve it at the end.

Thank you

1 Like

Thank you for the example,

For now I decided to postpone this and use AddNodeReferenceID without observing any events.

Probably later I will try to refer to the problem once again.

Moving nodes together is very easy, just set the same parent transform to all of them. If you want to have a fixed relative transform between them then add the relative transform as a transform node, use the commom transform node as parent, and set this transform node as parent for the second model node.

SomeNode.SetAndOvserveNodeReferenceID(otherNode) will notify the SomeNode if otherNode is modified. No other classes will be notified. If you want to observe changes in otherNode outside of SomeNode then you can add an observer directly using AddObserver.

1 Like