3eb8929578
- aggiunta gestione mm/inch in interfaccia utente (da fare verso macchina e in generazione CN).
559 lines
26 KiB
VB.net
559 lines
26 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports OmagCUT.TreeViewItem
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib
|
|
|
|
Public Class MachiningDbPageUC
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
' Lista degli utensili
|
|
Dim MachiningsList As New ObservableCollection(Of CathegoryItem)
|
|
|
|
' Proprietà
|
|
Private m_bFirst As Boolean = True
|
|
|
|
Private m_sMachiningName As String = String.Empty
|
|
|
|
'Array che contengono le variabili per Combobox
|
|
Dim WorkSide() As String = {"Centro", "Sinistra", "Destra"}
|
|
Dim HeadSide() As String = {"Sinistra", "Destra"}
|
|
Dim LeadInType() As String = {"Centrato", "Interno", "Esterno", "Esteso centrato", "Esteso esterno"}
|
|
Dim ExtLinkType() As String = {"Centrato", "Esteso precedente", "Esteso successivo", "Estesi entrambi"}
|
|
Dim LeadOutType() As String = {"Centrata", "Interna", "Esterna"}
|
|
Dim CurveUse() As String = {"Salta", "Approssima", "Convesso"}
|
|
Dim StepType() As String = {"Zig zag", "Una via", "Va e Vieni"}
|
|
Dim SawTool As New List(Of String)
|
|
Dim DrillTool As New List(Of String)
|
|
|
|
'Variabile che conserva la lavorazione precedentemente selezionata, usata nel caso si selezioni annulla quando si cambia lavorazione selezionata
|
|
Private m_OldItem As Object
|
|
|
|
Private Sub MachiningDbPage_Initialized(sender As Object, e As EventArgs)
|
|
|
|
' Assegno la lista degli utensili come sorgente del treeview
|
|
MachiningTreeView.ItemsSource = MachiningsList
|
|
|
|
'Assegno array a combobox
|
|
WorkSideCmBx.ItemsSource = WorkSide
|
|
HeadSideCmBx.ItemsSource = HeadSide
|
|
LeadInTypeCmBx.ItemsSource = LeadInType
|
|
ExtLinkTypeCmBx.ItemsSource = ExtLinkType
|
|
LeadOutTypeCmBx.ItemsSource = LeadOutType
|
|
CurveUseCmBx.ItemsSource = CurveUse
|
|
StepTypeCmBx.ItemsSource = StepType
|
|
'ToolCmBx.ItemsSource = SawTool
|
|
|
|
'Imposto i messaggi letti dal file dei messaggi
|
|
NewBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 16)
|
|
SaveBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 17)
|
|
RemoveBtn.Content = EgtMsg(MSG_MACHINEPAGEUC + 18)
|
|
|
|
NameTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 1)
|
|
DepthTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 2)
|
|
SideAngleTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 3)
|
|
InvertTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 4)
|
|
StepTypeTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 5)
|
|
WorkSideTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 6)
|
|
HeadSideTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 7)
|
|
StartPosTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 8)
|
|
LeadInTypeTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 9)
|
|
ExtLinkTypeTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 10)
|
|
LeadOutTypeTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 11)
|
|
CurveUseTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 12)
|
|
ApproxTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 13)
|
|
SawStepGpBx.Header = EgtMsg(MSG_MACHININGSDBPAGEUC + 14)
|
|
SawStepTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 15)
|
|
DrillStepTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 16)
|
|
ArcIntTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 17)
|
|
ArcExtTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 18)
|
|
LowLenGpBx.Header = EgtMsg(MSG_MACHININGSDBPAGEUC + 19)
|
|
StartsLowLenTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 20)
|
|
EndsLowLenTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 21)
|
|
ThrouAddLenTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 22)
|
|
ReturnPosTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 23)
|
|
|
|
ToolTxBl.Text = EgtMsg(MSG_MACHININGSDBPAGEUC + 24)
|
|
|
|
' Associo TextBox e Label
|
|
Dim TempLabel1 As New Label
|
|
TempLabel1.Content = SideAngleTxBl.Text
|
|
SideAngleTxBx.Tag = TempLabel1
|
|
Dim TempLabel2 As New Label
|
|
TempLabel2.Content = ApproxTxBl.Text
|
|
ApproxTxBx.Tag = TempLabel2
|
|
End Sub
|
|
|
|
Private Sub MachiningDbPage_Loaded(sender As Object, e As RoutedEventArgs)
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
InitializeToolLists()
|
|
If m_bFirst Then
|
|
' Inizializzo le famiglie di utensili nell'albero
|
|
InitializeToolLists()
|
|
InitializeMachiningFamily(K_SAWING, MCH_MY.SAWING, EgtMsg(MSG_MACHININGSDBPAGEUC + 31))
|
|
InitializeMachiningFamily(K_DRILLING, MCH_MY.DRILLING, EgtMsg(MSG_MACHININGSDBPAGEUC + 32))
|
|
'InitializeMachiningFamily(K_MILLING, MCH_MY.MILLING, EgtMsg(MSG_MACHININGSDBPAGEUC + 33))
|
|
m_bFirst = False
|
|
End If
|
|
|
|
InitializeFirstSelectedItem()
|
|
|
|
End Sub
|
|
|
|
'Funzione che permette di inizializzare le liste di utensili
|
|
Private Sub InitializeToolLists()
|
|
SawTool.Clear()
|
|
Dim sToolName As String = String.Empty
|
|
Dim nType As Integer = MCH_TY.NONE
|
|
If EgtTdbGetFirstTool(MCH_TF.SAWBLADE, sToolName, nType) Then
|
|
SawTool.Add(sToolName)
|
|
While EgtTdbGetNextTool(MCH_TF.SAWBLADE, sToolName, nType)
|
|
SawTool.Add(sToolName)
|
|
End While
|
|
End If
|
|
DrillTool.Clear()
|
|
If EgtTdbGetFirstTool(MCH_TF.DRILLBIT, sToolName, nType) Then
|
|
DrillTool.Add(sToolName)
|
|
While EgtTdbGetNextTool(MCH_TF.DRILLBIT, sToolName, nType)
|
|
DrillTool.Add(sToolName)
|
|
End While
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'Funzione che permette l'inizializzazione di albero e parametri all'apertura della pagina ToolsDb
|
|
Private Sub InitializeFirstSelectedItem()
|
|
If MachiningsList.Count > 0 Then
|
|
For Each MachiningFamily In MachiningsList
|
|
If MachiningFamily.Items.Count > 0 Then
|
|
MachiningFamily.IsExpanded = True
|
|
MachiningFamily.Items(0).IsSelected = True
|
|
EgtMdbSetCurrMachining(MachiningFamily.Items(0).Name)
|
|
m_OldItem = MachiningFamily.Items(0)
|
|
GetMachiningParams()
|
|
ViewMachiningParams()
|
|
Exit Sub
|
|
End If
|
|
Next
|
|
MachiningsList.Item(0).IsSelected = True
|
|
HideMachiningParams()
|
|
End If
|
|
End Sub
|
|
|
|
'Private Sub MoveParam()
|
|
' SpeedBrd.SetValue(Grid.RowProperty, 1)
|
|
' FeedBrd.SetValue(Grid.RowProperty, 2)
|
|
' CoolantTxBl.SetValue(Grid.RowProperty, 4)
|
|
' CoolantCmBx.SetValue(Grid.RowProperty, 4)
|
|
' CorrTxBl.SetValue(Grid.RowProperty, 4)
|
|
' CorrTxBx.SetValue(Grid.RowProperty, 4)
|
|
' OffsetBrd.SetValue(Grid.RowProperty, 5)
|
|
' AbsorptionBrd.SetValue(Grid.RowProperty, 6)
|
|
' MaxMatTxBl.SetValue(Grid.RowProperty, 7)
|
|
' MaxMatTxBx.SetValue(Grid.RowProperty, 7)
|
|
|
|
'End Sub
|
|
|
|
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
If TypeOf MachiningTreeView.SelectedItem Is CathegoryItem Then
|
|
Dim SelectedCathegory As CathegoryItem = MachiningTreeView.SelectedItem
|
|
Dim NewName As String = SelectedCathegory.Name
|
|
EgtMdbGetMachiningNewName(NewName)
|
|
If EgtMdbAddMachining(NewName, SelectedCathegory.nFType) Then
|
|
For Each MachiningFamily In MachiningsList
|
|
If MachiningFamily.nFType = SelectedCathegory.nFType Then
|
|
Dim NewMachiningItem As New CustomItem(NewName, SelectedCathegory.nFType)
|
|
MachiningFamily.Items.Add(NewMachiningItem)
|
|
NewMachiningItem.IsSelected = True
|
|
MachiningFamily.IsExpanded = True
|
|
m_OldItem = MachiningTreeView.SelectedItem
|
|
End If
|
|
Next
|
|
GetMachiningParams()
|
|
ViewMachiningParams()
|
|
End If
|
|
ElseIf TypeOf MachiningTreeView.SelectedItem Is CustomItem Then
|
|
Dim SelectedCathegory As CustomItem = MachiningTreeView.SelectedItem
|
|
Dim NewName As String = SelectedCathegory.Name
|
|
EgtMdbGetMachiningNewName(NewName)
|
|
If EgtMdbCopyMachining(SelectedCathegory.Name, NewName) Then
|
|
Dim CurrType As Integer
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, CurrType)
|
|
For Each MachiningFamily In MachiningsList
|
|
If MachiningFamily.nFType = CurrType Then
|
|
Dim NewMachiningItem As New CustomItem(NewName, CurrType)
|
|
MachiningFamily.Items.Add(NewMachiningItem)
|
|
NewMachiningItem.IsSelected = True
|
|
GetMachiningParams()
|
|
m_OldItem = MachiningTreeView.SelectedItem
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
SetMachiningParams()
|
|
EgtMdbSaveCurrMachining()
|
|
Dim CurrTool As CustomItem = TryCast(m_OldItem, CustomItem)
|
|
If CurrTool IsNot Nothing Then
|
|
CurrTool.Name = NameTxBx.Text
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RemoveBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemoveBtn.Click
|
|
If TypeOf MachiningTreeView.SelectedItem Is CustomItem Then
|
|
Dim SelectedItem As CustomItem = MachiningTreeView.SelectedItem
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
EgtMdbRemoveMachining(SelectedItem.Name)
|
|
For Each MachiningFamily In MachiningsList
|
|
If (MachiningFamily.nFType And SelectedItem.nType) <> 0 Then
|
|
MachiningFamily.Items.Remove(SelectedItem)
|
|
If MachiningFamily.Items.Count = 0 Then
|
|
MachiningFamily.IsSelected = True
|
|
HideMachiningParams()
|
|
Else
|
|
MachiningFamily.Items(0).IsSelected = True
|
|
EgtMdbSetCurrMachining(MachiningFamily.Items(0).Name)
|
|
m_OldItem = MachiningFamily.Items(0)
|
|
GetMachiningParams()
|
|
ViewMachiningParams()
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub InitializeMachiningFamily(sFIniConst As String, nFType As Integer, sFName As String)
|
|
If GetPrivateProfileInt(S_MACHININGS, sFIniConst, 0, m_MainWindow.GetMachIniFile()) = 1 Then
|
|
Dim MachiningCathegory As New CathegoryItem(sFName, nFType)
|
|
Dim MachiningName As String = String.Empty
|
|
If EgtMdbGetFirstMachining(nFType, MachiningName) Then
|
|
MachiningCathegory.Items.Add(New CustomItem(MachiningName, nFType))
|
|
While EgtMdbGetNextMachining(nFType, MachiningName)
|
|
MachiningCathegory.Items.Add(New CustomItem(MachiningName, nFType))
|
|
End While
|
|
End If
|
|
MachiningsList.Add(MachiningCathegory)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
|
' Se necessario, chiedo se salvare ll lavorazione corrente
|
|
If Not SaveCurrMachining() Then
|
|
Exit Sub
|
|
End If
|
|
' Salvo il DB utensili
|
|
EgtMdbSave()
|
|
' Esco dalla pagina
|
|
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Remove(m_MainWindow.m_MachinePageUC.m_MachiningDbPageUC)
|
|
m_MainWindow.m_MachinePageUC.MachinePageGrid.Children.Add(m_MainWindow.m_MachinePageUC.m_AlarmsPageUC)
|
|
m_MainWindow.m_MachinePageUC.m_ActiveMachinePage = MachinePageUC.MachinePages.Alarms
|
|
m_MainWindow.m_MachinePageUC.MachiningDBBtn.IsChecked = False
|
|
m_MainWindow.m_MachinePageUC.AlarmsBtn.IsChecked = True
|
|
|
|
End Sub
|
|
|
|
Private Sub GetMachiningParams()
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
Dim ToolString As String = String.Empty
|
|
Dim ToolInt As Integer = 0
|
|
Dim ToolDouble As Double = 0
|
|
Dim ToolBool As Boolean = False
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.NAME, m_sMachiningName)
|
|
NameTxBx.Text = m_sMachiningName
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.DEPTH_STR, ToolString)
|
|
DepthTxBx.Text = ExprToUIExpr(ToolString)
|
|
'Parametri Taglio
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGLE, ToolDouble)
|
|
SideAngleTxBx.Text = DoubleToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.INVERT, ToolBool)
|
|
InvertChBx.IsChecked = ToolBool
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.STEPTYPE, ToolInt)
|
|
StepTypeCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.WORKSIDE, ToolInt)
|
|
WorkSideCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.HEADSIDE, ToolInt)
|
|
HeadSideCmBx.SelectedIndex = ToolInt - 1
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.LEADINTYPE, ToolInt)
|
|
LeadInTypeCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.EXTLINKTYPE, ToolInt)
|
|
ExtLinkTypeCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.LEADOUTTYPE, ToolInt)
|
|
LeadOutTypeCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.CURVEUSE, ToolInt)
|
|
CurveUseCmBx.SelectedIndex = ToolInt
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.APPROX, ToolDouble)
|
|
ApproxTxBx.Text = LenToString(ToolDouble, 3)
|
|
'Parametri Foratura
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.STARTPOS, ToolDouble)
|
|
StartPosTxBx.Text = LenToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.STARTSLOWLEN, ToolDouble)
|
|
StartsLowLenTxBx.Text = LenToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.ENDSLOWLEN, ToolDouble)
|
|
EndsLowLenTxBx.Text = LenToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.THROUADDLEN, ToolDouble)
|
|
ThrouAddLenTxBx.Text = LenToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.STEP_, ToolDouble)
|
|
StepTxBx.Text = LenToString(ToolDouble, 3)
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.RETURNPOS, ToolDouble)
|
|
ReturnPosTxBx.Text = LenToString(ToolDouble, 3)
|
|
'Parametri utensile
|
|
Dim nMachiningType As Integer
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, nMachiningType)
|
|
Select Case nMachiningType
|
|
Case MCH_MY.SAWING 'Taglio
|
|
ToolCmBx.ItemsSource = SawTool
|
|
Case MCH_MY.DRILLING 'Foratura
|
|
ToolCmBx.ItemsSource = DrillTool
|
|
End Select
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, ToolString)
|
|
Dim bToolExist As Boolean = False
|
|
For Each CurrTool In ToolCmBx.ItemsSource
|
|
If CurrTool = ToolString Then
|
|
bToolExist = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
If bToolExist Then
|
|
ToolCmBx.SelectedItem = ToolString
|
|
'Else
|
|
' SawTool.Add("")
|
|
' ToolCmBx.SelectedItem = ""
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub SetMachiningParams()
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
Dim dTemp As Double
|
|
Dim bTemp As Boolean
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.NAME, NameTxBx.Text)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.DEPTH_STR, UIExprToExpr(DepthTxBx.Text))
|
|
'Parametri Taglio
|
|
StringToDouble(SideAngleTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.SIDEANGLE, dTemp)
|
|
bTemp = InvertChBx.IsChecked
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.INVERT, bTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.STEPTYPE, StepTypeCmBx.SelectedIndex)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.WORKSIDE, WorkSideCmBx.SelectedIndex)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.HEADSIDE, HeadSideCmBx.SelectedIndex + 1)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.LEADINTYPE, LeadInTypeCmBx.SelectedIndex)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.EXTLINKTYPE, ExtLinkTypeCmBx.SelectedIndex)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.LEADOUTTYPE, LeadOutTypeCmBx.SelectedIndex)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.CURVEUSE, CurveUseCmBx.SelectedIndex)
|
|
StringToLen(ApproxTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.APPROX, dTemp)
|
|
'Parametri Foratura
|
|
StringToLen(StartPosTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.STARTPOS, dTemp)
|
|
StringToLen(StartsLowLenTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.STARTSLOWLEN, dTemp)
|
|
StringToLen(EndsLowLenTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.ENDSLOWLEN, dTemp)
|
|
StringToLen(ThrouAddLenTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.THROUADDLEN, dTemp)
|
|
StringToLen(StepTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.STEP_, dTemp)
|
|
StringToLen(ReturnPosTxBx.Text, dTemp)
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.RETURNPOS, dTemp)
|
|
'Parametri utensile
|
|
If Not IsNothing(ToolCmBx.SelectedItem) Then
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.TOOL, ToolCmBx.SelectedItem.ToString)
|
|
Else
|
|
EgtMdbSetCurrMachiningParam(MCH_MP.TOOL, String.Empty)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ViewMachiningParams()
|
|
Dim nMachiningType As Integer
|
|
EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, nMachiningType)
|
|
NameTxBl.Visibility = Windows.Visibility.Visible
|
|
NameTxBx.Visibility = Windows.Visibility.Visible
|
|
DepthTxBl.Visibility = Windows.Visibility.Visible
|
|
DepthTxBx.Visibility = Windows.Visibility.Visible
|
|
Select Case nMachiningType
|
|
Case MCH_MY.SAWING 'Parametri Taglio
|
|
SideAngleTxBl.Visibility = Windows.Visibility.Visible
|
|
SideAngleTxBx.Visibility = Windows.Visibility.Visible
|
|
InvertTxBl.Visibility = Windows.Visibility.Visible
|
|
InvertChBx.Visibility = Windows.Visibility.Visible
|
|
StepTypeTxBl.Visibility = Windows.Visibility.Visible
|
|
StepTypeCmBx.Visibility = Windows.Visibility.Visible
|
|
SideBrd.Visibility = Windows.Visibility.Visible
|
|
TypeBrd.Visibility = Windows.Visibility.Visible
|
|
CurveBrd.Visibility = Windows.Visibility.Visible
|
|
If MachParamGrd.Children.Contains(StartPosTxBl) Then
|
|
MachParamGrd.Children.Remove(StartPosTxBl)
|
|
MachParamGrd.Children.Remove(StartPosTxBx)
|
|
TypeGrd.Children.Add(StartPosTxBl)
|
|
TypeGrd.Children.Add(StartPosTxBx)
|
|
StartPosTxBl.SetValue(Grid.ColumnProperty, 0)
|
|
StartPosTxBl.SetValue(Grid.RowProperty, 0)
|
|
StartPosTxBx.SetValue(Grid.ColumnProperty, 1)
|
|
StartPosTxBx.SetValue(Grid.RowProperty, 0)
|
|
StartPosTxBl.SetValue(Grid.RowSpanProperty, 1)
|
|
StartPosTxBx.SetValue(Grid.RowSpanProperty, 1)
|
|
End If
|
|
StartPosTxBl.Visibility = Windows.Visibility.Visible
|
|
StartPosTxBx.Visibility = Windows.Visibility.Visible
|
|
LowLenGpBx.Visibility = Windows.Visibility.Hidden
|
|
ThrouAddLenTxBl.Visibility = Windows.Visibility.Hidden
|
|
ThrouAddLenTxBx.Visibility = Windows.Visibility.Hidden
|
|
If DrillStepGrd.Children.Contains(StepTxBx) Then
|
|
DrillStepGrd.Children.Remove(StepTxBx)
|
|
SawStepGrd.Children.Add(StepTxBx)
|
|
StepTxBx.SetValue(Grid.ColumnProperty, 1)
|
|
StepTxBx.SetValue(Grid.RowProperty, 0)
|
|
End If
|
|
DrillStepBrd.Visibility = Windows.Visibility.Hidden
|
|
SawStepGpBx.Visibility = Windows.Visibility.Visible
|
|
ReturnPosTxBl.Visibility = Windows.Visibility.Hidden
|
|
ReturnPosTxBx.Visibility = Windows.Visibility.Hidden
|
|
Case MCH_MY.DRILLING 'Parametri Foratura
|
|
SideAngleTxBl.Visibility = Windows.Visibility.Hidden
|
|
SideAngleTxBx.Visibility = Windows.Visibility.Hidden
|
|
InvertTxBl.Visibility = Windows.Visibility.Hidden
|
|
InvertChBx.Visibility = Windows.Visibility.Hidden
|
|
StepTypeTxBl.Visibility = Windows.Visibility.Hidden
|
|
StepTypeCmBx.Visibility = Windows.Visibility.Hidden
|
|
SideBrd.Visibility = Windows.Visibility.Hidden
|
|
TypeBrd.Visibility = Windows.Visibility.Hidden
|
|
CurveBrd.Visibility = Windows.Visibility.Hidden
|
|
If TypeGrd.Children.Contains(StartPosTxBl) Then
|
|
TypeGrd.Children.Remove(StartPosTxBl)
|
|
TypeGrd.Children.Remove(StartPosTxBx)
|
|
MachParamGrd.Children.Add(StartPosTxBl)
|
|
MachParamGrd.Children.Add(StartPosTxBx)
|
|
StartPosTxBl.SetValue(Grid.ColumnProperty, 0)
|
|
StartPosTxBl.SetValue(Grid.RowProperty, 6)
|
|
StartPosTxBx.SetValue(Grid.ColumnProperty, 1)
|
|
StartPosTxBx.SetValue(Grid.RowProperty, 6)
|
|
StartPosTxBl.SetValue(Grid.RowSpanProperty, 3)
|
|
StartPosTxBx.SetValue(Grid.RowSpanProperty, 3)
|
|
End If
|
|
StartPosTxBl.Visibility = Windows.Visibility.Visible
|
|
StartPosTxBx.Visibility = Windows.Visibility.Visible
|
|
LowLenGpBx.Visibility = Windows.Visibility.Visible
|
|
ThrouAddLenTxBl.Visibility = Windows.Visibility.Visible
|
|
ThrouAddLenTxBx.Visibility = Windows.Visibility.Visible
|
|
If SawStepGrd.Children.Contains(StepTxBx) Then
|
|
SawStepGrd.Children.Remove(StepTxBx)
|
|
DrillStepGrd.Children.Add(StepTxBx)
|
|
StepTxBx.SetValue(Grid.ColumnProperty, 1)
|
|
StepTxBx.SetValue(Grid.RowProperty, 2)
|
|
End If
|
|
SawStepGpBx.Visibility = Windows.Visibility.Hidden
|
|
DrillStepBrd.Visibility = Windows.Visibility.Visible
|
|
ReturnPosTxBl.Visibility = Windows.Visibility.Visible
|
|
ReturnPosTxBx.Visibility = Windows.Visibility.Visible
|
|
End Select
|
|
'Parametri utensile
|
|
ToolTxBl.Visibility = Windows.Visibility.Visible
|
|
ToolCmBx.Visibility = Windows.Visibility.Visible
|
|
End Sub
|
|
|
|
Private Sub HideMachiningParams()
|
|
'Dim nMachiningType As Integer
|
|
'EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, nMachiningType)
|
|
NameTxBl.Visibility = Windows.Visibility.Hidden
|
|
NameTxBx.Visibility = Windows.Visibility.Hidden
|
|
DepthTxBl.Visibility = Windows.Visibility.Hidden
|
|
DepthTxBx.Visibility = Windows.Visibility.Hidden
|
|
'Parametri Taglio
|
|
SideAngleTxBl.Visibility = Windows.Visibility.Hidden
|
|
SideAngleTxBx.Visibility = Windows.Visibility.Hidden
|
|
InvertTxBl.Visibility = Windows.Visibility.Hidden
|
|
InvertChBx.Visibility = Windows.Visibility.Hidden
|
|
StepTypeTxBl.Visibility = Windows.Visibility.Hidden
|
|
StepTypeCmBx.Visibility = Windows.Visibility.Hidden
|
|
SideBrd.Visibility = Windows.Visibility.Hidden
|
|
TypeBrd.Visibility = Windows.Visibility.Hidden
|
|
CurveBrd.Visibility = Windows.Visibility.Hidden
|
|
SawStepGpBx.Visibility = Windows.Visibility.Hidden
|
|
'Parametri Foratura
|
|
StartPosTxBl.Visibility = Windows.Visibility.Hidden
|
|
StartPosTxBx.Visibility = Windows.Visibility.Hidden
|
|
LowLenGpBx.Visibility = Windows.Visibility.Hidden
|
|
ThrouAddLenTxBl.Visibility = Windows.Visibility.Hidden
|
|
ThrouAddLenTxBx.Visibility = Windows.Visibility.Hidden
|
|
ReturnPosTxBl.Visibility = Windows.Visibility.Hidden
|
|
ReturnPosTxBx.Visibility = Windows.Visibility.Hidden
|
|
DrillStepBrd.Visibility = Windows.Visibility.Hidden
|
|
'Parametri utensile
|
|
ToolTxBl.Visibility = Windows.Visibility.Hidden
|
|
ToolCmBx.Visibility = Windows.Visibility.Hidden
|
|
End Sub
|
|
|
|
Private Sub MachiningTreeView_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles MachiningTreeView.PreviewMouseUp
|
|
' Se necessario, chiedo se salvare l'utensile corrente
|
|
If Not SaveCurrMachining() Then
|
|
Dim PreviousMachining As CustomItem = m_OldItem
|
|
PreviousMachining.IsSelected = True
|
|
Exit Sub
|
|
End If
|
|
' Aggiorno
|
|
If TypeOf MachiningTreeView.SelectedItem Is CathegoryItem Then
|
|
Dim SelectedCathegory As CathegoryItem = MachiningTreeView.SelectedItem
|
|
SelectedCathegory.IsExpanded = Not SelectedCathegory.IsExpanded
|
|
HideMachiningParams()
|
|
ElseIf TypeOf MachiningTreeView.SelectedItem Is CustomItem Then
|
|
Dim SelectedMachining As CustomItem = MachiningTreeView.SelectedItem
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
EgtMdbSetCurrMachining(SelectedMachining.Name)
|
|
GetMachiningParams()
|
|
ViewMachiningParams()
|
|
End If
|
|
m_OldItem = MachiningTreeView.SelectedItem
|
|
End Sub
|
|
|
|
Friend Function SaveCurrMachining() As Boolean
|
|
SetMachiningParams()
|
|
If EgtMdbIsCurrMachiningModified() Then
|
|
Dim SaveCurrMachiningWnd As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 3), EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL)
|
|
Select Case SaveCurrMachiningWnd.DialogResult
|
|
Case 0 ' Annulla
|
|
Return False
|
|
Case 1 ' Si
|
|
EgtMdbSaveCurrMachining()
|
|
Dim CurrMachining As CustomItem = TryCast(m_OldItem, CustomItem)
|
|
If CurrMachining IsNot Nothing Then
|
|
CurrMachining.Name = NameTxBx.Text
|
|
End If
|
|
Case 2 ' No
|
|
EgtMdbSetCurrMachining(m_sMachiningName)
|
|
GetMachiningParams()
|
|
End Select
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub NameTxBx_EgtClosed(sender As Object, e As EventArgs) Handles NameTxBx.EgtClosed
|
|
' Se cambiato nome
|
|
If NameTxBx.Text <> m_sMachiningName Then
|
|
' Imposto contesto macchina
|
|
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
|
' Se nome nuovo,lo assegno
|
|
Dim TempName As String = NameTxBx.Text
|
|
EgtMdbGetMachiningNewName(TempName)
|
|
If TempName = NameTxBx.Text Then
|
|
NameTxBx.Text = NameTxBx.Text
|
|
Else
|
|
' Nome già utilizzato
|
|
Dim InfoBox As New EgtMsgBox(m_MainWindow, "", EgtMsg(91104), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.ESCLAMATION)
|
|
NameTxBx.Text = m_sMachiningName
|
|
End If
|
|
Else
|
|
NameTxBx.Text = m_sMachiningName
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub DepthTxBx_EgtClosed(sender As Object, e As EventArgs) Handles DepthTxBx.EgtClosed
|
|
' Non devo fare alcunchè
|
|
End Sub
|
|
|
|
End Class
|