Files
OmagCUT/Machine/AlarmsPageUC.xaml.vb
T
Dario Sassi 3740ec6de7 OmagCUT :
- eliminato parametro FinalDepth da config. macchina (ora viene preso dalla lavorazione "Ultimo Taglio").
2025-10-06 14:50:45 +02:00

1352 lines
68 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib
Public Class AlarmsPageUC
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_CurrentMachine As CurrentMachine
Friend m_CN As CN_generico
' Definizione pagina attrezzaggio
Friend m_SetUpPage As SetUpPage
' Properties
Private m_bFirst As Boolean = True
'Lista che contiene le lame disponibili (per Combobox pagina Alarms)
Private m_SawList As New ObservableCollection(Of String)
Private m_DrillList As New ObservableCollection(Of String)
Private m_MillList As New ObservableCollection(Of String)
Private m_CupWheelList As New ObservableCollection(Of String)
Private m_WaterJetList As New ObservableCollection(Of String)
Private m_AuxToolTypeList As New List(Of StringIdCmBx)
' Costante per nessun utensile definito
Private Const NO_TOOL As String = "-----"
Private Sub AlarmsPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Assegno liste a combobox
CurrSawCmBx.ItemsSource = m_SawList
CurrDrillCmBx.ItemsSource = m_DrillList
CurrMillCmBx.ItemsSource = m_MillList
CurrCupWheelCmBx.ItemsSource = m_CupWheelList
CurrWJetCmBx.ItemsSource = m_WaterJetList
AuxiliaryToolCmBx.ItemsSource = m_AuxToolTypeList
' Variabile che accorcia il riferimento alla macchina corrente
m_CurrentMachine = m_MainWindow.m_CurrentMachine
' Assegno lista ad elenco materiali
MaterialsLstBx.ItemsSource = m_CurrentMachine.Materials
' Se non è impostato il controllo numerico, nascondo il bottone di tastatura lama
If GetPrivateProfileInt(S_NUMERICALCONTROL, K_TYPE, 0, m_MainWindow.GetMachIniFile()) = 0 Then
SawProbingBtn.Visibility = Windows.Visibility.Hidden
End If
' Se esiste un file lua valido allora mostro il pulsante per l'esecuzione dello script
If Not String.IsNullOrEmpty(GetExecLuaFile()) And
ExecLuaBtn.Visibility = Visibility.Visible Then
Else
ExecLuaBtn.Visibility = Visibility.Hidden
End If
' Imposto i messaggi letti dal file dei messaggi
CurrSawTxBl.Text = EgtMsg(90901) ' Lama corrente
CurrSawTiltedTxBl.Text = EgtMsg(91049) ' Current saw tilted
AuxiliaryToolTxBl.Text = EgtMsg(90902) ' Utensile ausiliario
CurrDrillTxBl.Text = EgtMsg(90903) ' Foretto corrente
CurrCupWheelTxBl.Text = EgtMsg(91070) ' Scasso corrente
CurrMillTxBl.Text = EgtMsg(90904) ' Fresa corrente
CurrWJetTxBl.Text = EgtMsg(90900) ' Waterjet corrente
CompleteCutsTxBl.Text = EgtMsg(90908) ' Rispetta i tagli completi
SafeZTxBl.Text = EgtMsg(90905) ' Z Sicura
MaterialsGpBx.Header = EgtMsg(90913) ' Materiali
NewMatBtn.Content = EgtMsg(90914) ' Aggiungi
RemoveMatBtn.Content = EgtMsg(90915) ' Rimuovi
SetUpGpBx.Header = EgtMsg(90916) ' Utensili correnti
MachineParamGpBx.Header = EgtMsg(90919) ' Parametri macchina
DirectCutsParamGpBx.Header = EgtMsg(90927) ' Tagli diretti
FinalHomeTxBl.Text = EgtMsg(90928) ' Home finale
TopMillGpBx.Header = EgtMsg(91061) ' Parametri incisioni
TmEnableTxBl.Text = EgtMsg( 91062) ' Con fresa
TmDepthTxBl.Text = EgtMsg( 91063) ' Profondità
TmWidthTxBl.Text = EgtMsg( 91064) ' Larghezza
NestingParamGpBx.Header = EgtMsg(90931) ' Nesting
AlignTxBl.Text = EgtMsg(90932) ' Allineato
GhigliottinaTxBl.Text = EgtMsg(91066) ' Ghigliottina
AutomaticTxBl.Text = EgtMsg(91059) ' Automatico
SetUpBtn.Content = EgtMsg(90933) ' Attrezzaggio
NewMatBtn.Content = EgtMsg(90934) ' Nuovo
RemoveMatBtn.Content = EgtMsg(90935) ' Elimina
AdditionalTableTxBl.Text = EgtMsg(90936) ' Altezza sovratavola
AutoRawImageParamGpBx.Header = EgtMsg(90937) ' Contorno da Foto
BackImageBtn.Content = EgtMsg(90938) ' Sfondo
ThresholdTxBl.Text = EgtMsg(90939) ' Soglia
ToleranceTxBl.Text = EgtMsg(90940) ' Tolleranza
CutFredGpBx.Header = EgtMsg(90946) ' Tagli Feed inizio/fine
CfrLenTxBl.Text = EgtMsg(90947) ' Lunghezza
CfrPercTxBl.Text = EgtMsg(90948) ' Riduzione %
MachiningsGpBx.Header = EgtMsg(91051) ' Lavorazioni
CurrSawingTxBl.Text = EgtMsg(91052) ' Taglio lama
CurrSawingTiltedTxBl.Text = EgtMsg(91050) ' Taglio inclinato
CurrDrillingTxBl.Text = EgtMsg(91053) ' Foratura
CurrMillingTxBl.Text = EgtMsg(91054) ' Fresatura
CurrPocketingTxBl.Text = EgtMsg(91069) ' Svuotatura
CurrWaterJettingTxBl.Text = EgtMsg(91057) ' WaterJet
CurrDripSawingTxBl.Text = EgtMsg(91055) ' DripSawing
CurrDripDrillingTxBl.Text = EgtMsg(91056) ' DripDrilling
FrameGpBx.Header = EgtMsg(91068) ' Cornici
FramePauseTxBl.Text = EgtMsg(91067) ' Inserisci pausa
UseLaserOriginTxBl.Text = EgtMsg(91129) ' Usa laser per origine
SideAngCutProbeGpBx.Header = EgtMsg(90950) ' Tastatura
SideAngCutProbeTxBl.Text = EgtMsg(90950) ' Tastatura tagli inclinati
WashingGpBx.Header = EgtMsg(90941) ' Lavaggio
WashingTxBl.Text = EgtMsg(90941) ' Lavaggio
FinalSawCutGpBx.Header = EgtMsg(91254) ' Taglio Finale
EnableFinalSawCutTxBl.Text = EgtMsg(91255) ' Abilita
AutoRawImageParamGpBx.Visibility = Windows.Visibility.Hidden
End Sub
Private Sub AlarmsPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
If m_bFirst Then
' in assenza dell'uscita H1 nascondo i parametri lama
If EgtGetHeadId("H1") = GDB_ID.NULL Then
TopMillGpBx.Visibility = Visibility.Hidden
CurrSawTxBl.Visibility = Visibility.Hidden
CurrSawCmBx.Visibility = Visibility.Hidden
End If
' Verifico la configurazione della macchina per creare i combobox
Select Case m_CurrentMachine.MountedToolConfig
Case CurrentMachine.MountedToolConfigs.SAW
' Elimino le righe inutili e riduco il groupbox utensili correnti
For Index As Integer = 7 - 1 To 2 Step -1
CurrToolsGrid.RowDefinitions.RemoveAt(Index)
Next
Dim EndRow As New RowDefinition
EndRow.Height = New GridLength(0.25, GridUnitType.Star)
CurrToolsGrid.RowDefinitions.Add(EndRow)
SetUpGpBx.SetValue(Grid.RowSpanProperty, 1)
' Disattivo il gruppo dei parametri fori
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL
'Non faccio alcunchè
Case CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW
'Da implementare
End Select
' Se non previste fresature, disabilito relativo box e uso fresa con incisione
If Not m_CurrentMachine.bMilling Then
TmEnableChBx.IsEnabled = False
TmEnableChBx.IsChecked = False
End If
' Abilitazione box per contorni grezzo da foto
If m_MainWindow.m_Camera.GetCalcContour() Then
AutoRawImageParamGpBx.Visibility = Windows.Visibility.Visible
' Se macchina fotografica disabilitata, disabilito scatto per sfondo
If Not m_MainWindow.m_Camera.GetCameraLink() Then
BackImageBtn.IsEnabled = False
End If
End If
' Abilitazione Feed ridotta su inizio/fine tagli
If m_CurrentMachine.bFsevEnable And EgtGetHeadId("H1") <> GDB_ID.NULL Then
CutFredGpBx.Visibility = Windows.Visibility.Visible
Else
CutFredGpBx.Visibility = Windows.Visibility.Hidden
End If
' Se non previsto nesting automatico, nascondo flag relativo
If Not m_MainWindow.GetAutoNestingOption() Then
AutomaticTxBl.Visibility = Visibility.Hidden
AutomaticChBx.Visibility = Visibility.Hidden
End If
m_bFirst = False
End If
' Aggiorno lista delle lame per pagina macchina in cui scegliere quella corrente
CreateToolList(MCH_TF.SAWBLADE, m_SawList)
' Seleziono lama corrente
CurrSawCmBx.SelectedItem = m_CurrentMachine.sCurrSaw
' nascondo la lista dei materiali solo se macchina WaterJet
If m_CurrentMachine.bWaterJet Then
MaterialsGpBx.Visibility = Visibility.Hidden
End If
' Verifico la configurazione della macchina per creare i combobox
Select Case m_CurrentMachine.MountedToolConfig
Case CurrentMachine.MountedToolConfigs.SAW
' Non compio alcuna azione (non sono previsti utensili ausiliari)
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL
m_AuxToolTypeList.Clear()
' creo l'elenco degli utensili ausiliri
If m_CurrentMachine.bDrill Then
m_AuxToolTypeList.Add(New StringIdCmBx(1, EgtMsg(90921))) ' Foretto
End If
If m_CurrentMachine.bMill Then
m_AuxToolTypeList.Add(New StringIdCmBx(2, EgtMsg(90922))) ' Fresa
End If
If m_CurrentMachine.bCupWheel Then
m_AuxToolTypeList.Add(New StringIdCmBx(3, EgtMsg(90754))) ' Mola da scasso
End If
If m_CurrentMachine.bWaterJet Then
m_AuxToolTypeList.Add(New StringIdCmBx(4, EgtMsg(90755))) ' WaterJet
End If
' Aggiungo elemento nessuno in fondo alla lista
m_AuxToolTypeList.Add(New StringIdCmBx(0, EgtMsg(90920))) ' Nessuno
' ComboBox per la selezione dell'utensile ausiliario
AuxiliaryToolTxBl.Visibility = Windows.Visibility.Visible
AuxiliaryToolCmBx.Visibility = Windows.Visibility.Visible
' Drilling
CurrDrillTxBl.Visibility = Windows.Visibility.Hidden
CurrDrillCmBx.Visibility = Windows.Visibility.Hidden
' Milling
CurrMillTxBl.Visibility = Windows.Visibility.Hidden
CurrMillCmBx.Visibility = Windows.Visibility.Hidden
' Pocketing
CurrCupWheelTxBl.Visibility = Windows.Visibility.Hidden
CurrCupWheelCmBx.Visibility = Windows.Visibility.Hidden
' WaterJet
CurrWJetTxBl.Visibility = Windows.Visibility.Hidden
CurrWJetCmBx.Visibility = Windows.Visibility.Hidden
' verifico quale utensile è attulamente "montato sulla macchina"
If m_CurrentMachine.sCurrDrill <> String.Empty Then
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
m_DrillList.Add(NO_TOOL)
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(1, m_AuxToolTypeList)
CurrDrillTxBl.Visibility = Windows.Visibility.Visible
CurrDrillCmBx.Visibility = Windows.Visibility.Visible
ElseIf m_CurrentMachine.sCurrMill <> String.Empty Then
CreateToolList(MCH_TF.MILL, MCH_TY.MILL_STD, m_MillList)
m_MillList.Add(NO_TOOL)
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(2, m_AuxToolTypeList)
CurrMillTxBl.Visibility = Windows.Visibility.Visible
CurrMillCmBx.Visibility = Windows.Visibility.Visible
ElseIf m_CurrentMachine.sCurrMillNoTip <> String.Empty Then
CreateToolList(MCH_TF.MILL, MCH_TY.MILL_NOTIP, m_CupWheelList)
m_CupWheelList.Add(NO_TOOL)
CurrCupWheelCmBx.SelectedItem = m_CurrentMachine.sCurrMillNoTip
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(3, m_AuxToolTypeList)
CurrCupWheelTxBl.Visibility = Windows.Visibility.Visible
CurrCupWheelCmBx.Visibility = Windows.Visibility.Visible
ElseIf m_CurrentMachine.sCurrWaterJet <> String.Empty Then
CreateToolList(MCH_TF.WATERJET, m_WaterJetList)
m_WaterJetList.Add(NO_TOOL)
CurrWJetCmBx.SelectedItem = m_CurrentMachine.sCurrWaterJet
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(4, m_AuxToolTypeList)
CurrWJetTxBl.Visibility = Windows.Visibility.Visible
CurrWJetCmBx.Visibility = Windows.Visibility.Visible
Else
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(0, m_AuxToolTypeList)
End If
Case CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER
' attivo il bottone per l'apertura della pagina che mostra la configurazione degli utensili in parcheggio
SetUpBtn.Visibility = Windows.Visibility.Visible
Case CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW
' Aggiorno la lista delle lame con quelle montate sul portautensile automatico
Dim m_SawOnHolderList As New ObservableCollection(Of String)
Dim bOnHolder As Boolean = False
For Each sNameTool As String In m_SawList
If Not String.IsNullOrEmpty(sNameTool) Then
' Verifico che sia montata su un portautensile
EgtTdbSetCurrTool(sNameTool)
Dim sTCPos As String = String.Empty
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
If Not String.IsNullOrEmpty(sTCPos) Then
' Cerco nel porta utensili automaitico
For Each ToolPosition As ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
If ToolPosition.sTool <> String.Empty Then
If sNameTool = ToolPosition.sTool Then
m_SawOnHolderList.Add(sNameTool)
' Se il nome dell'utensile è lo stesso di quello impostato nella combo allora lo setto
If sNameTool = m_CurrentMachine.sCurrSaw Then
bOnHolder = True
End If
Exit For
End If
End If
Next
End If
End If
Next
m_SawList = m_SawOnHolderList
CurrSawCmBx.ItemsSource = m_SawList
If bOnHolder Then
' reimposto la lavorazione di lama e la lama impostate in macchina
EgtTdbSetCurrTool(m_CurrentMachine.sCurrSaw)
' Seleziono lama corrente
CurrSawCmBx.SelectedItem = m_CurrentMachine.sCurrSaw
Else
m_CurrentMachine.sCurrSawing = ""
End If
CurrSawTiltedCmBx.ItemsSource = m_SawList
If m_SawList.IndexOf(m_CurrentMachine.sCurrSawTilted) > -1 Then
' Seleziono lama corrente
CurrSawTiltedCmBx.SelectedItem = m_CurrentMachine.sCurrSawTilted
Else
m_CurrentMachine.sCurrSawingTilted = ""
End If
' attivo la selezione della lama per il taglio in inlinato
CurrSawTiltedTxBl.Visibility = Visibility.Visible
CurrSawTiltedCmBx.Visibility = Visibility.Visible
' attivo il bottone per l'apertura della pagina che mostra la configurazione degli utensili in parcheggio
SetUpBtn.Visibility = Windows.Visibility.Visible
End Select
' aggiorno le TextBlock con le lavorazioni correnti
RefreschMachining()
' Leggo offset fori
Dim dVal As Double
' Leggo distanza di sicurezza
dVal = 0
EgtMdbGetGeneralParam(MCH_GP.SAFEZ, dVal)
SafeZTxBx.Text = LenToString(dVal, 2)
' Salvo DB lavorazioni con aggiornamenti parametri generali
EgtMdbSave()
' Leggo flag abilitazione incisioni con fresa
TmEnableChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_NEST, K_MACH_ENGRAVING_WITHMILL, 1, m_MainWindow.GetMachIniFile()) <> 0)
' Leggo profondità e larghezza incisioni
dVal = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_ENGRAVING_DEPTH, 0, m_MainWindow.GetMachIniFile())
TmDepthTxBx.Text = LenToString(dVal, 2)
dVal = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_ENGRAVING_WIDTH, 0, m_MainWindow.GetMachIniFile())
TmWidthTxBx.Text = LenToString(dVal, 2)
' Flag per movimento in home alla fine dei tagli diretti
FinalHomeChBx.IsChecked = m_CurrentMachine.bDirectCutsFinalHome
' Leggo tagli ridotti per interferenza in nesting
CompleteCutsChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 0, m_MainWindow.GetMachIniFile()) = 0)
' Flag per nesting allineato
AlignChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_ALIGNED, 0, m_MainWindow.GetMachIniFile()) <> 0)
' Flag per nesting a ghigliottina
GhigliottinaChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_NEST, K_MACH_NEST_GHIGLIOTTINA, 0, m_MainWindow.GetMachIniFile()) <> 0)
' Flag per nesting automatico
AutomaticChBx.IsChecked =
(GetPrivateProfileInt(S_NEST, K_AUTOMATICOPTIMIZE, 0, m_MainWindow.GetIniFile()) <> 0)
AdjustGhigliottinaTextOnAutomaticOrCompleteCuts()
' Flag per inserire la puasa dopo la sgrossatura delle cornici
FramePauseChBx.IsChecked =
(GetPrivateProfileInt(S_MACH_FRAME, K_MACH_PAUSE, 1, m_MainWindow.GetMachIniFile()) <> 0)
' Aggiorno messaggio sovratavola con numero tavola
If GetTableCount() > 1 Then
AdditionalTableTxBl.Text = EgtMsg(90936) & " " & GetCurrentTable().ToString() ' Altezza sovratavola
End If
' Leggo altezza sovratavola
dVal = m_CurrentMachine.dAdditionalTable
AdditionalTableTxBx.Text = LenToString(dVal, 2)
' Leggo soglia e tolleranza per contorno grezzo da foto
ThresholdTxBx.Text = m_MainWindow.m_Camera.Threshold.ToString()
dVal = m_MainWindow.m_Camera.Tolerance
ToleranceTxBx.Text = LenToString(dVal, 2)
' Leggo flag tastatura tagli inclinati
Dim nSacProbe As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_SACPROBE, -1, m_MainWindow.GetMachIniFile())
If nSacProbe = -1 Then
SideAngCutProbeGpBx.Visibility = Visibility.Hidden
Else
SideAngCutProbeChBx.IsChecked = (nSacProbe <> 0)
End If
' Leggo flag lavaggio
Dim nWashing As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_WASHING, -1, m_MainWindow.GetMachIniFile())
If nWashing = -1 Then
WashingGpBx.Visibility = Visibility.Hidden
Else
WashingChBx.IsChecked = (nWashing <> 0)
End If
' Leggo parametri per variazione feed in tagli
CfrLenTxBx.Text = LenToString(m_CurrentMachine.dFsevLength, 3)
CfrPercTxBx.Text = DoubleToString(m_CurrentMachine.dFsevPerc, 0)
' leggo flag per tavola definita da laser
Dim nUseLaserOrigin As Integer = GetPrivateProfileInt(S_TABLE, K_USELASERORIGIN, -1, m_MainWindow.GetMachIniFile())
If nUseLaserOrigin = -1 Then
UseLaserOriginTxBl.Visibility = Visibility.Hidden
UseLaserOriginChBx.Visibility = Visibility.Hidden
Else
UseLaserOriginTxBl.Visibility = Visibility.Visible
UseLaserOriginChBx.IsChecked = (nUseLaserOrigin <> 0)
End If
EnableFinalSawCutChBx.IsChecked = m_MainWindow.m_CurrentMachine.bEnableFinalSawCut
End Sub
' aggiorna le text delle lavorazioni (la selezione avviene nella pagina del grezzo o dalla pagina del progetto corrente)
Private Sub RefreschMachining()
If m_CurrentMachine.sCurrSawing <> String.Empty Then
CurrSawingTxBx.Text = m_CurrentMachine.sCurrSawing
CurrSawingTxBl.Visibility = Windows.Visibility.Visible
CurrSawingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrSawingTxBl.Visibility = Windows.Visibility.Hidden
CurrSawingTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrSawingTilted <> String.Empty Then
If Not m_CurrentMachine.bApplySawingTilted Then
CurrSawingTiltedTxBx.Foreground = Brushes.Gray
CurrSawingTiltedTxBx.TextDecorations = TextDecorations.Strikethrough
Else
CurrSawingTiltedTxBx.Foreground = Brushes.White
CurrSawingTiltedTxBx.TextDecorations = Nothing
End If
CurrSawingTiltedTxBx.Text = m_CurrentMachine.sCurrSawingTilted
CurrSawingTiltedTxBl.Visibility = Windows.Visibility.Visible
CurrSawingTiltedTxBx.Visibility = Windows.Visibility.Visible
Else
CurrSawingTiltedTxBl.Visibility = Windows.Visibility.Hidden
CurrSawingTiltedTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrDrilling <> String.Empty Then
CurrDrillingTxBx.Text = m_CurrentMachine.sCurrDrilling
CurrDrillingTxBl.Visibility = Windows.Visibility.Visible
CurrDrillingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrDrillingTxBl.Visibility = Windows.Visibility.Hidden
CurrDrillingTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrMilling <> String.Empty Then
CurrMillingTxBx.Text = m_CurrentMachine.sCurrMilling
CurrMillingTxBl.Visibility = Windows.Visibility.Visible
CurrMillingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrMillingTxBl.Visibility = Windows.Visibility.Hidden
CurrMillingTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrPocketing <> String.Empty Then
CurrPocketingTxBx.Text = m_CurrentMachine.sCurrPocketing
CurrPocketingTxBl.Visibility = Windows.Visibility.Visible
CurrPocketingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrPocketingTxBl.Visibility = Windows.Visibility.Hidden
CurrPocketingTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrWaterJetting <> String.Empty Then
CurrWaterJettingTxBx.Text = m_CurrentMachine.sCurrWaterJetting
CurrWaterJettingTxBl.Visibility = Windows.Visibility.Visible
CurrWaterJettingTxBx.Visibility = Windows.Visibility.Visible
If m_CurrentMachine.bFromDBWaterJet Then
CurrWaterJettingTxBx.SetValue(Grid.ColumnSpanProperty, 1)
CurrWaterJettingTxBx.SetValue(MarginProperty, New Thickness(CurrWaterJettingTxBx.Margin.Left,
CurrWaterJettingTxBx.Margin.Top,
5,
CurrWaterJettingTxBx.Margin.Bottom))
CurrWaterJettingQualityTxBx.Text = m_CurrentMachine.sCurrWaterJettingQuality
CurrWaterJettingQualityTxBx.Visibility = Windows.Visibility.Visible
Else
CurrWaterJettingTxBx.SetValue(Grid.ColumnSpanProperty, 2)
CurrWaterJettingTxBx.SetValue(MarginProperty, New Thickness(CurrWaterJettingTxBx.Margin.Left,
CurrWaterJettingTxBx.Margin.Top,
10,
CurrWaterJettingTxBx.Margin.Bottom))
CurrWaterJettingQualityTxBx.Visibility = Windows.Visibility.Collapsed
End If
Else
CurrWaterJettingTxBl.Visibility = Windows.Visibility.Hidden
CurrWaterJettingTxBx.Visibility = Windows.Visibility.Hidden
CurrWaterJettingQualityTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrDripSawing <> String.Empty Then
CurrDripSawingTxBx.Text = m_CurrentMachine.sCurrDripSawing
CurrDripSawingTxBl.Visibility = Windows.Visibility.Visible
CurrDripSawingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrDripSawingTxBl.Visibility = Windows.Visibility.Hidden
CurrDripSawingTxBx.Visibility = Windows.Visibility.Hidden
End If
If m_CurrentMachine.sCurrDripDrilling <> String.Empty Then
CurrDripDrillingTxBx.Text = m_CurrentMachine.sCurrDripDrilling
CurrDripDrillingTxBl.Visibility = Windows.Visibility.Visible
CurrDripDrillingTxBx.Visibility = Windows.Visibility.Visible
Else
CurrDripDrillingTxBl.Visibility = Windows.Visibility.Hidden
CurrDripDrillingTxBx.Visibility = Windows.Visibility.Hidden
End If
End Sub
' questo metodo è utilizzato solo per le macchine con utensile ausiliario (Assenza del bottone Attrezzaggio-> monta un solo utensila per volta
Private Sub AuxiliaryToolCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles AuxiliaryToolCmBx.SelectionChanged
CurrDrillTxBl.Visibility = Windows.Visibility.Hidden
CurrDrillCmBx.Visibility = Windows.Visibility.Hidden
CurrMillTxBl.Visibility = Windows.Visibility.Hidden
CurrMillCmBx.Visibility = Windows.Visibility.Hidden
CurrCupWheelTxBl.Visibility = Windows.Visibility.Hidden
CurrCupWheelCmBx.Visibility = Windows.Visibility.Hidden
CurrWJetTxBl.Visibility = Windows.Visibility.Hidden
CurrWJetCmBx.Visibility = Windows.Visibility.Hidden
Dim SelectedItem As StringIdCmBx = AuxiliaryToolCmBx.SelectedItem
Select Case SelectedItem.nId
Case 0
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
Case 1
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
m_DrillList.Add(NO_TOOL)
If m_CurrentMachine.sCurrDrill = String.Empty Then
CurrDrillCmBx.SelectedItem = NO_TOOL
Else
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
End If
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
CurrDrillTxBl.Visibility = Windows.Visibility.Visible
CurrDrillCmBx.Visibility = Windows.Visibility.Visible
Case 2
CreateToolList(MCH_TF.MILL, MCH_TY.MILL_STD, m_MillList)
m_MillList.Add(NO_TOOL)
If m_CurrentMachine.sCurrMill = String.Empty Then
CurrMillCmBx.SelectedItem = NO_TOOL
Else
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
End If
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
CurrMillTxBl.Visibility = Windows.Visibility.Visible
CurrMillCmBx.Visibility = Windows.Visibility.Visible
Case 3
CreateToolList(MCH_TF.MILL, MCH_TY.MILL_NOTIP, m_CupWheelList)
m_CupWheelList.Add(NO_TOOL)
If m_CurrentMachine.sCurrMillNoTip = String.Empty Then
CurrCupWheelCmBx.SelectedItem = NO_TOOL
Else
CurrCupWheelCmBx.SelectedItem = m_CurrentMachine.sCurrMillNoTip
End If
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
CurrCupWheelTxBl.Visibility = Windows.Visibility.Visible
CurrCupWheelCmBx.Visibility = Windows.Visibility.Visible
Case 4
CreateToolList(MCH_TF.WATERJET, m_WaterJetList)
m_WaterJetList.Add(NO_TOOL)
If m_CurrentMachine.sCurrWaterJet = String.Empty Then
CurrWJetCmBx.SelectedItem = NO_TOOL
Else
CurrWJetCmBx.SelectedItem = m_CurrentMachine.sCurrWaterJet
End If
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
CurrWJetTxBl.Visibility = Windows.Visibility.Visible
CurrWJetCmBx.Visibility = Windows.Visibility.Visible
End Select
' aggionro l'elenco delle lavoarzioni
RefreschMachining()
End Sub
#Region "Selection: SAW, DRILL, MILL, CUPWHEEL, WATERJET"
' -- SAW --
Private Sub CurrSawCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawCmBx.SelectionChanged
If IsNothing(CurrSawCmBx.SelectedItem) Then Return
' Assegno
m_CurrentMachine.sCurrSaw = CurrSawCmBx.SelectedItem.ToString()
' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawing) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrSaw, True) <> 0 Then
m_CurrentMachine.sCurrSawing = String.Empty
End If
'Dim sVal As String = String.Empty
'Dim dVal As Double = 0
'If m_CurrentMachine.GetUserNote("FsevLength", sVal, m_CurrentMachine.sCurrSawing, false) Then
' StringToDouble(sVal, dVal)
' m_CurrentMachine.SetFsevLength(dVal)
'End If
'If m_CurrentMachine.GetUserNote("FsevPerc", sVal, m_CurrentMachine.sCurrSawing, false) Then
' StringToDouble(sVal, dVal)
' m_CurrentMachine.SetFsevPerc(dVal)
'End If
Dim sVal As String = String.Empty
Dim dVal As Double = 0
If m_CurrentMachine.GetUserNote("FsevLength", sVal, m_CurrentMachine.sCurrSaw) Then
StringToDouble(sVal, dVal)
m_CurrentMachine.SetFsevLength(dVal)
End If
If m_CurrentMachine.GetUserNote("FsevPerc", sVal, m_CurrentMachine.sCurrSaw) Then
StringToDouble(sVal, dVal)
m_CurrentMachine.SetFsevPerc(dVal)
End If
' Leggo parametri per variazione feed in tagli aggiornati in funzione della lama
CfrLenTxBx.Text = LenToString(m_CurrentMachine.dFsevLength, 3)
CfrPercTxBx.Text = DoubleToString(m_CurrentMachine.dFsevPerc, 0)
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
' Se è associata anche una lavorazione inclinata allora deve essere resettata
If m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
m_CurrentMachine.sCurrSawTilted = CurrSawCmBx.SelectedItem.ToString()
' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima
sMchTuuid = String.Empty
sMchTool = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawingTilted) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrSawTilted, True) <> 0 Then
m_CurrentMachine.sCurrSawingTilted = String.Empty
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End If
End Sub
' -- SAW TILTED --
Private Sub CurrSawTiltedCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrSawTiltedCmBx.SelectionChanged
If IsNothing(CurrSawTiltedCmBx.SelectedItem) Then Return
' Assegno
m_CurrentMachine.sCurrSawTilted = CurrSawTiltedCmBx.SelectedItem.ToString()
' Se nuova lama incompatibile con lavorazione di taglio corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrSawingTilted) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrSawTilted, True) <> 0 Then
m_CurrentMachine.sCurrSawingTilted = String.Empty
End If
' Dim sVal As String = String.Empty
' Dim dVal As Double = 0
' If m_CurrentMachine.GetUserNote("FsevLength", sVal, m_CurrentMachine.sCurrSaw) Then
' StringToDouble(sVal, dVal)
' m_CurrentMachine.SetFsevLength(dVal)
' End If
' If m_CurrentMachine.GetUserNote("FsevPerc", sVal, m_CurrentMachine.sCurrSaw) Then
' StringToDouble(sVal, dVal)
' m_CurrentMachine.SetFsevPerc(dVal)
' End If
'
' ' Leggo parametri per variazione feed in tagli aggiornati in funzione della lama
' CfrLenTxBx.Text = LenToString(m_CurrentMachine.dFsevLength, 3)
' CfrPercTxBx.Text = DoubleToString(m_CurrentMachine.dFsevPerc, 0)
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End Sub
' -- DRILL --
Private Sub CurrDrillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrDrillCmBx.SelectionChanged
If IsNothing(CurrDrillCmBx.SelectedItem) Then Return
' Rimuovo foretto
If CurrDrillCmBx.SelectedItem.ToString() = NO_TOOL Then
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
' Assegno foretto
Else
m_CurrentMachine.sCurrDrill = CurrDrillCmBx.SelectedItem.ToString()
' Reset fresa, waterjet e relative lavorazioni
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
End If
' Se nuovo foretto incompatibile con foratura corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrDrilling) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrDrill, True) <> 0 Then
m_CurrentMachine.sCurrDrilling = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End Sub
' -- MILL --
Private Sub CurrMillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrMillCmBx.SelectionChanged
If IsNothing(CurrMillCmBx.SelectedItem) Then Return
' Rimuovo fresa
If CurrMillCmBx.SelectedItem.ToString() = NO_TOOL Then
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
' Assegno fresa
Else
m_CurrentMachine.sCurrMill = CurrMillCmBx.SelectedItem.ToString()
' Reset foretto, waterjet e relative lavorazioni
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
End If
' Se nuova fresa incompatibile con fresatura corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrMilling) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrMill, True) <> 0 Then
m_CurrentMachine.sCurrMilling = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End Sub
' -- CUPWHEEL --
Private Sub CurrCupWheelCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrCupWheelCmBx.SelectionChanged
If IsNothing(CurrCupWheelCmBx.SelectedItem) Then Return
' Rimuovo fresa
If CurrCupWheelCmBx.SelectedItem.ToString() = NO_TOOL Then
m_CurrentMachine.sCurrMillNoTip = String.Empty
m_CurrentMachine.sCurrPocketing = String.Empty
' Assegno fresa
Else
m_CurrentMachine.sCurrMillNoTip = CurrCupWheelCmBx.SelectedItem.ToString()
' Reset foretto, waterjet e relative lavorazioni
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
End If
' Se nuova fresa incompatibile con fresatura corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrPocketing) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrMillNoTip, True) <> 0 Then
m_CurrentMachine.sCurrPocketing = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End Sub
' -- WATERJET --
Private Sub CurrWJetCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrWJetCmBx.SelectionChanged
If IsNothing(CurrWJetCmBx.SelectedItem) Then Return
' Rimuovo Waterjet
If CurrWJetCmBx.SelectedItem.ToString() = NO_TOOL Then
m_CurrentMachine.sCurrWaterJet = String.Empty
m_CurrentMachine.sCurrWaterJetting = String.Empty
' Assegno Waterjet
Else
m_CurrentMachine.sCurrWaterJet = CurrWJetCmBx.SelectedItem.ToString()
' Reset foretto, fresa e relative lavorazioni
If m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrDrilling = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
m_CurrentMachine.sCurrMilling = String.Empty
End If
' Se nuova Waterjet incompatibile con Waterjet corrente, resetto quest'ultima
Dim sMchTuuid As String = String.Empty
Dim sMchTool As String = String.Empty
If Not EgtMdbSetCurrMachining(m_CurrentMachine.sCurrWaterJetting) Or
Not EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, sMchTuuid) Or
Not EgtTdbGetToolFromUUID(sMchTuuid, sMchTool) Or
String.Compare(sMchTool, m_CurrentMachine.sCurrWaterJet, True) <> 0 Then
m_CurrentMachine.sCurrWaterJetting = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
' aggiorno la lista delle lavorazioni
RefreschMachining()
End Sub
#End Region 'Selection: SAW, DRILL, MILL, CUPWHEEL, WATERJET
Public Overloads Sub CreateToolList(ToolType As Integer, ToolList As ObservableCollection(Of String))
ToolList.Clear()
Dim ToolName As String = String.Empty
Dim nType As Integer = MCH_TY.NONE
Dim bFound As Boolean = EgtTdbGetFirstTool(ToolType, ToolName, nType)
While bFound
' Accetto utensili che non siano da sotto
If String.Compare(ToolName, m_CurrentMachine.sCurrDripSaw, True) <> 0 AndAlso
String.Compare(ToolName, m_CurrentMachine.sCurrDripDrill, True) <> 0 Then
ToolList.Add(ToolName)
End If
bFound = EgtTdbGetNextTool(ToolType, ToolName, nType)
End While
End Sub
' definisce l'elenco degli utensili in funzione della famiglia e del tipo (usata per distingure i diversi tipi di frese)
Public Overloads Sub CreateToolList(ToolFamily As Integer, ToolType As Integer, ToolList As ObservableCollection(Of String))
ToolList.Clear()
Dim ToolName As String = String.Empty
Dim nType As Integer = ToolType
Dim bFound As Boolean = EgtTdbGetFirstTool(ToolType, ToolName, nType)
While bFound
' Accetto utensili che non siano da sotto
If String.Compare(ToolName, m_CurrentMachine.sCurrDripSaw, True) <> 0 AndAlso
String.Compare(ToolName, m_CurrentMachine.sCurrDripDrill, True) <> 0 AndAlso
nType = ToolType Then
ToolList.Add(ToolName)
End If
bFound = EgtTdbGetNextTool(ToolType, ToolName, nType)
End While
End Sub
Private Sub SetUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles SetUpBtn.Click
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Remove(Me)
m_SetUpPage = New SetUpPage
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Add(m_SetUpPage)
End Sub
Private Sub SafeZTxBx_EgtClosed(sender As Object, e As EventArgs) Handles SafeZTxBx.EgtClosed
Dim dSafeZ As Double = 0
StringToLen(SafeZTxBx.Text, dSafeZ)
EgtMdbSetGeneralParam(MCH_GP.SAFEZ, dSafeZ)
EgtMdbSave()
End Sub
Private Sub CompleteCutsChBx_Click(sender As Object, e As RoutedEventArgs) Handles CompleteCutsChBx.Click
Dim NestPage As NestPageUC = m_MainWindow.m_CadCutPageUC.m_NestPage
If CompleteCutsChBx.IsChecked() Then
' Se pezzi in interferenza
If Not NestPage.VerifyPartsNesting(False) Then
' Ci sono interferenze, alcuni pezzi saranno parcheggiati. Vuoi continuare ?
Dim Dlg As EgtMsgBox
If m_MainWindow.IsSiemensPc Then
Dlg = New EgtMsgBox(m_MainWindow, Me.ActualWidth / 15 * 5.5, EgtMsgBox.WidthType.PIXEL, "", EgtMsg(91105), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.NULL, 1, 1)
Else
Dlg = New EgtMsgBox(m_MainWindow, "", EgtMsg(91105), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.NULL, 1, 1)
End If
If Dlg.m_nPressedBtn = 1 Then ' Ok
NestPage.StoreCollisionParts(False)
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile())
End If
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile())
End If
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "1", m_MainWindow.GetMachIniFile())
End If
AdjustGhigliottinaTextOnAutomaticOrCompleteCuts()
End Sub
Private Sub TmEnableChBx_Click(sender As Object, e As RoutedEventArgs) Handles TmEnableChBx.Click
If TmEnableChBx.IsChecked() Then
WritePrivateProfileString(S_MACH_NEST, K_MACH_ENGRAVING_WITHMILL, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_ENGRAVING_WITHMILL, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub TmDepthTxBx_EgtClosed(sender As Object, e As EventArgs) Handles TmDepthTxBx.EgtClosed
Dim dVal As Double = 0
StringToLen(TmDepthTxBx.Text, dVal)
WritePrivateProfileString(S_MACH_NEST, K_MACH_ENGRAVING_DEPTH, DoubleToString(dVal, 2), m_MainWindow.GetMachIniFile())
End Sub
Private Sub TmWidthTxBx_EgtClosed(sender As Object, e As EventArgs) Handles TmWidthTxBx.EgtClosed
Dim dVal As Double = 0
StringToLen(TmWidthTxBx.Text, dVal)
WritePrivateProfileString(S_MACH_NEST, K_MACH_ENGRAVING_WIDTH, DoubleToString(dVal, 2), m_MainWindow.GetMachIniFile())
End Sub
Private Sub FinalHomeChBx_Click(sender As Object, e As RoutedEventArgs) Handles FinalHomeChBx.Click
If FinalHomeChBx.IsChecked() Then
m_CurrentMachine.bDirectCutsFinalHome = True
Else
m_CurrentMachine.bDirectCutsFinalHome = False
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
Private Sub GligliottinaChBx_Click(sender As Object, e As RoutedEventArgs) Handles GhigliottinaChBx.Click
If GhigliottinaChBx.IsChecked() Then
WritePrivateProfileString(S_MACH_NEST, K_MACH_NEST_GHIGLIOTTINA, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_NEST_GHIGLIOTTINA, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub AutomaticChBx_Click(sender As Object, e As RoutedEventArgs) Handles AutomaticChBx.Click
If AutomaticChBx.IsChecked() Then
WritePrivateProfileString(S_NEST, K_AUTOMATICOPTIMIZE, "1", m_MainWindow.GetIniFile())
Else
WritePrivateProfileString(S_NEST, K_AUTOMATICOPTIMIZE, "0", m_MainWindow.GetIniFile())
End If
AdjustGhigliottinaTextOnAutomaticOrCompleteCuts()
End Sub
Private Sub AdjustGhigliottinaTextOnAutomaticOrCompleteCuts()
If AutomaticChBx.IsChecked() And Not CompleteCutsChBx.IsChecked() Then
GhigliottinaTxBl.Visibility = Visibility.Visible
GhigliottinaChBx.Visibility = Visibility.Visible
Else
GhigliottinaTxBl.Visibility = Visibility.Collapsed
GhigliottinaChBx.Visibility = Visibility.Collapsed
End If
End Sub
Private Sub AdditionalTableTxBx_EgtClosed(sender As Object, e As EventArgs) Handles AdditionalTableTxBx.EgtClosed
Dim dVal As Double = 0
StringToLen(AdditionalTableTxBx.Text, dVal)
m_CurrentMachine.dAdditionalTable = dVal
End Sub
Private Sub NewMatBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewMatBtn.Click
' Mostro textbox per il nome
MatNameTxBx.Text = String.Empty
MatNameTxBx.Visibility = Windows.Visibility.Visible
MaterialsLstBx.SetValue(Grid.RowSpanProperty, 1)
End Sub
Private Sub MatNameTxBx_EgtClosed(sender As Object, e As EventArgs) Handles MatNameTxBx.EgtClosed
' Verifico che il nome non sia vuoto
If Not String.IsNullOrWhiteSpace(MatNameTxBx.Text) Then
' Verifico che il nome non sia già utilizzato
Dim bNameExist As Boolean = False
For Each Material As Material In m_CurrentMachine.Materials
If Material.sName = MatNameTxBx.Text Then
bNameExist = True
Exit For
End If
Next
If Not bNameExist Then
m_CurrentMachine.AddMaterial(New Material(MatNameTxBx.Text, m_CurrentMachine.Materials))
End If
End If
' Nascondo textbox per il nome
MaterialsLstBx.SetValue(Grid.RowSpanProperty, 2)
MatNameTxBx.Visibility = Windows.Visibility.Hidden
End Sub
Private Sub RemoveMatBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemoveMatBtn.Click
Dim SelectedMat As Material = DirectCast(MaterialsLstBx.SelectedItem, Material)
If Not IsNothing(SelectedMat) Then
m_CurrentMachine.RemoveMaterial(SelectedMat)
End If
End Sub
Private Sub BackImageBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackImageBtn.Click
' Se macchina fotografica abilitata, faccio una foto
If m_MainWindow.m_Camera.GetCameraLink() Then
If m_MainWindow.m_Camera.CameraBackImage() Then
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(EgtMsg(90323)) 'Fotografia di sfondo riuscita
Else
m_MainWindow.m_CurrentProjectPageUC.SetErrorMessage(EgtMsg(90313)) 'Fotografia non riuscita
End If
End If
End Sub
Private Sub ThresholdTxBx_EgtClosed(sender As Object, e As EventArgs) Handles ThresholdTxBx.EgtClosed
' Recupero il valore
Dim nVal As Integer = 0
StringToInt(ThresholdTxBx.Text, nVal)
' Lo imposto
m_MainWindow.m_Camera.Threshold = nVal
' Lo recupero, potrebbe essere stato aggiustato
ThresholdTxBx.Text = m_MainWindow.m_Camera.Threshold.ToString()
End Sub
Private Sub ToleranceTxBx_EgtClosed(sender As Object, e As EventArgs) Handles ToleranceTxBx.EgtClosed
' Recupero il valore
Dim dVal As Double = 0
StringToLen(ToleranceTxBx.Text, dVal)
' Lo imposto
m_MainWindow.m_Camera.Tolerance = dVal
' Lo recupero, potrebbe essere stato aggiustato
ToleranceTxBx.Text = LenToString(m_MainWindow.m_Camera.Tolerance, 3)
End Sub
Private Sub SideAngCutProbeChBx_Click(sender As Object, e As RoutedEventArgs) Handles SideAngCutProbeChBx.Click
If SideAngCutProbeChBx.IsChecked() Then
WritePrivateProfileString(S_MACH_NEST, K_MACH_SACPROBE, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_SACPROBE, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub UseLaserOriginChBx_Click() Handles UseLaserOriginChBx.Click
If UseLaserOriginChBx.IsChecked() Then
WritePrivateProfileString(S_TABLE, K_USELASERORIGIN, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_TABLE, K_USELASERORIGIN, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub WashingChBx_Click(sender As Object, e As RoutedEventArgs) Handles WashingChBx.Click
If WashingChBx.IsChecked() Then
WritePrivateProfileString(S_MACH_NEST, K_MACH_WASHING, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_MACH_NEST, K_MACH_WASHING, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub CfrLenTxBx_Click(sender As Object, e As RoutedEventArgs) Handles CfrLenTxBx.EgtClosed
' Recupero il valore
Dim dVal As Double = 0
StringToLen(CfrLenTxBx.Text, dVal)
' Lo imposto
m_CurrentMachine.dFsevLength = dVal
End Sub
Private Sub CfrPercTxBx_Click(sender As Object, e As RoutedEventArgs) Handles CfrPercTxBx.EgtClosed
' Recupero il valore
Dim dVal As Double = 0
StringToDouble(CfrPercTxBx.Text, dVal)
' Lo imposto
m_CurrentMachine.dFsevPerc = dVal
End Sub
Private Sub FramePauseChBx_Click(sender As Object, e As RoutedEventArgs) Handles FramePauseChBx.Click
If FramePauseChBx.IsChecked() Then
WritePrivateProfileString(S_MACH_FRAME, K_MACH_PAUSE, "1", m_MainWindow.GetMachIniFile())
Else
WritePrivateProfileString(S_MACH_FRAME, K_MACH_PAUSE, "0", m_MainWindow.GetMachIniFile())
End If
End Sub
Private Sub SawProbingBtn_Click(sender As Object, e As RoutedEventArgs) Handles SawProbingBtn.Click
' imposto modo automatico
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
' in attesa di verifica
Case 3
Dim nResult As Short = m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
Case 4
' FANUC - Manual:7, Edit:1
Dim nResult As Short = m_CN.DGeneralFunctions_WriteCncMode(7)
EgtOutLog("Impostata modalità manuale: esito " & nResult.ToString)
End Select
' Recupero file LUA
EgtLuaExecFile(m_CurrentMachine.sMachDir() & "\DirectCmd\SawProbing.lua")
' Recupero utensile da tastare
Dim ToolForProbing As ToolPos = ChooseToolForProbing()
If IsNothing(ToolForProbing) OrElse String.IsNullOrWhiteSpace(ToolForProbing.m_ToolName) Then Return
If Not EgtTdbSetCurrTool(ToolForProbing.m_ToolName) Then Return
' Imposto parametri
Dim dToolDiam As Double = 0
Dim dToolThick As Double = 0
Dim dToolLen As Double = 0
Dim dCore As Double = 0
Dim sToolParam As String = String.Empty
EgtTdbGetCurrToolParam(MCH_TP.HEAD, sToolParam)
EgtLuaSetGlobStringVar("CMD.HEAD", sToolParam)
EgtLuaSetGlobStringVar("CMD.TCPOS", ToolForProbing.m_ToolPos)
EgtLuaSetGlobBoolVar("CMD.ISSAW", ToolForProbing.m_IsSaw)
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dToolDiam)
EgtLuaSetGlobNumVar("CMD.DIAM", dToolDiam * 1000)
EgtTdbGetCurrToolParam(MCH_TP.THICK, dToolThick)
EgtLuaSetGlobNumVar("CMD.THICK", dToolThick * 1000)
EgtTdbGetCurrToolParam(MCH_TP.LEN, dToolLen)
EgtLuaSetGlobNumVar("CMD.LENGTH", dToolLen * 1000)
EgtTdbGetCurrToolParam(MCH_TP.CORE, dCore)
EgtLuaSetGlobNumVar("CMD.CORE", dCore * 1000)
' Nuova varibile per gestione tastatura utensili Frankfurt (Polishing)
Dim nType As Integer
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nType)
If m_CurrentMachine.bPolishingWheel AndAlso nType = MCH_TY.MILL_POLISHING Then
EgtLuaSetGlobStringVar("CMD.POLISHING", "1")
End If
EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
EgtLuaCallFunction("CMD.CmdString")
' Leggo variabili
Dim CmdString As String = String.Empty
EgtLuaGetGlobStringVar("CMD.CMDSTRING", CmdString)
Dim nErr As Integer = 0
EgtLuaGetGlobIntVar("CMD.ERR", nErr)
' Reset lua
EgtLuaResetGlobVar("CMD")
' Verifico condizioni di errore
If nErr <> 0 Or String.IsNullOrWhiteSpace(CmdString) Then
' Errore in tastatura lama
Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(90244), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL) ' Errore in tastatura lama
EgtOutLog("ToolProbing Command error")
Return
End If
' Modifico stringa per inserire i newline
CmdString = CmdString.Replace("<br/>", Environment.NewLine)
' Creo file...
Dim FilePath As String = m_MainWindow.GetCncDir() & "\SawProbing" & m_CurrentMachine.sIsoFileExt
' ...e ci scrivo
Dim Writer As New IO.StreamWriter(FilePath, False)
Writer.Write(CmdString)
Writer.Close()
' Verifico se sono connesso alla macchina prima di continuare
If Not m_MainWindow.m_bNCLink Then
EgtOutLog("ToolProbing NcLink error")
Return
End If
' Leggo nome variabile tastatura eseguita
Dim ProbingStateNameVar As String = String.Empty
GetPrivateProfileString(S_MACH_PROBING, K_PROBINGSTATEVAR, "", ProbingStateNameVar, m_MainWindow.GetMachIniFile())
' Eseguo reset variabile tastatura eseguita
m_MainWindow.m_CNCommunication.m_CN.DVariables_WriteVariables2(ProbingStateNameVar, "0")
System.Threading.Thread.Sleep(300)
' Mando file al CN
If Not m_MainWindow.m_CNCommunication.SendProgram(FilePath, 900) Then
' Errore in tastatura lama
Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(90244), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
EgtOutLog("ToolProbing Send error")
Return
End If
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
' Se fanuc passo in modalità AUTO e attivo
If m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
Dim nResult As Short = m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
End If
' Aspetto e lo avvio
System.Threading.Thread.Sleep(300)
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
' Creo MsgBox di attesa
Dim MsgBoxStateInfo As New EgtMsgBox(m_MainWindow, String.Format(EgtMsg(90241), ToolForProbing.m_ToolName), EgtMsg(90242), True, EgtMsgBox.Buttons.CANCEL, EgtMsgBox.Icons.NULL)
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
' Definisco flag tastatura
Dim bProbingOk As Boolean = False
For I As Integer = 0 To 120
' Devo rileggere la variabile ad ogni ciclo
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(ProbingStateNameVar, 3)
System.Threading.Thread.Sleep(100)
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 3 Then
Dim L108Val As Integer = CInt(m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value)
Select Case L108Val
Case 0
' Non faccio alcunchè perchè sta tastando
Case 1
' Tastatura completata
bProbingOk = True
Exit For
Case 2
' Errore
bProbingOk = False
Exit For
End Select
End If
System.Threading.Thread.Sleep(900)
' Incremento progressbar
MsgBoxStateInfo.LoadingPrBr_Value += 100 / 120
' Costringo ad aggiornare UI
UpdateUI()
' Verifico se interrotto dall'utente
If MsgBoxStateInfo.m_nPressedBtn = 0 Then
MsgBoxStateInfo.Close()
UpdateUI()
System.Threading.Thread.Sleep(100)
EgtOutLog("ToolProbing canceled by user")
' Tastatura interrotta dall'utente
Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(90246), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
Return
End If
Next
' Se tastatura riuscita
If bProbingOk Then
' Leggo valore misurato (diametro per lama, lunghezza per altri utensili)
Dim bRead As Boolean = False
Dim SawDiameterNameVar As String = String.Empty
GetPrivateProfileString(S_MACH_PROBING, K_SAWDIAMETER, "", SawDiameterNameVar, m_MainWindow.GetMachIniFile())
' Se utensile non lama, allora la variabile in cui leggo il dato potrebbe essere differente
If Not ToolForProbing.m_IsSaw Then
GetPrivateProfileString(S_MACH_PROBING, K_TOOLLENGTH, SawDiameterNameVar, SawDiameterNameVar, m_MainWindow.GetMachIniFile())
End If
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
For I As Integer = 0 To 20
' Devo rileggere la variabile ad ogni ciclo
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(SawDiameterNameVar, 3)
System.Threading.Thread.Sleep(100)
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 3 Then
bRead = True
Dim dVal As Double = m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value
' Se fanuc il dato è in mm (NON MICRON)
If m_MainWindow.m_CNCommunication.m_nNCType <> 4 Then
dVal = dVal / 1000
End If
MsgBoxStateInfo.LoadingPrBr_Value = 100
' Tastatura conclusa con successo
Dim sOut As String = EgtMsg(90243) & " : " & DoubleToString(dVal, 1)
MsgBoxStateInfo.Text = sOut
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(sOut)
EgtOutLog("ToolVal=" & dVal.ToString())
' Costringo ad aggiornare UI
UpdateUI()
' Trasformo misura rilevata in mm
dVal *= If(m_MainWindow.m_CNCommunication.GetMachineInInches(), ONEINCH, ONEMM)
' Imposto valore misurato
If dVal > EPS_SMALL Then
' Recupero utensile dal Db utensili
EgtTdbSetCurrTool(ToolForProbing.m_ToolName)
' Se lama è il diametro, altrimenti la lunghezza
If ToolForProbing.m_IsSaw Then
EgtTdbSetCurrToolParam(MCH_TP.DIAM, dVal)
EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, dVal)
Else
EgtTdbSetCurrToolParam(MCH_TP.LEN, dVal)
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dVal)
End If
EgtTdbSaveCurrTool()
EgtTdbSave()
End If
' Chiudo msgbox
System.Threading.Thread.Sleep(3000)
MsgBoxStateInfo.Close()
Exit For
End If
System.Threading.Thread.Sleep(100)
Next
If Not bRead Then bProbingOk = False
End If
' Se tastatura non riuscita
If Not bProbingOk Then
MsgBoxStateInfo.Close()
UpdateUI()
System.Threading.Thread.Sleep(100)
EgtOutLog("ToolProbing error")
' Errore in tastatura lama
Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(90244), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
End If
End Sub
Private Function ChooseToolForProbing() As ToolPos
Select Case m_CurrentMachine.MountedToolConfig
Case CurrentMachine.MountedToolConfigs.SAW
Return New ToolPos(m_CurrentMachine.sCurrSaw, "T100", True)
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL, CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW
Dim ChooseTool As New ChooseToolWD(m_MainWindow)
If ChooseTool.ShowDialog Then
Return ChooseTool.GetSelectedTool
Else
Return Nothing
End If
Case Else
Return Nothing
End Select
End Function
Friend Sub NcError()
If m_CN.sz_NC_error_messages.Count > 0 Then
'NCErrorMessages.Text = m_CN.sz_NC_error_messages(0)
If m_CN.bIsErrorMessage Then
m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Red")
Else
m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray")
End If
Else
'NCErrorMessages.Text = ""
Dim BackColor As SolidColorBrush = m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background
If Colors.Red.Equals(BackColor.Color) Then
m_MainWindow.m_MachineStatusUC.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray")
End If
End If
End Sub
Friend Sub PlcError(ErrorMsg As String)
' m_MainWindow.m_MachineStatusUC.Background = Brushes.Red
' Dim sFilePath As String = m_MainWindow.GetMachinesRootDir() & "/PLCMessages/" & EgtMsg(MSG_MACHINEPAGEUC + 1)
' Try
' Dim sErrorText As String = File.ReadLines(sFilePath).Skip(m_CN.sz_PLC_error_messages).Take(1).First()
' sErrorText = sErrorText.Substring(sErrorText.IndexOf("$"))
' If sErrorText(0) = " " Then
' sErrorText = sErrorText.Substring(1)
' End If
' PLCErrorMessages.Text = sErrorText
' Catch ex As Exception
' MsgBox("Errore lettura errori PLC")
' End Try
End Sub
Private Sub ExecLuaBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExecLuaBtn.Click
Dim sExecFile As String = GetExecLuaFile()
' Eseguo file LUA e recupero risultato
Dim nErr As Integer = 999
EgtLuaExecFile(sExecFile)
EgtLuaGetGlobIntVar("ELS.ERR", nErr)
' Reset lua
EgtLuaResetGlobVar("ELS")
' Verifico condizioni di errore
If nErr Then
' Errore...
EgtOutLog("Error executing file: " & sExecFile & ", ELS.ERR=" & nErr.ToString)
' Error executing script
Dim MsgBoxError As New EgtMsgBox(m_MainWindow, "", EgtMsg(90259), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
Return
End If
End Sub
' Recupero il percorso del file lua da eseguire
Private Function GetExecLuaFile() As String
Dim sFile As String = String.Empty
If GetPrivateProfileString(S_EXECLUA, K_FILESCRIPT_LUA, "", sFile, m_MainWindow.GetMachIniFile()) <> 0 Then
' Sistemo nome file
sFile = sFile.Trim()
If Not sFile.EndsWith(".lua") Then sFile = sFile & ".lua"
' Creo path
Dim sPath As String = m_CurrentMachine.sMachDir() & "\Scripts\" & sFile
If File.Exists(sPath) Then Return sPath
End If
Return String.Empty
End Function
Private Sub EnableFinalSawCutChBx_IsChecked() Handles EnableFinalSawCutChBx.Click
m_MainWindow.m_CurrentMachine.bEnableFinalSawCut = EnableFinalSawCutChBx.IsChecked
WritePrivateProfileString(S_MACH, K_ENABLEFINALSAWCUT, If(m_MainWindow.m_CurrentMachine.bEnableFinalSawCut, "1", "0"), m_MainWindow.GetMachIniFile())
End Sub
End Class