OmagCUT :

- aggiunta gestione SpecialSend con copia file per Effector.
This commit is contained in:
Dario Sassi
2026-05-04 08:39:42 +02:00
parent dbcd4ca7a0
commit e710c55c2c
4 changed files with 64 additions and 8 deletions
+1
View File
@@ -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"
+10 -2
View File
@@ -129,9 +129,17 @@
<GroupBox Name="SpecialSendGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
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}"
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 Name="PowerGpBx" Style="{DynamicResource OmagCut_GroupBox}" Grid.Row="2"
+24 -2
View File
@@ -41,8 +41,11 @@ Public Class MachineCNPageUC
Dim nSpecialSend As Integer = GetPrivateProfileInt(S_NUMERICALCONTROL, K_SPECIALSEND, -1, m_MainWindow.GetMachIniFile())
If nSpecialSend <> -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
+29 -4
View File
@@ -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