Getting INote text from an ISimComponent

I am trying to make a text updater/replacer for the notes in components. We have a lot of similar modules, but they are currently updated by hand, 80-120 components with 4-76 text updates. So it is a lot of manual work. Any ideas are welcome. I have the IApplication, ISimWorld, and ISimComponents List to work with, but I am not sure how to check for the Note being attached to the component.

I think you could loop through all ISimComponent and check the Behaviours if there are any behaviors with Type Note.
This should give you a list of all the notes in all your components. Then you can access the Note property of the INote behavior, and update the text as a string.

Thanks for the reply. I will try this out hopefully today or tomorrow. :smiley:


I think it is working to change a component, but I am now stuck placing that component in the Components (ReadOnlyCollection) of the world (ISimWorld). Do you know how to perform this step?

If the component is not in that collection, try getting the root node of the component then use ISimNode.AttachTo() to attach that node to ISimWorld world node. But the Sim World should know all components in the world, so not sure is why the component would not be in that list.

My understanding is that the Components (ReadOnlyCollection) is not modifiable and therefore I would not be able to perform updates to the INote Behavior within that list. So my plan was to create a duplicate list which I will modify and then replace the Components Collection with the updates.

Component list is read only, but the component isn’t, you can access the component to overwrite INote.

1 Like