.NET Selecting components by reference

In my application I require components to be selected by reference(a name or vcid) so I can transform them in the world, not using the manual select tool (ISelectionManager).

Would anyone be able to point me in the right direction on this?



You can access components from IApplication.World.Components, which is of type ISimWorld. From that list, you can find a component by name, vcid, etc. You do not need to select a component to change its location, just edit its position matrix and do a render/request a render service.

Something like this:


// get component by name
string componentName = "component name";
var component = IoC.Get<IApplication>().World.Components.FirstOrDefault(c => c.Name == componentName);
if(component != null)
    var mat = component.TransformationInWorld;
    // changes to the matrix (or create a new matrix)
    mat.Pz += 100;
    // set back the matrix
    component.TransformationInWorld = mat;