From ff30a4d3b6187cc331f2d62befaada7eeed69b4d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 22 Sep 2016 14:47:57 +0000 Subject: [PATCH] OmagCUT 1.6u4 : - gestione nesting allineato (con regione di riferimento a L) - gestione epl pezzi rovinati da OmagVIEW per linee di produzione - piccole migliorie varie. --- AlarmsPageUC.xaml | 40 ++++++-- AlarmsPageUC.xaml.vb | 16 +++- CNCommunication.vb | 1 + CN_Siemens.vb | 2 +- CSVPage.xaml.vb | 2 + ConstGen.vb | 6 +- ConstIni.vb | 1 + ConstMachIni.vb | 1 + ConstMsg.vb | 4 +- M_MMFiles.vb | 190 +++++++++++++++++-------------------- MachineStatusUC.xaml.vb | 63 ++++++------ MainWindow.xaml.vb | 38 ++++++-- My Project/AssemblyInfo.vb | 4 +- NestPageUC.xaml.vb | 25 +++++ OmagCUT.vbproj | 1 + OmagCUTDictionary.xaml | 2 +- RawPartPageUC.xaml.vb | 9 +- ToolsDbPageUC.xaml | 4 +- 18 files changed, 248 insertions(+), 161 deletions(-) diff --git a/AlarmsPageUC.xaml b/AlarmsPageUC.xaml index 9b325bf..671a34b 100644 --- a/AlarmsPageUC.xaml +++ b/AlarmsPageUC.xaml @@ -183,7 +183,7 @@ - + @@ -205,14 +205,9 @@ - - - - - @@ -247,7 +242,7 @@ - + @@ -258,6 +253,33 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AlarmsPageUC.xaml.vb b/AlarmsPageUC.xaml.vb index acff9a1..37c782f 100644 --- a/AlarmsPageUC.xaml.vb +++ b/AlarmsPageUC.xaml.vb @@ -61,6 +61,8 @@ Public Class AlarmsPageUC FinalHomeTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 28) ' Home finale MillingsParamGpBx.Header = EgtMsg(MSG_ALARMSPAGEUC + 29) ' Parametri fresature InternalCutsTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 30) ' Sempre sugli interni + NestingParamGpBx.Header = EgtMsg(MSG_ALARMSPAGEUC + 31) ' Nesting + AlignTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 32) ' Allineato End Sub Private Sub AlarmsPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded @@ -188,6 +190,10 @@ Public Class AlarmsPageUC (GetPrivateProfileInt(S_MACH_NEST, K_MACH_MILLING_ON_SINKS, 0, m_MainWindow.GetMachIniFile()) <> 0) ' Flag per movimento in home alla fine dei tagli diretti FinalHomeChBx.IsChecked = m_MainWindow.m_CurrentMachine.bDirectCutsFinalHome + ' Flag per nesting allineato + AlignChBx.IsChecked = + (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0) + End Sub Private Sub AuxiliaryToolCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles AuxiliaryToolCmBx.SelectionChanged @@ -394,7 +400,7 @@ Public Class AlarmsPageUC ' Se pezzi in interferenza If Not NestPage.VerifyPartsNesting(False) Then ' Ci sono interferenze, alcuni pezzi saranno parcheggiati. Vuoi continuare ? - Dim Dlg As New EgtMsgBox(m_MainWindow, "", EgtMsg(91105), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.ESCLAMATION, 1) + Dim Dlg As New EgtMsgBox(m_MainWindow, "", EgtMsg(91105), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.NULL, 1, 1) If Dlg.DialogResult = 1 Then ' Ok NestPage.StoreCollisionParts(False) WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile()) @@ -423,6 +429,14 @@ Public Class AlarmsPageUC End If End Sub + Private Sub AlignChBx_Click(sender As Object, e As RoutedEventArgs) Handles AlignChBx.Click + If AlignChBx.IsChecked() Then + WritePrivateProfileString(S_MACH_NEST, K_MACH_NEST_ALIGNED, "1", m_MainWindow.GetMachIniFile()) + Else + WritePrivateProfileString(S_MACH_NEST, K_MACH_NEST_ALIGNED, "0", m_MainWindow.GetMachIniFile()) + End If + End Sub + Friend Sub NcError() If m_CN.sz_NC_error_messages.Count > 0 Then 'NCErrorMessages.Text = m_CN.sz_NC_error_messages(0) diff --git a/CNCommunication.vb b/CNCommunication.vb index 80d8fdb..89c4546 100644 --- a/CNCommunication.vb +++ b/CNCommunication.vb @@ -220,6 +220,7 @@ Public Class CNCommunication EgtOutLog("ProcessStart : " & m_sCNSiemensHMIPath & " " & sArg) Process.Start(m_sCNSiemensHMIPath, sArg) Catch ex As Exception + EgtOutLog("Error starting Process -> NcLink=True type=0") ' Per evitare crash con azioni verso il controllo, avvio quello di debug Me.m_CN.Stop_Connection() m_nNCType = 0 diff --git a/CN_Siemens.vb b/CN_Siemens.vb index e3200d6..b027d25 100644 --- a/CN_Siemens.vb +++ b/CN_Siemens.vb @@ -105,7 +105,7 @@ Public Class CN_Siemens End Sub Public Overrides Function read_active_mode() As Int16 - EgtOutLog("Modo attivo: " & M_MMFiles.SiemensRet.n_param2) + 'EgtOutLog("Modo attivo: " & M_MMFiles.SiemensRet.n_param2) 'Return M_MMFiles.read_active_mode() Return CShort(M_MMFiles.SiemensRet.n_param2) End Function diff --git a/CSVPage.xaml.vb b/CSVPage.xaml.vb index 89a4362..c7ab493 100644 --- a/CSVPage.xaml.vb +++ b/CSVPage.xaml.vb @@ -378,6 +378,8 @@ Public Class CSVPage ' Eseguo nesting Dim bFit As Boolean = False If m_MainWindow.m_CadCutPageUC.m_NestPage.UpdateNestRegions() Then + Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0) + m_MainWindow.m_CadCutPageUC.m_NestPage.EnableReferenceRegion(bAligned) If Not EgtExistsInfo(m_nRawId, KEY_RAWBYPOINTS) Then bFit = EgtPackPartInRectangle(nId2, True, True) End If diff --git a/ConstGen.vb b/ConstGen.vb index 5b659ac..0939151 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -80,7 +80,11 @@ Module ConstGen ' Nome della regione del kerf grezzo Public Const NAME_KERF_REGION As String = "KerfRegion" ' Nome della regione fuori kerf nel grezzo - Public Const NAME_OUTKERF As String = "SheetOut" + Public Const NAME_OUTKERF_REG As String = "SheetOut" + ' Nome della regione di riferimento nel grezzo + Public Const NAME_REF_REG As String = "RefReg" + ' Chiave per disabilitare la regione di riferimento + Public Const KEY_REF_REG_OFF As String = "Off" ' Chiave per definizione del grezzo per punti Public Const KEY_RAWBYPOINTS As String = "Rbp" ' Nome del contorno di un'area rovinata diff --git a/ConstIni.vb b/ConstIni.vb index ba42b7c..3efac45 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -33,6 +33,7 @@ Module ConstIni Public Const K_CNLINK As String = "CNLink" Public Const K_TESTINGPAGE As String = "TestingPage" Public Const K_SHOWTIPAXES As String = "ShowTipAxes" + Public Const K_LASTPROJTOVIEW As String = "LastProjToView" Public Const S_LANGUAGES As String = "Languages" Public Const K_LANGUAGE As String = "Language" diff --git a/ConstMachIni.vb b/ConstMachIni.vb index d3a3634..70c6e3b 100644 --- a/ConstMachIni.vb +++ b/ConstMachIni.vb @@ -85,6 +85,7 @@ Public Const K_MACH_REDUCEDDEPTH As String = "ReducedDepth" Public Const K_MACH_EXTARCMINRAD As String = "ExtArcMinRad" Public Const K_MACH_MILLING_ON_SINKS As String = "MillingOnSinks" + Public Const K_MACH_NEST_ALIGNED As String = "Aligned" Public Const S_TOOLCHANGER As String = "ToolChanger" Public Const K_NUMBER As String = "Number" diff --git a/ConstMsg.vb b/ConstMsg.vb index 52f6ce5..5f59c98 100644 --- a/ConstMsg.vb +++ b/ConstMsg.vb @@ -25,8 +25,8 @@ Public Const MSG_MACHININGSDBPAGEUC As Integer = MSG_OMAGCUT + 760 Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800 Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900 - Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 930 - Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 950 + Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 950 + Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980 Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100 Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200 diff --git a/M_MMFiles.vb b/M_MMFiles.vb index 6a54a35..0a129b5 100644 --- a/M_MMFiles.vb +++ b/M_MMFiles.vb @@ -21,6 +21,7 @@ Module M_MMFiles #Region " Structures" + _ Structure SiemensSendStruct Public n_Flag As Integer @@ -42,7 +43,7 @@ Module M_MMFiles End Structure - Dim SiemensSend As SiemensSendStruct + Private SiemensSend As SiemensSendStruct _ @@ -116,7 +117,7 @@ Module M_MMFiles ' view must be within the maximum size of the file mapping object (MAP_SIZE). ' If VIEW_SIZE is 0, the mapping extends from the offset (VIEW_OFFSET) to ' the end of the file mapping. - Friend Const ViewSize As UInt32 = &H400 + Friend Const ViewSize As UInt32 = &H1000 #End Region @@ -192,9 +193,9 @@ Module M_MMFiles ' Sub init() - Call MMFile_init() + MMFile_init() - Call Timer_init() + Timer_init() End Sub @@ -270,7 +271,7 @@ Module M_MMFiles ' scrivo !!!!! Marshal.StructureToPtr(SiemensSend, pView, False) - ' Call execute_command() + ' execute_command() System.Threading.Thread.Sleep(2000) @@ -316,7 +317,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_ActivateProgram SiemensSend.sz_string = sz_part_program - Call execute_command() + execute_command() EgtOutLog("ActivateProgram end dell'm_mmFiles") Return SiemensRet.n_result @@ -328,7 +329,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_Delete_NC_prog SiemensSend.sz_string = sz_filename - Call execute_command() + execute_command() EgtOutLog("Delete_NC_prog end dell'm_mmFiles") Return SiemensRet.n_result @@ -339,7 +340,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_CycleStart - Call execute_command() + execute_command() EgtOutLog("CycleStart end dell'm_mmFiles") Return SiemensRet.n_result @@ -350,7 +351,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_FeedHold - Call execute_command() + execute_command() EgtOutLog("FeedHold end dell'm_mmFiles") Return SiemensRet.n_result @@ -361,7 +362,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_Reset - Call execute_command() + execute_command() EgtOutLog("Reset end dell'm_mmFiles") Return SiemensRet.n_result @@ -372,7 +373,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_WriteCncMode SiemensSend.n_param1 = nmode - Call execute_command() + execute_command() EgtOutLog("WriteCncMode end dell'm_mmFiles") Return SiemensRet.n_result @@ -384,7 +385,7 @@ Module M_MMFiles SiemensSend.sz_string = sz_Pc_file_name SiemensSend.sz_string_2 = sz_NC_filen - Call execute_command() + execute_command() EgtOutLog("Download_NC_prog end dell'm_mmFiles") Return SiemensRet.n_result @@ -400,7 +401,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_MDI_command SiemensSend.sz_string = sz_command - Call execute_command() + execute_command() EgtOutLog("MDI_command end dell'm_mmFiles") Return SiemensRet.n_result @@ -411,7 +412,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_set_OP_OM SiemensSend.n_param1 = n - Call execute_command() + execute_command() EgtOutLog("set_OP_OM end dell'm_mmFiles") End Sub @@ -419,7 +420,7 @@ Module M_MMFiles EgtOutLog("read_active_mode start dell'm_mmFiles") SiemensSend.n_Command = CMD.CMD_read_active_mode - Call execute_command() + execute_command() EgtOutLog("read_active_mode end dell'm_mmFiles") Return SiemensRet.n_result @@ -440,7 +441,7 @@ Module M_MMFiles SiemensSend.n_Command = CMD.CMD_Read_Nc_var SiemensSend.n_param1 = n_var - Call execute_command() + execute_command() m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value = SiemensRet.d_param1 EgtOutLog("Read_Nc_var end dell'm_mmFiles") @@ -453,64 +454,54 @@ Module M_MMFiles ' Sub execute_command() - Dim lstate As State = State.Command_on - Dim b_end As Boolean = False Try - - ' attesa eventuale busy iniziale - b_end = False - While Not b_end + ' Attesa eventuale busy iniziale + Dim bEnd As Boolean = False + While Not bEnd If SiemensRet.b_busy Then - System.Threading.Thread.Sleep(100) ' se busy attendo a botte di 100 msec + System.Threading.Thread.Sleep(50) Else - b_end = True + bEnd = True End If End While - SiemensSend.n_Flag = COMMAND_ON ' alzo il comando - ' scrivo !!!!! + ' Alzo il comando + SiemensSend.n_Flag = COMMAND_ON + ' scrivo Marshal.StructureToPtr(SiemensSend, pView, False) - b_end = False - While Not b_end - - Select Case lstate - - Case State.Command_on ' alzato il comando attendo il busy - - If SiemensRet.b_busy Then - lstate = State.Busy_On - Else - System.Threading.Thread.Sleep(100) - End If - - Case State.Busy_On ' trovato il busy abbasso il comando - - SiemensSend.n_Flag = COMMAND_OFF ' abbasso il comando - ' scrivo !!!!! - Marshal.StructureToPtr(SiemensSend, pView, False) - - lstate = State.Command_off - - - Case State.Command_off - - If Not SiemensRet.b_busy Then ' abbassato il comando attendo il busy basso - lstate = State.Busy_Off - Else - System.Threading.Thread.Sleep(100) - End If - - - Case State.Busy_Off - b_end = True - + ' Ciclo di attesa della risposta + Dim nState As State = State.Command_on + bEnd = False + While Not bEnd + Select Case nState + Case State.Command_on ' alzato il comando attendo il busy + If SiemensRet.b_busy Then + nState = State.Busy_On + Else + System.Threading.Thread.Sleep(50) + End If + Case State.Busy_On ' trovato il busy abbasso il comando + SiemensSend.n_Flag = COMMAND_OFF ' abbasso il comando + ' scrivo !!!!! + Marshal.StructureToPtr(SiemensSend, pView, False) + nState = State.Command_off + Case State.Command_off + If Not SiemensRet.b_busy Then ' abbassato il comando attendo il busy basso + nState = State.Busy_Off + Else + System.Threading.Thread.Sleep(50) + End If + Case State.Busy_Off + bEnd = True End Select End While + EgtOutLog("Eseguito comando :" & SiemensSend.n_Command.ToString()) + Catch ex As Exception - EgtOutLog("Errore nell'esecuzione di un comando" & ex.ToString) + EgtOutLog("Errore nell'esecuzione di un comando :" & ex.ToString()) End Try End Sub @@ -545,7 +536,7 @@ Module M_MMFiles aTimer.Enabled = False b_busy = True - Call TimerProcessing() + TimerProcessing() b_busy = False aTimer.Enabled = True @@ -555,12 +546,11 @@ Module M_MMFiles Sub TimerProcessing() - ' !!!!!!!!!!!! mettete tutti i travasi di dati - Try - SiemensRet = Marshal.PtrToStructure(pView2, SiemensRet.GetType) + EgtOutLog("Siemens TimerProcessing start") + SiemensRet = Marshal.PtrToStructure(pView2, SiemensRet.GetType) For n As Short = 0 To COPY_MAX_AXES - 1 @@ -569,7 +559,6 @@ Module M_MMFiles Next - ' copy R vars For n = 0 To (N_R_VAR - 1) @@ -578,8 +567,6 @@ Module M_MMFiles ' copy spindle current m_MainWindow.m_CNCommunication.m_CN.d_spindle_power = SiemensRet.d_interf_spindle_power - 'EgtOutLog("Ampere =" & m_MainWindow.m_CNCommunication.m_CN.d_spindle_power) - m_MainWindow.m_CNCommunication.m_CN.n_spindle_override(0) = SiemensRet.n_interf_spindle_override @@ -606,6 +593,8 @@ Module M_MMFiles End If + EgtOutLog("stop") + Catch ex As Exception EgtOutLog("Errore nella lettura delle quote e simili variabili" & ex.ToString) End Try @@ -661,25 +650,24 @@ Module M_MMFiles ''' Represents a wrapper class for a file mapping handle. ''' ''' - _ + Friend NotInheritable Class SafeFileMappingHandle Inherits SafeHandleZeroOrMinusOneIsInvalid - _ + Private Sub New() MyBase.New(True) End Sub - _ - Public Sub New(ByVal handle As IntPtr, ByVal ownsHandle As Boolean) + + Public Sub New(handle As IntPtr, ownsHandle As Boolean) MyBase.New(ownsHandle) MyBase.SetHandle(handle) End Sub - _ - Private Shared Function CloseHandle(ByVal handle As IntPtr) _ - As Boolean + + Private Shared Function CloseHandle(handle As IntPtr) As Boolean End Function Protected Overrides Function ReleaseHandle() As Boolean @@ -725,15 +713,14 @@ Module M_MMFiles ''' If the function succeeds, the return value is a handle to the newly ''' created file mapping object. ''' - _ - Public Shared Function CreateFileMapping( _ - ByVal hFile As IntPtr, _ - ByVal lpAttributes As IntPtr, _ - ByVal flProtect As FileProtection, _ - ByVal dwMaximumSizeHigh As UInt32, _ - ByVal dwMaximumSizeLow As UInt32, _ - ByVal lpName As String) _ - As SafeFileMappingHandle + + Public Shared Function CreateFileMapping( + hFile As IntPtr, + lpAttributes As IntPtr, + flProtect As FileProtection, + dwMaximumSizeHigh As UInt32, + dwMaximumSizeLow As UInt32, + lpName As String) As SafeFileMappingHandle End Function ''' @@ -755,12 +742,11 @@ Module M_MMFiles ''' If the function succeeds, the return value is an open handle to the ''' specified file mapping object. ''' - _ - Public Shared Function OpenFileMapping( _ - ByVal dwDesiredAccess As FileMapAccess, _ - ByVal bInheritHandle As Boolean, _ - ByVal lpName As String) _ - As SafeFileMappingHandle + + Public Shared Function OpenFileMapping( + dwDesiredAccess As FileMapAccess, + bInheritHandle As Boolean, + lpName As String) As SafeFileMappingHandle End Function @@ -790,14 +776,13 @@ Module M_MMFiles ''' If the function succeeds, the return value is the starting address of ''' the mapped view. ''' - _ - Public Shared Function MapViewOfFile( _ - ByVal hFileMappingObject As SafeFileMappingHandle, _ - ByVal dwDesiredAccess As FileMapAccess, _ - ByVal dwFileOffsetHigh As UInt32, _ - ByVal dwFileOffsetLow As UInt32, _ - ByVal dwNumberOfBytesToMap As UInt32) _ - As IntPtr + + Public Shared Function MapViewOfFile( + hFileMappingObject As SafeFileMappingHandle, + dwDesiredAccess As FileMapAccess, + dwFileOffsetHigh As UInt32, + dwFileOffsetLow As UInt32, + dwNumberOfBytesToMap As UInt32) As IntPtr End Function @@ -810,10 +795,9 @@ Module M_MMFiles ''' be unmapped. ''' ''' - _ - Public Shared Function UnmapViewOfFile( _ - ByVal lpBaseAddress As IntPtr) _ - As Boolean + + Public Shared Function UnmapViewOfFile( + lpBaseAddress As IntPtr) As Boolean End Function End Class diff --git a/MachineStatusUC.xaml.vb b/MachineStatusUC.xaml.vb index 0b85343..2b343b4 100644 --- a/MachineStatusUC.xaml.vb +++ b/MachineStatusUC.xaml.vb @@ -12,37 +12,39 @@ Public Class MachineStatusUC Friend m_CN As CN_generico ' Flag per tipo visualizzazione assi Private m_bShowTipAxes As Boolean = False + ' Flag bistabile per delta (per lampeggiare delta Z anche quando macchina ferma) + Private m_bEven As Boolean = True Private Sub MachineStatus_Initialized(sender As Object, e As EventArgs) - If m_MainWindow.m_dHorScale < 1 Then - MachineStatusImage.Height *= m_MainWindow.m_dHorScale - MachineStatusImage.Width *= m_MainWindow.m_dHorScale - Axis1NameTxBx.FontSize *= m_MainWindow.m_dHorScale - Axis1TxBx.FontSize *= m_MainWindow.m_dHorScale - DeltaAxis1TxBx.FontSize *= m_MainWindow.m_dHorScale - Axis2NameTxBx.FontSize *= m_MainWindow.m_dHorScale - Axis2TxBx.FontSize *= m_MainWindow.m_dHorScale - DeltaAxis2TxBx.FontSize *= m_MainWindow.m_dHorScale - Axis3NameTxBx.FontSize *= m_MainWindow.m_dHorScale - Axis3TxBx.FontSize *= m_MainWindow.m_dHorScale - DeltaAxis3TxBx.FontSize *= m_MainWindow.m_dHorScale - Axis4NameTxBx.FontSize *= m_MainWindow.m_dHorScale - Axis4TxBx.FontSize *= m_MainWindow.m_dHorScale - DeltaAxis4TxBx.FontSize *= m_MainWindow.m_dHorScale - Axis5NameTxBx.FontSize *= m_MainWindow.m_dHorScale - Axis5TxBx.FontSize *= m_MainWindow.m_dHorScale - DeltaAxis5TxBx.FontSize *= m_MainWindow.m_dHorScale - FeedNameTxBx.FontSize *= m_MainWindow.m_dHorScale - FeedTxBx.FontSize *= m_MainWindow.m_dHorScale - FeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dHorScale - FeedOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale - SpeedNameTxBx.FontSize *= m_MainWindow.m_dHorScale - SpeedTxBx.FontSize *= m_MainWindow.m_dHorScale - SpeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dHorScale - SpeedOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale - ConsumptionNameTxBx.FontSize *= m_MainWindow.m_dHorScale - ConsumptionTxBx.FontSize *= m_MainWindow.m_dHorScale - AOverrideTxBx.FontSize *= m_MainWindow.m_dHorScale + If m_MainWindow.m_dMWinScale < 1 Then + MachineStatusImage.Height *= m_MainWindow.m_dMWinScale + MachineStatusImage.Width *= m_MainWindow.m_dMWinScale + Axis1NameTxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis1TxBx.FontSize *= m_MainWindow.m_dMWinScale + DeltaAxis1TxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis2NameTxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis2TxBx.FontSize *= m_MainWindow.m_dMWinScale + DeltaAxis2TxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis3NameTxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis3TxBx.FontSize *= m_MainWindow.m_dMWinScale + DeltaAxis3TxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis4NameTxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis4TxBx.FontSize *= m_MainWindow.m_dMWinScale + DeltaAxis4TxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis5NameTxBx.FontSize *= m_MainWindow.m_dMWinScale + Axis5TxBx.FontSize *= m_MainWindow.m_dMWinScale + DeltaAxis5TxBx.FontSize *= m_MainWindow.m_dMWinScale + FeedNameTxBx.FontSize *= m_MainWindow.m_dMWinScale + FeedTxBx.FontSize *= m_MainWindow.m_dMWinScale + FeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dMWinScale + FeedOverrideTxBx.FontSize *= m_MainWindow.m_dMWinScale + SpeedNameTxBx.FontSize *= m_MainWindow.m_dMWinScale + SpeedTxBx.FontSize *= m_MainWindow.m_dMWinScale + SpeedOverrideNameTxBx.FontSize *= m_MainWindow.m_dMWinScale + SpeedOverrideTxBx.FontSize *= m_MainWindow.m_dMWinScale + ConsumptionNameTxBx.FontSize *= m_MainWindow.m_dMWinScale + ConsumptionTxBx.FontSize *= m_MainWindow.m_dMWinScale + AOverrideTxBx.FontSize *= m_MainWindow.m_dMWinScale End If End Sub @@ -155,9 +157,10 @@ Public Class MachineStatusUC ' Visualizzazione DeltaAxis1TxBx.Text = LenToString(dL1, -3) DeltaAxis2TxBx.Text = LenToString(dL2, -3) - DeltaAxis3TxBx.Text = LenToString(dL3, -3) + DeltaAxis3TxBx.Text = LenToString(If(m_bEven, dL3, dL3 + EPS_SMALL), -3) DeltaAxis4TxBx.Text = DoubleToString(dR1, -3) DeltaAxis5TxBx.Text = DoubleToString(dR2, -3) + m_bEven = Not m_bEven End Sub Sub DisplayFeed() diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 07a49f1..79f380a 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -18,8 +18,8 @@ Class MainWindow ' Dichiarazione della MachineStatusBar Friend m_MachineStatusUC As MachineStatusUC - ' Coefficiente di scalatura orizzontale rispetto a standard - Friend m_dHorScale As Double = 1 + ' Coefficiente di scalatura della finestra rispetto a standard + Friend m_dMWinScale As Double = 1 ' Dichiarazione delle Page UserControl Friend m_WorkInProgressPageUC As WorkInProgressPageUC @@ -275,7 +275,7 @@ Class MainWindow Me.Height = nHeight Me.Width = nWidth WindowState = If(nFlag = 1, WindowState.Maximized, WindowState.Normal) - m_dHorScale = Me.Width / 1280 + m_dMWinScale = Math.Min(Me.Width / 1280, Me.Height / 832) ' Info su opzioni chiave EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString()) ' Inizializzazione della libreria EgtWPFLib @@ -874,8 +874,29 @@ Class MainWindow ' OnProdLine Private Sub OnProdLine() - ' Acquisizione eventuale file epl - ' !!! DA FARE !!! + ' Acquisizione eventuale file epl dei pezzi rovinati : + ' lo sposto dal direttorio condiviso al direttorio corrente dei CSV + Const CURR_PROJ_EPL As String = "CurrProj.epl" + If My.Computer.FileSystem.FileExists(m_CurrentMachine.sLineDataDir & "\" & CURR_PROJ_EPL) Then + ' Leggo direttorio corrente dei file CSV + Dim sCurrDir As String = String.Empty + GetPrivateProfileString(S_CSV, K_CSVCURRDIR, "C:\", sCurrDir, GetIniFile()) + If My.Computer.FileSystem.DirectoryExists(sCurrDir) Then + ' Recupero da INI ultimo progetto mandato a View + Dim sName As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTPROJTOVIEW, "", sName, GetIniFile()) + ' Eseguo spostamento + Try + My.Computer.FileSystem.MoveFile(m_CurrentMachine.sLineDataDir & "\" & CURR_PROJ_EPL, sCurrDir & "\Ruined" & sName & ".epl", True) + Catch ex As Exception + EgtOutLog("Error moving " & CURR_PROJ_EPL) + End Try + Else + EgtOutLog("Error in ruined parts management : " & sCurrDir & " not found") + ' Errore nella gestione dei pezzi rovinati + m_CurrentProjectPageUC.SetErrorMessage(EgtMsg(91119)) + End If + End If ' Leggo variabile con indice progetto da copiare per OmagVIEW (standard E80025) m_CNCommunication.m_CN.n_DReadELS_handle = 0 m_CNCommunication.m_CN.ReadEls_Add_Parameter(m_CurrentMachine.sVarProjCopy, 1) @@ -892,8 +913,10 @@ Class MainWindow ' Verifico esistenza progetto con numerazione equivalente e assenza file di lock Dim sNgeFile As String = GetSaveDir() & "\" & nVarCopy.ToString("D4") & ".nge" Dim sLockFile As String = m_CurrentMachine.sLineDataDir & "\CurrProj.lck" + Dim sEplFile As String = m_CurrentMachine.sLineDataDir & "\" & CURR_PROJ_EPL If My.Computer.FileSystem.FileExists(sNgeFile) And - Not My.Computer.FileSystem.FileExists(sLockFile) Then + Not My.Computer.FileSystem.FileExists(sLockFile) And + Not My.Computer.FileSystem.FileExists(sEplFile) Then Try ' Copio file di progetto nge Dim sNgeDest As String = m_CurrentMachine.sLineDataDir & "\CurrProj.nge" @@ -912,7 +935,10 @@ Class MainWindow FileClose(nF) ' Dichiaro progetto copiato m_CNCommunication.m_CN.DVariables_WriteVariables2(m_CurrentMachine.sVarProjCopy, "0") + ' Salvo in INI indice del progetto copiato + WritePrivateProfileString(S_GENERAL, K_LASTPROJTOVIEW, nVarCopy.ToString("D4"), GetIniFile()) Catch ex As Exception + EgtOutLog("Error copying files to OmagVIEW") ' Errore in copia file per OmagVIEW m_CurrentProjectPageUC.SetErrorMessage(EgtMsg(91117)) End Try diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 2a945d5..8dc5ab8 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -60,5 +60,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/NestPageUC.xaml.vb b/NestPageUC.xaml.vb index a15165f..d0579e1 100644 --- a/NestPageUC.xaml.vb +++ b/NestPageUC.xaml.vb @@ -157,6 +157,7 @@ Public Class NestPageUC If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' muovo il pezzo EgtMovePart(nMoveId, m_bReducedCut, vtMove) EgtSaveCollInfo() @@ -246,6 +247,7 @@ Public Class NestPageUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' eseguo movimento Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep) EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(0, dStep, 0)) @@ -274,6 +276,7 @@ Public Class NestPageUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' eseguo movimento Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep) EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(0, -dStep, 0)) @@ -302,6 +305,7 @@ Public Class NestPageUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' eseguo movimento Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep) EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(dStep, 0, 0)) @@ -330,6 +334,7 @@ Public Class NestPageUC EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' eseguo movimento Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep) EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(-dStep, 0, 0)) @@ -404,6 +409,7 @@ Public Class NestPageUC Else ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) Return EgtRotatePart(GDB_ID.SEL, m_bReducedCut, ptCen, dAngRotDeg) End If End Function @@ -452,6 +458,8 @@ Public Class NestPageUC ' Eseguo nesting Dim bFit As Boolean = False If UpdateNestRegions() Then + Dim bAligned As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0) + EnableReferenceRegion(bAligned) If Not EgtExistsInfo(m_nRawId, KEY_RAWBYPOINTS) Then bFit = EgtPackPartInRectangle(nId, m_bReducedCut, True) End If @@ -668,6 +676,7 @@ Public Class NestPageUC Friend Function VerifyPartsNesting(bReducedCut As Boolean) As Boolean ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' Ciclo su tutti i pezzi in tavola Dim nPartId As Integer = EgtGetFirstGroupInGroup(m_nRawId) While nPartId <> GDB_ID.NULL @@ -682,6 +691,7 @@ Public Class NestPageUC Friend Function StoreCollisionParts(bReducedCut As Boolean) As Boolean ' Aggiorno regioni per nesting UpdateNestRegions() + EnableReferenceRegion(False) ' Ciclo su tutti i pezzi in tavola (dall'ultimo) Dim nPartId As Integer = EgtGetLastGroupInGroup(m_nRawId) While nPartId <> GDB_ID.NULL @@ -698,6 +708,8 @@ Public Class NestPageUC ' Se necessario, creo la regione fuori kerf Dim nKerfId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_KERF) EgtCreateOutRegion(m_CurrProjPage.m_nRawId, nKerfId) + ' Se necessario, creo la regione di riferimento + EgtCreateReferenceRegion(m_CurrProjPage.m_nRawId, nKerfId, True) ' Se necessario, creo le regioni per le aree danneggiate Dim nId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_DAMAGED) While nId <> GDB_ID.NULL @@ -707,4 +719,17 @@ Public Class NestPageUC Return True End Function + Friend Function EnableReferenceRegion(bEnable As Boolean) As Boolean + ' Recupero identificativo della regione di riferimento + Dim nRegId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_REF_REG) + If nRegId = GDB_ID.NULL Then Return False + ' Imposto l'abilitazione voluta + If bEnable Then + EgtRemoveInfo(nRegId, KEY_REF_REG_OFF) + Else + EgtSetInfo(nRegId, KEY_REF_REG_OFF, 1) + End If + Return True + End Function + End Class diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index 77baa5a..ff20132 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -69,6 +69,7 @@ x86 MinimumRecommendedRules.ruleset false + false diff --git a/OmagCUTDictionary.xaml b/OmagCUTDictionary.xaml index 28eb848..6cc7192 100644 --- a/OmagCUTDictionary.xaml +++ b/OmagCUTDictionary.xaml @@ -863,7 +863,7 @@