197 lines
5.0 KiB
C#
197 lines
5.0 KiB
C#
using EgwProxy.MultiCncLib.CNC;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IOB_WIN
|
|
{
|
|
/// <summary>
|
|
/// Definizione indirizzo memoria FANUC
|
|
/// </summary>
|
|
public class memAddressFanuc
|
|
{
|
|
#region Public Fields
|
|
|
|
/// <summary>
|
|
/// Posizione memoria
|
|
/// </summary>
|
|
public int mPos;
|
|
|
|
/// <summary>
|
|
/// Tipo memoria
|
|
/// </summary>
|
|
public FANUC.MemType mType;
|
|
|
|
/// <summary>
|
|
/// Tipo valore
|
|
/// </summary>
|
|
public string vType;
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Inizializza da un formato stringa
|
|
/// </summary>
|
|
/// <param name="strFormat">Stringa TipoMem.Indice.DimMem (es D.1604.DW)</param>
|
|
public memAddressFanuc(string strFormat)
|
|
{
|
|
if (!string.IsNullOrEmpty(strFormat))
|
|
{
|
|
string[] memComp = strFormat.Split('.');
|
|
switch (memComp[0])
|
|
{
|
|
case "A":
|
|
mType = FANUC.MemType.A;
|
|
break;
|
|
|
|
case "C":
|
|
mType = FANUC.MemType.C;
|
|
break;
|
|
|
|
case "CM":
|
|
mType = FANUC.MemType.CM;
|
|
break;
|
|
|
|
case "D":
|
|
mType = FANUC.MemType.D;
|
|
break;
|
|
|
|
case "E":
|
|
mType = FANUC.MemType.E;
|
|
break;
|
|
|
|
case "F":
|
|
mType = FANUC.MemType.F;
|
|
break;
|
|
|
|
case "G":
|
|
mType = FANUC.MemType.G;
|
|
break;
|
|
|
|
case "K":
|
|
mType = FANUC.MemType.K;
|
|
break;
|
|
|
|
case "M":
|
|
mType = FANUC.MemType.M;
|
|
break;
|
|
|
|
case "N":
|
|
mType = FANUC.MemType.N;
|
|
break;
|
|
|
|
case "R":
|
|
mType = FANUC.MemType.R;
|
|
break;
|
|
|
|
case "T":
|
|
mType = FANUC.MemType.T;
|
|
break;
|
|
|
|
case "X":
|
|
mType = FANUC.MemType.X;
|
|
break;
|
|
|
|
case "Y":
|
|
mType = FANUC.MemType.Y;
|
|
break;
|
|
|
|
case "Z":
|
|
mType = FANUC.MemType.Z;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
int.TryParse(memComp[1], out mPos);
|
|
vType = memComp[2];
|
|
}
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
}
|
|
|
|
/// <summary>
|
|
/// Definizione area memoria FANUC
|
|
/// </summary>
|
|
public class memAreaFanuc
|
|
{
|
|
#region Public Fields
|
|
|
|
/// <summary>
|
|
/// Nome area memoria
|
|
/// </summary>
|
|
public string areaName;
|
|
|
|
/// <summary>
|
|
/// Dimensione array memoria
|
|
/// </summary>
|
|
public int arraySize;
|
|
|
|
/// <summary>
|
|
/// Indice inizio array
|
|
/// </summary>
|
|
public int startIdx;
|
|
|
|
#endregion Public Fields
|
|
}
|
|
|
|
/// <summary>
|
|
/// Definizione area memoria SIEMENS
|
|
/// </summary>
|
|
public class memAreaSiemens
|
|
{
|
|
#region Public Fields
|
|
|
|
/// <summary>
|
|
/// Indice DB
|
|
/// </summary>
|
|
public int DbNum = 0;
|
|
|
|
/// <summary>
|
|
/// Indice partenza memoria (es DBD0 --> 0)
|
|
/// </summary>
|
|
public int indiceMem = 0;
|
|
|
|
/// <summary>
|
|
/// Tipo Memoria (DBD, DBW...)
|
|
/// </summary>
|
|
public string tipoMem = "";
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Inizializza da un formato stringa
|
|
/// </summary>
|
|
/// <param name="strFormat"></param>
|
|
public memAreaSiemens(string strFormat)
|
|
{
|
|
if (!string.IsNullOrEmpty(strFormat))
|
|
{
|
|
string[] memComp = strFormat.Split('.');
|
|
int.TryParse(memComp[0].Replace("DB", ""), out DbNum);
|
|
//tipoMem = memComp[1].Substring(2, 1);
|
|
tipoMem = "";
|
|
for (int i = 0; i < memComp[1].Length; i++)
|
|
{
|
|
if (char.IsLetter(memComp[1][i]))
|
|
{
|
|
tipoMem += memComp[1][i];
|
|
}
|
|
}
|
|
// rimuovo DB iniziale..
|
|
tipoMem = tipoMem.Replace("DB", "");
|
|
// ciclo x trovare SOLO stringa
|
|
int.TryParse(memComp[1].Replace("DB", "").Replace(tipoMem, ""), out indiceMem);
|
|
}
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
}
|
|
} |