OmagCUT 3.1e1 :

- aggiunta modalità trasmissione del programma CN a step per debug con Siemens One (in Ini di OmagCUT [General] StepByStepSend=1).
This commit is contained in:
Dario Sassi
2026-05-05 19:14:33 +02:00
parent e710c55c2c
commit 45948e7004
5 changed files with 37 additions and 14 deletions
+1
View File
@@ -35,6 +35,7 @@ Module ConstIni
Public Const K_IMAGEDIR As String = "ImageDir"
Public Const K_CAMERALINK As String = "CameraLink"
Public Const K_CNLINK As String = "CNLink"
Public Const K_STEPBYSTEPSEND As String = "StepByStepSend"
Public Const K_TESTINGPAGE As String = "TestingPage"
Public Const K_SHOWTIPAXES As String = "ShowTipAxes"
Public Const K_LASTPROJFINISHED As String = "LastProjFinished"
+2 -2
View File
@@ -369,8 +369,8 @@ Class MainWindow
' Verifico abilitazione nesting automatico
m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 3104, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 3104, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 3105, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 3105, 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("3.1.4.2")>
<Assembly: AssemblyFileVersion("3.1.4.2")>
<Assembly: AssemblyVersion("3.1.5.1")>
<Assembly: AssemblyFileVersion("3.1.5.1")>
+30 -8
View File
@@ -21,6 +21,9 @@ Public Class CNCommunication
' Variabile per tipologia CN
Friend m_nNCType As Integer
' Modalità invio programmi step a step (attualmente solo per Siemens)
Private m_bStepByStepSend As Boolean = False
' Modalità speciale invio programmi (attualmente solo per Fanuc, fino a 4 programmi)
Private m_nSpecialSend As Integer = -1
Friend Property SpecialSend As Integer
@@ -116,6 +119,9 @@ Public Class CNCommunication
EgtOutLog("NcLink=" & m_MainWindow.m_bNCLink.ToString & " type=" & m_nNCType)
' Leggo flag invio programma a step per debug (da Ini di OmagCUT)
m_bStepByStepSend = (GetPrivateProfileInt(S_GENERAL, K_STEPBYSTEPSEND, 0, m_MainWindow.GetIniFile()) = 1)
' Leggo flag invio speciale programma di lavoro
Dim nTemp As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALSEND, -1, m_MainWindow.GetMachIniFile())
m_nSpecialSend = Math.Max( Math.Min( nTemp, 1), -1)
@@ -128,9 +134,9 @@ Public Class CNCommunication
' Se CN Siemens leggo dati programma intermedio di comunicazione
If m_nNCType = 3 Then
Dim sExeName As String = String.Empty
GetPrivateProfileString(S_NCSIEMENS, K_COMM_NAME, "", sExeName, m_MainWindow.m_CurrentMachine.sMachIniFile)
GetPrivateProfileString(S_NCSIEMENS, K_COMM_NAME, "", sExeName, m_MainWindow.GetMachIniFile())
m_sCNSiemensPath = m_MainWindow.GetExeRootDir() & "\" & sExeName
GetPrivateProfileString(S_NCSIEMENS, K_PATH_HMI, "", m_sCNSiemensHMIPath, m_MainWindow.m_CurrentMachine.sMachIniFile)
GetPrivateProfileString(S_NCSIEMENS, K_PATH_HMI, "", m_sCNSiemensHMIPath, m_MainWindow.GetMachIniFile())
End If
' Inizializzo la connessione
@@ -339,7 +345,7 @@ Public Class CNCommunication
#End Region ' ver 2.7h2 nuova gestione
Private Sub KillSimensCom(sProcessName As String)
Private Sub KillSiemensCom(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
@@ -555,7 +561,7 @@ Public Class CNCommunication
' !!!!!!!!!!!!!! FORZO LA SIMULAZIONE DELLA LETTURA DELLE VARIBILI E SIEMENS !!!!!!!!!!!!!!
EgtOutLog("ProcessStart : " & """" & m_sCNSiemensHMIPath & """" & " " & sArg)
KillSimensCom(m_sCNSiemensHMIPath)
KillSiemensCom(m_sCNSiemensHMIPath)
Process.Start(m_sCNSiemensHMIPath, sArg)
' !!!!!!!!!!!!!! FORZO LA SIMULAZIONE DELLA LETTURA DELLE VARIBILI E SIEMENS !!!!!!!!!!!!!!
@@ -680,7 +686,7 @@ Public Class CNCommunication
Next
' Attraverso la funzione "RefreshNoEvents" rileggo i dati caricati
' Recupero il perocorso delle variabili PLC
' Recupero il percorso delle variabili PLC
GetPrivateProfileString(S_NCSIEMENS, K_DBVARPATH, "", m_CN.m_DbVarPath, m_MainWindow.GetMachIniFile)
ElseIf m_CN.m_IsActiveModeSubscription Then
@@ -1605,7 +1611,7 @@ Public Class CNCommunication
Else
sNumProg = nNumProg.ToString()
End If
' Se Fanuc con trasmissione speciale come copia
' Se Fanuc con trasmissione speciale come copia in un direttorio opportuno
If m_nNCType = 4 AndAlso m_nSpecialSend = 1 AndAlso m_nSpecialAreas = 0 Then
bOk = SpecialSendCopyProgram(sCncPath)
If bOk Then
@@ -1628,6 +1634,10 @@ Public Class CNCommunication
End If
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nResetSendDelay)
' Se modalità invio a step per debug di Siemens
If m_bStepByStepSend And m_nNCType = 3 Then
MessageBox.Show( "Reset Done, Press Ok to Continue", "Send Program Step by Step")
End If
If m_nNCType = 1 Then
' Cancellazione eventuale file già presente con lo stesso nome (ignoro eventuale errore)
EgtOutLog("Delete_NC_prog(sNumProg)")
@@ -1653,6 +1663,10 @@ Public Class CNCommunication
bOk = bOk AndAlso (m_CN.Download_NC_prog(sCncPath, sNumProg) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' Se modalità invio a step per debug di Siemens
If m_bStepByStepSend And m_nNCType = 3 Then
MessageBox.Show( "Download NC Prog Done, Press Ok to Continue", "Send Program Step by Step")
End If
' FANUC: genero un file 901 vuoto da spedire, attivare; poi rispedisco il file 900
If m_nNCType = 4 And Not bOk Then
bOk = True
@@ -1694,10 +1708,18 @@ Public Class CNCommunication
EgtOutLog(TimeSpanEnd())
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' Se modalità invio a step per debug di Siemens
If m_bStepByStepSend And m_nNCType = 3 Then
MessageBox.Show( "ActivateProgram Done, Press Ok to Continue", "Send Program Step by Step")
End If
' Attivo la modalità AUTO prima per preparare il cyclo start
bOk = bOk AndAlso (m_CN.DGeneralFunctions_WriteCncMode(0) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' Se modalità invio a step per debug di Siemens
If m_bStepByStepSend And m_nNCType = 3 Then
MessageBox.Show( "AUTO Mode Setting Done, Press Ok to Continue", "Send Program Step by Step")
End If
' Modalità automatica
EgtOutLog("DGeneralFunctions_WriteCncMode(0)")
TimeSpanInit()
@@ -1790,9 +1812,9 @@ Public Class CNCommunication
' Solo per Fanuc
If m_nNCType <> 4 Then Return False
' Creo path destinazione
Dim sDestProg As String = m_CurrProjPage.GetCurrentProjectTitle()
Dim sDestPath As String = m_sSpecialDest & "\" & sDestProg & ".cnc"
Try
Dim sDestProg As String = m_CurrProjPage.GetCurrentProjectTitle() & ".cnc"
Dim sDestPath As String = My.Computer.FileSystem.CombinePath(m_sSpecialDest, sDestProg)
My.Computer.FileSystem.CopyFile(sz_PC_filename, sDestPath, True)
Catch ex As Exception
Return False
+2 -2
View File
@@ -839,9 +839,9 @@ Public Class CurrentProjectPageUC
End Function
Friend Function GetCurrentProjectTitle() As String
Dim CurrProjName As String = String.Empty
Dim CurrProjName As String = ""
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", CurrProjName, m_MainWindow.GetIniFile())
If String.IsNullOrEmpty(CurrProjName) Then
If String.IsNullOrWhiteSpace(CurrProjName) Then
CurrProjName = Math.Abs(m_nCurrProj).ToString("D4")
End If
Return CurrProjName