/// <summary> /// ReadServo Load and Current Details on All axis /// </summary> /// <param name="current">Current in Amp</param> /// <returns>Servo Load</returns> public static string ReadServoLoadCurrentDetails(ushort handle, out string current) { current = string.Empty; string buff = ""; //string sb = ""; string DL = "#"; short[] types = { 0, 1, 2 }; /* * cls = 2 (Servo) * type = 0 : Servo load meter * 1 : Load current (% unit) * 2 : Load current (Ampere unit) */ short MAX_AXIS = FocasLibBase.MAX_AXIS; short len = MAX_AXIS; FocasLibBase.ODBAXDT odbaxdt = new FocasLibBase.ODBAXDT(); List <string> pos = new List <string>(); //1st parameter - Position(=1), Servo(=2), Spindle(=3) //4th parameter - After execution, "(*len)" will have the actual number of axes. short ret = FocasLib.cnc_rdaxisdata(handle, 2, types, (short)types.Length, ref len, odbaxdt); if (ret == 0) { MAX_AXIS = len; get_actual_axis_value(odbaxdt, ref pos, len, types.Length); int i; //Servo load meter for (i = 0 * MAX_AXIS; i < 0 * MAX_AXIS + len; i++) { buff += pos[i]; buff += ","; } buff += DL; // Load current (% unit) for (i = 1 * MAX_AXIS; i < 1 * MAX_AXIS + len; i++) { buff += pos[i]; buff += ","; } buff += DL; //Load current (Ampere unit) for (i = 2 * MAX_AXIS; i < 2 * MAX_AXIS + len; i++) { buff += pos[i]; buff += ","; current += pos[i]; current += ","; } } return(buff); }