public Rotor(Program parent, string name = "") { lRotor = new List <IMyMotorStator>(); if (name != string.Empty) { IMyBlockGroup group = parent.GridTerminalSystem.GetBlockGroupWithName(name); if (group == null) { IMyMotorStator block = parent.GridTerminalSystem.GetBlockWithName(name) as IMyMotorStator; if (block != null && block.IsSameConstructAs(parent.Me)) { lRotor.Add(block); } } else { group.GetBlocksOfType(lRotor, x => x.IsSameConstructAs(parent.Me)); } if (lRotor.Count == 0) { throw new Exception($"No blocks found with argument: '{name}'"); } } else { parent.GridTerminalSystem.GetBlocksOfType(lRotor, x => x.IsSameConstructAs(parent.Me)); } if (lRotor.Count == 0) { throw new Exception($"No rotors found."); } }