Space Engineers Programming - Horizontal and Vertical self adjusting panels with pure C# scripting (No Mods!)

I was introduced to Space Engineers, this awesome game by NeoTheHitman ! Thanks

After learning all about it I ran across these programmable blocks, that are C# scripts so to call it. Me being a C# Pro by day, this seemed like a perfect match for mixing work with pleasure!

It took me a while to understand the API, and still it is in a pre-release stage so not everything is obvious or well documented. Neo gave me the idea to write a simple script to adjust one panel and then he challenged me to do it with Horizontal and Vertical panels. And here we are, a pure in game script to do this.


  • You can only do this on Large ships or Stations at the moment. Programming is not enabled for small ships yet.
  • Name your motors(rotors) motorH and motorV
  • Attached to the motors name the panels panelH and panelV respectively
  • You can use either one it doesn't matter as the script checks if the motor exists so its doesn't throw an null reference exception.
  • Build a programmable block and a timer block on the ship or station. Names don't matter.


Here is the code you will put into the programmable block

int panelRotationsH = 0;
int panelRotationsV = 0;

void Main() 
    IMySolarPanel panelV = GridTerminalSystem.GetBlockWithName("panelV") as IMySolarPanel; 
    IMySolarPanel panelH = GridTerminalSystem.GetBlockWithName("panelH") as IMySolarPanel; 

    IMyMotorStator motorV = GridTerminalSystem.GetBlockWithName("motorV") as IMyMotorStator; 
    IMyMotorStator motorH = GridTerminalSystem.GetBlockWithName("motorH") as IMyMotorStator; 
    int powerOutputV = -1;  
    int powerOutputH = -1;  

    if (panelV != null && panelRotationsV < 69){    
        powerOutputV = GetPanelPower(panelV);
        if (powerOutputV >= 70) { 
            panelRotationsV = 0;
        else { 
            panelRotationsV = 0;
        panelRotationsV += 1;

     if (panelH != null && panelRotationsH < 69){
        powerOutputH = GetPanelPower(panelH);        
        if (powerOutputH >= 70)  { 
            panelRotationsH = 0;             
        else  { 
            panelRotationsV = 0;
        panelRotationsH += 1; 
public int GetPanelPower(IMySolarPanel panel) 
    var _d = panel.DetailedInfo;  
    string _power = _d.Split(new string[] {"\n"}, StringSplitOptions.None)[1].Split(' ')[2]; //Checking the MAX Output 
    int _powerOutput = Convert.ToInt32(Math.Round(Convert.ToDouble(_power)));   
    return _powerOutput; 
public void RotatePanel(IMyMotorStator motor, int maxSpeed)
   if (motor.Velocity < maxSpeed)  

Timer block

  • Set the timer to 1 second. 
  • In the objects menu, first select the programming block and tell it to Run, then after that set THIS timer block to Run (effectively repeats every second)
  • Exit the menu and click run for the first time. It will repeat now.


Allot of thank to the Keen Software House forum where I could pick through examples using this page but also using the Advanced Programming document from Space Engineers.

I think you can do this script per ship and station. I have not tested if the names clash.

You can stack more panels on top of each other if they are in the same orientation. At least one panel must have the name panelH/panelV as the rest will have similar values.