OmagCUT 1.8j6 :
- Aggiunto gestione tastione tastatura utensili.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<Window x:Class="ChooseToolWD"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
|
||||
FontFamily="./Resources/Fonts/#Century Gothic"
|
||||
Title="OpenFile" Height="682.6" Width="426.6" WindowStyle="None" ResizeMode="NoResize" ShowInTaskbar="False" AllowsTransparency="True" Background="Transparent">
|
||||
|
||||
<Border Style="{StaticResource OmagCut_Border}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="5.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox Name="FilePathTxBl" Grid.Column="1" Grid.Row="1"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Foreground="White" FontSize="20"
|
||||
VerticalAlignment="Center"/>
|
||||
<ListBox Name="SetUpToolListBox" Grid.Column="1" Grid.Row="2"
|
||||
ItemsSource="{Binding ItemList}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ToolName}" Style="{StaticResource OmagCut_ListBoxTextBlock}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Grid Grid.Column="1" Grid.Row="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Name="OkBtn" Grid.Column="1" Style="{StaticResource OmagCut_GradientBlueIconButton}" IsDefault="True">
|
||||
<Image Source="Resources/V.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
<Button Name="ExitBtn" Grid.Column="3" Style="{StaticResource OmagCut_GradientBlueIconButton}" IsCancel="True">
|
||||
<Image Source="Resources/X.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,136 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class ChooseToolWD
|
||||
|
||||
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
||||
|
||||
Private m_SetUpToolList As New ObservableCollection(Of ToolPos)
|
||||
|
||||
Sub New(Owner As Window)
|
||||
Me.Owner = Owner
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private Sub OpenFile_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Posizione finestra
|
||||
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
|
||||
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
|
||||
' Definizione del collegamento tra ItemList e ListBox1
|
||||
SetUpToolListBox.ItemsSource = m_SetUpToolList
|
||||
End Sub
|
||||
|
||||
Private Sub OpenFile_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
||||
' carico direttorio
|
||||
LoadSetUpTool()
|
||||
' se presente seleziono il primo elemento
|
||||
If m_SetUpToolList.Count > 0 Then
|
||||
SetUpToolListBox.SelectedItem = m_SetUpToolList(0)
|
||||
OkBtn.IsEnabled = True
|
||||
Else
|
||||
OkBtn.IsEnabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function LoadSetUpTool() As Boolean
|
||||
Select Case m_MainWindow.m_CurrentMachine.MountedToolConfig
|
||||
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL
|
||||
m_SetUpToolList.Add(New ToolPos(m_MainWindow.m_CurrentMachine.sCurrSaw, "T100", True))
|
||||
If Not String.IsNullOrWhiteSpace(m_MainWindow.m_CurrentMachine.sCurrMill) Then
|
||||
m_SetUpToolList.Add(New ToolPos(m_MainWindow.m_CurrentMachine.sCurrMill, "T100", False))
|
||||
End If
|
||||
If Not String.IsNullOrWhiteSpace(m_MainWindow.m_CurrentMachine.sCurrDrill) Then
|
||||
m_SetUpToolList.Add(New ToolPos(m_MainWindow.m_CurrentMachine.sCurrDrill, "T100", False))
|
||||
End If
|
||||
Return True
|
||||
Case CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER
|
||||
If m_MainWindow.m_CurrentMachine.bSaw And Not String.IsNullOrWhiteSpace(m_MainWindow.m_CurrentMachine.sCurrSaw) Then
|
||||
EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||
Dim sToolPos As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sToolPos)
|
||||
m_SetUpToolList.Add(New ToolPos(m_MainWindow.m_CurrentMachine.sCurrSaw, sToolPos, True))
|
||||
End If
|
||||
' Recupero tutti gli utensili attrezzati (nel ToolChanger e nel ManualToolChanger)
|
||||
For Each ToolChangerPos In m_MainWindow.m_CurrentMachine.ManualToolChanger
|
||||
m_SetUpToolList.Add(New ToolPos(ToolChangerPos.sTool, ToolChangerPos.sName, False))
|
||||
Next
|
||||
Return True
|
||||
Case CurrentMachine.MountedToolConfigs.TOOLCHANGER
|
||||
' Recupero tutti gli utensili attrezzati (nel ToolChanger e nel ManualToolChanger)
|
||||
If m_MainWindow.m_CurrentMachine.bSaw And Not String.IsNullOrWhiteSpace(m_MainWindow.m_CurrentMachine.sCurrSaw) Then
|
||||
EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||
Dim sToolPos As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sToolPos)
|
||||
m_SetUpToolList.Add(New ToolPos(m_MainWindow.m_CurrentMachine.sCurrSaw, sToolPos, True))
|
||||
End If
|
||||
For Each ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
|
||||
If Not String.IsNullOrWhiteSpace(ToolChangerPos.sTool) Then
|
||||
m_SetUpToolList.Add(New ToolPos(ToolChangerPos.sTool, ToolChangerPos.sName, False))
|
||||
End If
|
||||
Next
|
||||
For Each ToolChangerPos In m_MainWindow.m_CurrentMachine.ManualToolChanger
|
||||
If Not String.IsNullOrWhiteSpace(ToolChangerPos.sTool) Then
|
||||
m_SetUpToolList.Add(New ToolPos(ToolChangerPos.sTool, ToolChangerPos.sName, False))
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
Case Else
|
||||
Return False
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub SetUpToolListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles SetUpToolListBox.PreviewMouseUp
|
||||
' Disabilito Ok
|
||||
OkBtn.IsEnabled = False
|
||||
' Recupero item selezionato
|
||||
If SetUpToolListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
End If
|
||||
' A seconda del tipo
|
||||
OkBtn.IsEnabled = True
|
||||
End Sub
|
||||
|
||||
Private Sub SetUpToolListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles SetUpToolListBox.SelectionChanged
|
||||
' Disabilito Ok
|
||||
OkBtn.IsEnabled = False
|
||||
' Recupero item selezionato
|
||||
If SetUpToolListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
Else
|
||||
OkBtn.IsEnabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
||||
DialogResult = True
|
||||
End Sub
|
||||
|
||||
Friend Function GetSelectedTool() As ToolPos
|
||||
Return SetUpToolListBox.SelectedItem
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ToolPos
|
||||
|
||||
Friend m_ToolName As String
|
||||
Public Property ToolName As String
|
||||
Get
|
||||
Return m_ToolName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_ToolName = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_ToolPos As String
|
||||
Friend m_IsSaw As Boolean
|
||||
|
||||
Sub New(sToolName As String, sToolPos As String, bIsSaw As Boolean)
|
||||
m_ToolName = sToolName
|
||||
m_ToolPos = sToolPos
|
||||
m_IsSaw = bIsSaw
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+41
-17
@@ -192,16 +192,17 @@ Public Class DirectCutPageUC
|
||||
Private Sub SawProbingBtn_Click(sender As Object, e As RoutedEventArgs) Handles SawProbingBtn.Click
|
||||
' Recupero file LUA
|
||||
EgtLuaExecFile(m_MainWindow.m_CurrentMachine.sMachDir() & "\DirectCmd\SawProbing.lua")
|
||||
' Recupero lama montata dal Db utensili
|
||||
EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||
' 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 dToolParam As Double = 0
|
||||
Dim sToolParam As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.HEAD, sToolParam)
|
||||
EgtLuaSetGlobStringVar("CMD.HEAD", sToolParam)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sToolParam)
|
||||
EgtLuaSetGlobStringVar("CMD.TCPOS", sToolParam)
|
||||
'Per ora fisso 100 per le macchine senza ToolChanger, ma da modificare per poterle gestire!!!!!!
|
||||
EgtLuaSetGlobStringVar("CMD.TCPOS", ToolForProbing.m_ToolPos)
|
||||
EgtLuaSetGlobBoolVar("CMD.ISSAW", ToolForProbing.m_IsSaw)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dToolParam)
|
||||
EgtLuaSetGlobNumVar("CMD.DIAM", dToolParam * 1000)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.THICK, dToolParam)
|
||||
@@ -276,12 +277,12 @@ Public Class DirectCutPageUC
|
||||
Next
|
||||
' Se tastatura riuscita
|
||||
If bProbingOk Then
|
||||
' Leggo spessore misurato
|
||||
' Leggo valore misurato (diametro per lama, lunghezza per altri utensili)
|
||||
Dim SawDiameterNameVar As String = String.Empty
|
||||
GetPrivateProfileString(S_MACH_PROBING, K_SAWDIAMETER, "", SawDiameterNameVar, m_MainWindow.GetMachIniFile())
|
||||
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(SawDiameterNameVar, 1)
|
||||
Dim SawDiam As Double = 0
|
||||
Dim dVal As Double = 0
|
||||
For I = 0 To 20
|
||||
' Se NUM Axium o Siemens devo rileggere la variabile ad ogni ciclo
|
||||
If m_MainWindow.m_CNCommunication.m_nNCType = 1 Or
|
||||
@@ -289,24 +290,31 @@ Public Class DirectCutPageUC
|
||||
m_MainWindow.m_CNCommunication.m_CN.ReadEls_Add_Parameter(SawDiameterNameVar, 1)
|
||||
End If
|
||||
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 1 Then
|
||||
SawDiam = m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value
|
||||
dVal = m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value
|
||||
MsgBoxStateInfo.LoadingPrBr_Value = 100
|
||||
MsgBoxStateInfo.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 43)
|
||||
EgtOutLog("SawDiam=" & SawDiam.ToString())
|
||||
EgtOutLog("ToolVal=" & dVal.ToString())
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
System.Threading.Thread.Sleep(1500)
|
||||
' Trasformo misura rilevata in mm
|
||||
If m_MainWindow.m_CNCommunication.GetMachineInInches() Then
|
||||
SawDiam *= ONEINCH / 1000
|
||||
dVal *= ONEINCH / 1000
|
||||
Else
|
||||
SawDiam *= ONEMM / 1000
|
||||
dVal *= ONEMM / 1000
|
||||
End If
|
||||
' Imposto spessore misurato come diametro lama
|
||||
If SawDiam > -EPS_ZERO Then
|
||||
' Recupero lama montata dal Db utensili
|
||||
EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DIAM, SawDiam)
|
||||
' Imposto valore misurato
|
||||
If dVal > -EPS_ZERO 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
|
||||
@@ -316,7 +324,7 @@ Public Class DirectCutPageUC
|
||||
End If
|
||||
System.Threading.Thread.Sleep(100)
|
||||
Next
|
||||
' Altrimenti tastatura non riuscita o interrotta dall'utente
|
||||
' Altrimenti tastatura non riuscita o interrotta dall'utente
|
||||
Else
|
||||
m_MainWindow.m_CurrentProjectPageUC.SetErrorMessage(EgtMsg(MSG_DIRECTCUTPAGEUC + 44))
|
||||
MsgBoxStateInfo.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 44) ' Errore in tastatura lama
|
||||
@@ -329,6 +337,22 @@ Public Class DirectCutPageUC
|
||||
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
||||
End Sub
|
||||
|
||||
Private Function ChooseToolForProbing() As ToolPos
|
||||
Select Case m_MainWindow.m_CurrentMachine.MountedToolConfig
|
||||
Case CurrentMachine.MountedToolConfigs.SAW
|
||||
Return New ToolPos(m_MainWindow.m_CurrentMachine.sCurrSaw, "T100", True)
|
||||
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL, CurrentMachine.MountedToolConfigs.MANUALTOOLCHANGER, CurrentMachine.MountedToolConfigs.TOOLCHANGER
|
||||
Dim ChooseTool As New ChooseToolWD(m_MainWindow)
|
||||
If ChooseTool.ShowDialog = True Then
|
||||
Return ChooseTool.GetSelectedTool
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
Case Else
|
||||
Return Nothing
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub ManualModeBtn_Click(sender As Object, e As RoutedEventArgs) Handles ManualModeBtn.Click
|
||||
' Imposto modalità manuale della macchina
|
||||
Dim nResult As Short = m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
|
||||
|
||||
@@ -62,5 +62,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.8.10.5")>
|
||||
<Assembly: AssemblyFileVersion("1.8.10.5")>
|
||||
<Assembly: AssemblyVersion("1.8.10.6")>
|
||||
<Assembly: AssemblyFileVersion("1.8.10.6")>
|
||||
|
||||
@@ -171,6 +171,9 @@
|
||||
<Compile Include="ChooseMachining.xaml.vb">
|
||||
<DependentUpon>ChooseMachining.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ChooseToolWD.xaml.vb">
|
||||
<DependentUpon>ChooseToolWD.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CNCommunication.vb" />
|
||||
<Compile Include="CN_Debug.vb" />
|
||||
<Compile Include="CN_generico.vb" />
|
||||
@@ -329,6 +332,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ChooseToolWD.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="CompoDimensionUC.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
Reference in New Issue
Block a user