diff --git a/Constants/ConstMachIni.vb b/Constants/ConstMachIni.vb
index 10af3c6..73d2cbf 100644
--- a/Constants/ConstMachIni.vb
+++ b/Constants/ConstMachIni.vb
@@ -5,6 +5,7 @@
Public Const K_SPECIALSEND As String = "SpecialSend"
Public Const K_SPECIALAREAS As String = "SpecialAreas"
Public Const K_SPECIALDEST As String = "SpecialDest"
+ Public Const K_SPECIALEXEC As String = "SpecialExec"
Public Const S_PARTPROGRAM As String = "PartProgram"
Public Const K_EXTENSION As String = "Extension"
diff --git a/Machine/MachineCNPageUC.xaml b/Machine/MachineCNPageUC.xaml
index d02ae27..4efc8cc 100644
--- a/Machine/MachineCNPageUC.xaml
+++ b/Machine/MachineCNPageUC.xaml
@@ -129,9 +129,17 @@
-
+
+
+
+
+
+ Margin="0,0,0,0"/>
+
+
-1 Then
SpecialSendChBx.IsChecked() = (nSpecialSend = 1)
+ SpecialSendBtn.Content = "Run"
SpecialSendGpBx.Header = "Special Send"
SpecialSendGpBx.Visibility = Visibility.Visible
+ Dim nSpecialAreas As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALAREAS, 4, m_MainWindow.GetMachIniFile())
+ If nSpecialAreas <> 0 Then SpecialSendBtn.Visibility = Visibility.Collapsed
else
SpecialSendGpBx.Visibility = Visibility.Collapsed
End If
@@ -333,8 +336,27 @@ Public Class MachineCNPageUC
MDITxBx.Background = Brushes.LightGray
End Sub
- Private Sub SpecialSend_Click(sender As Object, e As RoutedEventArgs) Handles SpecialSendChBx.Click
- m_MainWindow.m_CNCommunication.SpecialSend() = If( SpecialSendChBx.IsChecked(), 1, 0)
+ Private Sub SpecialSendChBx_Click(sender As Object, e As RoutedEventArgs) Handles SpecialSendChBx.Click
+ m_MainWindow.m_CNCommunication.SpecialSend = If( SpecialSendChBx.IsChecked(), 1, 0)
+ End Sub
+
+ Private Sub SpecialSendBtn_Click(sender As Object, e As RoutedEventArgs) Handles SpecialSendBtn.Click
+ ' Recupero path dell'eseguibile
+ Dim sSpecialExec As String = ""
+ GetPrivateProfileString(S_NUMERICALCONTROL, K_SPECIALEXEC, "", sSpecialExec, m_MainWindow.m_CurrentMachine.sMachIniFile)
+ ' Verifico validità
+ If String.IsNullOrWhiteSpace( sSpecialExec) Then
+ EgtOutLog( "Warning : SpecialExec with empty name")
+ End If
+ ' Recupero il nome
+ Dim sSpecialName As String = IO.Path.GetFileNameWithoutExtension(sSpecialExec)
+ ' Mando in esecuzione
+ Dim ProcsSpecial As Process() = Process.GetProcessesByName(sSpecialName)
+ If ProcsSpecial.Length() > 0 Then
+ ShowWindow(ProcsSpecial(0).MainWindowHandle, 3)
+ Else
+ Process.Start(sSpecialExec)
+ End If
End Sub
Private Sub PowerON_Click(sender As Object, e As RoutedEventArgs) Handles PowerONBtn.Click
diff --git a/NcComm/CNCommunication.vb b/NcComm/CNCommunication.vb
index ba24a62..1c20787 100644
--- a/NcComm/CNCommunication.vb
+++ b/NcComm/CNCommunication.vb
@@ -1,10 +1,11 @@
-Imports System.Windows.Threading
+Imports System.Collections.ObjectModel
Imports System.Globalization
-Imports System.Collections.ObjectModel
-Imports EgtUILib
Imports System.IO
Imports System.Text
+Imports System.Windows.Threading
+Imports EgtUILib
Imports EgtWPFLib.EgtMsgBox
+Imports EgtWPFLib5
Imports OmagCUT.CN_generico
Public Class CNCommunication
@@ -120,7 +121,7 @@ Public Class CNCommunication
m_nSpecialSend = Math.Max( Math.Min( nTemp, 1), -1)
' Leggo numero di aree per invio speciale
Dim nTemp2 As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALAREAS, 4, m_MainWindow.GetMachIniFile())
- m_nSpecialAreas = Math.Max( Math.Min( nTemp2, 16), 1)
+ m_nSpecialAreas = Math.Max( Math.Min( nTemp2, 16), 0)
' Leggo il direttorio di destinazione (se Fanuc data server è "//DATA_SV/PROGRAM_DS/")
GetPrivateProfileString(S_NUMERICALCONTROL, K_SPECIALDEST, "", m_sSpecialDest, m_MainWindow.GetMachIniFile())
@@ -1604,6 +1605,16 @@ Public Class CNCommunication
Else
sNumProg = nNumProg.ToString()
End If
+ ' Se Fanuc con trasmissione speciale come copia
+ If m_nNCType = 4 AndAlso m_nSpecialSend = 1 AndAlso m_nSpecialAreas = 0 Then
+ bOk = SpecialSendCopyProgram(sCncPath)
+ If bOk Then
+ m_CurrProjPage.SetInfoMessage(EgtMsg(90317)) ' Programma CN trasmesso con successo
+ Else
+ m_CurrProjPage.SetErrorMessage(EgtMsg(90315)) ' Errore nella trasmissione del programma CN
+ End If
+ Return bOk
+ End If
' Se Fanuc con trasmissione speciale, disabilito attivazione
If m_nNCType = 4 AndAlso m_nSpecialSend = 1 Then
bActivate = False
@@ -1775,6 +1786,20 @@ Public Class CNCommunication
End If
End Function
+ Private Function SpecialSendCopyProgram(sz_PC_filename As String) As Boolean
+ ' 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
+ My.Computer.FileSystem.CopyFile(sz_PC_filename, sDestPath, True)
+ Catch ex As Exception
+ Return False
+ End Try
+ Return True
+ End Function
+
Private Sub GetSpecialCAxes()
If m_CN.bCPos Then
m_CN.d_axis_position(m_nA4) = m_CN.dCPos