diff --git a/CadCuts/SplitPageUC.xaml.vb b/CadCuts/SplitPageUC.xaml.vb index 09f78fc..aabf014 100644 --- a/CadCuts/SplitPageUC.xaml.vb +++ b/CadCuts/SplitPageUC.xaml.vb @@ -61,6 +61,9 @@ Public Class SplitPageUC ' Abilita la mofica Inizio fine per i tagli interni sugli angoli Private m_StartEndModifyOnIntCorner As Boolean = False + Private m_IsCtrlKeyDown As Boolean = False + Private m_IsShiftKeyDown As Boolean = False + Private Sub SplitPageUC_Initialized(sender As Object, e As EventArgs) PrevBtn.IsEnabled = False ' Collego lista di oggetti a ListBox @@ -453,6 +456,24 @@ Public Class SplitPageUC #End Region ' Bridge + Private Sub OnMyMouseDownScene_DoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene_DoubleClick + If MachiningLsBx.SelectedItems.Count = 1 Then + OnMyMouseDownScene(sender, e) + Dim x As NameIdLsBxItem = DirectCast(MachiningLsBx.SelectedItems(0), NameIdLsBxItem) + Dim nI As Integer = x.Ind + If m_MachiningList(nI).m_bEnabled Then + m_MachiningList(nI).m_bEnabled = False + x.bIsActive = False + Else + m_MachiningList(nI).m_bEnabled = True + x.bIsActive = True + End If + ColorMachining(m_MachiningList(nI)) + ColorNumberArrow(nI) + EgtDraw() + End If + End Sub + Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene ' Verifico di essere il gestore attivo e non in modalità sola visualizzazione If Not m_bActive OrElse m_bShow Then Return @@ -733,6 +754,24 @@ Public Class SplitPageUC EgtDraw() End Sub + Private Sub MachiningLsBx_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles MachiningLsBx.MouseDoubleClick + If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return + If MachiningLsBx.SelectedItems.Count = 1 Then + Dim x As NameIdLsBxItem = DirectCast(MachiningLsBx.SelectedItems(0), NameIdLsBxItem) + Dim nI As Integer = x.Ind + If m_MachiningList(nI).m_bEnabled Then + m_MachiningList(nI).m_bEnabled = False + x.bIsActive = False + Else + m_MachiningList(nI).m_bEnabled = True + x.bIsActive = True + End If + ColorMachining(m_MachiningList(nI)) + ColorNumberArrow(nI) + EgtDraw() + End If + End Sub + Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click MoveItem(-1) End Sub @@ -916,11 +955,31 @@ Public Class SplitPageUC EnableButtons() End Sub - ' ERRORE: questo evento non è eseguito! - Private Sub OnKeyDownScene(sender As Object, e As KeyEventArgs) - If e.Key = Key.Escape Then - ' se sono in fase di creazione di un ponticello interrompo - DeselectWJBridgesPart() + '' DA FARE: quando seleziono Esc devo togliere deselezionare tutte le enità! + 'Private Sub OnKeyDownScene(sender As Object, e As KeyEventArgs) Handles Me.KeyDown + ' If e.Key = Key.Escape Then + ' ' se sono in fase di creazione di un ponticello interrompo + ' DeselectWJBridgesPart() + ' EgtDeselectAll() + ' RemoveMarkAndNumbers() + ' End If + 'End Sub + + Private Sub MachiningLsBx_KeyDown(sender As Object, e As KeyEventArgs) Handles MachiningLsBx.KeyDown + If e.Key = Key.LeftCtrl Or e.Key = Key.RightCtrl Then + m_IsCtrlKeyDown = True + End If + If e.Key = Key.LeftShift Or e.Key = Key.RightShift Then + m_IsShiftKeyDown = True + End If + End Sub + + Private Sub MachiningLsBx_KeyUp(sender As Object, e As KeyEventArgs) Handles MachiningLsBx.KeyUp + If e.Key = Key.LeftCtrl Or e.Key = Key.RightCtrl Then + m_IsCtrlKeyDown = False + End If + If e.Key = Key.LeftShift Or e.Key = Key.RightShift Then + m_IsShiftKeyDown = False End If End Sub diff --git a/DirectCuts/ControlsMachineButtonUC.xaml.vb b/DirectCuts/ControlsMachineButtonUC.xaml.vb index af1e888..0dddfce 100644 --- a/DirectCuts/ControlsMachineButtonUC.xaml.vb +++ b/DirectCuts/ControlsMachineButtonUC.xaml.vb @@ -23,6 +23,9 @@ Public Class ControlsMachineButtonUC Friend m_CN As CN_generico Private m_bFirst As Boolean = True + ' visualizzo l'elenco degli elementi della pagina sono al primo avvio + Friend Shared m_OutLogTypeButton As Boolean = True + ' Creazione converter da String a ImageSource Dim ImageConverter As New ImageSourceConverter @@ -76,6 +79,7 @@ Public Class ControlsMachineButtonUC For Each MachineButton As MachineButton In m_ButtonList GetTypeButton(MachineButton) Next + m_OutLogTypeButton = False NotifyPropertyChanged("ButtonList") End If @@ -87,6 +91,7 @@ Public Class ControlsMachineButtonUC '------------------------------------------------------------------------------- Friend Sub GetTypeButton(CurrMachineButton As MachineButton) + If Not m_OutLogTypeButton Then Return Dim BtnType As Type = CurrMachineButton.GetType If BtnType Is GetType(NoStateButton) Then EgtOutLog(" ► " & BtnType.ToString.Replace("OmagCUT.", "(0) ") & " , " & CurrMachineButton.StateFlag) diff --git a/DirectCuts/VacuumMachineButtonUC.xaml.vb b/DirectCuts/VacuumMachineButtonUC.xaml.vb index 10fafc9..c9d2593 100644 --- a/DirectCuts/VacuumMachineButtonUC.xaml.vb +++ b/DirectCuts/VacuumMachineButtonUC.xaml.vb @@ -22,6 +22,9 @@ Public Class VacuumMachineButtonUC Friend m_CN As CN_generico Private m_bFirst As Boolean = True + ' visualizzo l'elenco degli elementi della pagina sono al primo avvio + Friend m_OutLogTypeButton As Boolean = True + ' Creazione converter da String a ImageSource Dim ImageConverter As New ImageSourceConverter @@ -73,8 +76,9 @@ Public Class VacuumMachineButtonUC End While For Each MachineButton As MachineButton In m_ButtonList - GetTypeButton(MachineButton) + OutLogTypeButton(MachineButton) Next + m_OutLogTypeButton = False NotifyPropertyChanged("ButtonList") End If @@ -85,7 +89,8 @@ Public Class VacuumMachineButtonUC ' i segeunti metodi notificano il cambiamento di stato di specifici bottoni '------------------------------------------------------------------------------- - Friend Sub GetTypeButton(CurrMachineButton As MachineButton) + Friend Sub OutLogTypeButton(CurrMachineButton As MachineButton) + If Not m_OutLogTypeButton Then Return Dim BtnType As Type = CurrMachineButton.GetType If BtnType Is GetType(NoStateButton) Then EgtOutLog(" ► " & BtnType.ToString.Replace("OmagCUT.", "(0) ") & " , " & CurrMachineButton.StateFlag) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 459d89e..50be55a 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -62,5 +62,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/NcComm/CNCommunication.vb b/NcComm/CNCommunication.vb index 26dae6f..c102f6a 100644 --- a/NcComm/CNCommunication.vb +++ b/NcComm/CNCommunication.vb @@ -4,6 +4,7 @@ Imports System.Collections.ObjectModel Imports EgtUILib Imports System.IO Imports System.Text +Imports EgtWPFLib.EgtMsgBox Imports OmagCUT.CN_generico Public Class CNCommunication @@ -240,6 +241,16 @@ Public Class CNCommunication m_bInInches = (GetPrivateProfileInt(S_AXES, K_ININCHES, 0, m_MainWindow.GetMachIniFile()) <> 0) End Sub + Private Sub KillSimensCom(sProcessName As String) + Dim sAppName As String = Path.GetFileNameWithoutExtension(sProcessName) + Dim pList() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses + For Each proc As System.Diagnostics.Process In pList + If proc.ProcessName.ToString = sAppName Then + proc.Kill() + End If + Next + End Sub + Private Sub InitCn() m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Yellow") @@ -407,8 +418,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 + '' !!!!!!!!!!!!! Per forzare la lettura delle variabili siemens di configurazione !!!!!!!!!!!!! + ' m_nNCType = 3 + '' !!!!!!!!!!!!! Per forzare la lettura delle variabili siemens di configurazione !!!!!!!!!!!!! Select Case m_nNCType Case 0 'Debug @@ -434,33 +446,27 @@ Public Class CNCommunication Try m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray") Dim sArg As String = "-start """ & m_sCNSiemensPath & """" + + ' !!!!!!!!!!!!!! FORZO LA SIMULAZIONE DELLA LETTURA DELLE VARIBILI E SIEMENS !!!!!!!!!!!!!! + EgtOutLog("ProcessStart : " & """" & m_sCNSiemensHMIPath & """" & " " & sArg) + KillSimensCom(m_sCNSiemensHMIPath) Process.Start(m_sCNSiemensHMIPath, sArg) + ' !!!!!!!!!!!!!! FORZO LA SIMULAZIONE DELLA LETTURA DELLE VARIBILI E SIEMENS !!!!!!!!!!!!!! + 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) - ' 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) + ' lista che associa Indice del vettore al nome (per associazioni Bit a Bit) + Dim ListIndexToVar As New List(Of IndexArrayToBit) + ' Creo un vettore che mi permetta di risalire a cosa 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 @@ -512,6 +518,35 @@ Public Class CNCommunication m_CN.DVariables_Read_Subscription(sItem(1), nVarType, nIndexArrayStr) ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayStr, ItemIndex, nVarType)) nIndexArrayStr += 1 + Case 5 + If nIndexArrayInt > 14 Then + Continue For + End If + ' verifico se devo riempire un vettore con bit + Dim sSubItem As String() = sItem(1).Split("."c) + ' //My. name. Is Bond._James Bond! + Dim sVarName = String.Join(".", sSubItem.Take(sSubItem.Length - 1)) ' //My. name. Is Bond + Dim sIndexBit = sSubItem.Last() ' //_James Bond! + If sSubItem.Count > 1 And IsNumeric(sIndexBit) Then + Dim bFound As Boolean = False + Dim nIndexArrayInt_1 As Integer = nIndexArrayInt + For Each VarSiemens As IndexArrayToBit In ListIndexToVar + If VarSiemens.sNameVar.Trim = sVarName.Trim Then + nIndexArrayInt_1 = VarSiemens.nIndex + bFound = True + Exit For + End If + Next + nVarType = VarType.TInteger + m_CN.DVariables_Read_Subscription(sVarName, nVarType, nIndexArrayInt_1) + ListReferenceIndex.Add(New RefereceFlagSimens(nIndexArrayInt_1, ItemIndex, nVarType, sIndexBit)) + If Not bFound Then + nIndexArrayInt += 1 + ListIndexToVar.Add(New IndexArrayToBit(nIndexArrayInt_1, sVarName.Trim)) + End If + Else + EgtOutLog(" ATTENZIONE: in [NcData] '" & m_CN.m_szCnDataVar(ItemIndex) & "' non è inidicato il bit associato") + End If Case Else If nIndexArrayInt > 14 Then Continue For @@ -522,6 +557,8 @@ Public Class CNCommunication nIndexArrayInt += 1 End Select End If + Else + EgtOutLog(" ATTENZIONE: in [NcData] '" & m_CN.m_szCnDataVar(ItemIndex) & "' non è indicato il tipo (0→Bool,1→Int,2→Long,3→Double,4→String,5→Bit)") End If End If Next @@ -529,6 +566,7 @@ Public Class CNCommunication ' Recupero il perocorso delle variabili PLC GetPrivateProfileString(S_NCSIEMENS, K_DBVARPATH, "", m_CN.m_DbVarPath, m_MainWindow.GetMachIniFile) + ElseIf m_CN.m_IsActiveModeSubscription Then m_CN.DVariables_Read_Subscription(m_CN.m_szCnDataVar(CN_generico.CnData.BlowState), VarType.TInteger, 3) End If @@ -1056,6 +1094,68 @@ Public Class CNCommunication 'Laser = 16384 End Enum +#Region "MASCHERA per conttrollo Bit a Bit" + + Public Enum Mask As Integer + bit_Err = -1 + bit_0 = &H1 ' 1 + bit_1 = &H2 ' 2 + bit_2 = &H4 ' 4 + bit_3 = &H8 ' 8 + bit_4 = &H10 ' 16 + bit_5 = &H20 ' 32 + bit_6 = &H40 ' 64 + bit_7 = &H80 ' 128 + bit_8 = &H100 ' 256 + bit_9 = &H200 ' 512 + bit_10 = &H400 ' 1024 + bit_11 = &H800 ' 2048 + bit_12 = &H1000 ' 4096 + bit_13 = &H2000 ' 8192 + bit_14 = &H4000 ' 16384 + bit_15 = &H8000 ' 32768 + End Enum + + Public Function GetMaskByBit(IndexBit As Integer) As Mask + Dim Bit_ As Mask = Mask.bit_Err + Select Case IndexBit + Case 0 + Bit_ = Mask.bit_0 + Case 1 + Bit_ = Mask.bit_1 + Case 2 + Bit_ = Mask.bit_2 + Case 3 + Bit_ = Mask.bit_3 + Case 4 + Bit_ = Mask.bit_4 + Case 5 + Bit_ = Mask.bit_5 + Case 6 + Bit_ = Mask.bit_6 + Case 7 + Bit_ = Mask.bit_7 + Case 8 + Bit_ = Mask.bit_8 + Case 9 + Bit_ = Mask.bit_9 + Case 10 + Bit_ = Mask.bit_10 + Case 11 + Bit_ = Mask.bit_11 + Case 12 + Bit_ = Mask.bit_12 + Case 13 + Bit_ = Mask.bit_13 + Case 14 + Bit_ = Mask.bit_14 + Case 15 + Bit_ = Mask.bit_15 + End Select + Return Bit_ + End Function +#End Region ' Maschera per controllo Bit a Bit + Public Function IsSetAll(value As Integer, flag As Integer) As Boolean ' somma Bit a Bit Return ((value And flag) = flag) @@ -1071,7 +1171,7 @@ Public Class CNCommunication m_MachineStatus.DisplaySpeed() - m_MachineStatus.DisplayPower() + 'm_MachineStatus.DisplayPower() m_MachineStatus.DisplayVar() 'EgtOutLog("Modo attivato: " & m_CN.read_active_mode & " modo attivo: " & m_nCurrMode) @@ -1104,66 +1204,17 @@ Public Class CNCommunication End If End If + ' lettura delle variabili abbonate 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) - - '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) - '------------ 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 nIndexBit As Integer = ListReferenceIndex(IndxLst).IndexBit Dim b_temp As Boolean = False - Dim n_temp As Boolean = 0 + Dim n_temp As Integer = 0 Dim l_temp As Long = 0.0 Dim d_temp As Double = 0.0 ' leggo il valore caricato @@ -1172,6 +1223,8 @@ Public Class CNCommunication b_temp = m_CN.b_data(nIndex) Case VarType.TInteger n_temp = m_CN.n_data(nIndex) + ' VENTOSE: lettura dato da intero Bit a Bit (ver_2.6h1), ritorno un Boolean + b_temp = ReadBit(nIndexBit, n_temp) Case VarType.TLong l_temp = m_CN.l_data(nIndex) Case VarType.TDouble @@ -1196,6 +1249,8 @@ Public Class CNCommunication Else m_nCountRefresh = m_nCountRefresh + 1 End If + Case CN_generico.CnData.Power + m_CN.d_spindle_power = d_temp Case CN_generico.CnData.Spindle ' (7) Stato rotazione mandrino m_CN.bSpindleState = b_temp Case CN_generico.CnData.Coolant ' (8) Stato acqua @@ -1294,6 +1349,8 @@ Public Class CNCommunication End If + m_MachineStatus.DisplayPower() + ' Flag e variabili per bottoni macchina, che verifico solo nelle pagine in cui ci sono If m_MainWindow.m_ActivePage = MainWindow.Pages.DirectCut Then If m_MainWindow.m_DirectCutPageUC.m_NewMachineButtonsType Then @@ -1383,6 +1440,14 @@ Public Class CNCommunication End Sub + Private Function ReadBit(IndexBit As Integer, Val As Integer) As Boolean + If IndexBit < 0 Then Return False + Dim _mask = GetMaskByBit(IndexBit) + If _mask = Mask.bit_Err Then Return False + If (Val And _mask) = 0 Then Return False + Return True + End Function + Friend Function SetProgramMainOrSub(bMain As Boolean) As Boolean Return m_CN.SetProgramMainOrSub(bMain) End Function @@ -1600,6 +1665,8 @@ Public Class RefereceFlagSimens Private m_SiemnesArrayIndex As Integer Private m_FlagIndex As Integer Private m_TypeArray As Integer + ' Opzionale + Private m_IndexBit As Integer = -1 Public Property SiemnesArrayIndex As Integer Get @@ -1628,10 +1695,49 @@ Public Class RefereceFlagSimens End Set End Property + Public Property IndexBit As String + Get + Return m_IndexBit + End Get + Set(value As String) + m_IndexBit = 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 + Sub New(IndArray As Integer, Flag As Integer, nType As Integer, nIndBit As Integer) + m_SiemnesArrayIndex = IndArray + m_FlagIndex = Flag + m_TypeArray = nType + m_IndexBit = nIndBit + End Sub + +End Class + +Public Class IndexArrayToBit + + Private m_nIndex As Integer = 0 + Public ReadOnly Property nIndex As Integer + Get + Return m_nIndex + End Get + End Property + + Private m_sNameVar As String = "" + Public ReadOnly Property sNameVar As String + Get + Return m_sNameVar + End Get + End Property + + Sub New(Index As Integer, NameVar As String) + m_nIndex = Index + m_sNameVar = NameVar + End Sub + End Class \ No newline at end of file diff --git a/NcComm/CN_Siemens.vb b/NcComm/CN_Siemens.vb index 8ec6793..df1dd1a 100644 --- a/NcComm/CN_Siemens.vb +++ b/NcComm/CN_Siemens.vb @@ -228,7 +228,7 @@ Public Class CN_Siemens Public Overrides Sub DVariables_Read_Subscription(VarAddr As String, ParType As Short, Index As Integer) ' Ricevo il percorso della varibile, il tipo Dim n_ret As Short = Read_subscription(VarAddr, ParType, Index) - 'EgtOutLog("CN SIEMENS Dopo lettura abbonamento") + EgtOutLog(" ABBONAMENTO (Esito: " & n_ret.ToString & ") -> Address: " & VarAddr & ", Type: " & ParType.ToString & ", Index: " & Index.ToString) End Sub ' diff --git a/NcComm/M_MMFiles.vb b/NcComm/M_MMFiles.vb index 7c02912..b521ff0 100644 --- a/NcComm/M_MMFiles.vb +++ b/NcComm/M_MMFiles.vb @@ -603,16 +603,15 @@ 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 & "'") + EgtOutLog(" → Sottoscrivo lettura di '" & VarAddr & "'") SiemensSend.n_param1 = Index ' tipo di dato da scrivere - EgtOutLog(" Indice del vettore associato '" & Index & "'") + EgtOutLog(" Indice del vettore associato '" & Index & "'") SiemensSend.n_param2 = ParType ' tipo di dato da scrivere - EgtOutLog(" Indice tipo di variabile '" & ParType & "'") + EgtOutLog(" Indice tipo di variabile '" & ParType & "'") execute_command() m_MainWindow.m_CNCommunication.m_CN.sz_interf_error_message = SiemensRet.sz_interf_error_message - - EgtOutLog("sz_interf_error_message: " & m_MainWindow.m_CNCommunication.m_CN.sz_interf_error_message) - EgtOutLog("n_result: " & SiemensRet.n_result) + EgtOutLog(" sz_interf_error_message: " & m_MainWindow.m_CNCommunication.m_CN.sz_interf_error_message) + EgtOutLog(" n_result: " & SiemensRet.n_result) Return SiemensRet.n_result End Function diff --git a/Project/CurrentProjectPageUC.xaml.vb b/Project/CurrentProjectPageUC.xaml.vb index 1ae2a2d..3097720 100644 --- a/Project/CurrentProjectPageUC.xaml.vb +++ b/Project/CurrentProjectPageUC.xaml.vb @@ -7,6 +7,7 @@ Imports EgtWPFLib5 Public Class CurrentProjectPageUC ' Dichiarazione eventi Friend Event OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Friend Event OnMouseDownScene_DoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Friend Event OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Friend Event OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) ' Riferimento alla MainWindow @@ -336,6 +337,10 @@ Public Class CurrentProjectPageUC RaiseEvent OnMouseDownScene(sender, e) End Sub + Private Sub OnMyMouseDownScene_DoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.MouseDoubleClick + RaiseEvent OnMouseDownScene_DoubleClick(sender, e) + End Sub + Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseMoveScene RaiseEvent OnMouseMoveScene(sender, e) End Sub