Compare commits

...

31 Commits

Author SHA1 Message Date
Nicola Pievani 9b0e464e4b Ricavo contorno da codice python 2024-08-28 11:07:57 +02:00
Nicola Pievani 123d6118e9 Correzione gestion uscita in caso di errore 2024-08-21 16:11:33 +02:00
Nicola Pievani a2104eaa03 Nuovi messaggi e CMD.TABLE in lua script 2024-08-19 10:21:01 +02:00
Nicola Pievani 65b9bfdcdb Migliorati messaggi comunicazione CN 2024-08-06 15:48:49 +02:00
Nicola Pievani 004591896c Messaggio di Kill Process per SiemensComm 2024-08-01 10:57:59 +02:00
Nicola Pievani 02af01052b Gestione invio programmi doppia tavola 2024-07-31 18:31:32 +02:00
Nicola Pievani 2bc386807f Merge branch 'master' into develop 2024-07-31 10:25:02 +02:00
Nicola Pievani 82af1baae3 Merge branch 'develop' 2024-07-31 10:24:33 +02:00
Nicola Pievani 68b4dfed80 Correzzione numero di versione 2.6g7 2024-07-31 10:24:20 +02:00
Nicola Pievani ffc7536177 Merge branch 'master' into develop 2024-07-31 10:08:29 +02:00
Nicola Pievani 70368b73be Aggiornamento versione 2.6h1 2024-07-31 10:08:05 +02:00
Nicola Pievani 05b4e2e95a Merge branch 'develop' 2024-07-30 14:31:20 +02:00
Nicola Pievani 1d7cdf8fa0 Merge branch 'Features/Manage_SimensOne' into develop 2024-07-30 14:31:09 +02:00
Nicola Pievani 5190a41470 Lettura degli interi Bit a Bit 2024-07-30 14:30:53 +02:00
Nicola Pievani 3afe6bb35b Migliorata stampa dei messaggi OutLog comunicazione 2024-07-29 13:54:57 +02:00
Nicola Pievani c546df45ca Aggiornamento versione 2.6g6 (nuove DLL) 2024-07-29 11:11:42 +02:00
Nicola Pievani 554ae16e48 Merge branch 'develop' into Features/Manage_SimensOne 2024-07-26 18:35:54 +02:00
Nicola Pievani 1b4d239202 OnOff lavorazioni elezione lavorazioni con DoppioClick 2024-07-26 14:30:35 +02:00
Nicola Pievani 3b2d15703a Lettura bit a bit Siemens 2024-07-25 15:20:47 +02:00
Nicola Pievani 8e5a4d4ac5 Merge branch 'develop' into Features/Manage_SimensOne 2024-07-24 08:51:27 +02:00
Nicola Pievani ef621a340a Merge branch 'develop' 2024-07-17 13:03:04 +02:00
Nicola Pievani f2ce55ff27 Nuova versione programma ver 2.6g1 2024-07-17 13:01:48 +02:00
Nicola Pievani ae3b16b715 Merge branch 'Features/Imports_Engrave_Btn' into develop 2024-07-17 12:32:39 +02:00
Nicola Pievani 8ff4b74725 Nuovo parametro MachDb Waterjet (Full Slow) 2024-07-17 12:32:25 +02:00
Nicola Pievani e7e1946230 Cambio versione 2.6f3 2024-06-18 18:06:24 +02:00
Nicola Pievani 8dc6b63801 Merge branch 'develop' 2024-06-18 18:05:23 +02:00
Nicola Pievani 7f548e5ba6 Merge branch 'develop' 2024-06-11 17:35:07 +02:00
Nicola Pievani 2cf1be7348 Aggiornate info copyright 2024-06-03 18:08:15 +02:00
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 26ef6b2d3b Migliorata gestione SiemensCommand 2024-03-13 11:26:33 +01:00
15 changed files with 353 additions and 97 deletions
+64 -5
View File
@@ -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
+15 -1
View File
@@ -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)
@@ -750,8 +755,17 @@ Public MustInherit Class MachineButton
EgtLuaSetGlobNumVar("CMD.R1", dR1)
EgtLuaSetGlobNumVar("CMD.R2", dR2)
EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
' versione 2.6h1
Dim sCurrTable As String = String.Empty
Dim nCuttTable As Integer = 1
EgtGetTableName(sCurrTable)
If sCurrTable <> "MainTab" Then nCuttTable = 2
EgtLuaSetGlobIntVar("CMD.TABLE", nCuttTable)
EgtLuaCallFunction("CmdString")
' Leggo variabili
' Leggo variabili da file Lua
CmdString = String.Empty
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
b2Start = False
+4
View File
@@ -530,6 +530,10 @@ Public Class SawTestUC
ElseIf nWSide = MCH_SAW_WS.LEFT Then
vtPerp = vtDir
vtPerp.Rotate(Vector3d.Z_AX, +90)
Else
m_CurrProjPage.ClearMessage()
' 91144 = Set machining side: right or left.
m_CurrProjPage.SetInfoMessage(EgtMsg(91144))
End If
Dim ptEnd As Point3d = ptStart + vtDir * m_dLen + vtPerp * dThick
Dim dLen2 As Double = m_dLen / 2
+7 -2
View File
@@ -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)
+1 -1
View File
@@ -1265,7 +1265,7 @@ Public Class AlarmsPageUC
System.Threading.Thread.Sleep(300)
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
' Creo MsgBox di attesa
Dim MsgBoxStateInfo As New EgtMsgBox(m_MainWindow, EgtMsg(MSG_DIRECTCUTPAGEUC + 41), EgtMsg(MSG_DIRECTCUTPAGEUC + 42), True, EgtMsgBox.Buttons.CANCEL, EgtMsgBox.Icons.NULL)
Dim MsgBoxStateInfo As New EgtMsgBox(m_MainWindow, String.Format(EgtMsg(MSG_DIRECTCUTPAGEUC + 41), ToolForProbing.m_ToolName), EgtMsg(MSG_DIRECTCUTPAGEUC + 42), True, EgtMsgBox.Buttons.CANCEL, EgtMsgBox.Icons.NULL)
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
' Definisco flag tastatura
Dim bProbingOk As Boolean = False
+3 -1
View File
@@ -1662,7 +1662,9 @@ Public Class CurrentMachine
Dim dToolDiam As Double = 0
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dToolDiam)
' Confronto con massimo ammesso
Return (dToolDiam <= dMaxSawDiamForProbe)
Dim bOk As Boolean = dToolDiam <= dMaxSawDiamForProbe
If Not bOk Then EgtOutLog("WARNING: Saw diameter to big for porbing")
Return bOk
End Function
Friend Function GetPrivateProfileMaterial(
+1 -1
View File
@@ -61,7 +61,7 @@ Public Class MachiningDbPageUC
StepType = {EgtMsg(MSG_COMBOBOXPARAM + 38), EgtMsg(MSG_COMBOBOXPARAM + 39), EgtMsg(MSG_COMBOBOXPARAM + 40)}
RouFinStepType = {EgtMsg(MSG_COMBOBOXPARAM + 38), EgtMsg(MSG_COMBOBOXPARAM + 39)}
ExtCornType = {EgtMsg(MSG_COMBOBOXPARAM + 43), EgtMsg(MSG_COMBOBOXPARAM + 44), EgtMsg(MSG_COMBOBOXPARAM + 45)}
IntCornType = {EgtMsg(MSG_COMBOBOXPARAM + 43), EgtMsg(MSG_COMBOBOXPARAM + 44)}
IntCornType = {EgtMsg(MSG_COMBOBOXPARAM + 43), EgtMsg(MSG_COMBOBOXPARAM + 44), EgtMsg(90852)}
' Assegno array a combobox
WorkSideCmBx.ItemsSource = WorkSide
+3 -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, 2606, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2606, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2607, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2607, 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
@@ -461,6 +461,7 @@ Class MainWindow
If GetPrivateProfileInt(S_GENERAL, "Test", "0", m_sIniFile) = 0 OrElse
Not File.Exists(m_CurrentMachine.sMachDir() & "\DirectCmd\TestWork.lua") Then
m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Collapsed
EgtOutLog("Warning: Missing file 'TestWork.lua' in folder 'DirectCmd', buttun 'TEST' collapsed!")
Else
m_CadCutPageUC.m_ProjectMgr.TestBtn.Visibility = Visibility.Visible
End If
+3 -3
View File
@@ -22,7 +22,7 @@ Imports System.Windows
#End If
<Assembly: AssemblyCompany("Egalware s.r.l.")>
<Assembly: AssemblyProduct("OmagCUT")>
<Assembly: AssemblyCopyright("Copyright © 2015-2023 by Egalware s.r.l.")>
<Assembly: AssemblyCopyright("Copyright © 2015-2024 by Egalware s.r.l.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.6.6.2")>
<Assembly: AssemblyFileVersion("2.6.6.2")>
<Assembly: AssemblyVersion("2.6.7.7")>
<Assembly: AssemblyFileVersion("2.6.7.7")>
+183 -71
View File
@@ -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,17 @@ 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()
EgtOutLog("ProcessKill : " & """" & sProcessName & """")
End If
Next
End Sub
Private Sub InitCn()
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Yellow")
@@ -407,8 +419,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 +447,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 +519,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 +558,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 +567,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 +1095,68 @@ Public Class CNCommunication
'Laser = 16384
End Enum
#Region "MASCHERA per conttrollo Bit a Bit"
<Flags()>
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 +1172,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 +1205,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 +1224,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 +1250,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 +1350,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 +1441,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
@@ -1390,6 +1456,11 @@ Public Class CNCommunication
Friend Function SendProgram(ByVal sCncPath As String, ByVal nNumProg As Integer,
Optional bActivate As Boolean = True) As Boolean
Dim bOk As Boolean = True
' !!!!!!!!!!!!!!!!!! FORZO IL PROGRAMMA !!!!!!!!!!!!!!!!!!
' m_nNCType = 2
' !!!!!!!!!!!!!!!!!! FORZO IL PROGRAMMA !!!!!!!!!!!!!!!!!!
' Download programma
If m_MainWindow.m_bNCLink Then
bOk = (m_nNCType > 0)
@@ -1423,7 +1494,7 @@ Public Class CNCommunication
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
End If
EgtOutLog("Download_NC_prog(sCncPath, sNumProg)")
EgtOutLog("Download_NC_prog(" & sCncPath & ", " & sNumProg.ToString & ")")
' -------------- START DOWNLOAD --------------
TimeSpanInit()
bOk = bOk AndAlso (m_CN.Download_NC_prog(sCncPath, sNumProg) = 0)
@@ -1600,6 +1671,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 +1701,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
+1 -1
View File
@@ -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
'
+5 -6
View File
@@ -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
+5
View File
@@ -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
+32 -2
View File
@@ -744,6 +744,12 @@ Public Class ProjectMgrUC
Exit For
End If
Next
' leggo il nome della tavola da cui sto lanciando il progetto
Dim sTabeName As String = String.Empty
EgtGetTableName(sTabeName)
Dim bDoubleProg As Boolean = (GetPrivateProfileInt(S_PRODUCTIONLINE, "DoubleProg", 0, m_MainWindow.GetMachIniFile()) <> 0)
' Leggo eventuale variabile per lavorazione con 2 tavole in parallelo (standard E80027)
Dim nVarProgTwins As Integer = 1
If Not String.IsNullOrWhiteSpace(m_CurrMachine.sVarProgTwins) Then
@@ -757,8 +763,26 @@ Public Class ProjectMgrUC
End If
Next
End If
' Verifico se posso scrivere nell'area 1
If nVarProg1 = 0 And (nVarProg2 <> 1 Or nVarProgTwins = 2) Then
Dim bSendToAre1 As Boolean = (nVarProg1 = 0 And (nVarProg2 <> 1 Or nVarProgTwins = 2))
Dim bSendToAre2 As Boolean = (nVarProg2 = 0 And (nVarProg1 <> 1 Or nVarProgTwins = 2))
If bDoubleProg Then
If sTabeName = MAIN_TAB Then
' spedisco il programma da tavola 1 solo se CN ha terminato programma 901
bSendToAre1 = (nVarProg1 = 0)
bSendToAre2 = False
EgtOutLog(" Invio programma da tavola 1")
Else
' spedisco il programma da tavola 2 solo se CN ha terminato programma 902
bSendToAre1 = False
bSendToAre2 = (nVarProg2 = 0)
EgtOutLog(" Invio programma da tavola 2")
End If
End If
If bSendToAre1 Then
m_CurrNcComm.SetProgramMainOrSub(False)
If m_CurrNcComm.SendProgram(sCncPath, m_CurrMachine.nProg1, False) Then
' Dichiaro part program inviato
@@ -775,7 +799,7 @@ Public Class ProjectMgrUC
End If
m_CurrNcComm.SetProgramMainOrSub(True)
' Altrimenti verifico se posso scrivere nell'area 2
ElseIf nVarProg2 = 0 And (nVarProg1 <> 1 Or nVarProgTwins = 2) Then
ElseIf bSendToAre2 Then
m_CurrNcComm.SetProgramMainOrSub(False)
If m_CurrNcComm.SendProgram(sCncPath, m_CurrMachine.nProg2, False) Then
' Dichiaro part program inviato
@@ -795,6 +819,12 @@ Public Class ProjectMgrUC
Else
m_CurrProjPage.SetErrorMessage(EgtMsg(90318)) 'La macchina non accetta il programma CN
End If
' avvio programma solo se DoubleProg
If (GetPrivateProfileInt(S_GENERAL, K_STARTPROGRAM, 0, m_MainWindow.GetIniFile()) <> 0 And bDoubleProg) And
(bSendToAre1 Or bSendToAre2) Then
Dim MyCicloStartWD As New CicloStartWD(m_MainWindow)
MyCicloStartWD.ShowDialog()
End If
End If
#End If
+26 -1
View File
@@ -142,8 +142,33 @@ Public Class PhotoPageUC
Dim sPhoto As String = m_sCurrDir & "\" & m_sCurrFile
Dim sContour As String = String.Empty
If m_MainWindow.m_Camera.GetCalcContour() Then
' ----------------------- LANCIO file Batch per eseguire codice Python -----------------------
Dim FileBatch As String = "C:\EgtData\OmagCUT\Temp\PostPhotoTemplate.bat"
If File.Exists(FileBatch) Then
Dim FileBatchCopy As String = "C:\EgtData\OmagCUT\Temp\PostPhoto.bat"
Try
IO.File.Delete(FileBatchCopy)
Catch ex As Exception
End Try
IO.File.Copy(FileBatch, FileBatchCopy)
Dim sFilePhoto As String = Path.GetDirectoryName(sPhoto) & "\" & Path.GetFileNameWithoutExtension(sPhoto)
IO.File.WriteAllText(FileBatchCopy, IO.File.ReadAllText(FileBatchCopy).Replace("£_FILE_IMAGE_£", sFilePhoto))
' Creo file Dxf del contorno
Dim RunPython As Process = Process.Start(FileBatchCopy)
While Not RunPython.HasExited
' Attendo che il processo sia terminato
System.Threading.Thread.Sleep(1000)
End While
Try
IO.File.Delete(FileBatchCopy)
Catch ex As Exception
End Try
End If
' ----------------------- LANCIO file Batch per eseguire codice Python -----------------------
sContour = Path.ChangeExtension(sPhoto, "dxf")
End If
End If
m_MainWindow.m_CadCutPageUC.PostPhoto(sPhoto, sContour)
End If
End Sub