Aggiunta gestione codici G (modali) - esistono non modali? refresh codice collegato...

This commit is contained in:
Samuele E. Locatelli
2017-04-24 18:35:44 +02:00
parent 974965c507
commit df04b0149d
5 changed files with 134 additions and 129 deletions
@@ -958,6 +958,10 @@ Namespace CNC
Return True
End Function
Public Overridable Function getPathGCodeMod(ByRef GCodeCurr As UShort()) As Boolean
Return True
End Function
#End Region
End Class
@@ -1094,7 +1094,6 @@ Retry: nRetry += 1
End Try
End Function
Public Overloads Overrides Function getAllAxisPos(tipoPos As Int16, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
' RIFERIMENTO:
' CndexLinkUser.pdf | pag 146, 266
@@ -1114,7 +1113,7 @@ Retry: nRetry += 1
myGetAxesPosition.Select = tipoPos
myGetAxesPositionR = OPENws.GetAxesPosition(myGetAxesPosition)
If O_CheckRetError(myGetAxesPositionR.retval, myGetAxesPositionR.ErrClass, myGetAxesPositionR.ErrNum, "ReadCurrentAnomalyMsg() O_ReadCurrentAnomalyMsg CNC.OSAI_OPEN", szReturn) Then
If O_CheckRetError(myGetAxesPositionR.retval, myGetAxesPositionR.ErrClass, myGetAxesPositionR.ErrNum, "GetAxesPosition() getAllAxisPos CNC.OSAI_OPEN", szReturn) Then
Throw New CmsNcException(szReturn)
Return False
End If
@@ -1128,6 +1127,72 @@ Retry: nRetry += 1
End Try
End Function
Public Overloads Overrides Function getPathGCodeMod(ByRef GCodeCurr As UShort()) As Boolean
' RIFERIMENTO:
' CndexLinkUser.pdf | pag 165
Dim szReturn As String = ""
Dim myGetGCodeR As OPENcontrol.GetGCodeR
Dim myGetGCode As New OPENcontrol.GetGCode
Dim ProcessId As Short
Dim nRetry As Integer
Retry: nRetry += 1
Try
O_GetSelectedProcess(ProcessId)
myGetGCode.ProcNum = ProcessId
myGetGCodeR = OPENws.GetGCode(myGetGCode)
If O_CheckRetError(myGetGCodeR.retval, myGetGCodeR.ErrClass, myGetGCodeR.ErrNum, "ReadCurrentAnomalyMsg() O_ReadCurrentAnomalyMsg CNC.OSAI_OPEN", szReturn) Then
Throw New CmsNcException(szReturn)
Return False
End If
GCodeCurr = myGetGCodeR.GCode
Return True
Catch ex As System.ServiceModel.CommunicationException
If nRetry < MAXRET Then GoTo Retry
Throw New CmsNcException(ex.Message)
Return False
End Try
End Function
#If False Then
Public Function getPathGCode1Shot() As Focas1.ODBGCD
' RIFERIMENTO:
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
Dim nPathIdx As Integer
Dim nNumAxisRead As Integer
Dim nReturn As Integer
Dim actGCode As Focas1.ODBGCD
' inizializzo
actGCode = New Focas1.ODBGCD
'leggo il numero del processo attivo
nPathIdx = GetActivePath()
'leggo num max assi dal cn
nNumAxisRead = Focas1.MAX_AXIS
If Is30Series Then
' leggo tutto!!! 0-27 (28 elementi)
nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -2, 1, 4, actGCode)
If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib") Then
Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib")
End If
End If
Return actGCode
End Function
#End If
#If False Then
Public Function getAllAxisLoad() As Focas1.ODBSVLOAD
@@ -1259,67 +1324,7 @@ Retry: nRetry += 1
End Function
Public Function getPathGCodeMod() As Focas1.ODBGCD
' RIFERIMENTO:
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
Dim nPathIdx As Integer
Dim nNumAxisRead As Integer
Dim nReturn As Integer
Dim actGCode As Focas1.ODBGCD
' inizializzo
actGCode = New Focas1.ODBGCD
'leggo il numero del processo attivo
nPathIdx = GetActivePath()
'leggo num max assi dal cn
nNumAxisRead = Focas1.MAX_AXIS
If Is30Series Then
' leggo tutto!!! 0-27 (28 elementi)
nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -1, 1, 37, actGCode)
If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib") Then
Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib")
End If
End If
Return actGCode
End Function
Public Function getPathGCode1Shot() As Focas1.ODBGCD
' RIFERIMENTO:
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
Dim nPathIdx As Integer
Dim nNumAxisRead As Integer
Dim nReturn As Integer
Dim actGCode As Focas1.ODBGCD
' inizializzo
actGCode = New Focas1.ODBGCD
'leggo il numero del processo attivo
nPathIdx = GetActivePath()
'leggo num max assi dal cn
nNumAxisRead = Focas1.MAX_AXIS
If Is30Series Then
' leggo tutto!!! 0-27 (28 elementi)
nReturn = Focas1.cnc_rdgcode(nLibHandle(nPathIdx), -2, 1, 4, actGCode)
If F_CheckRetError_Cnc(nReturn, "cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib") Then
Throw New CmsNcException("ERR cnc_rdgcode RefreshPathGCode CNC.FANUC.CMS_CncLib")
End If
End If
Return actGCode
End Function
Public Function getPathTTCoord() As Focas1.ODB5AXMAN
' RIFERIMENTO:
+17 -16
View File
@@ -1713,8 +1713,9 @@ namespace MTC_Adapter
adpRunning = false;
// chiudo!
parentForm.resetProgBar();
parentForm.dataMonitorSx = "... not connected, waiting for data ...";
parentForm.dataMonitorDx = "...";
parentForm.dataMonitor_1 = "... not connected, waiting for data ...";
parentForm.dataMonitor_2 = "";
parentForm.dataMonitor_3 = "";
parentForm.displayTaskAndWait("Adapter Stopped.");
}
@@ -2611,7 +2612,7 @@ namespace MTC_Adapter
// salvo su maschera...
StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format("ACC_TIME: {0}", mAccTime.Value));
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
// ...aggiorno valore riferimento...
contOreMaccOn = istOreMaccOn;
@@ -2638,7 +2639,7 @@ namespace MTC_Adapter
// salvo su maschera...
StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format("ACC_TIME_WORK: {0}", mAccTimeWork.Value));
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
// ...aggiorno valore riferimento...
contOreMaccLav = istOreMaccLav;
@@ -2665,7 +2666,7 @@ namespace MTC_Adapter
// salvo su maschera...
StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format("SlittaTastatore_Count: {0}", mSlittaTast.Value));
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
// ...aggiorno valore riferimento...
contSlittaTast = istSlittaTast;
@@ -2764,7 +2765,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettPath[i].mPathPartCount.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2794,7 +2795,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettUnOp[i].mUnOpAccTime.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2824,7 +2825,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettUnOp[i].mUnOpNumCU.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2854,7 +2855,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettAxis[i].mAxDistDone.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_3 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2883,7 +2884,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettAxis[i].mAxAccTime.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_3 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2913,7 +2914,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettAxis[i].mAxInvDDone.Value);
}
// salvo su maschera...
parentForm.dataMonitorDx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_3 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2943,7 +2944,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettVacPump[i].mVacPumpWrkTime.Value);
}
// salvo su maschera...
parentForm.dataMonitorSx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -2973,7 +2974,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettVacAct[i].mVacActCount.Value);
}
// salvo su maschera...
parentForm.dataMonitorSx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -3003,7 +3004,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettLubro[i].mLubroNum.Value);
}
// salvo su maschera...
parentForm.dataMonitorSx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -3033,7 +3034,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettSlittaMag[i].mSlittaMagCount.Value);
}
// salvo su maschera...
parentForm.dataMonitorSx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
@@ -3063,7 +3064,7 @@ namespace MTC_Adapter
outString += string.Format("{0} | ", vettProtMag[i].mProtMagCount.Value);
}
// salvo su maschera...
parentForm.dataMonitorSx += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
+41 -46
View File
@@ -1131,6 +1131,10 @@ namespace MTC_Adapter
public override void getGlobalData()
{
base.getGlobalData();
// svuoto...
parentForm.dataMonitor_1 = "";
parentForm.dataMonitor_2 = "";
parentForm.dataMonitor_3 = "";
// accodo dati path in DataMonitor......
StringBuilder sb = new StringBuilder();
@@ -1194,8 +1198,7 @@ namespace MTC_Adapter
allarmiCNC = new CMSCncLib.OPENcontrol.MSGERROR();
}
parentForm.dataMonitorSx = sb.ToString();
parentForm.dataMonitorDx = "";
parentForm.dataMonitor_1 = sb.ToString();
// gestisco lettura dati manutenzione da PLC...
getMtzDataFromPlc();
@@ -1343,7 +1346,7 @@ namespace MTC_Adapter
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, alarmText, allarme.CodeErr.ToString(), "", "");
// mostro in form!
sb.AppendLine(alarmText);
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
}
catch (Exception exc)
{
@@ -1539,46 +1542,25 @@ namespace MTC_Adapter
public override void getPath()
{
// NON richiamo metodo base... ma faccio override qui (e altrove...)
checkPath();
#if false
// recupero vettore generale G MODE
inizio = DateTime.Now;
CMSCncLib.Focas1.ODBGCD vettGCodes = OSAI_ref.getPathGCodeMod();
ushort[] vettGCodes= new ushort[14];
OSAI_ref.getPathGCodeMod(ref vettGCodes);
if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
// attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535
string GCodAttivi = "";
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd0.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd1.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd2.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd3.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd4.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd5.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd6.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd7.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd8.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd9.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd10.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd11.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd12.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd13.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd14.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd15.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd16.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd17.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd18.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd19.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd20.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd21.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd22.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd23.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd24.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd25.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd26.code);
GCodAttivi += string.Format("[{0}]", vettGCodes.gcd27.code);
for (int i = 0; i < vettGCodes.Length; i++)
{
// se il valore è < di UShort.max (65535)...
if (vettGCodes[i] < ushort.MaxValue)
{
GCodAttivi += string.Format("[G{0}]", vettGCodes[i]);
}
}
// NON ci sono nella documentazione GCode OneShot, verificare con Andrea...
#if false
inizio = DateTime.Now;
vettGCodes = OSAI_ref.getPathGCode1Shot();
if (utils.CRB("recTime")) TimingData.addResult("R-GCodOneShot", DateTime.Now.Subtract(inizio).Ticks);
@@ -1587,40 +1569,53 @@ namespace MTC_Adapter
if (vettGCodes.gcd2.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd2.code);
if (vettGCodes.gcd3.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd3.code);
#endif
#if false
inizio = DateTime.Now;
CMSCncLib.Focas1.ODB5AXMAN vettTTCoord = OSAI_ref.getPathTTCoord();
if (utils.CRB("recTime")) TimingData.addResult("R-TTCoord", DateTime.Now.Subtract(inizio).Ticks);
#endif
// cicl su path
StringBuilder sb_2;
StringBuilder sb_3;
for (int i = 0; i < currAdpConf.nPath; i++)
{
// accodo dati path in DataMonitor......
StringBuilder sb = new StringBuilder();
// accodo dati path in DataMonitor...
sb_2 = new StringBuilder();
sb_3 = new StringBuilder();
vettPath[i].mPathCodG_Act.Value = GCodAttivi;
#if false
vettPath[i].mPathPosActX.Value = ((decimal)vettTTCoord.data1) / utils.CRI("fattdecimale");
vettPath[i].mPathPosActY.Value = ((decimal)vettTTCoord.data2) / utils.CRI("fattdecimale");
vettPath[i].mPathPosActZ.Value = ((decimal)vettTTCoord.data3) / utils.CRI("fattdecimale");
vettPath[i].mPathPosActI.Value = ((decimal)vettTTCoord.c1) / utils.CRI("fattdecimale");
vettPath[i].mPathPosActJ.Value = ((decimal)vettTTCoord.c2) / utils.CRI("fattdecimale");
vettPath[i].mPathPosActK.Value = "0"; // è 5 assi...nullo...
vettPath[i].mPathPosActK.Value = "0"; // è 5 assi...nullo...
#endif
// 2017.01.16 da rivedere
vettPath[i].mPathCurrProgRowNum.Value = "";
vettPath[i].mPathActiveAxes.Value = "";
sb.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, vettPath[i].mPathCurrProg.Value));
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, vettPath[i].mPathCurrProg.Value));
sb_3.AppendLine(string.Format("Path {0}, GCodes: {1}", i + 1, GCodAttivi));
#if false
sb.AppendLine(string.Format("Path {0}, Asse 1: {1:N3}", i + 1, ((decimal)vettTTCoord.data1) / utils.CRI("fattdecimale")));
sb.AppendLine(string.Format("Path {0}, Asse 2: {1:N3}", i + 1, ((decimal)vettTTCoord.data2) / utils.CRI("fattdecimale")));
sb.AppendLine(string.Format("Path {0}, Asse 3: {1:N3}", i + 1, ((decimal)vettTTCoord.data3) / utils.CRI("fattdecimale")));
sb.AppendLine(string.Format("Path {0}, Cent 1: {1:N3}", i + 1, ((decimal)vettTTCoord.c1) / utils.CRI("fattdecimale")));
sb.AppendLine(string.Format("Path {0}, Cent 2: {1:N3}", i + 1, ((decimal)vettTTCoord.c2) / utils.CRI("fattdecimale")));
parentForm.dataMonitor += sb.ToString();
}
sb.AppendLine(string.Format("Path {0}, Cent 2: {1:N3}", i + 1, ((decimal)vettTTCoord.c2) / utils.CRI("fattdecimale")));
#endif
parentForm.dataMonitor_2 += sb_2.ToString();
parentForm.dataMonitor_3 += sb_3.ToString();
}
}
public override void getAxis()
@@ -1722,7 +1717,7 @@ namespace MTC_Adapter
}
}
parentForm.dataMonitorDx += sb.ToString();
parentForm.dataMonitor_3 += sb.ToString();
}
}
}
+4 -4
View File
@@ -1143,7 +1143,7 @@ namespace MTC_Adapter
allarmiCNC = new CMSCncLib.Focas1.ODBALMMSG2();
}
parentForm.dataMonitorSx = sb.ToString();
parentForm.dataMonitor_1 = sb.ToString();
// gestisco lettura dati manutenzione da PLC...
getMtzDataFromPlc();
@@ -1314,7 +1314,7 @@ namespace MTC_Adapter
}
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
}
/// <summary>
/// procedura di lettura (Multipla) dati da memoria x caricare dati utensile
@@ -1536,7 +1536,7 @@ namespace MTC_Adapter
sb.AppendLine(string.Format("Path {0}, Cent 1: {1:N3}", i + 1, ((decimal)vettTTCoord.c1) / utils.CRI("fattdecimale")));
sb.AppendLine(string.Format("Path {0}, Cent 2: {1:N3}", i + 1, ((decimal)vettTTCoord.c2) / utils.CRI("fattdecimale")));
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
}
}
@@ -1655,7 +1655,7 @@ namespace MTC_Adapter
//vettAxis[i].mAxBattery.Value = AxData.AxisBattery;
}
parentForm.dataMonitorSx += sb.ToString();
parentForm.dataMonitor_1 += sb.ToString();
}
}
}