RENAME GROUP OF COMPONENTS

PAULO RICARDO SAENGER shared this feedback 5 years ago
Submitted

I often want to rename a group of components. However, I am required to rename one by one.


For example, "MINER - LARGE CONTAINER", "BASE - REACTORS", "BASE - HANGAR DOORS", "MINER - DRILL".

Instinctively, I select various components on the control panel and try to rename them.

Replies (1)

photo
1

I use a script I made to rename blocks, its very easy to make. Just adjust the type of block you want and the name you want. It comes with a commented modifier for the custom data too.

public Program() { }

public void Save() { }

public void Main(string argument, UpdateType updateSource)
{
    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
    GridTerminalSystem.GetBlocksOfType<IMyCargoContainer>(blocks, (b => b.CubeGrid == Me.CubeGrid));
    int count = blocks.Count;
    foreach (IMyTerminalBlock block in blocks) {
        block.CustomName = "Cargo " + (i + 1).ToString().PadLeft(count.ToString().Length, '0');
        //block.CustomDate = "Whatever you like";
    }
}

photo
1

public Program() { }

public void Save() { }

public void Main(string argument, UpdateType updateSource)
{
    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
    GridTerminalSystem.GetBlocksOfType<IMyRefinery>(blocks, (b => b.CubeGrid == Me.CubeGrid));
    int count = blocks.Count;
    for (int i = 0; i < blocks.Count; i++) {
        blocks[i].CustomName = "Refinery " + (i + 1).ToString().PadLeft(count.ToString().Length, '0');
        //block.CustomDate = "Whatever you like";
    }
}

photo
1

Very nice. But I really want a single feature, where it's not necessary use of advanced stuff.

I want select 2 or more components in the Control Painel and rename all together.

photo
Leave a Comment
 
Attach a file