//Sätt verktyg till:
if ((Evar == null))

{

  exec.AddStatusmessage("Parameters: E<tool>");

  return;

}

 

int Newtool = Convert.ToInt32(Evar);

//int Newtool = 1;

exec.Setcurrenttool(Newtool); //Set the current tool -> the new tool

int CurrentTool = Newtool; //Hämta nuvarande verktyg
string CurrentToolString = CurrentTool.ToString(); //Konvertera till string
exec.Writekey("JB CNC", "CurrentTool", CurrentToolString); //Skriv till profil

exec.Code("G43 H" + Newtool); // Load new tool offset 

while(exec.IsMoving());