OmagCUT :
- aggiunta gestione SpecialSend con copia file per Effector.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
Public Const K_SPECIALSEND As String = "SpecialSend"
|
Public Const K_SPECIALSEND As String = "SpecialSend"
|
||||||
Public Const K_SPECIALAREAS As String = "SpecialAreas"
|
Public Const K_SPECIALAREAS As String = "SpecialAreas"
|
||||||
Public Const K_SPECIALDEST As String = "SpecialDest"
|
Public Const K_SPECIALDEST As String = "SpecialDest"
|
||||||
|
Public Const K_SPECIALEXEC As String = "SpecialExec"
|
||||||
|
|
||||||
Public Const S_PARTPROGRAM As String = "PartProgram"
|
Public Const S_PARTPROGRAM As String = "PartProgram"
|
||||||
Public Const K_EXTENSION As String = "Extension"
|
Public Const K_EXTENSION As String = "Extension"
|
||||||
|
|||||||
@@ -129,9 +129,17 @@
|
|||||||
|
|
||||||
<GroupBox Name="SpecialSendGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
|
<GroupBox Name="SpecialSendGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
|
||||||
Grid.Column="2" Grid.ColumnSpan="1" Margin="5,0,5,0">
|
Grid.Column="2" Grid.ColumnSpan="1" Margin="5,0,5,0">
|
||||||
<CheckBox Name="SpecialSendChBx"
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<CheckBox Name="SpecialSendChBx" Grid.Column="0"
|
||||||
Style="{DynamicResource OmagCut_CheckBox_Single}"
|
Style="{DynamicResource OmagCut_CheckBox_Single}"
|
||||||
HorizontalAlignment="Center" Margin="0,0,0,0"/>
|
Margin="0,0,0,0"/>
|
||||||
|
<Button Name="SpecialSendBtn" Grid.Column="1"
|
||||||
|
Style="{DynamicResource OmagCut_RightGrayGradientYellowTextButton}"/>
|
||||||
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
<GroupBox Name="PowerGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
|
<GroupBox Name="PowerGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
|
||||||
|
|||||||
@@ -41,8 +41,11 @@ Public Class MachineCNPageUC
|
|||||||
Dim nSpecialSend As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALSEND, -1, m_MainWindow.GetMachIniFile())
|
Dim nSpecialSend As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALSEND, -1, m_MainWindow.GetMachIniFile())
|
||||||
If nSpecialSend <> -1 Then
|
If nSpecialSend <> -1 Then
|
||||||
SpecialSendChBx.IsChecked() = (nSpecialSend = 1)
|
SpecialSendChBx.IsChecked() = (nSpecialSend = 1)
|
||||||
|
SpecialSendBtn.Content = "Run"
|
||||||
SpecialSendGpBx.Header = "Special Send"
|
SpecialSendGpBx.Header = "Special Send"
|
||||||
SpecialSendGpBx.Visibility = Visibility.Visible
|
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
|
else
|
||||||
SpecialSendGpBx.Visibility = Visibility.Collapsed
|
SpecialSendGpBx.Visibility = Visibility.Collapsed
|
||||||
End If
|
End If
|
||||||
@@ -333,8 +336,27 @@ Public Class MachineCNPageUC
|
|||||||
MDITxBx.Background = Brushes.LightGray
|
MDITxBx.Background = Brushes.LightGray
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub SpecialSend_Click(sender As Object, e As RoutedEventArgs) Handles SpecialSendChBx.Click
|
Private Sub SpecialSendChBx_Click(sender As Object, e As RoutedEventArgs) Handles SpecialSendChBx.Click
|
||||||
m_MainWindow.m_CNCommunication.SpecialSend() = If( SpecialSendChBx.IsChecked(), 1, 0)
|
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
|
End Sub
|
||||||
|
|
||||||
Private Sub PowerON_Click(sender As Object, e As RoutedEventArgs) Handles PowerONBtn.Click
|
Private Sub PowerON_Click(sender As Object, e As RoutedEventArgs) Handles PowerONBtn.Click
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
Imports System.Windows.Threading
|
Imports System.Collections.ObjectModel
|
||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
Imports System.Collections.ObjectModel
|
|
||||||
Imports EgtUILib
|
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
|
Imports System.Windows.Threading
|
||||||
|
Imports EgtUILib
|
||||||
Imports EgtWPFLib.EgtMsgBox
|
Imports EgtWPFLib.EgtMsgBox
|
||||||
|
Imports EgtWPFLib5
|
||||||
Imports OmagCUT.CN_generico
|
Imports OmagCUT.CN_generico
|
||||||
|
|
||||||
Public Class CNCommunication
|
Public Class CNCommunication
|
||||||
@@ -120,7 +121,7 @@ Public Class CNCommunication
|
|||||||
m_nSpecialSend = Math.Max( Math.Min( nTemp, 1), -1)
|
m_nSpecialSend = Math.Max( Math.Min( nTemp, 1), -1)
|
||||||
' Leggo numero di aree per invio speciale
|
' Leggo numero di aree per invio speciale
|
||||||
Dim nTemp2 As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALAREAS, 4, m_MainWindow.GetMachIniFile())
|
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/")
|
' Leggo il direttorio di destinazione (se Fanuc data server è "//DATA_SV/PROGRAM_DS/")
|
||||||
GetPrivateProfileString(S_NUMERICALCONTROL, K_SPECIALDEST, "", m_sSpecialDest, m_MainWindow.GetMachIniFile())
|
GetPrivateProfileString(S_NUMERICALCONTROL, K_SPECIALDEST, "", m_sSpecialDest, m_MainWindow.GetMachIniFile())
|
||||||
|
|
||||||
@@ -1604,6 +1605,16 @@ Public Class CNCommunication
|
|||||||
Else
|
Else
|
||||||
sNumProg = nNumProg.ToString()
|
sNumProg = nNumProg.ToString()
|
||||||
End If
|
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
|
' Se Fanuc con trasmissione speciale, disabilito attivazione
|
||||||
If m_nNCType = 4 AndAlso m_nSpecialSend = 1 Then
|
If m_nNCType = 4 AndAlso m_nSpecialSend = 1 Then
|
||||||
bActivate = False
|
bActivate = False
|
||||||
@@ -1775,6 +1786,20 @@ Public Class CNCommunication
|
|||||||
End If
|
End If
|
||||||
End Function
|
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()
|
Private Sub GetSpecialCAxes()
|
||||||
If m_CN.bCPos Then
|
If m_CN.bCPos Then
|
||||||
m_CN.d_axis_position(m_nA4) = m_CN.dCPos
|
m_CN.d_axis_position(m_nA4) = m_CN.dCPos
|
||||||
|
|||||||
Reference in New Issue
Block a user