EgtCAM5 :

- Aggiunta possibilità di getire progressbar e output message presenti nella StatusBar da LUA.
- Inizio scrittura della struttura per MTables.
- Aggiunta la possibilità di aggiungere nuovi gruppi di lavorazione.
- Gestita uscita da NewMachiningCmd(in OperationList) con Esc.
This commit is contained in:
Emmanuele Sassi
2016-10-07 10:14:14 +00:00
parent 80e92223c6
commit a312eef399
16 changed files with 276 additions and 63 deletions
+1
View File
@@ -174,6 +174,7 @@ Class Application
Friend Const NEWMACHININGMODEISACTIVE As String = "NewMachiningModeIsActive"
Friend Const SIMULATIONEXPANDER_GET_ISEXPANDED As String = "Get_SimulationExpander_IsExpanded"
Friend Const SIMULATIONEXPANDER_SET_ISEXPANDED As String = "Set_SimulationExpander_IsExpanded"
Friend Const CANCELOPERATIONCOMMAND As String = "CancelOperationCommand"
' StatusBar messages
Friend Const STATUSGRIDCOMMAND As String = "StatusGridCommand"
+1
View File
@@ -135,6 +135,7 @@
<DependentUpon>MTableDbView.xaml</DependentUpon>
</Compile>
<Compile Include="MTableDb\MTableDbViewModel.vb" />
<Compile Include="MTableDb\MTableListBox.vb" />
<Compile Include="OptionsWindow\OptionsView.xaml.vb">
<DependentUpon>OptionsView.xaml</DependentUpon>
</Compile>
+7 -7
View File
@@ -14,7 +14,7 @@
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<ListBox ItemsSource="{Binding TablesList}">
<ListBox ItemsSource="{Binding TablesList}" SelectedItem="{Binding SelectedTable}">
</ListBox>
<StackPanel Grid.Column="1">
@@ -66,13 +66,13 @@
<DataGrid ItemsSource="{Binding MachiningTable}">
<DataGrid.Columns>
<DataGridCheckBoxColumn />
<DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<DataGridCheckBoxColumn Width="Auto"/>
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="1*"/>
<DataGridComboBoxColumn Header="Operation" ItemsSource="{Binding OperationList}"
SelectedItemBinding="{Binding SelectedOperation}"/>
<DataGridTextColumn Header="Machining" Binding="{Binding Machining}" />
<DataGridTextColumn Header="MachiningUp" Binding="{Binding MachiningUp}" />
<DataGridTextColumn Header="MachiningDown" Binding="{Binding MachiningDown}" />
SelectedItemBinding="{Binding SelectedOperation}" Width="1*"/>
<DataGridTextColumn Header="Machining" Binding="{Binding Machining}" Width="1*"/>
<DataGridTextColumn Header="MachiningUp" Binding="{Binding MachiningUp}" Width="1*"/>
<DataGridTextColumn Header="MachiningDown" Binding="{Binding MachiningDown}" Width="1*"/>
</DataGrid.Columns>
</DataGrid>
+17 -13
View File
@@ -17,6 +17,16 @@ Namespace EgtCAM5
End Set
End Property
Private m_SelectedTable As String
Public Property SelectedTable As String
Get
Return m_SelectedTable
End Get
Set(value As String)
m_SelectedTable = value
End Set
End Property
Private m_Title As String
Public ReadOnly Property Title As String
Get
@@ -29,20 +39,14 @@ Namespace EgtCAM5
End Sub
Private Sub SearchTables()
'' Leggo dal file ini il direttorio per le Table
'If GetPrivateProfileString(S_TABLE, K_TABLESDIR, "", m_sTablesRoot) = 0 _
' Or not My.Computer.FileSystem.DirectoryExists(m_sTablesRoot) Then
' ' Se non lo trovo mando messaggio di errore e chiudo la finestra
' MessageBox.Show("ERROR IN LOADING TABLES", "Tables dir not found.")
'End If
' se trovo la cartella carico la lista di tabelle
Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot)
If TempArray.Count = 0 Then
'esci
' Leggo dal file ini il direttorio per le Table
If GetPrivateProfileString(S_TABLE, K_TABLESDIR, "", m_sTablesRoot) = 0 _
Or Not My.Computer.FileSystem.DirectoryExists(m_sTablesRoot) Then
' Se non lo trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show("ERROR IN LOADING TABLES", "Tables dir not found.")
End If
For Each Table In My.Computer.FileSystem.GetFiles("c:\EgtData\Doors\MTables\")
' se trovo la cartella carico la lista di tabelle
For Each Table In My.Computer.FileSystem.GetFiles(m_sTablesRoot)
m_TablesList.Add(Path.GetFileNameWithoutExtension(Table))
Next
End Sub
+122
View File
@@ -0,0 +1,122 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class MTableListBox
Implements INotifyPropertyChanged
Private m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_MachineList As ObservableCollection(Of MTableMachineListBox)
Public Property MachineList As ObservableCollection(Of MTableMachineListBox)
Get
Return m_MachineList
End Get
Set(value As ObservableCollection(Of MTableMachineListBox))
m_MachineList = Value
End Set
End Property
'Private m_OnPar As Boolean
'Public Property OnPar As Boolean
' Get
' Return m_OnPar
' End Get
' Set(value As Boolean)
' m_OnPar = value
' End Set
'End Property
'Private m_Oper As Boolean
'Public Property Oper As Boolean
' Get
' Return m_Oper
' End Get
' Set(value As Boolean)
' m_Oper = value
' End Set
'End Property
'Private m_Mach As Boolean
'Public Property Mach As Boolean
' Get
' Return m_Mach
' End Get
' Set(value As Boolean)
' m_Mach = value
' End Set
'End Property
'Private m_MachUp As Boolean
'Public Property MachUp As Boolean
' Get
' Return m_MachUp
' End Get
' Set(value As Boolean)
' m_MachUp = value
' End Set
'End Property
'Private m_MachDw As Boolean
'Public Property MachDw As Boolean
' Get
' Return m_MachDw
' End Get
' Set(value As Boolean)
' m_MachDw = value
' End Set
'End Property
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
Public Class MTableMachineListBox
Private m_MachName As String
Public Property MachName As String
Get
Return m_MachName
End Get
Set(value As String)
m_MachName = value
End Set
End Property
Private m_NcGenerate As Boolean
Public Property NcGenerate As Boolean
Get
Return m_NcGenerate
End Get
Set(value As Boolean)
m_NcGenerate = value
End Set
End Property
Private m_Makeraw As Boolean
Public Property Makeraw As Boolean
Get
Return m_Makeraw
End Get
Set(value As Boolean)
m_Makeraw = value
End Set
End Property
End Class
Public Class MTableAssociationGridBox
End Class
-2
View File
@@ -7,8 +7,6 @@
Style="{StaticResource GridViewPanelButton}" Width="55" Content="ToolDb"/>
<Button Command="{Binding MachDbCommand}" ToolTip="{Binding MachDbToolTip}"
Style="{StaticResource GridViewPanelButton}" Width="55" Content="MachDb"/>
<Button Command="{Binding MTableDbCommand}" ToolTip="{Binding MTableToolTip}"
Style="{StaticResource GridViewPanelButton}" Width="65" Content="MTableDb" Visibility="Collapsed"/>
</StackPanel>
</UserControl>
-29
View File
@@ -10,7 +10,6 @@ Namespace EgtCAM5
' Definizione comandi
Private m_cmdToolDb As ICommand
Private m_cmdMachDb As ICommand
Private m_cmdMTableDb As ICommand
#End Region 'FIELDS & PROPERTIES
@@ -86,34 +85,6 @@ Namespace EgtCAM5
#End Region ' MachDbCommand
#Region "MachDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MTableDbCommand As ICommand
Get
If m_cmdMTableDb Is Nothing Then
m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
End If
Return m_cmdMTableDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MTableDb(ByVal param As Object)
Dim MTableDbWindow As New MTableDbView
MTableDbWindow.Height = 614
MTableDbWindow.Width = 1024
MTableDbWindow.DataContext = New MTableDbViewModel
MTableDbWindow.Owner = Application.Current.MainWindow
MTableDbWindow.ShowDialog()
End Sub
#End Region ' MachDbCommand
#End Region ' COMMANDS
End Class
@@ -13,6 +13,8 @@
</Button>
<Button Command="{Binding DMachCommand}" Style="{StaticResource GridViewPanelButton}"
Width="55" Content="DMACH"/>
<Button Command="{Binding MTableDbCommand}" ToolTip="{Binding MTableToolTip}"
Style="{StaticResource GridViewPanelButton}" Width="65" Content="MTABLE" Visibility="Collapsed"/>
</StackPanel>
</UserControl>
@@ -15,6 +15,7 @@ Namespace EgtCAM5
Private m_cmdDoors As ICommand
Private m_cmdDMach As ICommand
Private Shared m_cmdOpenMruDoor As ICommand
Private m_cmdMTableDb As ICommand
#Region "COMMANDS"
@@ -101,6 +102,34 @@ Namespace EgtCAM5
#End Region ' DMachCommand
#Region "MTableDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MTableDbCommand As ICommand
Get
If m_cmdMTableDb Is Nothing Then
m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
End If
Return m_cmdMTableDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MTableDb(ByVal param As Object)
Dim MTableDbWindow As New MTableDbView
MTableDbWindow.Height = 614
MTableDbWindow.Width = 1024
MTableDbWindow.DataContext = New MTableDbViewModel
MTableDbWindow.Owner = Application.Current.MainWindow
MTableDbWindow.ShowDialog()
End Sub
#End Region ' MTableDbCommand
#End Region
End Class
@@ -24,7 +24,7 @@
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding}" GroupName="MachiningGroups"
<RadioButton GroupName="MachiningGroups"
Height="30" MaxWidth="150" Margin="0,0,2,0" Padding="5,0,5,0" ToolTip="{Binding}"
Style="{StaticResource {x:Type ToggleButton}}"
Command="{Binding DataContext.SetCurrMachGroupCommand,
@@ -32,13 +32,18 @@
AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"
IsChecked="{Binding Path=IsSelected, RelativeSource={
RelativeSource AncestorType={x:Type ListBoxItem}},Mode=TwoWay}"/>
RelativeSource AncestorType={x:Type ListBoxItem}},Mode=TwoWay}">
<RadioButton.Content>
<TextBlock Text="{Binding}"/>
</RadioButton.Content>
</RadioButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="+" Height="20" Width="20" VerticalAlignment="Center"
Margin="3,0,5,0" Command="{Binding AddMachGroupCommand}" IsEnabled="False"/>
Margin="3,0,5,0" Command="{Binding AddMachGroupCommand}"/>
<Button Content="-" Height="20" Width="20" VerticalAlignment="Center"
Margin="0,0,5,0" Command="{Binding RemoveMachGroupCommand}"/>
@@ -77,8 +77,9 @@ Namespace EgtCAM5
End Sub
Private Function AddNewMachGroup() As Boolean
Dim bOk As Boolean
bOk = (EgtAddMachGroup("Mach01") <> GDB_ID.NULL)
Dim sNewMachName As String = "Mach_1"
EgtGetMachGroupNewName(sNewMachName)
Dim bOk As Boolean = (EgtAddMachGroup(sNewMachName) <> GDB_ID.NULL)
Dim sInitScriptPath As String = String.Empty
EgtUILib.GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath, IniFile.m_sCurrMachIniFilePath)
If bOk And Not String.IsNullOrEmpty(sInitScriptPath) Then
@@ -133,10 +134,15 @@ Namespace EgtCAM5
End Property
Public Sub AddMachGroup()
AddNewMachGroup()
EgtDraw()
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
If AddNewMachGroup() Then
Dim sMachName As String = String.Empty
EgtGetMachGroupName(EgtGetCurrMachGroup(), sMachName)
MachGroupList.Add(sMachName)
SelectedMachGroup = sMachName
EgtDraw()
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
End If
End Sub
#End Region ' AddMachGroupCommand
@@ -14,6 +14,9 @@
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}" CommandParameter="{Binding ElementName=MachiningsTreeView,Path=SelectedItem}"/>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<TreeView.InputBindings>
<KeyBinding Key="Escape" Command="{Binding CancelNewCommand}" CommandParameter="Escape"/>
</TreeView.InputBindings>
<TreeView.Resources>
<!--Modifico HierarchicalDataTemplate del CathegoryItem per poter inserire immagine e testo e per -->
<!--renderlo apribile con un solo click -->
@@ -39,6 +39,7 @@ Namespace EgtCAM5
' Definizione comandi
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdCancelNew As ICommand
#End Region
@@ -135,6 +136,29 @@ Namespace EgtCAM5
#End Region ' TreeViewDoubleClickCommand
#Region "CancelNewCommand"
''' <summary>
''' Returns a command that do TreeViewDoubleClick.
''' </summary>
Public ReadOnly Property CancelNewCommand As ICommand
Get
If m_cmdCancelNew Is Nothing Then
m_cmdCancelNew = New RelayCommand(AddressOf CancelNew)
End If
Return m_cmdCancelNew
End Get
End Property
''' <summary>
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub CancelNew(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
End Sub
#End Region ' CancelNewCommand
#End Region ' Commands
#Region "METHODS"
@@ -65,6 +65,9 @@
<Expander Header="{Binding OperationListHeader}" IsExpanded="{Binding ListIsExpanded}" Name="OperationsListExpander"
Style="{StaticResource ExpanderStyle}">
<Expander.InputBindings>
<KeyBinding Key="Escape" Command="{Binding CancelOperationCommand}" CommandParameter="Escape"/>
</Expander.InputBindings>
<StackPanel>
@@ -31,10 +31,10 @@ Namespace EgtCAM5
EgtDraw()
' Blocco la lista operazioni
IsEnabledOperationList = False
' Abilito ed apro l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
' Abilito la selezione di curve e superfici del pezzo
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.PARTCURVESANDSURFACES)
' Abilito ed apro l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
Else
' Deseleziono eventuali geometrie selezionate
EgtDeselectAll()
@@ -600,7 +600,9 @@ Namespace EgtCAM5
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
If NewMachining Then NewMachining = False
End Sub)
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
CancelOperation(String.Empty)
End Sub)
End Sub
#Region "COMMANDS"
@@ -669,6 +671,15 @@ Namespace EgtCAM5
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub CancelOperation(ByVal param As Object)
' se viene premuto il tasto Esc
If DirectCast(param, String) = "Escape" Then
If m_NewMachining Then
NewMachining = False
ListIsExpanded = True
End If
Return
End If
' in tutti gli altri casi
If m_NewMachining Then
NewMachining = False
ListIsExpanded = True
+33
View File
@@ -1,6 +1,8 @@
Imports System.Collections.ObjectModel
Imports System.Runtime.InteropServices
Imports System.IO
Imports EgtUILib
Imports System.Threading
Namespace EgtCAM5
@@ -9,6 +11,10 @@ Namespace EgtCAM5
#Region "FIELDS & PROPERTIES"
' Funzioni di callback per output in interfaccia da LUA
Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
Private m_OutTextCallback As New OutTextCallback(AddressOf OutText)
' GRAPHICAL ELEMENTS
Private m_StatusOutput As String
Public Property StatusOutput As String
@@ -250,6 +256,10 @@ Namespace EgtCAM5
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
MachineListIsEnabled = True
End Sub)
' Installo funzione gestione eventi per lua
EgtSetProcessEvents(m_ProcEventsCallback)
' Installo funzione output testo su status per lua
EgtSetOutText(m_OutTextCallback)
End Sub
#End Region ' Constructor
@@ -493,6 +503,29 @@ Namespace EgtCAM5
End If
End Sub
Public Function OutText(ByRef psText As IntPtr) As Boolean
StatusOutput = (Marshal.PtrToStringUni(psText))
Return True
End Function
Public Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
' Se previsto, imposto progress
If nProg > 0 Then
StatusProgress = nProg
End If
' Costringo ad aggiornare
UpdateUI()
' Eventuale attesa
Thread.Sleep(nPause)
' Ritorno eventuale stop
If m_bStopScript Then
m_bStopScript = False
Return 0
Else
Return 1
End If
End Function
#End Region ' Methods
End Class