Compare commits

..

7 Commits

Author SHA1 Message Date
Nicola Pievani bb932788f9 Aggiornamento versione 2.6f1 2024-06-03 13:11:25 +02:00
Nicola Pievani 4c0da9af53 Merge branch 'develop' 2024-06-03 13:00:43 +02:00
Nicola Pievani 9eaca47566 Merge branch 'Features/Select_Test_Work_Tool' into develop 2024-06-03 12:45:45 +02:00
Nicola Pievani 7c53ecceb4 Correzione lettura punto da laser/lama SingleCut 2024-06-03 12:44:47 +02:00
Nicola Pievani 9d9e184efa Modifiche per lettura variabili Sinumerik 2024-05-09 14:43:43 +02:00
Nicola Pievani cf3f756683 Inizio nuova gestione controllo Sinumerik 2024-05-07 16:15:14 +02:00
Nicola Pievani 72544190cc Inserito logo Egalware nelle risosre 2024-04-23 10:07:03 +02:00
12 changed files with 447 additions and 92 deletions
@@ -72,6 +72,11 @@ Public Class ControlsMachineButtonUC
If Not IsNothing(ButtonToAdd) Then m_ButtonList.Add(ButtonToAdd)
End If
End While
For Each MachineButton As MachineButton In m_ButtonList
GetTypeButton(MachineButton)
Next
NotifyPropertyChanged("ButtonList")
End If
End Sub
@@ -81,6 +86,21 @@ Public Class ControlsMachineButtonUC
' i segeunti metodi notificano il cambiamento di stato di specifici bottoni
'-------------------------------------------------------------------------------
Friend Sub GetTypeButton(CurrMachineButton As MachineButton)
Dim BtnType As Type = CurrMachineButton.GetType
If BtnType Is GetType(NoStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(0) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(TwoStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(1) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(ThreeStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(2) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(DoubleCommandButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(3) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(PressedCommandButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(4) ") & " , " & CurrMachineButton.StateFlag)
End If
End Sub
Friend Sub SpindleStateChanged(SpindleState As Boolean)
Dim SpindleButton As TwoStateButton = Nothing
For Each MachineButton As MachineButton In m_ButtonList
@@ -788,11 +808,26 @@ Public Class TwoStateButton
Set(value As Boolean)
' accendo il comando, anche se dovrei aspettare di leggere lo stato da PLC
m_IsChecked = value
Dim sLuaScriptFile As String = m_MainWindow.m_CurrentMachine.sMachDir & "\DirectCmd\"
If value Then
sLuaScriptFile &= TLuaScriptName
ExecuteMDICommand(TLuaScriptName)
Else
sLuaScriptFile &= FLuaScriptName
ExecuteMDICommand(FLuaScriptName)
End If
Dim IsPressedShiftKey As Boolean = False
If Keyboard.Modifiers And ModifierKeys.Shift And
GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0, m_MainWindow.GetIniFile()) > 4 Then IsPressedShiftKey = True
' procedo all'apertura del file CadCut1 appena generato (solo se generazione corretta)
If IsPressedShiftKey Then
Try
Process.Start("Notepad.exe", sLuaScriptFile)
Catch ex As Exception
EgtOutLog(ex.ToString)
End Try
End If
End Set
End Property
Friend Sub SetIsChecked(value As Boolean)
+8 -4
View File
@@ -300,6 +300,7 @@ Public Class SingleCutUC
If Not EgtSetCalcTool("", "H3", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP1) Then Return
EgtOutLog("Coordinate punto 1 da H3: " & m_ptTipP1.x.ToString & " ," & m_ptTipP1.y.ToString)
' Reimposto eventuale precedente utensile
EgtSetCalcTool(sTool, sHead, nExit)
' Altrimenti da lama
@@ -308,6 +309,7 @@ Public Class SingleCutUC
EgtSetCalcTool(sTool, sHead, nExit)
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP1) Then Return
EgtOutLog("Coordinate punto 1 da H1: " & m_ptTipP1.x.ToString & " ," & m_ptTipP1.y.ToString)
End If
' Calcolo direzione asse lama
If Not EgtGetCalcToolDirFromAngles(vAng, m_vtToolP1) Then Return
@@ -391,20 +393,20 @@ Public Class SingleCutUC
' Imposto come testa corrente il laser (senza utensile ovviamente)
If Not EgtSetCalcTool("", "H3", 1) Then Return
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP1) Then Return
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP2) Then Return
EgtOutLog("Coordinate punto 2 da H3: " & m_ptTipP2.x.ToString & " ," & m_ptTipP2.y.ToString)
' Reimposto eventuale precedente utensile
EgtSetCalcTool(sTool, sHead, nExit)
' Altrimenti da lama
Else
' Reimposto eventuale precedente utensile
EgtSetCalcTool(sTool, sHead, nExit)
' Trasformo in posizione punta utensile in basso
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP1) Then Return
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, vAng, True, m_ptTipP2) Then Return
End If
' Calcolo direzione asse lama
If Not EgtGetCalcToolDirFromAngles(vAng, m_vtToolP1) Then Return
If Not EgtGetCalcToolDirFromAngles(vAng, m_vtToolP2) Then Return
' Porto il tip nell'origine tavola
m_ptTipP2.ToLoc(New Frame3d(m_ptTabOri))
m_bPointP2Ok = True
@@ -437,6 +439,7 @@ Public Class SingleCutUC
m_dAngO = dAngOrizzDeg
LenghtTxBx.Text = LenToString(m_dLen, 1)
DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
EgtOutLog("Lunghezza taglio: " & dLen.ToString & "Angolo: " & dAngOrizzDeg.ToString)
CreateSingleCut()
' Disegno la macchina nella sua posizione reale
SetMachineInCurrPos()
@@ -629,6 +632,7 @@ Public Class SingleCutUC
Private Function CreateSingleCut() As Boolean
' Verifico sia definito il punto iniziale e il grezzo
If Not m_bPointP1Ok Or Not m_bRawOk Then
EgtOutLog("Primo punto non valido")
m_bCutOk = False
Return False
End If
+27
View File
@@ -71,10 +71,35 @@ Public Class VacuumMachineButtonUC
If Not IsNothing(ButtonToAdd) Then m_ButtonList.Add(ButtonToAdd)
End If
End While
For Each MachineButton As MachineButton In m_ButtonList
GetTypeButton(MachineButton)
Next
NotifyPropertyChanged("ButtonList")
End If
End Sub
#Region "STATE CHANGED"
' ------------------------------------------------------------------------------
' i segeunti metodi notificano il cambiamento di stato di specifici bottoni
'-------------------------------------------------------------------------------
Friend Sub GetTypeButton(CurrMachineButton As MachineButton)
Dim BtnType As Type = CurrMachineButton.GetType
If BtnType Is GetType(NoStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(0) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(TwoStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(1) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(ThreeStateButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(2) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(DoubleCommandButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(3) ") & " , " & CurrMachineButton.StateFlag)
ElseIf BtnType Is GetType(PressedCommandButton) Then
EgtOutLog("" & BtnType.ToString.Replace("OmagCUT.", "(4) ") & " , " & CurrMachineButton.StateFlag)
End If
End Sub
Friend Sub VacuumUpChanged(VacuumUpState As Boolean)
Dim VacuumUpButton As TwoStateButton = Nothing
For Each MachineButton As MachineButton In m_ButtonList
@@ -371,6 +396,8 @@ Public Class VacuumMachineButtonUC
Next
End Sub
#End Region ' State Range
Public Function GetPrivateProfileMachineButtons(
ByVal lpAppName As String,
ByVal lpKeyName As String,
+3
View File
@@ -1193,6 +1193,7 @@ Public Class AlarmsPageUC
Dim dToolDiam As Double = 0
Dim dToolThick As Double = 0
Dim dToolLen As Double = 0
Dim dCore As Double = 0
Dim sToolParam As String = String.Empty
EgtTdbGetCurrToolParam(MCH_TP.HEAD, sToolParam)
EgtLuaSetGlobStringVar("CMD.HEAD", sToolParam)
@@ -1204,6 +1205,8 @@ Public Class AlarmsPageUC
EgtLuaSetGlobNumVar("CMD.THICK", dToolThick * 1000)
EgtTdbGetCurrToolParam(MCH_TP.LEN, dToolLen)
EgtLuaSetGlobNumVar("CMD.LENGTH", dToolLen * 1000)
EgtTdbGetCurrToolParam(MCH_TP.CORE, dCore)
EgtLuaSetGlobNumVar("CMD.CORE", dCore * 1000)
' Nuova varibile per gestione tastatura utensili Frankfurt (Polishing)
Dim nType As Integer
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nType)
+10 -2
View File
@@ -308,8 +308,16 @@ Public Class MachineStatusUC
Dim dSpindleOvr As Double
' se attivi nuovi comandi MDI su siemens
If m_MainWindow.m_CNCommunication.m_nNCType = 3 AndAlso m_MainWindow.m_CNCommunication.m_CN.m_IsSiemensOne Then
dSpindlePower = m_CN.d_data(0)
dSpindleOvr = m_CN.d_data(1)
If m_MainWindow.m_CNCommunication.m_CN.m_IsSiemensOne Then
dSpindlePower = m_CN.d_spindle_power
'dSpindleOvr = If(m_CN.bPowerOvr > 0, m_CN.d_spindle_power / m_CN.bPowerOvr * 100, 0)
dSpindleOvr = m_CN.bPowerOvr
Else
' questo sistema è deprecabile dalla versione 2.6d2 (nuova gestione dei vettori)
dSpindlePower = m_CN.d_data(0)
dSpindleOvr = m_CN.d_data(1)
End If
ElseIf m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
dSpindlePower = m_CN.d_spindle_power / 1000
Else
+2 -2
View File
@@ -343,8 +343,8 @@ Class MainWindow
' Verifico abilitazione nesting automatico
m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2605, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2605, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2606, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2606, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.CUT_BASE)
' Impostazione per programma OnlyFrame: solo se CUT_BASE non attivo
+2 -2
View File
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.6.5.2")>
<Assembly: AssemblyFileVersion("2.6.5.2")>
<Assembly: AssemblyVersion("2.6.6.1")>
<Assembly: AssemblyFileVersion("2.6.6.1")>
+343 -75
View File
@@ -4,6 +4,7 @@ Imports System.Collections.ObjectModel
Imports EgtUILib
Imports System.IO
Imports System.Text
Imports OmagCUT.CN_generico
Public Class CNCommunication
@@ -28,6 +29,9 @@ Public Class CNCommunication
' Oggetto CN
Public WithEvents m_CN As CN_generico
' NUOVO ! in fase di test
Private ListReferenceIndex As New List(Of RefereceFlagSimens)
' Flag di aggiornamento dati
Private m_bNewPosData As Boolean = True
Private m_bNewDeltaData As Boolean = True
@@ -389,7 +393,7 @@ Public Class CNCommunication
If Not String.IsNullOrEmpty(sVal) Then m_CN.SetCnDataVar(CN_generico.CnData.Remote, sVal)
End If
' Solo per controllo FANUNC
' Solo per controllo FANUC
GetPrivateProfileString(S_NCDATA, K_NAXES, "", sVal, m_MainWindow.GetMachIniFile())
m_CN.SetCnDataVar(CN_generico.CnData.nAxes, sVal)
@@ -402,6 +406,9 @@ Public Class CNCommunication
EgtOutLog("Error starting NC communication : " & ex.Message)
End Try
'' Per forzare la lettura delle variabili siemens di configurazione
'm_nNCType = 3
Select Case m_nNCType
Case 0 'Debug
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Yellow")
@@ -426,24 +433,99 @@ Public Class CNCommunication
Try
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray")
Dim sArg As String = "-start """ & m_sCNSiemensPath & """"
EgtOutLog("ProcessStart : " & """" & m_sCNSiemensHMIPath & """" & " " & sArg)
Process.Start(m_sCNSiemensHMIPath, sArg)
EgtOutLog("ProcessStart : " & """" & m_sCNSiemensHMIPath & """" & " " & sArg)
m_CN.m_IsSiemensOne = GetPrivateProfileInt(S_NCSIEMENS, K_ISSIEMENSONE, 0, m_MainWindow.GetMachIniFile()) > 0
m_CN.m_IsActiveModeSubscription = GetPrivateProfileInt(S_NCSIEMENS, K_ISACTIVEMODESUBSCR, 0, m_MainWindow.GetMachIniFile()) > 0
If m_CN.m_IsSiemensOne Then
' Creo l'abbonamento delle seguenti varibili che saranno sempre lette in ciclo dal Siemenscomm
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.Laser), VarType.TInteger, 0)
' stati bottoni ventose
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.LaserTrac), VarType.TInteger, 1)
' stati porte
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.DoorClosed), VarType.TInteger, 2)
' ventose
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.BlowState), VarType.TInteger, 3)
' stati bottoni parte 2
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.CBAxes), VarType.TInteger, 4)
' ampere e ampere override
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.Spindle), VarType.TDouble, 0)
m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.SpeedOvr), VarType.TDouble, 1)
' ' Creo l'abbonamento delle seguenti varibili che saranno sempre lette in ciclo dal Siemenscomm
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.Laser), VarType.TInteger, 0)
' ' stati bottoni ventose
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.LaserTrac), VarType.TInteger, 1)
' ' stati porte
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.DoorClosed), VarType.TInteger, 2)
' ' ventose
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.BlowState), VarType.TInteger, 3)
' ' stati bottoni parte 2
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.CBAxes), VarType.TInteger, 4)
' ' ampere e ampere override
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.Spindle), VarType.TDouble, 0)
' m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.SpeedOvr), VarType.TDouble, 1)
' Leggo tutte le varaibili che sono state caricate nel percorso [NcData] del file *.ini
Dim nIndexArrayBool As Integer = 0
Dim nIndexArrayInt As Integer = 0
Dim nIndexArrayLong As Integer = 0
Dim nIndexArrayDoub As Integer = 0
Dim nIndexArrayStr As Integer = 0
' Creo un vettore che mi permetta di risalire a cose contiene ogni vettore FLAG (di tipo Enum)
For ItemIndex As Integer = 0 To m_CN.m_szCnDataVar.Count - 1
' escludo i Flag 'Comm' e 'Refresh'
If ItemIndex = CnData.Comm Or ItemIndex = CnData.Refresh Then
Continue For
End If
If Not String.IsNullOrEmpty(m_CN.m_szCnDataVar(ItemIndex)) Then
Dim sItem As String() = m_CN.m_szCnDataVar(ItemIndex).Split(","c)
Dim nVarType As VarType = VarType.TInteger
If sItem.Count > 1 Then
If IsNumeric(sItem(0)) Then
Select Case CInt(sItem(0))
Case 0
If nIndexArrayBool > 14 Then
Continue For
End If
nVarType = VarType.TBoolean
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayBool)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayBool, ItemIndex, nVarType))
nIndexArrayBool += 1
Case 1
If nIndexArrayInt > 14 Then
Continue For
End If
nVarType = VarType.TInteger
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayInt)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayInt, ItemIndex, nVarType))
nIndexArrayInt += 1
Case 2
If nIndexArrayLong > 14 Then
Continue For
End If
nVarType = VarType.TLong
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayLong)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayLong, ItemIndex, nVarType))
nIndexArrayLong += 1
Case 3
If nIndexArrayDoub > 14 Then
Continue For
End If
nVarType = VarType.TDouble
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayDoub)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayDoub, ItemIndex, nVarType))
nIndexArrayDoub += 1
Case 4
If nIndexArrayStr > 14 Then
Continue For
End If
nVarType = VarType.TString
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayStr)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayStr, ItemIndex, nVarType))
nIndexArrayStr += 1
Case Else
If nIndexArrayInt > 14 Then
Continue For
End If
nVarType = VarType.TInteger
m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayInt)
ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayInt, ItemIndex, nVarType))
nIndexArrayInt += 1
End Select
End If
End If
End If
Next
' Attraverso la funzione "RefreshNoEvents" rileggo i dati caricati
' Recupero il perocorso delle variabili PLC
GetPrivateProfileString(S_NCSIEMENS, K_DBVARPATH, "", m_CN.m_DbVarPath, m_MainWindow.GetMachIniFile)
ElseIf m_CN.m_IsActiveModeSubscription Then
@@ -993,18 +1075,18 @@ Public Class CNCommunication
m_MachineStatus.DisplayVar()
'EgtOutLog("Modo attivato: " & m_CN.read_active_mode & " modo attivo: " & m_nCurrMode)
If m_nCountRefresh > 10 Then
Dim TempCurrMode As Short = m_CN.read_active_mode()
'EgtOutLog("Machine status: " & TempCurrMode)
If TempCurrMode <> m_nCurrMode Then
'EgtOutLog("Modo attivo: " & m_CN.read_active_mode)
m_nCurrMode = CInt(TempCurrMode)
m_MachineStatus.DisplayActiveMode(m_nCurrMode)
End If
m_nCountRefresh = 0
Else
m_nCountRefresh = m_nCountRefresh + 1
End If
'If m_nCountRefresh > 10 Then
' Dim TempCurrMode As Short = m_CN.read_active_mode()
' 'EgtOutLog("Machine status: " & TempCurrMode)
' If TempCurrMode <> m_nCurrMode Then
' 'EgtOutLog("Modo attivo: " & m_CN.read_active_mode)
' m_nCurrMode = CInt(TempCurrMode)
' m_MachineStatus.DisplayActiveMode(m_nCurrMode)
' End If
' m_nCountRefresh = 0
'Else
' m_nCountRefresh = m_nCountRefresh + 1
'End If
If m_CN.b_NC_error Then
ErrorList.Clear()
@@ -1023,56 +1105,191 @@ Public Class CNCommunication
If m_MainWindow.m_DirectCutPageUC.m_NewMachineButtonsType Then
' lettura variabili stati mancanti su Siemens
Dim nVarValue As Integer = m_CN.n_data(0)
EgtOutLog("Variabile PLC control addr: " & 1 & " value: " & nVarValue)
m_CN.bSpindleState = IsSetAll(nVarValue, ControlStates.Spindle)
m_CN.bLaserTracState = IsSetAll(nVarValue, ControlStates.LaserTrac)
m_CN.bCoolantState = IsSetAll(nVarValue, ControlStates.Coolant)
m_CN.bInternalCoolantState = IsSetAll(nVarValue, ControlStates.InternalCoolant)
m_CN.bExternCoolantState = IsSetAll(nVarValue, ControlStates.ExternCoolant)
m_CN.bCBAxesState = IsSetAll(nVarValue, ControlStates.CAxis)
m_CN.bAirBlowState = IsSetAll(nVarValue, ControlStates.AirBlow)
m_CN.bHomeState = IsSetAll(nVarValue, ControlStates.Home)
m_CN.bTableUpState = IsSetAll(nVarValue, ControlStates.TableUp)
m_CN.bTableDownState = IsSetAll(nVarValue, ControlStates.TableDown)
m_CN.bLimitZState = IsSetAll(nVarValue, ControlStates.LimitZ)
m_CN.b5AxesState = IsSetAll(nVarValue, ControlStates.Axis5)
' ' lettura variabili stati mancanti su Siemens
' Dim nVarValue As Integer = m_CN.n_data(0)
' EgtOutLog("Variabile PLC control addr: " & 1 & " value: " & nVarValue)
' m_CN.bSpindleState = IsSetAll(nVarValue, ControlStates.Spindle)
' m_CN.bLaserTracState = IsSetAll(nVarValue, ControlStates.LaserTrac)
' m_CN.bCoolantState = IsSetAll(nVarValue, ControlStates.Coolant)
' m_CN.bInternalCoolantState = IsSetAll(nVarValue, ControlStates.InternalCoolant)
' m_CN.bExternCoolantState = IsSetAll(nVarValue, ControlStates.ExternCoolant)
' m_CN.bCBAxesState = IsSetAll(nVarValue, ControlStates.CAxis)
' m_CN.bAirBlowState = IsSetAll(nVarValue, ControlStates.AirBlow)
' m_CN.bHomeState = IsSetAll(nVarValue, ControlStates.Home)
' m_CN.bTableUpState = IsSetAll(nVarValue, ControlStates.TableUp)
' m_CN.bTableDownState = IsSetAll(nVarValue, ControlStates.TableDown)
' m_CN.bLimitZState = IsSetAll(nVarValue, ControlStates.LimitZ)
' m_CN.b5AxesState = IsSetAll(nVarValue, ControlStates.Axis5)
nVarValue = m_CN.n_data(1)
'EgtOutLog("Variabile PLC vacuum addr: " & m_CN.m_szCnDataVar(CN_generico.CnData.LaserTrac) & " value: " & nVarValue)
m_CN.bVacuumUp = IsSetAll(nVarValue, VacuumStates.VacuumUp)
m_CN.bVacuumDown = IsSetAll(nVarValue, VacuumStates.VacuumDown)
m_CN.bVacuum2Up = IsSetAll(nVarValue, VacuumStates.Vacuum2Up)
m_CN.bVacuum2Down = IsSetAll(nVarValue, VacuumStates.Vacuum2Down)
m_CN.bVacuum1State = IsSetAll(nVarValue, VacuumStates.Vacuum1State)
m_CN.bVacuum2State = IsSetAll(nVarValue, VacuumStates.Vacuum2State)
m_CN.bVacuum3State = IsSetAll(nVarValue, VacuumStates.Vacuum3State)
m_CN.bVacuum4State = IsSetAll(nVarValue, VacuumStates.Vacuum4State)
m_CN.bVacuum5State = IsSetAll(nVarValue, VacuumStates.Vacuum5State)
m_CN.bVacuum6State = IsSetAll(nVarValue, VacuumStates.Vacuum6State)
m_CN.bOpenAllState = (m_CN.bVacuum1State And m_CN.bVacuum2State And m_CN.bVacuum3State And m_CN.bVacuum4State And m_CN.bVacuum5State And m_CN.bVacuum6State)
m_CN.bCloseAllState = (Not m_CN.bVacuum1State And Not m_CN.bVacuum2State And Not m_CN.bVacuum3State And Not m_CN.bVacuum4State And Not m_CN.bVacuum5State And Not m_CN.bVacuum6State)
m_CN.bOpen123State = (m_CN.bVacuum1State And m_CN.bVacuum2State And m_CN.bVacuum3State)
m_CN.bOpen456State = (m_CN.bVacuum4State And m_CN.bVacuum5State And m_CN.bVacuum6State)
m_CN.bClose123State = (Not m_CN.bVacuum1State And Not m_CN.bVacuum2State And Not m_CN.bVacuum3State)
m_CN.bClose456State = (Not m_CN.bVacuum4State And Not m_CN.bVacuum5State And Not m_CN.bVacuum6State)
m_CN.bBlowState = IsSetAll(nVarValue, VacuumStates.AirBlow)
m_CN.bVacuumOn = IsSetAll(nVarValue, VacuumStates.VacuumOn)
m_CN.bVacuumOff = IsSetAll(nVarValue, VacuumStates.VacuumOff)
m_CN.bBypassState = IsSetAll(nVarValue, VacuumStates.BypassState)
'nVarValue = m_CN.n_data(1)
''EgtOutLog("Variabile PLC vacuum addr: " & m_CN.m_szCnDataVar(CN_generico.CnData.LaserTrac) & " value: " & nVarValue)
'm_CN.bVacuumUp = IsSetAll(nVarValue, VacuumStates.VacuumUp)
'm_CN.bVacuumDown = IsSetAll(nVarValue, VacuumStates.VacuumDown)
'm_CN.bVacuum2Up = IsSetAll(nVarValue, VacuumStates.Vacuum2Up)
'm_CN.bVacuum2Down = IsSetAll(nVarValue, VacuumStates.Vacuum2Down)
'm_CN.bVacuum1State = IsSetAll(nVarValue, VacuumStates.Vacuum1State)
'm_CN.bVacuum2State = IsSetAll(nVarValue, VacuumStates.Vacuum2State)
'm_CN.bVacuum3State = IsSetAll(nVarValue, VacuumStates.Vacuum3State)
'm_CN.bVacuum4State = IsSetAll(nVarValue, VacuumStates.Vacuum4State)
'm_CN.bVacuum5State = IsSetAll(nVarValue, VacuumStates.Vacuum5State)
'm_CN.bVacuum6State = IsSetAll(nVarValue, VacuumStates.Vacuum6State)
'm_CN.bOpenAllState = (m_CN.bVacuum1State And m_CN.bVacuum2State And m_CN.bVacuum3State And m_CN.bVacuum4State And m_CN.bVacuum5State And m_CN.bVacuum6State)
'm_CN.bCloseAllState = (Not m_CN.bVacuum1State And Not m_CN.bVacuum2State And Not m_CN.bVacuum3State And Not m_CN.bVacuum4State And Not m_CN.bVacuum5State And Not m_CN.bVacuum6State)
'm_CN.bOpen123State = (m_CN.bVacuum1State And m_CN.bVacuum2State And m_CN.bVacuum3State)
'm_CN.bOpen456State = (m_CN.bVacuum4State And m_CN.bVacuum5State And m_CN.bVacuum6State)
'm_CN.bClose123State = (Not m_CN.bVacuum1State And Not m_CN.bVacuum2State And Not m_CN.bVacuum3State)
'm_CN.bClose456State = (Not m_CN.bVacuum4State And Not m_CN.bVacuum5State And Not m_CN.bVacuum6State)
'm_CN.bBlowState = IsSetAll(nVarValue, VacuumStates.AirBlow)
'm_CN.bVacuumOn = IsSetAll(nVarValue, VacuumStates.VacuumOn)
'm_CN.bVacuumOff = IsSetAll(nVarValue, VacuumStates.VacuumOff)
'm_CN.bBypassState = IsSetAll(nVarValue, VacuumStates.BypassState)
'
'nVarValue = m_CN.n_data(2)
''EgtOutLog("Variabile PLC door addr: " & m_CN.m_szCnDataVar(CN_generico.CnData.DoorClosed) & " value: " & nVarValue)
'm_CN.nDoorClosedState = nVarValue
'
'nVarValue = m_CN.n_data(4)
''EgtOutLog("Variabile PLC control 2 addr: " & 3 & " value: " & nVarValue)
'm_CN.bLaserState = IsSetAll(nVarValue, ControlStates2.Laser)
'm_CN.bHsm = IsSetAll(nVarValue, ControlStates2.Hsm)
'm_CN.bResetState = IsSetAll(nVarValue, ControlStates2.ResetState)
'm_CN.bFeedHold = IsSetAll(nVarValue, ControlStates2.FeedHold)
'm_CN.bSpeedHold = IsSetAll(nVarValue, ControlStates2.SpindleHold)
nVarValue = m_CN.n_data(2)
'EgtOutLog("Variabile PLC door addr: " & m_CN.m_szCnDataVar(CN_generico.CnData.DoorClosed) & " value: " & nVarValue)
m_CN.nDoorClosedState = nVarValue
'------------ SINUMERIK ONE ----------------------------------------------
For IndxLst As Integer = 0 To ListReferenceIndex.Count - 1
Dim nType As Integer = ListReferenceIndex(IndxLst).TypeArray
Dim nFlag As Integer = ListReferenceIndex(IndxLst).FlagIndex
Dim nIndex As Integer = ListReferenceIndex(IndxLst).SiemnesArrayIndex
Dim b_temp As Boolean = False
Dim n_temp As Boolean = 0
Dim l_temp As Long = 0.0
Dim d_temp As Double = 0.0
' leggo il valore caricato
Select Case nType
Case VarType.TBoolean
b_temp = m_CN.b_data(nIndex)
Case VarType.TInteger
n_temp = m_CN.n_data(nIndex)
Case VarType.TLong
l_temp = m_CN.l_data(nIndex)
Case VarType.TDouble
d_temp = m_CN.d_data(nIndex)
Case VarType.TString
'b_temp = If(m_CN.d_data(nIndex) = 0, True, False)
End Select
nVarValue = m_CN.n_data(4)
'EgtOutLog("Variabile PLC control 2 addr: " & 3 & " value: " & nVarValue)
m_CN.bLaserState = IsSetAll(nVarValue, ControlStates2.Laser)
m_CN.bHsm = IsSetAll(nVarValue, ControlStates2.Hsm)
m_CN.bResetState = IsSetAll(nVarValue, ControlStates2.ResetState)
m_CN.bFeedHold = IsSetAll(nVarValue, ControlStates2.FeedHold)
m_CN.bSpeedHold = IsSetAll(nVarValue, ControlStates2.SpindleHold)
Select Case nFlag
Case CN_generico.CnData.Mode ' (0) Stato modo attivo
m_CN.n_index_mode = nIndex
If m_nCountRefresh > 10 Then
Dim TempCurrMode As Short = m_CN.read_active_mode()
'EgtOutLog("Machine status: " & TempCurrMode)
If TempCurrMode <> m_nCurrMode Then
'EgtOutLog("Modo attivo: " & m_CN.read_active_mode)
m_nCurrMode = CInt(TempCurrMode)
m_MachineStatus.DisplayActiveMode(m_nCurrMode)
m_CN.nMachineMode = m_nCurrMode
End If
m_nCountRefresh = 0
Else
m_nCountRefresh = m_nCountRefresh + 1
End If
Case CN_generico.CnData.Spindle ' (7) Stato rotazione mandrino
m_CN.bSpindleState = b_temp
Case CN_generico.CnData.Coolant ' (8) Stato acqua
m_CN.bCoolantState = b_temp
Case CN_generico.CnData.Laser ' (9) Stato laser punto
m_CN.bLaserState = b_temp
Case CN_generico.CnData.PowerOvr ' (10) Amperaggio
m_CN.bPowerOvr = d_temp
Case CN_generico.CnData.InternalCoolant ' (13) Stato acqua interna
m_CN.bInternalCoolantState = b_temp
Case CN_generico.CnData.ExternCoolant ' (14) Stato acqua esterna
m_CN.bExternCoolantState = b_temp
Case CN_generico.CnData.CBAxes ' (15) Stato ativazione assi c e b
m_CN.bCBAxesState = b_temp
Case CN_generico.CnData.AirBlow ' (16) Stato soffio utensile
m_CN.bAirBlowState = b_temp
Case CN_generico.CnData.Home ' (17) Stato home
m_CN.bHomeState = b_temp
Case CN_generico.CnData.TableUp ' (18) Stato tavolo su
m_CN.bTableUpState = b_temp
Case CN_generico.CnData.TableDown ' (19) Stato tavolo giu'
m_CN.bTableDownState = b_temp
Case CN_generico.CnData.DoorClosed ' (20) Stato porte
m_CN.nDoorClosedState = n_temp
Case CN_generico.CnData.LimitZ ' (21) Stato limitazione asse Z
m_CN.bLimitZState = b_temp
Case CN_generico.CnData.VacuumUp ' (22) Stato ventosa su'
m_CN.bVacuumUp = b_temp
Case CN_generico.CnData.VacuumDown ' (23) Stato ventosa giu'
m_CN.bVacuumDown = b_temp
Case CN_generico.CnData.Vacuum2Up ' (24) Stato ventosa2 su'
m_CN.bVacuum2Up = b_temp
Case CN_generico.CnData.Vacuum2Down ' (25) Stato ventosa2 giu'
m_CN.bVacuum2Down = b_temp
Case CN_generico.CnData.Vacuum1State ' (26) Stato ventosa 1
m_CN.bVacuum1State = b_temp
Case CN_generico.CnData.Vacuum2State ' (27) Stato ventosa 2
m_CN.bVacuum2State = b_temp
Case CN_generico.CnData.Vacuum3State ' (28) Stato ventosa 3
m_CN.bVacuum3State = b_temp
Case CN_generico.CnData.Vacuum4State ' (29) Stato ventosa 4
m_CN.bVacuum4State = b_temp
Case CN_generico.CnData.Vacuum5State ' (30) Stato ventosa 5
m_CN.bVacuum5State = b_temp
Case CN_generico.CnData.Vacuum6State ' (31) Stato ventosa 6
m_CN.bVacuum6State = b_temp
Case CN_generico.CnData.Vacuum135State ' (32) Stato ventose 135
m_CN.bVacuum135State = b_temp
Case CN_generico.CnData.Vacuum246State ' (33) Stato ventose 246
m_CN.bVacuum246State = b_temp
Case CN_generico.CnData.OpenAllState ' (34) Stato apertura ventose
m_CN.bOpenAllState = b_temp
Case CN_generico.CnData.CloseAllState ' (35) Stato chiusura ventose
m_CN.bCloseAllState = b_temp
Case CN_generico.CnData.Open123State ' (36) Stato apertura ventose
m_CN.bOpen123State = b_temp
Case CN_generico.CnData.Open456State ' (37) Stato apertura ventose
m_CN.bOpen456State = b_temp
Case CN_generico.CnData.Close123State ' (38) Stato chiusura ventose
m_CN.bClose123State = b_temp
Case CN_generico.CnData.Close456State ' (39) Stato chiusura ventose
m_CN.bClose456State = b_temp
Case CN_generico.CnData.BlowState ' (40) Stato soffio ventose
m_CN.bBlowState = b_temp
Case CN_generico.CnData.VacuumOn ' (41) Stato aspirazione ventose acceso
m_CN.bVacuumOn = b_temp
Case CN_generico.CnData.BypassState ' (42) Stato bypass
m_CN.bBypassState = b_temp
Case CN_generico.CnData.Vacuum0 ' (43) Stato rotazione ventosa 0
m_CN.bVacuum0 = b_temp
Case CN_generico.CnData.Vacuum90 ' (44) Stato rotazione ventosa 0
m_CN.bVacuum90 = b_temp
Case CN_generico.CnData.VacuumOff ' (45) Stato aspirazione ventose spento
m_CN.bVacuumOff = b_temp
Case CN_generico.CnData.LaserTrac ' (46) Stato laser tracciatura
m_CN.bLaserTracState = b_temp
Case CN_generico.CnData.XYJog ' (47)
m_CN.bXYJog = b_temp
Case CN_generico.CnData.ZCJog ' (48)
m_CN.bZCJog = b_temp
Case CN_generico.CnData.ZBJog ' (49)
m_CN.bZBCJog = b_temp
Case CN_generico.CnData.PowerON ' (50)
m_CN.bPowerON = b_temp
Case CN_generico.CnData.Remote ' (51)
m_CN.bRemote = b_temp
Case CN_generico.CnData.Parking ' (52)
m_CN.bParkingState = b_temp
Case CN_generico.CnData.nAxes ' (55)
m_CN.n_index_is_G24_active = nIndex
m_CN.b5AxesState = b_temp
End Select
Next
'------------ SINUMERIK ONE ----------------------------------------------
End If
@@ -1125,6 +1342,7 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserTracStateChanged(m_CN.bLaserTracState)
' modalità vecchia
If m_CN.Is_G24_active() Then
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ThreeAxisStateChanged(False)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.FiveAxisStateChanged(True)
@@ -1153,6 +1371,15 @@ Public Class CNCommunication
End If
End If
If m_MainWindow.m_ActivePage = MainWindow.Pages.Machine Then
If m_IsNewConsole Then
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.PowerONChanged(m_CN.bPowerON)
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.PowerOFFChanged(Not m_CN.bPowerON)
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.CncModeChange(m_CN.nMachineMode)
End If
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.CncModeChange(m_CN.nMachineMode)
End If
End Sub
Friend Function SetProgramMainOrSub(bMain As Boolean) As Boolean
@@ -1236,7 +1463,7 @@ Public Class CNCommunication
' Se richiesta attivazione
If bActivate Then
' Attivazione programma
EgtOutLog("ActivateProgram(nNumProg)")
EgtOutLog("ActivateProgram(" & nNumProg.ToString & ")")
TimeSpanInit()
bOk = bOk AndAlso (m_CN.ActivateProgram(nNumProg) = 0)
EgtOutLog(TimeSpanEnd())
@@ -1366,3 +1593,44 @@ Public Class CNCommunication
End Function
End Class
Public Class RefereceFlagSimens
Private m_SiemnesArrayIndex As Integer
Private m_FlagIndex As Integer
Private m_TypeArray As Integer
Public Property SiemnesArrayIndex As Integer
Get
Return m_SiemnesArrayIndex
End Get
Set(value As Integer)
m_SiemnesArrayIndex = value
End Set
End Property
Public Property FlagIndex As Integer
Get
Return m_FlagIndex
End Get
Set(value As Integer)
m_FlagIndex = value
End Set
End Property
Public Property TypeArray As Integer
Get
Return m_TypeArray
End Get
Set(value As Integer)
m_TypeArray = value
End Set
End Property
Sub New(IndArray As Integer, Flag As Integer, nType As Integer)
m_SiemnesArrayIndex = IndArray
m_FlagIndex = Flag
m_TypeArray = nType
End Sub
End Class
+7 -2
View File
@@ -133,7 +133,7 @@ Public Class CN_Siemens
Public Overrides Function read_active_mode() As Short
'EgtOutLog("Modo attivo: " & M_MMFiles.SiemensRet.n_param2)
If m_IsSiemensOne Or m_IsActiveModeSubscription Then
Select Case n_data(3)
Select Case n_data(n_index_mode)
Case 1
Return 0
Case 2
@@ -153,7 +153,12 @@ Public Class CN_Siemens
Public Overrides Function Is_G24_active() As Boolean
Return M_MMFiles.SiemensRet.b_interf_G24
If m_IsSiemensOne Or m_IsActiveModeSubscription Then
Return b_data(n_index_is_G24_active)
Else
Return M_MMFiles.SiemensRet.b_interf_G24
End If
End Function
+3
View File
@@ -138,6 +138,9 @@ Public MustInherit Class CN_generico
Public d_param1 As Double
Public sz_string As String ' ( MAX 200 caratteri )
' Indice del vettore n_data associato alla lettura nMode
Public n_index_mode As Integer = 0
Public n_index_is_G24_active As Integer = 0
Public b_data(14) As Boolean
Public n_data(14) As Int16
Public l_data(14) As Long
+7 -5
View File
@@ -206,6 +206,7 @@ Module M_MMFiles
End Enum
Friend Enum VarType As Short
TBoolean = 0
TInteger = 1
TLong = 2
TDouble = 3
@@ -371,7 +372,8 @@ Module M_MMFiles
SiemensSend.n_Command = CMD.CMD_CycleStart
execute_command()
'EgtOutLog("CycleStart end dell'm_mmFiles")
' Rimango in attesa
EgtOutLog(" → CycleStart")
Return SiemensRet.n_result
End Function
@@ -598,11 +600,11 @@ Module M_MMFiles
'EgtOutLog("Write_Nc_var start dell'm_mmFiles")
SiemensSend.n_Command = CMD.CMD_Read_NC_subscription
SiemensSend.sz_string_2 = VarAddr ' indirizzo su CN dell' oggetto da scrivere
EgtOutLog(" Sottoscrivo lettura di '" & VarAddr & "'")
SiemensSend.n_param1 = Index ' tipo di dato da scrivere
EgtOutLog(" Indice del vettore associato '" & Index & "'")
SiemensSend.n_param2 = ParType ' tipo di dato da scrivere
EgtOutLog(" Indice tipo di variabile '" & ParType & "'")
execute_command()
m_MainWindow.m_CNCommunication.m_CN.sz_interf_error_message = SiemensRet.sz_interf_error_message
@@ -766,7 +768,7 @@ Module M_MMFiles
End If
' copio variabili in abbonamento
For Index As Integer = 0 To 5
For Index As Integer = 0 To 14
CurrCN.b_data(Index) = SiemensRet.b_data(Index)
CurrCN.n_data(Index) = SiemensRet.n_data(Index)
CurrCN.l_data(Index) = SiemensRet.l_data(Index)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 8.2 KiB