@tig said:
You can also do it without Ruby...
Try this way...
In the model select the component instances you want to be replaced - either by manually picking them (in which case they can even be a mixture of several types) OR by using the Component Browser (model-tab) and then right-clicking over the definition's icon that you want to have selected and pick 'Select Instances' - that way all of its active instances are selected.
Now use the Component Browser - either in the model-tab to use components that are already within the model, or from any other 'external' location for components that are currently not yet loaded into the project - again you right-click over the definition's icon that you want 'to add' and pick 'Replace Selected'.
Now the components you selected have been replaced by the component you wanted...
It's possible to script it BUT it might be as easy to do it this way... There are already several component swapping scripts too...
It can be done using the Component Browser, but when you have lots of components, it can be easier to select a desired component on-screen rather than hunting through the browser. Though I wrote ApplyTo before the Component Browser offered that functionality, it retains its relevance for this reason.