EgtCAM5 :
- Cambiati nomi classi e file.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="InfoExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:EgtCAM5.EgtCAM5">
|
||||
|
||||
<Expander IsExpanded="{Binding IsEnabled}" IsEnabled="{Binding IsEnabled}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="{Binding PropertiesMsg}"/>
|
||||
</Expander.Header>
|
||||
<UniformGrid>
|
||||
<TextBox Text="{Binding InfoBox}" MaxHeight="100" IsReadOnly="True" HorizontalScrollBarVisibility="Auto"/>
|
||||
</UniformGrid>
|
||||
</Expander>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class InfoExpanderView
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,86 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class InfoExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property PropertiesMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 1)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Private m_IsExpanded As Boolean
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsExpanded Then
|
||||
m_IsExpanded = value
|
||||
OnPropertyChanged("IsEnabled")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_InfoBox As String
|
||||
Public Property InfoBox As String
|
||||
Get
|
||||
Return m_InfoBox
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_InfoBox Then
|
||||
m_InfoBox = value
|
||||
If value <> String.Empty Then
|
||||
IsEnabled = True
|
||||
Else
|
||||
IsEnabled = False
|
||||
End If
|
||||
OnPropertyChanged("InfoBox")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
Application.Msn.Register(Application.UPDATEOBJDATAINOBJTREE, Sub(Id As Integer)
|
||||
UpdateObjDataInObjTree(Id)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SETINFOBOX, Sub(sString As String)
|
||||
InfoBox = sString
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
|
||||
' recupero il tipo del nuovo oggetto
|
||||
Dim nType As Integer = EgtGetType(nId)
|
||||
' stampa dei dati dell'oggetto
|
||||
Dim sDump As String = String.Empty
|
||||
If nType = GDB_TY.NONE Then
|
||||
InfoBox = String.Empty
|
||||
ElseIf nType = GDB_TY.GROUP Then
|
||||
If EgtGroupDump(nId, sDump) Then
|
||||
InfoBox = sDump
|
||||
IsEnabled = True
|
||||
Else
|
||||
InfoBox = String.Empty
|
||||
IsEnabled = False
|
||||
End If
|
||||
Else
|
||||
If EgtGeoObjDump(nId, sDump) Then
|
||||
InfoBox = sDump
|
||||
IsEnabled = True
|
||||
Else
|
||||
InfoBox = String.Empty
|
||||
IsEnabled = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="InputExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Expander Header="{Binding Title}" IsExpanded="{Binding IsExpanded}" IsEnabled="{Binding IsEnabled}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<StackPanel>
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding FocusTextBox}" Value="True">
|
||||
<Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=PropertySearch}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<TextBlock Text="{Binding TextBlock}" Margin="5,5,0,5"/>
|
||||
<TextBox Text="{Binding TextBox,UpdateSourceTrigger=PropertyChanged}" Margin="5,0,5,5">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
|
||||
<KeyBinding Key="S" Modifiers="Control" Command="{Binding ShowCommand}"/>
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<CheckBox Content="{Binding CheckBoxText}" IsChecked="{Binding IsChecked}"
|
||||
Visibility="{Binding CheckVisibility}" Margin="5,0,5,5"/>
|
||||
<ComboBox ItemsSource="{Binding ComboItemsList}" SelectedIndex="{Binding ComboSelectedIndex}"
|
||||
Visibility="{Binding ComboVisibility}" Margin="5,0,5,5"/>
|
||||
<Grid Margin="5,0,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Command="{Binding ShowCommand}" Visibility="{Binding ShowBtnVisibility}"
|
||||
Content="{Binding ShowMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
<Button Command="{Binding DoneCommand}" Grid.Column="1"
|
||||
Content="{Binding OkMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class InputExpanderView
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,343 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class InputExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
' Expander fields
|
||||
Private m_IsExpanded As Boolean
|
||||
Public Property IsExpanded As Boolean
|
||||
Get
|
||||
Return m_IsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsExpanded = value
|
||||
OnPropertyChanged("IsExpanded")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsEnabled As Boolean
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsEnabled = value
|
||||
OnPropertyChanged("IsEnabled")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Title As String
|
||||
Public Property Title As String
|
||||
Get
|
||||
Return m_Title
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Title = value
|
||||
OnPropertyChanged("Title")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' TextBlock fields
|
||||
Private m_TextBlock As String
|
||||
Public Property TextBlock As String
|
||||
Get
|
||||
Return m_TextBlock
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_TextBlock = value
|
||||
OnPropertyChanged("TextBlock")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' TextBox fields
|
||||
Private m_TextBox As String
|
||||
Public Property TextBox As String
|
||||
Get
|
||||
Return m_TextBox
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_TextBox = value
|
||||
Application.Msn.NotifyColleagues(Application.NOTIFYINPUTTEXT, value)
|
||||
OnPropertyChanged("TextBox")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_FocusTextBox As Boolean
|
||||
Public Property FocusTextBox As Boolean
|
||||
Get
|
||||
Return m_FocusTextBox
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_FocusTextBox = value
|
||||
OnPropertyChanged("FocusTextBox")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'CheckBox fields
|
||||
Private m_CheckBoxText As String
|
||||
Public Property CheckBoxText As String
|
||||
Get
|
||||
Return m_CheckBoxText
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_CheckBoxText = value
|
||||
OnPropertyChanged("CheckBoxText")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsChecked As Boolean
|
||||
Public Property IsChecked As Boolean
|
||||
Get
|
||||
Return m_IsChecked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsChecked Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, value)
|
||||
m_IsChecked = value
|
||||
OnPropertyChanged("IsChecked")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_CheckVisibility As Visibility
|
||||
Public Property CheckVisibility As Visibility
|
||||
Get
|
||||
Return m_CheckVisibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
If value <> m_CheckVisibility Then
|
||||
m_CheckVisibility = value
|
||||
OnPropertyChanged("CheckVisibility")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' ComboBox fields
|
||||
Private m_ComboItemsList As New ObservableCollection(Of String)
|
||||
Public Property ComboItemsList As ObservableCollection(Of String)
|
||||
Get
|
||||
Return m_ComboItemsList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of String))
|
||||
m_ComboItemsList = value
|
||||
OnPropertyChanged("ComboItemsList")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ComboSelectedIndex As Integer
|
||||
Public Property ComboSelectedIndex As Integer
|
||||
Get
|
||||
Return m_ComboSelectedIndex
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, value)
|
||||
m_ComboSelectedIndex = value
|
||||
OnPropertyChanged("ComboSelectedIndex")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ComboVisibility As Visibility
|
||||
Public Property ComboVisibility As Visibility
|
||||
Get
|
||||
Return m_ComboVisibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
If value <> m_ComboVisibility Then
|
||||
m_ComboVisibility = value
|
||||
OnPropertyChanged("ComboVisibility")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Buttons fields
|
||||
Private m_ShowBtnVisibility As Visibility
|
||||
Public Property ShowBtnVisibility As Visibility
|
||||
Get
|
||||
Return m_ShowBtnVisibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_ShowBtnVisibility = value
|
||||
OnPropertyChanged("ShowBtnVisibility")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Commands definition
|
||||
Private m_cmdShow As ICommand
|
||||
Private m_cmdDone As ICommand
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property ShowMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 14)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property OkMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 15)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#End Region ' Fields & Properties
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
RegisterMethodsCall()
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ShowCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ShowCommand As ICommand
|
||||
Get
|
||||
If m_cmdShow Is Nothing Then
|
||||
m_cmdShow = New RelayCommand(AddressOf Show, AddressOf CanShow)
|
||||
End If
|
||||
Return m_cmdShow
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Show(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SHOW, TextBox)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Returns always true.
|
||||
''' </summary>
|
||||
Private Function CanShow(ByVal param As Object) As Boolean
|
||||
Return If(m_ShowBtnVisibility = Visibility.Visible, True, False)
|
||||
End Function
|
||||
|
||||
#End Region ' ShowCommand
|
||||
|
||||
#Region "DoneCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DoneCommand As ICommand
|
||||
Get
|
||||
If m_cmdDone Is Nothing Then
|
||||
m_cmdDone = New RelayCommand(AddressOf Done, AddressOf CanDone)
|
||||
End If
|
||||
Return m_cmdDone
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Done(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.DONE, m_TextBox)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Returns always true.
|
||||
''' </summary>
|
||||
Private Function CanDone(ByVal param As Object) As Boolean
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' DoneCommand
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Sub RegisterMethodsCall()
|
||||
Application.Msn.Register(Application.PREPAREINPUTBOX, Sub(PrepareInputBoxParam As PrepareInputBoxParam)
|
||||
PrepareInputBox(PrepareInputBoxParam)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SETINPUTBOXTEXT, Sub(sString As String)
|
||||
SetInputBoxText(sString)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SETINPUTBOXCHECK, Sub(bBoolean As Boolean)
|
||||
SetInputBoxCheck(bBoolean)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.CHANGEINPUTBOXCHECK, Sub()
|
||||
ChangeInputBoxCheck()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.ADDINPUTBOXCOMBO, Sub(AddInputBoxComboParam As AddInputBoxComboParam)
|
||||
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.RESETINPUTBOX, Sub()
|
||||
ResetInputBox()
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
Private Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
|
||||
Title = PrepareInputBoxParam.sTitle
|
||||
TextBlock = PrepareInputBoxParam.sLabel
|
||||
TextBox = ""
|
||||
If PrepareInputBoxParam.sCheckLabel <> "" Then
|
||||
CheckBoxText = PrepareInputBoxParam.sCheckLabel
|
||||
CheckVisibility = Visibility.Visible
|
||||
End If
|
||||
If PrepareInputBoxParam.bShowCombo Then
|
||||
ComboItemsList.Clear()
|
||||
ComboVisibility = Visibility.Visible
|
||||
End If
|
||||
If PrepareInputBoxParam.bShowBtn Then
|
||||
ShowBtnVisibility = Visibility.Visible
|
||||
End If
|
||||
IsEnabled = True
|
||||
IsExpanded = True
|
||||
FocusTextBox = True
|
||||
End Sub
|
||||
|
||||
Private Sub ResetInputBox()
|
||||
Title = EgtMsg(MSG_DRAWOPTION + 5)
|
||||
CheckVisibility = Visibility.Collapsed
|
||||
ComboVisibility = Visibility.Collapsed
|
||||
ShowBtnVisibility = Visibility.Collapsed
|
||||
IsExpanded = False
|
||||
IsEnabled = False
|
||||
End Sub
|
||||
|
||||
Private Function SetInputBoxText(ByVal sVal As String) As Boolean
|
||||
TextBox = sVal
|
||||
FocusTextBox = True
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function ChangeInputBoxCheck() As Boolean
|
||||
IsChecked = Not m_IsChecked
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
|
||||
IsChecked = bCheck
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, IsChecked)
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
|
||||
ComboItemsList.Add(sText)
|
||||
If bSelected Then
|
||||
ComboSelectedIndex = ComboItemsList.Count - 1
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,121 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class LayerTreeViewItem
|
||||
Inherits TreeViewItemBase
|
||||
|
||||
Friend Shared m_SendCmd As Boolean = True
|
||||
Friend Shared m_MarkOnSel As Boolean = True
|
||||
|
||||
Private m_Id As Integer
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Property that determines if the Tool is selected or not
|
||||
''' </summary>
|
||||
Public Overrides Property IsSelected As Boolean
|
||||
Get
|
||||
Return m_IsSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If (value <> m_IsSelected) Then
|
||||
m_IsSelected = value
|
||||
If value Then
|
||||
' recupero l'Id del nuovo oggetto selezionato
|
||||
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, False)
|
||||
If m_MarkOnSel Then
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, Me.Id)
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREENOMARK, Me.Id)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsRightSelected As Boolean
|
||||
''' <summary>
|
||||
''' Property that determines if the Tool is selected or not
|
||||
''' </summary>
|
||||
Public Property IsRightSelected As Boolean
|
||||
Get
|
||||
Return m_IsRightSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
' In realtà il valore di value è insignificante perchè la cosa importante è che il click esegua questo Set
|
||||
m_IsRightSelected = value
|
||||
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, True)
|
||||
Application.Msn.NotifyColleagues(Application.RIGHTCLICKEDLAYERTREEITEM, Me.Id)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Items As New ObservableCollection(Of LayerTreeViewItem)
|
||||
Public Property Items As ObservableCollection(Of LayerTreeViewItem)
|
||||
Get
|
||||
Return m_Items
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of LayerTreeViewItem))
|
||||
m_Items = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_OnOff As Boolean
|
||||
Public Property OnOff As Boolean
|
||||
Get
|
||||
Return m_OnOff
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If m_OnOff <> value Then
|
||||
m_OnOff = value
|
||||
' se abilitato, eseguo operazione
|
||||
If m_SendCmd Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, Id)
|
||||
If value Then
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SHOW)
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.HIDE)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_sPictureString As String
|
||||
Public Property PictureString As String
|
||||
Get
|
||||
Return m_sPictureString
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_sPictureString Then
|
||||
m_sPictureString = value
|
||||
NotifyPropertyChanged("PictureString")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_LayerColor As SolidColorBrush
|
||||
Public Property LayerColor As SolidColorBrush
|
||||
Get
|
||||
Return m_LayerColor
|
||||
End Get
|
||||
Set(value As SolidColorBrush)
|
||||
m_LayerColor = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(Id As Integer, Name As String, Image As String, CurrColor As Color3d)
|
||||
MyBase.New(Name)
|
||||
Me.m_Id = Id
|
||||
Me.PictureString = Image
|
||||
Me.LayerColor = New SolidColorBrush(Color.FromArgb(CByte(CurrColor.A * 255 / 100), CByte(CurrColor.R), CByte(CurrColor.G), CByte(CurrColor.B)))
|
||||
End Sub
|
||||
|
||||
Sub New(Id As Integer, Name As String)
|
||||
MyBase.New(Name)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,120 @@
|
||||
<UserControl x:Class="ManageLayerExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:expression="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
|
||||
xmlns:local="clr-namespace:EgtCAM5">
|
||||
|
||||
<Expander IsExpanded="True" Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding HeaderName}" Margin="0,0,5,0"/>
|
||||
<Ellipse Height="10" Width="10" Fill="{Binding HeaderColor}" />
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<UniformGrid Rows="1">
|
||||
<Button Content="{Binding NewPartMsg}" Command="{Binding NewPartCommand}" Height="30"/>
|
||||
<Button Content="{Binding NewLayerMsg}" Command="{Binding NewLayerCommand}" Height="30"/>
|
||||
<Button Content="{Binding ColorMsg}" Command="{Binding LayerColorCommand}" Height="30"/>
|
||||
</UniformGrid>
|
||||
|
||||
<TreeView Name="LayerTreeView" MinHeight="150" MaxHeight="250"
|
||||
ItemsSource="{Binding Path=LayerList}"
|
||||
VirtualizingStackPanel.IsVirtualizing = "True"
|
||||
VirtualizingStackPanel.VirtualizationMode = "Recycling">
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
||||
<interactivity:InvokeCommandAction Command="{Binding TreeViewDoubleClickCommand}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
<TreeView.Resources>
|
||||
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:LayerTreeViewItem}" ItemsSource="{Binding Items}">
|
||||
<Grid>
|
||||
<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseUp">
|
||||
<interactivity:InvokeCommandAction Command="{Binding Path=DataContext.TreeViewMouseUpCommand,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" CommandParameter="{Binding ElementName=LayerTreeView,Path=SelectedItem}"/>
|
||||
</interactivity:EventTrigger>
|
||||
<interactivity:EventTrigger EventName="PreviewMouseRightButtonDown">
|
||||
<expression:ChangePropertyAction PropertyName="IsRightSelected" Value="true" TargetObject="{Binding}"/>
|
||||
</interactivity:EventTrigger>
|
||||
</interactivity:Interaction.Triggers>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ToggleButton Style="{StaticResource EgtCAM5_LampToggleButton}" Grid.Column="0" IsChecked="{Binding OnOff}" Focusable="False" Height="15" Width="15" Margin="0,0,5,0"/>
|
||||
<Image Grid.Column="1" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<Ellipse Grid.Column="3" Height="10" Width="10" Fill="{Binding LayerColor}" />
|
||||
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.Resources>
|
||||
|
||||
<!--Style dei nodi CathegoryItem che li riquadra di azzurro quando clicckati ed elimina l'ombra grigia
|
||||
che si presenta quando la categoria rimane vuota (ombra causata dal multibinding).-->
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Command="{Binding SelectCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding SelectMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding DeselectCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding DeselectMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Command="{Binding NameCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding NameMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding InfoCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding InfoMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Command="{Binding RelocateCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding RelocateMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding CopyCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding CopyMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding DeleteCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding DeleteMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding SaveCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding SaveMsg}"/>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class ManageLayerExpanderView
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,857 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
Imports EgtCAM5.IniFile
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class ManageLayerExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
' Expander Header Properties
|
||||
Private m_HeaderName As String
|
||||
Public Property HeaderName As String
|
||||
Get
|
||||
Return m_HeaderName
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_HeaderName = value
|
||||
OnPropertyChanged("HeaderName")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_HeaderColor As SolidColorBrush
|
||||
Public Property HeaderColor As SolidColorBrush
|
||||
Get
|
||||
Return m_HeaderColor
|
||||
End Get
|
||||
Set(value As SolidColorBrush)
|
||||
m_HeaderColor = value
|
||||
OnPropertyChanged("HeaderColor")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewPart As ICommand
|
||||
Private m_cmdNewLayer As ICommand
|
||||
Private m_cmdLayerColor As ICommand
|
||||
Private m_cmdTreeViewDoubleClick As ICommand
|
||||
Private m_cmdTreeViewMouseUp As ICommand
|
||||
Private m_cmdTreeViewMouseRightButton As ICommand
|
||||
Private m_cmdSelect As ICommand
|
||||
Private m_cmdDeselect As ICommand
|
||||
Private m_cmdName As ICommand
|
||||
Private m_cmdInfo As ICommand
|
||||
Private m_cmdRelocate As ICommand
|
||||
Private m_cmdCopy As ICommand
|
||||
Private m_cmdDelete As ICommand
|
||||
Private m_cmdSave As ICommand
|
||||
|
||||
' Lista dei layer
|
||||
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
|
||||
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
|
||||
Get
|
||||
Return m_LayerList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of LayerTreeViewItem))
|
||||
m_LayerList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsRightClickedTreeItem As Boolean
|
||||
Public ReadOnly Property IsRightClickedTreeItem As Integer
|
||||
Get
|
||||
Return m_RightClickedTreeItemId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RightClickedTreeItemId As Integer
|
||||
Public ReadOnly Property RightClickedTreeItemId As Integer
|
||||
Get
|
||||
Return m_RightClickedTreeItemId
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property NewPartMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 2)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property NewLayerMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 3)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property ColorMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 4)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SelectMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 6)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DeselectMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 7)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property NameMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 8)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property InfoMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 9)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property RelocateMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 10)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CopyMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 11)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property DeleteMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 12)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property SaveMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DRAWOPTION + 13)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
'Imposto tempo di evidenziazione delle entità clickate
|
||||
ObjTreeTimer.Interval = TimeSpan.FromMilliseconds(1000)
|
||||
Application.Msn.Register(Application.LOADOBJTREE, Sub()
|
||||
LoadObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJINOBJTREE, Sub(nId As Integer)
|
||||
UpdateObjInObjTree(nId)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJINOBJTREENOMARK, Sub(nId As Integer)
|
||||
UpdateObjInObjTreeNoMark(nId)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SELECTIDINOBJTREE, Sub(nId As Integer)
|
||||
SelectIdInObjTree(nId, True)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SELECTIDINOBJTREENOMARK, Sub(nId As Integer)
|
||||
SelectIdInObjTree(nId, False)
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.CLEAROBJTREE, Sub()
|
||||
ClearObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
|
||||
UpdateObjTree()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
|
||||
Me.HeaderName = HeaderName
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
|
||||
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
|
||||
Me.m_nObjTreeOldId = ObjTreeOldId
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.RIGHTCLICKEDLAYERTREEITEM, Sub(Id As Integer)
|
||||
EgtResetMark(m_RightClickedTreeItemId)
|
||||
m_RightClickedTreeItemId = Id
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.ISRIGHTCLICKEDLAYERTREEITEM, Sub(Value As Boolean)
|
||||
m_IsRightClickedTreeItem = Value
|
||||
End Sub)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructor
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewPartCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewPartCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewPart Is Nothing Then
|
||||
m_cmdNewPart = New RelayCommand(AddressOf NewPart)
|
||||
End If
|
||||
Return m_cmdNewPart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewPart(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
|
||||
' Seleziono nell'albero il layer del pezzo appena creato
|
||||
SelectIdInObjTree(EgtGetCurrLayer(), False)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewPartCommand
|
||||
|
||||
#Region "NewLayerCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewLayerCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewLayer Is Nothing Then
|
||||
m_cmdNewLayer = New RelayCommand(AddressOf NewLayer)
|
||||
End If
|
||||
Return m_cmdNewLayer
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewLayer(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
|
||||
' Seleziono nell'albero il layer appena creato
|
||||
SelectIdInObjTree(EgtGetCurrLayer(), False)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewLayerCommand
|
||||
|
||||
#Region "LayerColorCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property LayerColorCommand As ICommand
|
||||
Get
|
||||
If m_cmdLayerColor Is Nothing Then
|
||||
m_cmdLayerColor = New RelayCommand(AddressOf LayerColor)
|
||||
End If
|
||||
Return m_cmdLayerColor
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub LayerColor(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
|
||||
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
|
||||
End Sub
|
||||
|
||||
#End Region ' LayerColorCommand
|
||||
|
||||
#Region "TreeViewDoubleClickCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewDoubleClick Is Nothing Then
|
||||
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
|
||||
End If
|
||||
Return m_cmdTreeViewDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewDoubleClick(ByVal param As Object)
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewDoubleClickCommand
|
||||
|
||||
#Region "TreeViewMouseRightButtonCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewMouseRightButtonCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewMouseRightButton Is Nothing Then
|
||||
m_cmdTreeViewMouseRightButton = New RelayCommand(AddressOf TreeViewMouseRightButton)
|
||||
End If
|
||||
Return m_cmdTreeViewMouseRightButton
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewMouseRightButton(ByVal param As Object)
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewMouseRightButtonCommand
|
||||
|
||||
#Region "TreeViewMouseUpCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewMouseUpCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewMouseUp Is Nothing Then
|
||||
m_cmdTreeViewMouseUp = New RelayCommand(AddressOf TreeViewMouseUp)
|
||||
End If
|
||||
Return m_cmdTreeViewMouseUp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewMouseUp(ByVal param As Object)
|
||||
' determino Id di eventuale item sotto il mouse
|
||||
Dim nId As Integer = GDB_ID.NULL
|
||||
If m_IsRightClickedTreeItem Then
|
||||
nId = m_RightClickedTreeItemId
|
||||
Else
|
||||
nId = m_nObjTreeOldId
|
||||
End If
|
||||
' se Id coincide con il corrente
|
||||
If nId <> GDB_ID.NULL Then 'And nId = m_nObjTreeOldId Then
|
||||
' evidenzio
|
||||
EgtSetMark(nId)
|
||||
EgtDraw()
|
||||
' lancio timer per successiva de-evidenziazione
|
||||
ObjTreeTimer.Stop()
|
||||
ObjTreeTimer.Start()
|
||||
End If
|
||||
' se rilascio tasto destro
|
||||
'If e.Button = Windows.Forms.MouseButtons.Right Then
|
||||
' ' Id pezzo sotto il mouse
|
||||
' m_nObjTreeMenuId = nId
|
||||
' ' verifico stato visualizzazione per abilitare voci menù
|
||||
' Dim nStat As GDB_ST = GDB_ST.ON_
|
||||
' Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF
|
||||
' For Each Item As ToolStripItem In ContextMenuTreeView1.Items
|
||||
' If Item.Name = "cmdSetName" Or Item.Name = "cmdSetInfo" Then
|
||||
' Item.Enabled = True
|
||||
' Else
|
||||
' Item.Enabled = bOn
|
||||
' End If
|
||||
' Next
|
||||
' 'ContextMenuTreeView1.Show(TreeView1, e.Location)
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
#End Region ' TreeViewMouseUpCommand
|
||||
|
||||
#Region "SelectCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SelectCommand As ICommand
|
||||
Get
|
||||
If m_cmdSelect Is Nothing Then
|
||||
m_cmdSelect = New RelayCommand(AddressOf SelectCmd)
|
||||
End If
|
||||
Return m_cmdSelect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub SelectCmd(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' SelectCommand
|
||||
|
||||
#Region "DeselectCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DeselectCommand As ICommand
|
||||
Get
|
||||
If m_cmdDeselect Is Nothing Then
|
||||
m_cmdDeselect = New RelayCommand(AddressOf Deselect)
|
||||
End If
|
||||
Return m_cmdDeselect
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Deselect(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DESELECTPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeselectCommand
|
||||
|
||||
#Region "NameCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NameCommand As ICommand
|
||||
Get
|
||||
If m_cmdName Is Nothing Then
|
||||
m_cmdName = New RelayCommand(AddressOf Name)
|
||||
End If
|
||||
Return m_cmdName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Name(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETNAME)
|
||||
End Sub
|
||||
|
||||
#End Region ' NameCommand
|
||||
|
||||
#Region "InfoCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property InfoCommand As ICommand
|
||||
Get
|
||||
If m_cmdInfo Is Nothing Then
|
||||
m_cmdInfo = New RelayCommand(AddressOf Info)
|
||||
End If
|
||||
Return m_cmdInfo
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Info(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETINFO)
|
||||
End Sub
|
||||
|
||||
#End Region ' InfoCommand
|
||||
|
||||
#Region "RelocateCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property RelocateCommand As ICommand
|
||||
Get
|
||||
If m_cmdRelocate Is Nothing Then
|
||||
m_cmdRelocate = New RelayCommand(AddressOf Relocate)
|
||||
End If
|
||||
Return m_cmdRelocate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Relocate(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.RELOCATEPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' RelocateCommand
|
||||
|
||||
#Region "CopyCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CopyCommand As ICommand
|
||||
Get
|
||||
If m_cmdCopy Is Nothing Then
|
||||
m_cmdCopy = New RelayCommand(AddressOf Copy)
|
||||
End If
|
||||
Return m_cmdCopy
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Copy(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.COPYPARTLAYEROBJ)
|
||||
End Sub
|
||||
|
||||
#End Region ' CopyCommand
|
||||
|
||||
#Region "DeleteCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DeleteCommand As ICommand
|
||||
Get
|
||||
If m_cmdDelete Is Nothing Then
|
||||
m_cmdDelete = New RelayCommand(AddressOf Delete)
|
||||
End If
|
||||
Return m_cmdDelete
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Delete(ByVal param As Object)
|
||||
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
|
||||
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DELETE)
|
||||
End Sub
|
||||
|
||||
#End Region ' DeleteCommand
|
||||
|
||||
#Region "SaveCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SaveCommand As ICommand
|
||||
Get
|
||||
If m_cmdSave Is Nothing Then
|
||||
m_cmdSave = New RelayCommand(AddressOf Save)
|
||||
End If
|
||||
Return m_cmdSave
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Save(ByVal param As Object)
|
||||
Dim sDir As String = String.Empty
|
||||
GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir)
|
||||
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
|
||||
Application.Msn.NotifyColleagues(Application.SAVEOBJECT, New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
|
||||
End Sub
|
||||
|
||||
#End Region ' SaveCommand
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
|
||||
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
|
||||
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
|
||||
Private m_bEnableUpdateObjInObjTree As Boolean = True
|
||||
|
||||
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
|
||||
Dim nId As Integer = GDB_ID.NULL
|
||||
If m_IsRightClickedTreeItem Then
|
||||
nId = m_RightClickedTreeItemId
|
||||
Else
|
||||
nId = m_nObjTreeOldId
|
||||
End If
|
||||
If nId <> GDB_ID.NULL Then
|
||||
EgtResetMark(nId)
|
||||
EgtDraw()
|
||||
End If
|
||||
ObjTreeTimer.Stop()
|
||||
End Sub
|
||||
|
||||
Public Sub LoadObjTree()
|
||||
LayerTreeViewItem.m_SendCmd = False
|
||||
Dim nOldId As Integer = ClearObjTree()
|
||||
AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, LayerList)
|
||||
If nOldId <> GDB_ID.NULL Then
|
||||
m_bEnableUpdateObjInObjTree = False
|
||||
SelectIdInObjTree(nOldId, True)
|
||||
m_bEnableUpdateObjInObjTree = True
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
|
||||
End If
|
||||
LayerTreeViewItem.m_SendCmd = True
|
||||
End Sub
|
||||
|
||||
Private Function ClearObjTree() As Integer
|
||||
Dim nOldId As Integer = RevertOldIdInObjTree()
|
||||
LayerList.Clear()
|
||||
Return nOldId
|
||||
End Function
|
||||
|
||||
Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As ObservableCollection(Of LayerTreeViewItem))
|
||||
|
||||
Dim CurrNodColl As ObservableCollection(Of LayerTreeViewItem)
|
||||
|
||||
If nGroupId = GDB_ID.ROOT Then
|
||||
CurrNodColl = PrevNodColl
|
||||
Else
|
||||
' livello
|
||||
Dim nObjLev As Integer = GDB_LV.USER
|
||||
EgtGetLevel(nGroupId, nObjLev)
|
||||
If nObjLev = GDB_LV.TEMP Then
|
||||
nLevel = GDB_LV.TEMP
|
||||
ElseIf nLevel = GDB_LV.USER Then
|
||||
nLevel = nObjLev
|
||||
End If
|
||||
' tipo
|
||||
Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer
|
||||
If nLevel = GDB_LV.USER Then
|
||||
nGroupType = nDepth
|
||||
End If
|
||||
' nome
|
||||
Dim sName As String = String.Empty
|
||||
Dim sText As String = String.Empty
|
||||
If EgtGetName(nGroupId, sName) Then
|
||||
If nGroupType = 1 Then
|
||||
sText = sName + " (Part " + nGroupId.ToString + ")"
|
||||
ElseIf nGroupType = 2 Then
|
||||
sText = sName + " (Layer " + nGroupId.ToString + ")"
|
||||
Else
|
||||
sText = sName + " (Group " + nGroupId.ToString + ")"
|
||||
End If
|
||||
Else
|
||||
If nGroupType = 1 Then
|
||||
sText = "Part " + nGroupId.ToString
|
||||
ElseIf nGroupType = 2 Then
|
||||
sText = "Layer " + nGroupId.ToString
|
||||
Else
|
||||
sText = "Group " + nGroupId.ToString
|
||||
End If
|
||||
End If
|
||||
' per visualizzare oggetti di livello diverso da utente, si deve avere il permesso
|
||||
If nLevel <> GDB_LV.USER And m_nUserLevel < 5 Then
|
||||
Return
|
||||
End If
|
||||
' inserisco il nodo nell'albero
|
||||
Dim CurrColor As Color3d
|
||||
EgtGetCalcColor(nGroupId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor)
|
||||
PrevNodColl.Add(CurrNod)
|
||||
CurrNodColl = CurrNod.Items
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nGroupId, nStat)
|
||||
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
|
||||
End If
|
||||
|
||||
Dim nObjs As Integer = EgtGetGroupObjs(nGroupId)
|
||||
If (nObjs > 275000) Then
|
||||
Dim sText As String = "Too many entities (" + nObjs.ToString() + ")"
|
||||
CurrNodColl.Add(New LayerTreeViewItem(GDB_ID.NULL, sText))
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim nId As Integer = EgtGetFirstInGroup(nGroupId)
|
||||
While nId <> GDB_ID.NULL
|
||||
'recupero il tipo di nodo
|
||||
Dim nType As Integer = EgtGetType(nId)
|
||||
'se gruppo
|
||||
If nType = GDB_TY.GROUP Then
|
||||
AddGroupInObjTree(nId, nLevel, nDepth + 1, CurrNodColl)
|
||||
'se oggetto geometrico
|
||||
ElseIf nType >= GDB_TY.GEO_VECTOR Then
|
||||
Dim sTitle As String = String.Empty
|
||||
EgtGetTitle(nId, sTitle)
|
||||
Dim sName As String = String.Empty
|
||||
Dim sText As String = String.Empty
|
||||
If EgtGetName(nId, sName) Then
|
||||
sText = sName + " (" + sTitle + " " + nId.ToString + ")"
|
||||
Else
|
||||
sText = sTitle + " " + nId.ToString
|
||||
End If
|
||||
Dim CurrColor As New Color3d(0, 0, 0, 0)
|
||||
EgtGetColor(nId, CurrColor)
|
||||
Dim sImage As String = TypeToImageInObjTree(nType, nDepth)
|
||||
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor)
|
||||
CurrNodColl.Add(CurrNod)
|
||||
Dim nStat As Integer = GDB_ST.ON_
|
||||
EgtGetStatus(nId, nStat)
|
||||
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
|
||||
End If
|
||||
'passo al successivo
|
||||
nId = EgtGetNext(nId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nSubType As Integer) As String
|
||||
|
||||
Select Case nType
|
||||
Case GDB_TY.GROUP
|
||||
If nSubType = 1 Then
|
||||
Return "/Resources/TreeView/Folder.png"
|
||||
ElseIf nSubType = 2 Then
|
||||
Return "/Resources/TreeView/Folder.png"
|
||||
Else
|
||||
Return "/Resources/TreeView/Group.ico"
|
||||
End If
|
||||
Case GDB_TY.GEO_VECTOR
|
||||
Return "/Resources/TreeView/Vector.ico"
|
||||
Case GDB_TY.GEO_POINT
|
||||
Return "/Resources/TreeView/Point.ico"
|
||||
Case GDB_TY.GEO_FRAME
|
||||
Return "/Resources/TreeView/Frame.ico"
|
||||
Case GDB_TY.CRV_LINE
|
||||
Return "/Resources/TreeView/Line.ico"
|
||||
Case GDB_TY.CRV_ARC
|
||||
Return "/Resources/TreeView/Arc.ico"
|
||||
Case GDB_TY.CRV_BEZ
|
||||
Return "/Resources/TreeView/CBezier.ico"
|
||||
Case GDB_TY.CRV_COMPO
|
||||
Return "/Resources/TreeView/CCompo.ico"
|
||||
Case GDB_TY.SRF_MESH
|
||||
Return "/Resources/TreeView/STriMesh.ico"
|
||||
Case GDB_TY.SRF_FRGN
|
||||
Return "/Resources/TreeView/SFlatRegion.ico"
|
||||
Case GDB_TY.VOL_ZMAP
|
||||
Return "/Resources/TreeView/VolZmap.ico"
|
||||
Case GDB_TY.EXT_TEXT
|
||||
Return "/Resources/TreeView/Text.ico"
|
||||
End Select
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Private Sub UpdateObjTree()
|
||||
' per aggiornare l'albero senza ricostruirlo da capo
|
||||
' se c'è una entità corrente, ne aggiorno i dati
|
||||
If m_nObjTreeOldId <> GDB_ID.NULL Then
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, m_nObjTreeOldId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateObjInObjTree(nId As Integer)
|
||||
If m_bEnableUpdateObjInObjTree Then
|
||||
' ripristino eventuale vecchio oggetto selezionato
|
||||
RevertOldIdInObjTree()
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
' evidenzio l'oggetto
|
||||
EgtSetMark(nId)
|
||||
m_nObjTreeOldId = nId
|
||||
' imposto il ridisegno della scena
|
||||
EgtDraw()
|
||||
' lancio timer per successiva de-evidenziazione
|
||||
ObjTreeTimer.Stop()
|
||||
ObjTreeTimer.Start()
|
||||
Else
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateObjInObjTreeNoMark(nId As Integer)
|
||||
If m_bEnableUpdateObjInObjTree Then
|
||||
' ripristino eventuale vecchio oggetto selezionato
|
||||
RevertOldIdInObjTree()
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
' salvo id corrente
|
||||
m_nObjTreeOldId = nId
|
||||
Else
|
||||
' stampa dei dati del nuovo oggetto
|
||||
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function RevertOldIdInObjTree() As Integer
|
||||
' salvo il vecchio Id
|
||||
Dim nOldId As Integer = m_nObjTreeOldId
|
||||
' se non nullo...
|
||||
If EgtExistsObj(m_nObjTreeOldId) Then
|
||||
' smarco l'oggetto
|
||||
EgtResetMark(m_nObjTreeOldId)
|
||||
' annullo oggetto da ripristinare
|
||||
m_nObjTreeOldId = GDB_ID.NULL
|
||||
End If
|
||||
Return nOldId
|
||||
End Function
|
||||
|
||||
Private Function SelectIdInObjTree(nId As Integer, bMark As Boolean) As Boolean
|
||||
Dim tNode As LayerTreeViewItem = SearchIdInLayerList(LayerList, nId, True)
|
||||
If Not IsNothing(tNode) Then
|
||||
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = False
|
||||
tNode.IsSelected = True
|
||||
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = True
|
||||
tNode.IsExpanded = True
|
||||
m_nObjTreeOldId = nId
|
||||
Return True
|
||||
Else
|
||||
m_nObjTreeOldId = GDB_ID.NULL
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function SearchIdInLayerList(Tree As ObservableCollection(Of LayerTreeViewItem), nId As Integer, bExpand As Boolean) As LayerTreeViewItem
|
||||
For Each Item In Tree
|
||||
If Item.Id = nId Then
|
||||
If bExpand Then Item.IsExpanded = True
|
||||
Return Item
|
||||
ElseIf Item.Items.Count() > 0 Then
|
||||
Dim Item2 As LayerTreeViewItem = SearchIdInLayerList(Item.Items, nId, bExpand)
|
||||
If Not IsNothing(Item2) Then
|
||||
If bExpand Then Item.IsExpanded = True
|
||||
Return Item2
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
'Private Sub MenuObjTree_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuTreeView1.ItemClicked
|
||||
' If e.ClickedItem.Name = "cmdSelectPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SELECTPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdDeselectPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.DESELECTPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSetName" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SETNAME)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSetInfo" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.SETINFO)
|
||||
' ElseIf e.ClickedItem.Name = "cmdRelocatePartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.RELOCATEPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdCopyPartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.COPYPARTLAYEROBJ)
|
||||
' ElseIf e.ClickedItem.Name = "cmdDeletePartLayObj" Then
|
||||
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
|
||||
' m_Controller.ExecuteCommand(CMD.DELETE)
|
||||
' ElseIf e.ClickedItem.Name = "cmdSavePartLay" Then
|
||||
' ContextMenuTreeView1.Close()
|
||||
' Dim sDir As String = String.Empty
|
||||
' GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir, m_sIniFile)
|
||||
' Dim nType As NGE = GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT, m_sIniFile)
|
||||
' m_Controller.SaveObject(m_nObjTreeMenuId, sDir, nType)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
<UserControl x:Class="MachiningTreeExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:local="clr-namespace:EgtCAM5">
|
||||
|
||||
<Expander Header="{Binding MachListHdr}" IsExpanded="{Binding IsEnabled}" IsEnabled="{Binding IsEnabled}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<UniformGrid MaxHeight="100">
|
||||
<TreeView Name="MachiningsTreeView" Grid.Row="1"
|
||||
ItemsSource="{Binding Path=MachiningsList}">
|
||||
<!--<interactivity:Interaction.Triggers>
|
||||
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
||||
<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 -->
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:FamilyMachiningTreeViewExpanderItem}" ItemsSource="{Binding Items}">
|
||||
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Image Grid.Column="0" Source="{Binding PictureString}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!--Assegna ai nodi ToolItem lo Style normale dei TreeViewItem, eliminando l'ombra, data dal
|
||||
multibinding quando sono attivi.-->
|
||||
<HierarchicalDataTemplate.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}" >
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<EventSetter Event="MouseDoubleClick" Handler="MachiningsTreeView_MouseDoubleClick"/>
|
||||
</Style>
|
||||
</HierarchicalDataTemplate.ItemContainerStyle>
|
||||
|
||||
</HierarchicalDataTemplate>
|
||||
<!--Modifico DataTemplate del ToolItem per poter inserire immagine e testo-->
|
||||
<DataTemplate DataType="{x:Type local:MachiningTreeViewExpanderItem}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Tool}"/>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</TreeView.Resources>
|
||||
|
||||
<!--Style dei nodi CathegoryItem che li riquadra di azzurro quando clicckati ed elimina l'ombra grigia -->
|
||||
<!--che si presenta quando la categoria rimane vuota (ombra causata dal multibinding). -->
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
|
||||
</TreeView>
|
||||
</UniformGrid>
|
||||
</Expander>
|
||||
|
||||
</UserControl>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
Public Class MachiningTreeExpanderView
|
||||
|
||||
' Evento necessario per impedire che venga creata la lavorazione quando si fa doppio click sulla ScrollBar
|
||||
Private Sub MachiningsTreeView_MouseDoubleClick(sender As Object, e As System.Windows.Input.MouseButtonEventArgs)
|
||||
'Dim src As DependencyObject = VisualTreeHelper.GetParent(DirectCast(e.OriginalSource, DependencyObject))
|
||||
|
||||
'' Your logic here
|
||||
'If TypeOf src Is Control AndAlso src.[GetType]() <> GetType(Grid) Then
|
||||
' e.Handled = True
|
||||
'End If
|
||||
' recupero il viewmodel associato a questa view in cui è presente la funzione che l'evento deve lanciare
|
||||
Dim MachiningTreeExpanderViewModel As EgtCAM5.MachiningTreeExpanderViewModel = DirectCast(Me.DataContext, EgtCAM5.MachiningTreeExpanderViewModel)
|
||||
' recupero il treeviewitem clickato(sorgente dell'evento)
|
||||
Dim ClickedTreeViewItem As TreeViewItem = DirectCast(sender, TreeViewItem)
|
||||
' ne recupero il VM da passare alla funzione
|
||||
Dim ClickedTreeViewItemVM As MachiningTreeViewExpanderItem = DirectCast(ClickedTreeViewItem.DataContext, MachiningTreeViewExpanderItem)
|
||||
MachiningTreeExpanderViewModel.TreeViewDoubleClick(ClickedTreeViewItemVM)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+213
@@ -0,0 +1,213 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class MachiningTreeExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
Private m_CodeCommand As Boolean = False
|
||||
Private m_IsEnabled As Boolean
|
||||
Public Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsEnabled Then
|
||||
m_IsEnabled = value
|
||||
If Not value And Not m_CodeCommand Then
|
||||
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
|
||||
End If
|
||||
m_CodeCommand = False
|
||||
OnPropertyChanged("IsEnabled")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Lista delle lavorazioni
|
||||
Private m_MachiningsList As New ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
|
||||
Public Property MachiningsList As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
|
||||
Get
|
||||
Return m_MachiningsList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem))
|
||||
m_MachiningsList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova
|
||||
Private m_nSelectedOperationId As Integer = -1
|
||||
|
||||
Public ReadOnly Property MachListHdr As String
|
||||
Get
|
||||
Return EgtMsg(5412) ' Nuove Lavorazioni
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdTreeViewDoubleClick As ICommand
|
||||
Private m_cmdCancelNew As ICommand
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
' Per caricare l'albero la prima volta che viene aperto
|
||||
IsEnabled = False
|
||||
LoadSelectedMachineMachinings()
|
||||
Application.Msn.Register(Application.UPDATEOPERATIONMACHININGLIST, Sub()
|
||||
m_MachiningsList.Clear()
|
||||
LoadSelectedMachineMachinings()
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.MACHININGTREEVIEWEXPANDERISENABLED, Sub(bValue As Boolean)
|
||||
m_CodeCommand = True
|
||||
IsEnabled = bValue
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem)
|
||||
m_nSelectedOperationId = SelectedOperation.Id
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "TreeViewDoubleClickCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do TreeViewDoubleClick.
|
||||
''' </summary>
|
||||
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
|
||||
Get
|
||||
If m_cmdTreeViewDoubleClick Is Nothing Then
|
||||
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
|
||||
End If
|
||||
Return m_cmdTreeViewDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
|
||||
''' </summary>
|
||||
Public Sub TreeViewDoubleClick(ByVal param As Object)
|
||||
If TypeOf param Is MachiningTreeViewExpanderItem Then
|
||||
Dim Machining As MachiningTreeViewExpanderItem = DirectCast(param, MachiningTreeViewExpanderItem)
|
||||
' Creo nuova lavorazione(operazione) con la lavorazione selezionata
|
||||
Dim MachiningId As Integer = EgtAddMachining(MachiningTypeToString(Machining.Type) & "_1", Machining.Name)
|
||||
' Se è abilitata l'opzione
|
||||
If Not OptionModule.m_bNewMachiningIsLastOne Then
|
||||
' Sposto la lavorazione aggiunta subito dopo quella appena selezionata
|
||||
EgtRelocate(MachiningId, m_nSelectedOperationId, GDB_POS.AFTER)
|
||||
End If
|
||||
' Recupero geometria correntemente selezionata e la metto in un vettore
|
||||
Dim SelectedEntities As New List(Of Integer)
|
||||
Dim EntityId As Integer = EgtGetFirstSelectedObj()
|
||||
While EntityId <> GDB_ID.NULL
|
||||
SelectedEntities.Add(EntityId)
|
||||
EntityId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
' Imposto l'operazione appena creata come corrente
|
||||
EgtSetCurrMachining(MachiningId)
|
||||
If SelectedEntities.Count = 1 AndAlso EgtGetType(SelectedEntities(0)) = GDB_TY.SRF_MESH Then
|
||||
Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedEntities(0), IniFile.m_LastSubEntityId)
|
||||
If nF < 0 Then nF = 0
|
||||
Dim SubEntityArray As Integer() = {nF}
|
||||
EgtSetMachiningGeometry(SelectedEntities.ToArray, SubEntityArray)
|
||||
Else
|
||||
' Imposto il vettore come geometria di lavorazione
|
||||
EgtSetMachiningGeometry(SelectedEntities.ToArray)
|
||||
End If
|
||||
' Calcolo la lavorazione con la nuova geometria
|
||||
EgtApplyMachining(True)
|
||||
EgtDraw()
|
||||
' Ricarico la lista operazioni per avere quella nuova
|
||||
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
|
||||
' disabilito la modalità nuova lavorazione
|
||||
Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, New NewMachOpParam(False, MachiningId))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function MachiningTypeToString(Type As Integer) As String
|
||||
Select Case Type
|
||||
Case MCH_MY.DRILLING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
|
||||
Case MCH_MY.SAWING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
|
||||
Case MCH_MY.MILLING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
|
||||
Case MCH_MY.POCKETING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 4)
|
||||
Case MCH_MY.MORTISING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 5)
|
||||
Case MCH_MY.SAWROUGHING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 6)
|
||||
Case MCH_MY.SAWFINISHING
|
||||
Return EgtMsg(MSG_MACHININGSDBPAGE + 7)
|
||||
Case Else
|
||||
Return "Mach"
|
||||
End Select
|
||||
End Function
|
||||
|
||||
#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"
|
||||
|
||||
''' <summary>
|
||||
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
|
||||
''' </summary>
|
||||
Private Sub LoadSelectedMachineMachinings()
|
||||
Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies()
|
||||
For Each MachiningsType In ActiveMachiningsTypes
|
||||
Dim FamilyTreeView As New FamilyMachiningTreeViewExpanderItem(MachiningsType.TypeName, MachiningsType.TypeId)
|
||||
MachiningsList.Add(FamilyTreeView)
|
||||
Dim MachiningName As String = String.Empty
|
||||
Dim MachiningToolName As String = String.Empty
|
||||
EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName)
|
||||
While Not String.IsNullOrEmpty(MachiningName)
|
||||
EgtMdbSetCurrMachining(MachiningName)
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningToolName)
|
||||
FamilyTreeView.Items.Add(New MachiningTreeViewExpanderItem(MachiningName, MachiningsType.TypeId, MachiningToolName))
|
||||
EgtMdbGetNextMachining(MachiningsType.TypeId, MachiningName)
|
||||
End While
|
||||
Next
|
||||
' Se esiste almeno una famiglia di lavorazioni, la seleziono
|
||||
If MachiningsList.Count > 0 Then
|
||||
MachiningsList(0).IsSelected = True
|
||||
MachiningsList(0).NotifyPropertyChanged("IsSelected")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
Imports EgtUILib
|
||||
|
||||
''' <summary>
|
||||
''' Class that represent a Machining in the treeview.
|
||||
''' It's an element in the treeview that represent the child of familymachiningtreeviewitem, but also the class that read and write in the machining's database
|
||||
''' </summary>
|
||||
Public Class MachiningTreeViewExpanderItem
|
||||
Inherits ChildItem
|
||||
|
||||
#Region "Machining Property"
|
||||
|
||||
Private m_Type As MCH_MY
|
||||
Public ReadOnly Property Type As Integer
|
||||
Get
|
||||
Return m_Type
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Property that determines if the Machining is selected or not
|
||||
''' </summary>
|
||||
Public Overrides Property IsSelected As Boolean
|
||||
Get
|
||||
Return m_IsSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If (value <> m_IsSelected) Then
|
||||
m_IsSelected = value
|
||||
' If Machining is selected, set it as current and notify all machining's property
|
||||
' to refresh them values with those of the new selected machining
|
||||
If value Then
|
||||
EgtMdbSetCurrMachining(Me.Name)
|
||||
Else
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End Set
|
||||
|
||||
End Property
|
||||
|
||||
Private m_Tool As String
|
||||
Public Property Tool As String
|
||||
Get
|
||||
Return m_Tool
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Tool = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region ' Machining Property
|
||||
|
||||
#Region "Constructors"
|
||||
|
||||
Sub New(Name As String, Type As MCH_MY, Tool As String)
|
||||
MyBase.New(Name)
|
||||
Me.m_Type = Type
|
||||
Me.Tool = If(Not String.IsNullOrEmpty(Tool), "(" & Tool & ")", String.Empty)
|
||||
End Sub
|
||||
|
||||
#End Region ' Constructors
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Class that represent a FamilyMachining in the treeview.
|
||||
''' It's an element in the treeview that represent a folder, but also a machining family
|
||||
''' </summary>
|
||||
Public Class FamilyMachiningTreeViewExpanderItem
|
||||
Inherits ParentItem
|
||||
|
||||
Private m_MachiningType As MCH_MY
|
||||
''' <summary>
|
||||
''' Property that determines the machining type of the family
|
||||
''' </summary>
|
||||
Public Property MachiningType As MCH_MY
|
||||
Get
|
||||
Return m_MachiningType
|
||||
End Get
|
||||
Set(value As MCH_MY)
|
||||
m_MachiningType = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Property that determines if the Machining is selected or not
|
||||
''' </summary>
|
||||
Public Overrides Property IsSelected As Boolean
|
||||
Get
|
||||
Return m_IsSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If (value <> m_IsSelected) Then
|
||||
m_IsSelected = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Constructor that receive the name of the FamilyMachiningTreeViewItem, the MachiningType, and set
|
||||
''' the picture(Folder.png)
|
||||
''' </summary>
|
||||
Sub New(Name As String, MachiningType As MCH_MY)
|
||||
MyBase.New(Name)
|
||||
Me.MachiningType = MachiningType
|
||||
Me.PictureString = "/Resources/TreeView/Folder.png"
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
<UserControl x:Class="DispositionParameterExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<UserControl.Resources>
|
||||
<sys:Int32 x:Key="TL">1</sys:Int32>
|
||||
<sys:Int32 x:Key="TR">2</sys:Int32>
|
||||
<sys:Int32 x:Key="BL">3</sys:Int32>
|
||||
<sys:Int32 x:Key="BR">4</sys:Int32>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<Expander Header="RawPart" IsExpanded="{Binding RawPartIsExpanded}"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
<StackPanel>
|
||||
<!--<CheckBox Content="Move with Fixture" IsChecked="{Binding MoveWithFixture, Mode=TwoWay}"/>-->
|
||||
<!--ContentPresenter that contains the RawPart options -->
|
||||
<ContentPresenter Name="RawPartOptions" Content="{Binding RawPartOptions ,Mode=OneWay}"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander Header="Part" IsExpanded="{Binding PartIsExpanded}"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
|
||||
</Expander>
|
||||
|
||||
<Expander Header="Fixture" IsExpanded="{Binding FixtureIsExpanded}"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
<!--ContentPresenter that contains the Fixture options -->
|
||||
<ContentPresenter Name="FixtureParameters" Content="{Binding FixtureParameters ,Mode=OneWay}"/>
|
||||
</Expander>
|
||||
|
||||
<UniformGrid Columns="2">
|
||||
<RadioButton Content="Move" IsChecked="{Binding MoveIsChecked}"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="30"/>
|
||||
<RadioButton Content="Rotate"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="30"/>
|
||||
</UniformGrid>
|
||||
|
||||
<Grid Margin="0,5,0,5" Visibility="{Binding RawRefGroupVisibility}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.ColumnSpan="4" Text="Move Raw Reference"/>
|
||||
<RadioButton Grid.Column="1" Grid.Row="1" Command="{Binding CheckedRawRefCommand}"
|
||||
CommandParameter="{StaticResource TL}"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="40" Width="40">
|
||||
<Border BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="5,5,0,0"
|
||||
Height="30" Width="30"/>
|
||||
</RadioButton>
|
||||
<RadioButton Grid.Column="2" Grid.Row="1" Command="{Binding CheckedRawRefCommand}"
|
||||
CommandParameter="{StaticResource TR}"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="40" Width="40">
|
||||
<Border BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="0,5,5,0"
|
||||
Height="30" Width="30"/>
|
||||
</RadioButton>
|
||||
<RadioButton Grid.Column="1" Grid.Row="2" Command="{Binding CheckedRawRefCommand}"
|
||||
CommandParameter="{StaticResource BL}" IsChecked="{Binding BLIsChecked,Mode=OneWay}"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="40" Width="40">
|
||||
<Border BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="5,0,0,5"
|
||||
Height="30" Width="30"/>
|
||||
</RadioButton>
|
||||
<RadioButton Grid.Column="2" Grid.Row="2" Command="{Binding CheckedRawRefCommand}"
|
||||
CommandParameter="{StaticResource BR}"
|
||||
Style="{StaticResource {x:Type ToggleButton}}" Height="40" Width="40">
|
||||
<Border BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="0,0,5,5"
|
||||
Height="30" Width="30"/>
|
||||
</RadioButton>
|
||||
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="{Binding InputMsg,Mode=OneWay}" Margin="5,5,0,5"/>
|
||||
<TextBox Text="{Binding InputValue,UpdateSourceTrigger=PropertyChanged}" Margin="5,0,5,5">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding DoneCommand}"/>
|
||||
<!--<KeyBinding Key="S" Modifiers="Control" Command="{Binding ShowCommand}"/>-->
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<TextBlock Text="{Binding InputErrorMsg,Mode=OneWay}" Margin="5,5,5,5"
|
||||
Style="{StaticResource ValidationErrorTextBlock}"/>
|
||||
|
||||
<Grid Margin="5,0,5,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--<Button Command="{Binding ShowCommand}" Visibility="{Binding ShowBtnVisibility}"
|
||||
Content="{Binding ShowMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>-->
|
||||
<Button Command="{Binding DoneCommand}" Grid.Column="1"
|
||||
Content="{Binding OkMsg}" Style="{StaticResource EgtCAM5_InputButton}"/>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Public Class DispositionParameterExpanderView
|
||||
|
||||
End Class
|
||||
+464
@@ -0,0 +1,464 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class DispositionParameterExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
|
||||
|
||||
Public Enum ObjectType As Integer
|
||||
RAWPART = 1
|
||||
PART = 2
|
||||
FIXTURE = 3
|
||||
End Enum
|
||||
|
||||
Private m_ActiveObject As ObjectType
|
||||
Public Property ActiveObject As ObjectType
|
||||
Get
|
||||
Return m_ActiveObject
|
||||
End Get
|
||||
Set(value As ObjectType)
|
||||
If value <> m_ActiveObject Then
|
||||
Select Case value
|
||||
Case ObjectType.RAWPART
|
||||
RawPartIsExpanded = True
|
||||
Case ObjectType.PART
|
||||
PartIsExpanded = True
|
||||
Case ObjectType.FIXTURE
|
||||
FixtureIsExpanded = True
|
||||
End Select
|
||||
m_ActiveObject = value
|
||||
End If
|
||||
m_ActiveObject = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Friend m_Id As Integer
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
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_RawPartIsExpanded As Boolean
|
||||
Public Property RawPartIsExpanded As Boolean
|
||||
Get
|
||||
Return m_RawPartIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_RawPartIsExpanded Then
|
||||
If value Then
|
||||
' Chiudo Part e Fixture
|
||||
PartIsExpanded = False
|
||||
FixtureIsExpanded = False
|
||||
' verifico se è attiva l'opzione muovi con ventose
|
||||
If m_MoveWithFixture Then
|
||||
' Abilito la selezione dei RawPart con ventose
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
|
||||
Else
|
||||
' Abilito la selezione dei RawPart
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
|
||||
End If
|
||||
If m_MoveIsChecked Then
|
||||
m_RawRefGroupVisibility = Visibility.Visible
|
||||
OnPropertyChanged("RawRefGroupVisibility")
|
||||
End If
|
||||
Else
|
||||
' Nascondo i bottoni per impostare la posizione di riferimento del grezzo
|
||||
m_RawRefGroupVisibility = Visibility.Collapsed
|
||||
OnPropertyChanged("RawRefGroupVisibility")
|
||||
' smarco la prima entità selezionata
|
||||
EgtResetMark(EgtGetFirstSelectedObj)
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
End If
|
||||
m_RawPartIsExpanded = value
|
||||
ActiveObject = ObjectType.RAWPART
|
||||
OnPropertyChanged("RawPartIsExpanded")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_PartIsExpanded As Boolean
|
||||
Public Property PartIsExpanded As Boolean
|
||||
Get
|
||||
Return m_PartIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_PartIsExpanded Then
|
||||
If value Then
|
||||
' Chiudo RawPart e Fixture
|
||||
RawPartIsExpanded = False
|
||||
FixtureIsExpanded = False
|
||||
Else
|
||||
' smarco la prima entità selezionata
|
||||
EgtResetMark(EgtGetFirstSelectedObj)
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
End If
|
||||
m_PartIsExpanded = value
|
||||
ActiveObject = ObjectType.PART
|
||||
OnPropertyChanged("PartIsExpanded")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_FixtureIsExpanded As Boolean
|
||||
Public Property FixtureIsExpanded As Boolean
|
||||
Get
|
||||
Return m_FixtureIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_FixtureIsExpanded Then
|
||||
If value Then
|
||||
' Chiudo RawPart e Part
|
||||
RawPartIsExpanded = False
|
||||
PartIsExpanded = False
|
||||
' Abilito la selezione delle Fixture
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
|
||||
m_ExpandFixtureFunction()
|
||||
Else
|
||||
' smarco la prima entità selezionata
|
||||
EgtResetMark(EgtGetFirstSelectedObj)
|
||||
' deseleziono tutto ed aggiorno la visualizzazione
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
End If
|
||||
m_FixtureIsExpanded = value
|
||||
ActiveObject = ObjectType.FIXTURE
|
||||
OnPropertyChanged("FixtureIsExpanded")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_MoveIsChecked As Boolean
|
||||
Public Property MoveIsChecked As Boolean
|
||||
Get
|
||||
Return m_MoveIsChecked
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_MoveIsChecked Then
|
||||
Application.Msn.NotifyColleagues(Application.SETMOVEINDISPOSITION, value)
|
||||
InputValue = String.Empty
|
||||
OnPropertyChanged("InputValue")
|
||||
If value Then
|
||||
If m_RawPartIsExpanded Then
|
||||
m_RawRefGroupVisibility = Visibility.Visible
|
||||
OnPropertyChanged("RawRefGroupVisibility")
|
||||
Else
|
||||
m_RawRefGroupVisibility = Visibility.Collapsed
|
||||
OnPropertyChanged("RawRefGroupVisibility")
|
||||
End If
|
||||
m_InputMsg = "Move to:"
|
||||
Else
|
||||
m_RawRefGroupVisibility = Visibility.Collapsed
|
||||
OnPropertyChanged("RawRefGroupVisibility")
|
||||
m_InputMsg = "Rotate of:"
|
||||
End If
|
||||
OnPropertyChanged("InputMsg")
|
||||
m_MoveIsChecked = value
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_MoveWithFixture As Boolean = False
|
||||
Public Property MoveWithFixture As Boolean
|
||||
Get
|
||||
Return m_MoveWithFixture
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_MoveWithFixture Then
|
||||
If value Then
|
||||
' Abilito la selezione di RawPart con autoselezione delle sue ventose
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
|
||||
' Seleziono le ventose associate ad uno dei grezzi selezionati
|
||||
' ciclo sui grezzi selezionati
|
||||
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelRawPartId <> GDB_ID.NULL
|
||||
' seleziono i sottopezzi del grezzo
|
||||
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
|
||||
nSelRawPartId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Else
|
||||
' Abilito la selezione di RawPart
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
|
||||
' ciclo sui grezzi selezionati
|
||||
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelRawPartId <> GDB_ID.NULL
|
||||
' deseleziono i sottopezzi del grezzo
|
||||
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
|
||||
nSelRawPartId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End If
|
||||
EgtDraw()
|
||||
m_MoveWithFixture = value
|
||||
OnPropertyChanged("MoveWithFixture")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_InputValue As String
|
||||
Public Property InputValue As String
|
||||
Get
|
||||
Return m_InputValue
|
||||
End Get
|
||||
Set(value As String)
|
||||
If Not String.IsNullOrEmpty(m_InputErrorMsg) Then
|
||||
m_InputErrorMsg = String.Empty
|
||||
OnPropertyChanged("InputErrorMsg")
|
||||
End If
|
||||
m_InputValue = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_BLIsChecked As Boolean = True
|
||||
Public ReadOnly Property BLIsChecked As Boolean
|
||||
Get
|
||||
Return m_BLIsChecked
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RawRefPosition As MCH_CR = MCH_CR.BL
|
||||
|
||||
Private m_RawRefGroupVisibility As Visibility
|
||||
Public ReadOnly Property RawRefGroupVisibility As Visibility
|
||||
Get
|
||||
Return m_RawRefGroupVisibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Actions
|
||||
Private m_ExpandFixtureFunction As Action
|
||||
|
||||
Private m_FixtureParameters As FixtureParametersView
|
||||
Public ReadOnly Property FixtureParameters As ContentControl
|
||||
Get
|
||||
If IsNothing(m_FixtureParameters) Then
|
||||
m_FixtureParameters = New FixtureParametersView
|
||||
m_FixtureParameters.DataContext = New FixtureParametersViewModel(m_ExpandFixtureFunction)
|
||||
End If
|
||||
Return m_FixtureParameters
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_RawPartOptions As RawPartOptionView
|
||||
Public ReadOnly Property RawPartOptions As ContentControl
|
||||
Get
|
||||
If IsNothing(m_RawPartOptions) Then
|
||||
m_RawPartOptions = New RawPartOptionView
|
||||
m_RawPartOptions.DataContext = New RawPartOptionViewModel
|
||||
End If
|
||||
Return m_RawPartOptions
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Private m_InputMsg As String
|
||||
Public ReadOnly Property InputMsg As String
|
||||
Get
|
||||
Return m_InputMsg
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_InputErrorMsg As String
|
||||
Public ReadOnly Property InputErrorMsg As String
|
||||
Get
|
||||
Return m_InputErrorMsg
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property OkMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 1)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdDone As ICommand
|
||||
Private m_cmdCheckedRawRef As ICommand
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New(ByRef OpenDispositionFunction As Action(Of Boolean))
|
||||
OpenDispositionFunction = AddressOf OpenDispositionParameters
|
||||
MoveIsChecked = True
|
||||
m_BLIsChecked = True
|
||||
OnPropertyChanged("BLIsChecked")
|
||||
m_RawRefPosition = MCH_CR.BL
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Public Sub OpenDispositionParameters(bFirst As Boolean)
|
||||
If bFirst Then
|
||||
ActiveObject = ObjectType.RAWPART
|
||||
Else
|
||||
ActiveObject = ObjectType.FIXTURE
|
||||
End If
|
||||
Select Case m_ActiveObject
|
||||
Case ObjectType.RAWPART
|
||||
' Abilito la selezione delle Fixture
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
|
||||
Case ObjectType.FIXTURE
|
||||
' Abilito la selezione delle Fixture
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
|
||||
End Select
|
||||
m_MoveWithFixture = False
|
||||
OnPropertyChanged("MoveWithFixture")
|
||||
End Sub
|
||||
|
||||
#End Region ' METHODS
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "DoneCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Done.
|
||||
''' </summary>
|
||||
Public ReadOnly Property DoneCommand As ICommand
|
||||
Get
|
||||
If m_cmdDone Is Nothing Then
|
||||
m_cmdDone = New RelayCommand(AddressOf Done)
|
||||
End If
|
||||
Return m_cmdDone
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the DoneCommand.
|
||||
''' </summary>
|
||||
Public Sub Done(ByVal param As Object)
|
||||
' Verifico la validità del punto in Input
|
||||
If Not String.IsNullOrEmpty(m_InputValue) Then
|
||||
' se movimento di traslazione
|
||||
If m_MoveIsChecked Then
|
||||
Dim InputPoint As New Point3d(0, 0, 0)
|
||||
Dim Values() As String = m_InputValue.Split(","c)
|
||||
If Values.Count = 2 Then
|
||||
StringToLen(Values(0), InputPoint.x)
|
||||
StringToLen(Values(1), InputPoint.y)
|
||||
Else
|
||||
m_InputErrorMsg = "Il valore non è una cordinata XY"
|
||||
OnPropertyChanged("InputErrorMsg")
|
||||
Return
|
||||
End If
|
||||
' Vettore di movimento
|
||||
Dim vtMove As Vector3d
|
||||
' lo imposto a seconda del tipo del primo elemento selezionato
|
||||
Dim nFirstSelectedId As Integer = EgtGetFirstSelectedObj()
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo il punto del grezzo da posizionar nelle coordinate di input
|
||||
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' creo un punto con le coordinate di input espresse rispetto alla tavola
|
||||
Dim TableRefInputPoint As New Point3d(InputPoint)
|
||||
TableRefInputPoint.LocToLoc(EgtGetGridFrame(), New Frame3d(ptTableRef))
|
||||
' calcolo il vettore di spostamento del grezzo
|
||||
vtMove = TableRefInputPoint - ptRawRefPoint
|
||||
' se è una ventosa
|
||||
ElseIf EgtVerifyFixture(nFirstSelectedId) Then
|
||||
Dim SelObjFrame3d As New Frame3d(Frame3d.GLOB)
|
||||
EgtGetGroupGlobFrame(nFirstSelectedId, SelObjFrame3d)
|
||||
SelObjFrame3d.ToLoc(EgtGetGridFrame())
|
||||
Dim FixturePoint As New Point3d(SelObjFrame3d.Orig)
|
||||
' Ricavo il vettore di movimento (tengo solo XY)
|
||||
vtMove = InputPoint - FixturePoint
|
||||
vtMove.z = 0
|
||||
End If
|
||||
' Muovo tutti gli oggetti selezionati
|
||||
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, vtMove)
|
||||
' se è un grezzo
|
||||
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
|
||||
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
|
||||
' verifico se lo spostamento effettuato differisce da quello richiesto
|
||||
Dim vtRemainingMove As Vector3d = InputPoint - ptRawRefPoint
|
||||
' se differisce
|
||||
If Not vtRemainingMove.IsSmall() Then
|
||||
' eseguo lo spostamento rimanente sull'asse x
|
||||
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(vtRemainingMove.x, 0, 0))
|
||||
' eseguo lo spostamento rimanente sull'asse y
|
||||
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(0, vtRemainingMove.y, 0))
|
||||
End If
|
||||
End If
|
||||
' se rotazione
|
||||
Else
|
||||
Dim InputAngle As Double = 0
|
||||
If Not StringToDouble(m_InputValue, InputAngle) Then
|
||||
m_InputErrorMsg = "Il valore non è un angolo valido"
|
||||
OnPropertyChanged("InputErrorMsg")
|
||||
Return
|
||||
End If
|
||||
Dim nSelId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelId <> GDB_ID.NULL
|
||||
Select Case m_ActiveObject
|
||||
Case ObjectType.RAWPART
|
||||
If Not EgtRotateRawPart(nSelId, Vector3d.Z_AX, InputAngle) Then
|
||||
m_InputErrorMsg = "Impossibile ruotare il grezzo."
|
||||
OnPropertyChanged("InputErrorMsg")
|
||||
End If
|
||||
Case ObjectType.PART
|
||||
'EgtMove...
|
||||
Case ObjectType.FIXTURE
|
||||
If Not EgtRotateFixture(nSelId, InputAngle) Then
|
||||
m_InputErrorMsg = "Impossibile ruotare la ventosa"
|
||||
OnPropertyChanged("InputErrorMsg")
|
||||
End If
|
||||
End Select
|
||||
nSelId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End If
|
||||
EgtDraw()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' DoneCommand
|
||||
|
||||
#Region "CheckedRawRefCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Done.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CheckedRawRefCommand As ICommand
|
||||
Get
|
||||
If m_cmdCheckedRawRef Is Nothing Then
|
||||
m_cmdCheckedRawRef = New RelayCommand(AddressOf CheckedRawRef)
|
||||
End If
|
||||
Return m_cmdCheckedRawRef
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the DoneCommand.
|
||||
''' </summary>
|
||||
Public Sub CheckedRawRef(ByVal param As Object)
|
||||
Dim nRawRef As MCH_CR = DirectCast(param, MCH_CR)
|
||||
m_RawRefPosition = nRawRef
|
||||
End Sub
|
||||
|
||||
#End Region ' CheckedRawRefCommand
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
+594
@@ -0,0 +1,594 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Public NotInheritable Class DispositionUtility
|
||||
|
||||
Friend Shared Function GetRawPartRefPoint(nRawPartId As Integer, RawRefPosition As MCH_CR) As Point3d
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' recupero il solido del grezzo dal primo elemento selezionato
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
' imposto il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
' calcolo i punti min e max del bbox riferiti alla tavola
|
||||
Dim ptBBoxRawPartMin As New Point3d(bboxRawPart.Min)
|
||||
Dim ptBBoxRawPartMax As New Point3d(bboxRawPart.Max)
|
||||
ptBBoxRawPartMin.ToLoc(New Frame3d(ptTableRef))
|
||||
ptBBoxRawPartMax.ToLoc(New Frame3d(ptTableRef))
|
||||
' dal box e dal tipo di punto di riferimento selezionato ricavo le coordinate del punto di riferimento
|
||||
Dim ptRawRefPoint As Point3d
|
||||
Select Case RawRefPosition
|
||||
Case MCH_CR.TL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.TR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMax.y
|
||||
Case MCH_CR.BL
|
||||
ptRawRefPoint.x = ptBBoxRawPartMin.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
Case MCH_CR.BR
|
||||
ptRawRefPoint.x = ptBBoxRawPartMax.x
|
||||
ptRawRefPoint.y = ptBBoxRawPartMin.y
|
||||
End Select
|
||||
ptRawRefPoint.z = ptBBoxRawPartMin.z
|
||||
Return ptRawRefPoint
|
||||
End Function
|
||||
|
||||
Public Shared Function MoveRawPartPartAndFixture(nMoveId As Integer, vtMove As Vector3d, Optional nCount As Integer = 1) As Boolean
|
||||
Dim bErrorMoving As Boolean = False
|
||||
' Muovo gli oggetti selezionati se consentito
|
||||
If nMoveId = GDB_ID.SEL Then
|
||||
Dim nSelObjId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelObjId <> GDB_ID.NULL
|
||||
If EgtVerifyFixture(nSelObjId) Then
|
||||
If Not EgtMoveFixture(nSelObjId, vtMove) Then
|
||||
bErrorMoving = True
|
||||
nSelObjId = EgtGetPrevSelectedObj()
|
||||
While nSelObjId <> GDB_ID.NULL
|
||||
If EgtVerifyFixture(nSelObjId) Then
|
||||
EgtMoveFixture(nSelObjId, -vtMove)
|
||||
Else
|
||||
EgtMoveRawPart(nSelObjId, -vtMove)
|
||||
End If
|
||||
nSelObjId = EgtGetPrevSelectedObj()
|
||||
End While
|
||||
Exit While
|
||||
End If
|
||||
nSelObjId = EgtGetNextSelectedObj()
|
||||
Else
|
||||
If Not EgtMoveRawPart(nSelObjId, vtMove) Then
|
||||
bErrorMoving = True
|
||||
nSelObjId = EgtGetPrevSelectedObj()
|
||||
While nSelObjId <> GDB_ID.NULL
|
||||
If EgtVerifyFixture(nSelObjId) Then
|
||||
EgtMoveFixture(nSelObjId, -vtMove)
|
||||
Else
|
||||
EgtMoveRawPart(nSelObjId, -vtMove)
|
||||
End If
|
||||
nSelObjId = EgtGetPrevSelectedObj()
|
||||
End While
|
||||
Exit While
|
||||
End If
|
||||
nSelObjId = EgtGetNextSelectedObj()
|
||||
End If
|
||||
End While
|
||||
Else
|
||||
If EgtVerifyFixture(nMoveId) Then
|
||||
If Not EgtMoveFixture(nMoveId, vtMove) Then
|
||||
bErrorMoving = True
|
||||
End If
|
||||
Else
|
||||
If Not EgtMoveRawPart(nMoveId, vtMove) Then
|
||||
bErrorMoving = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' Variabile che contiene l'eventuale spostamento correttivo per interferenza con riferimenti
|
||||
Dim vtRefMove As New Vector3d(Vector3d.NULL)
|
||||
' Se non ci sono stati errori nel movimento
|
||||
Dim bErrorVerify As Boolean = False
|
||||
If Not bErrorMoving Then
|
||||
' Verifico che gli spostamenti effettuati siano validi
|
||||
If nMoveId = GDB_ID.SEL Then
|
||||
Dim nSelObjId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelObjId <> GDB_ID.NULL
|
||||
If Not VerifyRawPartFixturePos(nSelObjId, vtMove, vtRefMove) Then
|
||||
bErrorVerify = True
|
||||
Exit While
|
||||
End If
|
||||
nSelObjId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Else
|
||||
If Not VerifyRawPartFixturePos(nMoveId, vtMove, vtRefMove) Then
|
||||
bErrorVerify = True
|
||||
End If
|
||||
'Dim sOut As String = "VerifyRaw : Count=" & nCount & " Err=" & If(bErrorVerify, "1", "0") &
|
||||
' " Move=" & LenToString(vtMove.x, 3) & "," & LenToString(vtMove.y, 3) &
|
||||
' " RefMove=" & LenToString(vtRefMove.x, 3) & "," & LenToString(vtRefMove.y, 3)
|
||||
'EgtOutLog(sOut)
|
||||
End If
|
||||
End If
|
||||
' Se non c'è errore ma necessaria correzione riferimento
|
||||
If Not bErrorVerify AndAlso Not vtRefMove.IsSmall() Then
|
||||
' provo a correggere (max 1 prova)
|
||||
If nCount < 2 Then
|
||||
bErrorVerify = Not MoveRawPartPartAndFixture(nMoveId, vtRefMove, nCount + 1)
|
||||
End If
|
||||
End If
|
||||
' Se c'è almeno uno spostamento non valido
|
||||
If bErrorVerify Then
|
||||
' ripristino la situazione iniziale annullando tutti i movimenti
|
||||
If nMoveId = GDB_ID.SEL Then
|
||||
Dim nSelObjId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelObjId <> GDB_ID.NULL
|
||||
If EgtVerifyFixture(nSelObjId) Then
|
||||
EgtMoveFixture(nSelObjId, -vtMove)
|
||||
Else
|
||||
EgtMoveRawPart(nSelObjId, -vtMove)
|
||||
End If
|
||||
nSelObjId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Else
|
||||
If EgtVerifyFixture(nMoveId) Then
|
||||
EgtMoveFixture(nMoveId, -vtMove)
|
||||
Else
|
||||
EgtMoveRawPart(nMoveId, -vtMove)
|
||||
End If
|
||||
End If
|
||||
' ritorno falso
|
||||
Return False
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Shared Function VerifyRawPartFixturePos(nMovedObjId As Integer, ByRef vtOrigMove As Vector3d, ByRef vtRefMove As Vector3d) As Boolean
|
||||
' Verifico quale sia il tipo dell'oggetto mosso
|
||||
If EgtVerifyFixture(nMovedObjId) Then
|
||||
Return VerifyFixturePosition(nMovedObjId, vtRefMove)
|
||||
ElseIf EgtVerifyRawPartCurrPhase(nMovedObjId) Then
|
||||
Return VerifyRawPosition(nMovedObjId, vtOrigMove, vtRefMove)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Friend Shared Function VerifyFixturePosition(nMovedFixtureId As Integer, ByRef vtRefMove As Vector3d) As Boolean
|
||||
' Definisco il box della ventosa mossa
|
||||
Dim bboxMovedFixture As New BBox3d
|
||||
EgtGetBBoxGlob(nMovedFixtureId, GDB_BB.ONLY_VISIBLE, bboxMovedFixture)
|
||||
Dim bboxFixture As New BBox3d
|
||||
' Ciclo sui sottopezzi correnti per verificare le collisioni con il sottopezzo spostato
|
||||
Dim nFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nFixtureId <> GDB_ID.NULL
|
||||
If EgtVerifyFixture(nFixtureId) AndAlso nFixtureId <> nMovedFixtureId Then
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
|
||||
' verifico se c'è sovrapposizione
|
||||
If bboxMovedFixture.OverlapsXY(bboxFixture) Then
|
||||
' se c'è restituisco falso perchè i sottopezzi non si possono sovrapporre
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
Return VerifyFixtureWithRaw(nMovedFixtureId, vtRefMove)
|
||||
End Function
|
||||
|
||||
Private Shared Function VerifyFixtureWithRaw(nFixtureId As Integer, ByRef vtRefMove As Vector3d) As Boolean
|
||||
' Tengo da parte il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
Dim TableFrame As New Frame3d(ptTableRef)
|
||||
' Definisco il box del sottopezzo mosso
|
||||
Dim bboxFixture As New BBox3d
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' Variabile che indica se il riferimento non è in battuta su nessun grezzo
|
||||
Dim bRefAttachedToRaw As Boolean = False
|
||||
' Ciclo sui grezzi della fase corrente per verificare le collisioni con il sottopezzo mosso
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
|
||||
' recupero il solido del grezzo
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
' verifico il tipo di sottopezzo
|
||||
Select Case FixtureType(nFixtureId)
|
||||
' se il sottopezzo è una ventosa
|
||||
Case FIX_TYPE.VACUUM
|
||||
' verifico se c'è sovrapposizione
|
||||
If bboxFixture.OverlapsXY(bboxRawPart) Then
|
||||
' se c'è devo verificare che l'altezza del grezzo sia uguale a quella della ventosa
|
||||
' recupero altezza ventosa
|
||||
Dim dFixtureHeight As Double = 0
|
||||
EgtGetInfo(nFixtureId, "H", dFixtureHeight)
|
||||
' recupero altezza grezzo riferita alla tavola
|
||||
Dim dRawPartMin As Point3d = bboxRawPart.Min
|
||||
dRawPartMin.ToLoc(TableFrame)
|
||||
' se l'altezza grezzo è minore di quella della ventosa, lo sposto alla stessa altezza
|
||||
If dRawPartMin.z < dFixtureHeight - EPS_SMALL Then
|
||||
Dim vtMove As New Vector3d(0, 0, dFixtureHeight - dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawPartId, vtMove)
|
||||
' ricalcolo il BBox del solido del grezzo per averlo aggiornato con la nuova Z
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
End If
|
||||
' se non c'è sovrapposizione devo verificare il grezzo con tutti gli altri sottopezzi per sapere se ho tolto l'ultimo e quindi devo abbassarlo
|
||||
Else
|
||||
' variabile che contiene la massima altezza delle ventose sottostanti
|
||||
Dim dMaxFixtureHeight As Double = 0
|
||||
' Variabile che dice se c'è almeno una ventosa sotto il grezzo
|
||||
Dim bIsFixtureUnderRawPart As Boolean = False
|
||||
Dim nOtherFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nOtherFixtureId <> GDB_ID.NULL
|
||||
' evito di rifare la verifica sul sottopezzo mosso
|
||||
If nOtherFixtureId <> nFixtureId Then
|
||||
' calcolo il BBox del sottopezzo
|
||||
Dim bboxOtherFixture As New BBox3d
|
||||
EgtGetBBoxGlob(nOtherFixtureId, GDB_BB.ONLY_VISIBLE, bboxOtherFixture)
|
||||
If bboxRawPart.OverlapsXY(bboxOtherFixture) Then
|
||||
bIsFixtureUnderRawPart = True
|
||||
' recupero altezza ventosa
|
||||
Dim dOtherFixtureHeight As Double = 0
|
||||
EgtGetInfo(nFixtureId, "H", dOtherFixtureHeight)
|
||||
' la confronto con quella massima
|
||||
If dOtherFixtureHeight > dMaxFixtureHeight Then
|
||||
dMaxFixtureHeight = dOtherFixtureHeight
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
nOtherFixtureId = EgtGetNextFixture(nOtherFixtureId)
|
||||
End While
|
||||
' recupero altezza grezzo riferita alla tavola
|
||||
Dim dRawPartMin As Point3d = bboxRawPart.Min
|
||||
dRawPartMin.ToLoc(TableFrame)
|
||||
' se non ci sono ventose sotto il grezzo
|
||||
If Not bIsFixtureUnderRawPart Then
|
||||
' verifico che il grezzo sia ad altezza tavola
|
||||
If dRawPartMin.z <> 0 Then
|
||||
Dim vtMove As New Vector3d(0, 0, -dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawPartId, vtMove)
|
||||
End If
|
||||
Else
|
||||
' se ci sono verifico che l'altezza del grezzo sia quella della ventosa più alta
|
||||
If Math.Abs(dRawPartMin.z - dMaxFixtureHeight) > EPS_SMALL Then
|
||||
Dim vtMove As New Vector3d(0, 0, dMaxFixtureHeight - dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawPartId, vtMove)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' se il sottopezzo è un riferimento
|
||||
Case FIX_TYPE.REFERENCE
|
||||
' verifico se c'è sovrapposizione
|
||||
If bboxFixture.OverlapsXY(bboxRawPart) Then
|
||||
' recupero arco del riferimento
|
||||
Dim arcRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_ARC)
|
||||
' calcolo bbox dell'arco di riferimento
|
||||
Dim bboxArcRef As New BBox3d
|
||||
EgtGetBBoxGlob(arcRefId, GDB_BB.STANDARD, bboxArcRef)
|
||||
' ne faccio l'offset ??
|
||||
'bboxArcRef.Expand(10)
|
||||
If bboxRawPart.OverlapsXY(bboxArcRef) Then
|
||||
' recupero contorno del grezzo
|
||||
Dim ccompoRawPartOutlineId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWOUTLINE)
|
||||
'recupero il raggio dell'arco di riferimento
|
||||
Dim dArcRadius As Double
|
||||
EgtArcRadius(arcRefId, dArcRadius)
|
||||
' faccio copia e offset del contorno grezzo
|
||||
Dim ccompoRawPartOutlineOffsetId As Integer = EgtCopyGlob(ccompoRawPartOutlineId, ccompoRawPartOutlineId, GDB_POS.AFTER)
|
||||
EgtOffsetCurve(ccompoRawPartOutlineOffsetId, dArcRadius, OFF_TYPE.FILLET)
|
||||
' recupero centro dell'arco di riferimento
|
||||
Dim ptArcCenter As Point3d
|
||||
EgtCenterPoint(arcRefId, ccompoRawPartOutlineOffsetId, ptArcCenter)
|
||||
' verifico quale è il punto dell'offset vicino al centro dell'arco di riferimento
|
||||
Dim dDist As Double
|
||||
Dim ptMin As Point3d
|
||||
Dim nSide As Integer
|
||||
EgtGetMinDistPntSidePointCurve(ptArcCenter, ccompoRawPartOutlineOffsetId, Vector3d.Z_AX, dDist, ptMin, nSide)
|
||||
' cancello offset
|
||||
EgtErase(ccompoRawPartOutlineOffsetId)
|
||||
' calcolo il vettore di spostamento necessario ad allinearli
|
||||
Dim vtDelta As Vector3d = ptArcCenter - ptMin
|
||||
vtDelta.z = 0
|
||||
' se i punti coincidono, esco
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
bRefAttachedToRaw = True
|
||||
Else
|
||||
' altrimenti riporto il vettore di correzione
|
||||
vtRefMove = -vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
End If
|
||||
Else
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
' se è un riferimento e non è in battuta sul nessun grezzo
|
||||
If FixtureType(nFixtureId) = FIX_TYPE.REFERENCE AndAlso Not bRefAttachedToRaw Then
|
||||
' lo segnalo
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Shared Function VerifyRawPosition(nMovedRawId As Integer, ByRef vtOrigMove As Vector3d, ByRef vtRefMove As Vector3d) As Boolean
|
||||
' Recupero il solido del grezzo
|
||||
Dim nMovedRawSolidId As Integer = EgtGetFirstNameInGroup(nMovedRawId, RAWSOLID)
|
||||
' definisco il box del solido del grezzo
|
||||
Dim bboxMovedRawPart As New BBox3d
|
||||
EgtGetBBoxGlob(nMovedRawSolidId, GDB_BB.ONLY_VISIBLE, bboxMovedRawPart)
|
||||
Dim bboxRawPart As New BBox3d
|
||||
' Ciclo sui grezzi della fase corrente per verificare le collisioni con il grezzo spostato
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartCurrPhase(nRawPartId) AndAlso nRawPartId <> nMovedRawId Then
|
||||
' recupero il solido del grezzo
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne calcolo il BBox
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
' verifico se c'è sovrapposizione
|
||||
If bboxMovedRawPart.OverlapsXY(bboxRawPart) Then
|
||||
' se c'è restituisco falso perchè i grezzi non si possono sovrapporre
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
' verifico le interferenze tra il grezzo spostato e le ventose
|
||||
Return VerifyRawWithFixture(nMovedRawId, vtOrigMove, vtRefMove)
|
||||
End Function
|
||||
|
||||
Private Shared Function VerifyRawWithFixture(nRawId As Integer, ByRef vtOrigMove As Vector3d, ByRef vtRefMove As Vector3d) As Boolean
|
||||
' Tengo da parte il riferimento della tavola
|
||||
Dim ptTableRef As Point3d
|
||||
EgtGetTableRef(1, ptTableRef)
|
||||
Dim TableFrame As New Frame3d(ptTableRef)
|
||||
' Recupero il solido del grezzo
|
||||
Dim nMovedRawSolidId As Integer = EgtGetFirstNameInGroup(nRawId, RAWSOLID)
|
||||
' definisco il box del solido del grezzo
|
||||
Dim bboxRawPartId As New BBox3d
|
||||
EgtGetBBoxGlob(nMovedRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPartId)
|
||||
' Variabile che dice se c'è almeno una ventosa sotto il grezzo
|
||||
Dim bIsFixtureUnderRawPart As Boolean = False
|
||||
Dim bboxFixture As New BBox3d
|
||||
' variabile che contiene la massima altezza delle ventose sottostanti
|
||||
Dim dMaxFixtureHeight As Double = 0
|
||||
' recupero altezza grezzo riferita alla tavola
|
||||
Dim dRawPartMin As Point3d = bboxRawPartId.Min
|
||||
dRawPartMin.ToLoc(TableFrame)
|
||||
' Ciclo sui sottopezzi presenti per verificare le collisioni con il grezzo
|
||||
Dim nFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nFixtureId <> GDB_ID.NULL
|
||||
' calcolo il BBox del sottopezzo
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
|
||||
' verifico se c'è sovrapposizione
|
||||
If bboxRawPartId.OverlapsXY(bboxFixture) Then
|
||||
Select Case FixtureType(nFixtureId)
|
||||
' se il sottopezzo è una ventosa
|
||||
Case FIX_TYPE.VACUUM
|
||||
' recupero altezza ventosa
|
||||
Dim dFixtureHeight As Double = 0
|
||||
EgtGetInfo(nFixtureId, "H", dFixtureHeight)
|
||||
' la confronto con quella massima
|
||||
If dFixtureHeight > dMaxFixtureHeight Then
|
||||
dMaxFixtureHeight = dFixtureHeight
|
||||
End If
|
||||
' se l'altezza grezzo è diversa da quella della ventosa, lo sposto alla stessa altezza
|
||||
If dRawPartMin.z < dFixtureHeight - EPS_SMALL Then
|
||||
Dim vtMove As New Vector3d(0, 0, dFixtureHeight - dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawId, vtMove)
|
||||
' recupero il solido del grezzo
|
||||
Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawId, RAWSOLID)
|
||||
' ricalcolo il BBox del solido del grezzo per averlo aggiornato con la nuova Z
|
||||
EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPartId)
|
||||
dRawPartMin = bboxRawPartId.Min
|
||||
dRawPartMin.ToLoc(TableFrame)
|
||||
End If
|
||||
bIsFixtureUnderRawPart = True
|
||||
' se il sottopezzo è un riferimento
|
||||
Case FIX_TYPE.REFERENCE
|
||||
' recupero arco del riferimento
|
||||
Dim arcRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_ARC)
|
||||
' calcolo bbox dell'arco di riferimento
|
||||
Dim bboxArcRef As New BBox3d
|
||||
EgtGetBBoxGlob(arcRefId, GDB_BB.STANDARD, bboxArcRef)
|
||||
' ne faccio l'offset ??
|
||||
'bboxArcRef.Expand(10)
|
||||
If bboxRawPartId.OverlapsXY(bboxArcRef) Then
|
||||
' recupero contorno del grezzo
|
||||
Dim ccompoRawPartOutlineId As Integer = EgtGetFirstNameInGroup(nRawId, RAWOUTLINE)
|
||||
'recupero il raggio dell'arco di riferimento
|
||||
Dim dArcRadius As Double
|
||||
EgtArcRadius(arcRefId, dArcRadius)
|
||||
' faccio copia e offset del contorno grezzo
|
||||
Dim ccompoRawPartOutlineOffsetId As Integer = EgtCopyGlob(ccompoRawPartOutlineId, ccompoRawPartOutlineId, GDB_POS.AFTER)
|
||||
EgtOffsetCurve(ccompoRawPartOutlineOffsetId, dArcRadius, OFF_TYPE.FILLET)
|
||||
' recupero centro dell'arco di riferimento
|
||||
Dim ptArcCenter As Point3d
|
||||
EgtCenterPoint(arcRefId, ccompoRawPartOutlineId, ptArcCenter)
|
||||
' Creo un segmento avente origine nel centro dell'arco e direzione opposta a quella del movimento
|
||||
Dim nDistLine As Integer = EgtCreateLinePVL(EgtGetParent(ccompoRawPartOutlineId), ptArcCenter, vtOrigMove.Loc(ccompoRawPartOutlineId), 10000)
|
||||
' cerco punto di intersezione tra il segmento e l'offset
|
||||
Dim ptDist As Point3d
|
||||
If EgtIntersectionPoint(nDistLine, ccompoRawPartOutlineOffsetId, ptArcCenter, ptDist) Then
|
||||
' calcolo il vettore di spostamento necessario ad allinearli
|
||||
Dim vtDelta As Vector3d = -(ptDist - ptArcCenter)
|
||||
vtDelta.z = 0
|
||||
' se il vettore non è nullo
|
||||
If vtDelta.IsSmall() Then
|
||||
' il grezzo è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColGreen)
|
||||
Else
|
||||
vtDelta = vtDelta.Glob(ccompoRawPartOutlineId)
|
||||
' il vettore da restituire è nullo, quindi lo inizializzo
|
||||
If vtRefMove.IsSmall() Then
|
||||
vtRefMove = vtDelta
|
||||
' altrimenti lo confronto
|
||||
Else
|
||||
' per ogni coordinata devo prendere il massimo in direzione opposta allo spostamento originale
|
||||
' calcolo il versore nella direzione del movimento
|
||||
Dim vtMoveVers As New Vector3d(vtOrigMove)
|
||||
vtMoveVers.Normalize()
|
||||
If (vtDelta * vtMoveVers) < (vtRefMove * vtMoveVers) Then
|
||||
vtRefMove = vtDelta
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' cancello segmento e offset
|
||||
EgtErase(nDistLine)
|
||||
EgtErase(ccompoRawPartOutlineOffsetId)
|
||||
Else
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
End Select
|
||||
' se non c'è sovrapposizione
|
||||
ElseIf FixtureType(nFixtureId) = FIX_TYPE.REFERENCE Then
|
||||
' il grezzo non è in battuta sul riferimento
|
||||
Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
|
||||
EgtSetColor(nContactColDisk, ReferenceContactColRed)
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
' se non ci sono ventose sotto il grezzo
|
||||
If Not bIsFixtureUnderRawPart Then
|
||||
' verifico che il grezzo sia ad altezza tavola
|
||||
If dRawPartMin.z <> 0 Then
|
||||
Dim vtMove As New Vector3d(0, 0, -dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawId, vtMove)
|
||||
End If
|
||||
Else
|
||||
' se ci sono verifico che l'altezza del grezzo sia quella della ventosa più alta
|
||||
If Math.Abs(dRawPartMin.z - dMaxFixtureHeight) > EPS_SMALL Then
|
||||
Dim vtMove As New Vector3d(0, 0, dMaxFixtureHeight - dRawPartMin.z)
|
||||
EgtMoveRawPart(nRawId, vtMove)
|
||||
End If
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Funzione che restituisce il tipo di sottopezzo passatogli
|
||||
Friend Shared Function FixtureType(nFixtureId As Integer) As FIX_TYPE
|
||||
Dim sFixtureType As String = String.Empty
|
||||
EgtGetInfo(nFixtureId, EgtUILib.FIX_TYPE, sFixtureType)
|
||||
Select Case sFixtureType
|
||||
Case FIX_VAC
|
||||
Return FIX_TYPE.VACUUM
|
||||
Case FIX_REF
|
||||
Return FIX_TYPE.REFERENCE
|
||||
Case FIX_VIS
|
||||
Return FIX_TYPE.VISE
|
||||
End Select
|
||||
Return FIX_TYPE.NULL
|
||||
End Function
|
||||
|
||||
Public Enum FIX_TYPE As Integer
|
||||
NULL = 0
|
||||
VACUUM = 1
|
||||
REFERENCE = 2
|
||||
VISE = 3
|
||||
End Enum
|
||||
|
||||
' Funzione che seleziona i sottopezzi del grezzo passatogli
|
||||
Friend Shared Sub SelectRawPartFixture(nRawPartId As Integer)
|
||||
Dim bboxRawPart As New BBox3d
|
||||
Dim bboxFixture As New BBox3d
|
||||
' ricavo solido del grezzo
|
||||
Dim nRawPartSolid As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne ricavo il bbox
|
||||
EgtGetBBoxGlob(nRawPartSolid, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
Dim nFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nFixtureId <> GDB_ID.NULL
|
||||
' ricavo il bbox del sottopezzo
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
|
||||
' verifico se si sovrappongono
|
||||
If bboxRawPart.OverlapsXY(bboxFixture) Then
|
||||
' seleziono il sottopezzo
|
||||
EgtSelectObj(nFixtureId)
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
' Funzione che deseleziona i sottopezzi del grezzo passatogli
|
||||
Friend Shared Sub DeselectRawPartFixture(nRawPartId As Integer)
|
||||
Dim bboxRawPart As New BBox3d
|
||||
Dim bboxFixture As New BBox3d
|
||||
' ricavo solido del grezzo
|
||||
Dim nRawPartSolid As Integer = EgtGetFirstNameInGroup(nRawPartId, RAWSOLID)
|
||||
' ne ricavo il bbox
|
||||
EgtGetBBoxGlob(nRawPartSolid, GDB_BB.ONLY_VISIBLE, bboxRawPart)
|
||||
Dim nFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nFixtureId <> GDB_ID.NULL
|
||||
' ricavo il bbox del sottopezzo
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
|
||||
' verifico se si sovrappongono
|
||||
If bboxRawPart.OverlapsXY(bboxFixture) Then
|
||||
' deseleziono il pezzo
|
||||
EgtDeselectObj(nFixtureId)
|
||||
End If
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
' Costante che identifica l'informazione contenente il Frame3d originale del pezzo
|
||||
Private Const ORIG_FRAME As String = "ORIGFRAME"
|
||||
|
||||
' Funzione che visualizza i pezzi disponibili e li sposta sotto il grezzo
|
||||
Friend Shared Sub ShowParts()
|
||||
' prendo riferimento tavola
|
||||
|
||||
|
||||
|
||||
' ciclo sui pezzi
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
' mi faccio dare il riferimento del pezzo prima si spostarlo
|
||||
Dim frOrigPart As New Frame3d
|
||||
EgtGetGroupGlobFrame(nPartId, frOrigPart)
|
||||
' salvo il riferimento originale
|
||||
EgtSetInfo(nPartId, ORIG_FRAME, frOrigPart)
|
||||
|
||||
|
||||
'
|
||||
|
||||
|
||||
' Attivo la visualizzazione del pezzo mettendolo in modalità standard
|
||||
EgtSetStatus(nPartId, GDB_ST.ON_)
|
||||
' prendo il pezzo successivo
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
' Funzione che rimette a posto i pezzi
|
||||
Friend Shared Sub HideParts()
|
||||
' ciclo sui pezzi
|
||||
Dim nPartId As Integer = EgtGetFirstPart()
|
||||
While nPartId <> GDB_ID.NULL
|
||||
' recupero il riferimento originale
|
||||
Dim frOrigPart As New Frame3d
|
||||
EgtGetInfo(nPartId, ORIG_FRAME, frOrigPart)
|
||||
' lo ripristino
|
||||
EgtChangeGroupFrame(nPartId, frOrigPart)
|
||||
' Attivo la visualizzazione del pezzo mettendolo in modalità standard
|
||||
EgtSetStatus(nPartId, GDB_ST.OFF)
|
||||
' prendo il pezzo successivo
|
||||
nPartId = EgtGetNextPart(nPartId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<UserControl x:Class="FixtureParametersView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:EgtCAM5="clr-namespace:EgtCAM5">
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<ListBox Name="FixtureListBox" ItemsSource="{Binding FixtureTypeList}"
|
||||
Height="150" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedFixtureType}">
|
||||
<ListBox.Resources>
|
||||
<DataTemplate DataType="{x:Type EgtCAM5:FixtureType}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding UsedTotalRatio}" TextAlignment="Right"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type EgtCAM5:FixtureListItem}">
|
||||
<Border CornerRadius="1" Background="{StaticResource EgaltechBlue3}" FocusVisualStyle="{x:Null}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}" Foreground="White" Margin="5,0,0,0"
|
||||
FontSize="15" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource FixtureTypeListBoxItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled, Mode=OneWay}"/>
|
||||
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
|
||||
<Setter Property="Focusable" Value="{Binding Focusable, Mode=OneWay}"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
||||
<TextBlock Text="{Binding FixtureErrorMsg,Mode=OneWay}" Margin="5,5,5,5"
|
||||
Style="{StaticResource ValidationErrorTextBlock}"/>
|
||||
|
||||
<UniformGrid Columns="2">
|
||||
<Button Content="Add" Height="30" Command="{Binding AddCommand}" CommandParameter="{Binding Path=SelectedItem, ElementName=FixtureListBox}"/>
|
||||
<Button Content="Remove" Height="30" Command="{Binding RemoveCommand}" CommandParameter="{Binding Path=SelectedItem, ElementName=FixtureListBox}"/>
|
||||
</UniformGrid>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Public Class FixtureParametersView
|
||||
|
||||
End Class
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class FixtureParametersViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
Private m_FixtureTypeList As ObservableCollection(Of FixtureListItem)
|
||||
Public ReadOnly Property FixtureTypeList As ObservableCollection(Of FixtureListItem)
|
||||
Get
|
||||
If IsNothing(m_FixtureTypeList) Then
|
||||
m_FixtureTypeList = New ObservableCollection(Of FixtureListItem)(FixtureType.ReadFixtureTypeFromMachIni())
|
||||
End If
|
||||
Return m_FixtureTypeList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SelectedFixtureType As FixtureListItem
|
||||
Public Property SelectedFixtureType As FixtureListItem
|
||||
Get
|
||||
Return m_SelectedFixtureType
|
||||
End Get
|
||||
Set(value As FixtureListItem)
|
||||
m_SelectedFixtureType = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Private m_FixtureErrorMsg As String
|
||||
Public ReadOnly Property FixtureErrorMsg As String
|
||||
Get
|
||||
Return m_FixtureErrorMsg
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property OkMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 1)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
Sub New(ByRef ExpandFixtureFunction As Action)
|
||||
ExpandFixtureFunction = AddressOf UpdateFixtureCount
|
||||
' seleziono secondo elemento se presente perchè primo è categoria
|
||||
SelectedFixtureType = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateFixtureCount()
|
||||
' resetto tutto
|
||||
For Index = 0 To m_FixtureTypeList.Count - 1
|
||||
If TypeOf m_FixtureTypeList(Index) Is FixtureType Then
|
||||
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
|
||||
CurrFixtureType.UsedNumber = 0
|
||||
End If
|
||||
Next
|
||||
' calcolo i sottopezzi utilizzati in questa fase
|
||||
Dim nUsedFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nUsedFixtureId <> GDB_ID.NULL
|
||||
Dim sUsedFixtureName As String = String.Empty
|
||||
For Index = 0 To m_FixtureTypeList.Count - 1
|
||||
EgtGetName(nUsedFixtureId, sUsedFixtureName)
|
||||
If sUsedFixtureName = m_FixtureTypeList(Index).Name Then
|
||||
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
|
||||
CurrFixtureType.UsedNumber += 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
nUsedFixtureId = EgtGetNextFixture(nUsedFixtureId)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdAdd As ICommand
|
||||
Private m_cmdRemove As ICommand
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "AddCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Done.
|
||||
''' </summary>
|
||||
Public ReadOnly Property AddCommand As ICommand
|
||||
Get
|
||||
If m_cmdAdd Is Nothing Then
|
||||
m_cmdAdd = New RelayCommand(AddressOf Add)
|
||||
End If
|
||||
Return m_cmdAdd
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the DoneCommand.
|
||||
''' </summary>
|
||||
Public Sub Add(ByVal param As Object)
|
||||
' resetto il messaggio di errore
|
||||
m_FixtureErrorMsg = String.Empty
|
||||
' verifico se è stato selezionato un sottopezzo nella lista
|
||||
Dim SelectedFixture As FixtureType
|
||||
If TypeOf param Is FixtureType Then
|
||||
SelectedFixture = DirectCast(param, FixtureType)
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
' recupero area della tavola
|
||||
Dim ptTableMin As Point3d
|
||||
Dim ptTableMax As Point3d
|
||||
EgtGetTableArea(1, ptTableMin, ptTableMax)
|
||||
' calcolo il centro della tavola
|
||||
Dim ptTableMid As New Point3d((ptTableMax.x - ptTableMin.x) / 2, (ptTableMax.y - ptTableMin.y) / 2, (ptTableMax.z - ptTableMin.z) / 2)
|
||||
' posiziono il nuovo sottopezzo al centro della tavola
|
||||
Dim nAddedFixtureId As Integer = EgtAddFixture(SelectedFixture.Name, ptTableMid, 0, 0)
|
||||
' verifico se è in una posizione valida
|
||||
If Not DispositionUtility.VerifyFixturePosition(nAddedFixtureId, New Vector3d) Then
|
||||
' creo un gruppo temporaneo
|
||||
Dim nTempGroupId As Integer = EgtCreateGroup(GDB_ID.ROOT)
|
||||
EgtSetLevel(nTempGroupId, GDB_LV.USER)
|
||||
EgtSetMode(nTempGroupId, GDB_MD.STD)
|
||||
' calcolo ingombro sottopezzo aggiunto
|
||||
Dim bboxAddedFixture As New BBox3d
|
||||
EgtGetBBoxGlob(nAddedFixtureId, GDB_BB.STANDARD, bboxAddedFixture)
|
||||
' calcolo bbox tavolo
|
||||
Dim bboxTableArea As New BBox3d(ptTableMin, ptTableMax)
|
||||
bboxTableArea.Expand(-bboxAddedFixture.DimX / 2, -bboxAddedFixture.DimY / 2, 0)
|
||||
' creo superficie delle misure della tavola
|
||||
Dim nTableFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, bboxTableArea.Min, bboxTableArea.Max)
|
||||
' ciclo su tutti i pezzi di questa fase
|
||||
Dim nFixtureId As Integer = EgtGetFirstFixture()
|
||||
While nFixtureId <> GDB_ID.NULL
|
||||
' creo il bbox del sottopezzo
|
||||
Dim bboxFixture As New BBox3d
|
||||
EgtGetBBoxGlob(nFixtureId, GDB_BB.STANDARD, bboxFixture)
|
||||
' faccio offset del bbox del sottopezzo per includere metà del sottopezzo da aggiungere
|
||||
bboxFixture.Expand(bboxAddedFixture.DimX / 2, bboxAddedFixture.DimY / 2, 0)
|
||||
' lo porto all'altezza della tavola
|
||||
Dim ptMinFixtureFr As New Point3d(bboxFixture.Min)
|
||||
Dim ptMaxFixtureFr As New Point3d(bboxFixture.Max)
|
||||
ptMinFixtureFr.z = ptTableMin.z
|
||||
ptMaxFixtureFr.z = ptTableMin.z
|
||||
' creo la regione occupata dal bbox del sottopezzo
|
||||
Dim nFixtureFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, ptMinFixtureFr, ptMaxFixtureFr)
|
||||
' sottraggo la regione del sottopezzo da quella della tavola
|
||||
Dim x = EgtSurfFrSubtract(nTableFrId, nFixtureFrId)
|
||||
nFixtureId = EgtGetNextFixture(nFixtureId)
|
||||
End While
|
||||
' creo gruppo con i bordi della regione di tavola avanzata
|
||||
Dim TableFrBorderGroupId As Integer = EgtCreateGroup(nTempGroupId)
|
||||
Dim nTableFrBorderCount As Integer = 0
|
||||
Dim nChunk As Integer=EgtSurfFrChunkCount(nTableFrId)
|
||||
For Index = 0 To nChunk - 1
|
||||
EgtExtractSurfFrChunkLoops(nTableFrId, Index, TableFrBorderGroupId, nTableFrBorderCount)
|
||||
Next
|
||||
' verifico se c'è almeno un bordo
|
||||
If nTableFrBorderCount = 0 Then
|
||||
m_FixtureErrorMsg = "Impossibile posizionare la ventosa sulla tavola"
|
||||
OnPropertyChanged("FixtureErrorMsg")
|
||||
Return
|
||||
End If
|
||||
' converto il punto medio della tavola in coordinate globali
|
||||
Dim PtTableRef As Point3d
|
||||
EgtGetTableRef(1, PtTableRef)
|
||||
Dim frTableRef As New Frame3d(PtTableRef)
|
||||
ptTableMid.ToGlob(frTableRef)
|
||||
' ciclo sui bordi per trovare il punto più vicino
|
||||
Dim dMinDist As Double = (bboxTableArea.Max - bboxTableArea.Min).SqLenXY
|
||||
Dim ptMinAbs As Point3d
|
||||
Dim BorderId As Integer = EgtGetFirstInGroup(TableFrBorderGroupId)
|
||||
While BorderId <> GDB_ID.NULL
|
||||
Dim dDist As Double = 0
|
||||
Dim ptMinRel As Point3d
|
||||
Dim nSide As Integer = 0
|
||||
EgtGetMinDistPntSidePointCurve(ptTableMid, BorderId, Vector3d.Z_AX, dDist, ptMinRel, nSide)
|
||||
If dDist < dMinDist Then
|
||||
dMinDist = dDist
|
||||
ptMinAbs = ptMinRel
|
||||
End If
|
||||
BorderId = EgtGetNext(BorderId)
|
||||
End While
|
||||
' sposto il sottopezzo nel punto trovato
|
||||
Dim vtFixtureMove As Vector3d = ptMinAbs - ptTableMid
|
||||
vtFixtureMove.z = 0
|
||||
EgtMoveFixture(nAddedFixtureId, vtFixtureMove)
|
||||
' cancello il gruppo temporaneo
|
||||
EgtErase(nTempGroupId)
|
||||
End If
|
||||
' sottraggo la ventosa aggiunta dal conto di quelle disponibili
|
||||
SelectedFixture.UsedNumber += 1
|
||||
EgtDraw()
|
||||
OnPropertyChanged("FixtureErrorMsg")
|
||||
End Sub
|
||||
|
||||
#End Region ' AddCommand
|
||||
|
||||
#Region "RemoveCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Done.
|
||||
''' </summary>
|
||||
Public ReadOnly Property RemoveCommand As ICommand
|
||||
Get
|
||||
If m_cmdRemove Is Nothing Then
|
||||
m_cmdRemove = New RelayCommand(AddressOf Remove)
|
||||
End If
|
||||
Return m_cmdRemove
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the DoneCommand.
|
||||
''' </summary>
|
||||
Public Sub Remove()
|
||||
Dim SelectedFixtureId As Integer = EgtGetFirstSelectedObj()
|
||||
While SelectedFixtureId <> GDB_ID.NULL
|
||||
Dim NextSelectedId As Integer = EgtGetNextSelectedObj()
|
||||
If EgtVerifyFixture(SelectedFixtureId) Then
|
||||
EgtRemoveFixture(SelectedFixtureId)
|
||||
For Index = 0 To FixtureTypeList.Count - 1
|
||||
Dim SelFixtureName As String = String.Empty
|
||||
EgtGetName(SelectedFixtureId, SelFixtureName)
|
||||
If SelFixtureName = FixtureTypeList(Index).Name Then
|
||||
Dim CurrFixtureType As FixtureType = DirectCast(FixtureTypeList(Index), FixtureType)
|
||||
CurrFixtureType.UsedNumber -= 1
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
SelectedFixtureId = NextSelectedId
|
||||
End While
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
#End Region ' RemoveCommand
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
Public Class FixtureType
|
||||
Inherits FixtureListItem
|
||||
|
||||
Private m_TotalNumber As Integer
|
||||
Private m_UsedNumber As Integer
|
||||
Private m_IsEnabled As Boolean = True
|
||||
Private m_IsSelected As Boolean = False
|
||||
|
||||
Public Property TotalNumber As Integer
|
||||
Get
|
||||
Return m_TotalNumber
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
If value <> m_TotalNumber Then
|
||||
m_TotalNumber = value
|
||||
NotifyPropertyChanged("UsedTotalRatio")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public Property UsedNumber As Integer
|
||||
Get
|
||||
Return m_UsedNumber
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
If value <> m_UsedNumber Then
|
||||
m_UsedNumber = value
|
||||
NotifyPropertyChanged("UsedTotalRatio")
|
||||
If UsedNumber >= TotalNumber Then
|
||||
m_IsEnabled = False
|
||||
m_IsSelected = False
|
||||
NotifyPropertyChanged("IsSelected")
|
||||
Else
|
||||
m_IsEnabled = True
|
||||
End If
|
||||
NotifyPropertyChanged("IsEnabled")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property UsedTotalRatio As String
|
||||
Get
|
||||
Return (TotalNumber - UsedNumber).ToString & " / " & TotalNumber.ToString
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property IsEnabled As Boolean
|
||||
Get
|
||||
Return m_IsEnabled
|
||||
End Get
|
||||
End Property
|
||||
Public Property IsSelected As Boolean
|
||||
Get
|
||||
Return m_IsSelected
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsSelected = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(sName As String, sCat As DispositionUtility.FIX_TYPE, nTot As Integer)
|
||||
MyBase.New(sName, sCat)
|
||||
TotalNumber = nTot
|
||||
m_IsEnabled = True
|
||||
End Sub
|
||||
|
||||
Public Shared Function ReadFixtureTypeFromMachIni() As List(Of FixtureListItem)
|
||||
' creo la lista locale
|
||||
Dim FixtureTypeList As New List(Of FixtureListItem)
|
||||
' aggiungo le ventose se presenti
|
||||
Dim sName As String = String.Empty
|
||||
Dim nTot As Integer = 0
|
||||
Dim bFirst As Boolean = True
|
||||
Dim nIndex As Integer = 1
|
||||
While GetPrivateProfileFixture(S_FIXTURES, System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(FIX_VAC) & nIndex, sName, nTot)
|
||||
If bFirst Then
|
||||
FixtureTypeList.Add(New FixtureListItem(FIX_VAC, DispositionUtility.FIX_TYPE.VACUUM))
|
||||
bFirst = False
|
||||
End If
|
||||
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VACUUM, nTot))
|
||||
nIndex += 1
|
||||
End While
|
||||
' aggiungo i riferimenti se presenti
|
||||
bFirst = True
|
||||
nIndex = 1
|
||||
While GetPrivateProfileFixture(S_FIXTURES, FIX_REF & nIndex, sName, nTot)
|
||||
If bFirst Then
|
||||
FixtureTypeList.Add(New FixtureListItem(FIX_REF, DispositionUtility.FIX_TYPE.REFERENCE))
|
||||
bFirst = False
|
||||
End If
|
||||
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.REFERENCE, nTot))
|
||||
nIndex += 1
|
||||
End While
|
||||
' aggiungo le morse se presenti
|
||||
bFirst = True
|
||||
nIndex = 1
|
||||
While GetPrivateProfileFixture(S_FIXTURES, FIX_VIS & nIndex, sName, nTot)
|
||||
If bFirst Then
|
||||
FixtureTypeList.Add(New FixtureListItem(FIX_VIS, DispositionUtility.FIX_TYPE.VISE))
|
||||
bFirst = False
|
||||
End If
|
||||
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VISE, nTot))
|
||||
nIndex += 1
|
||||
End While
|
||||
Return FixtureTypeList
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Public Class FixtureListItem
|
||||
Implements INotifyPropertyChanged
|
||||
|
||||
Private m_Name As String
|
||||
Private m_Cathegory As DispositionUtility.FIX_TYPE
|
||||
Private m_Focusable As Boolean
|
||||
|
||||
Public Property Name As String
|
||||
Get
|
||||
Return m_Name
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Name = value
|
||||
End Set
|
||||
End Property
|
||||
Public Property Cathegory As DispositionUtility.FIX_TYPE
|
||||
Get
|
||||
Return m_Cathegory
|
||||
End Get
|
||||
Set(value As DispositionUtility.FIX_TYPE)
|
||||
m_Cathegory = value
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property Focusable As Boolean
|
||||
Get
|
||||
Return m_Focusable
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CathegoryName As String
|
||||
Get
|
||||
Select Case Cathegory
|
||||
Case DispositionUtility.FIX_TYPE.VACUUM
|
||||
Return "Vacuum"
|
||||
Case DispositionUtility.FIX_TYPE.REFERENCE
|
||||
Return "Reference"
|
||||
Case DispositionUtility.FIX_TYPE.VISE
|
||||
Return "Vise"
|
||||
Case Else
|
||||
Return String.Empty
|
||||
End Select
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New(sName As String, Cathegory As DispositionUtility.FIX_TYPE)
|
||||
Me.Name = sName
|
||||
Me.Cathegory = Cathegory
|
||||
If TypeOf Me Is FixtureType Then
|
||||
m_Focusable = True
|
||||
Else
|
||||
m_Focusable = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="RawPartOptionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<CheckBox Content="Move with Fixture" IsChecked="{Binding MoveWithFixture, Mode=TwoWay}"/>
|
||||
<UniformGrid Columns="2" Margin="0,5,0,0">
|
||||
<Button Content="New" Command="{Binding NewRawPartCommand}"/>
|
||||
<Button Content="Remove" Command="{Binding RemoveRawPartCommand}"/>
|
||||
</UniformGrid>
|
||||
<Grid Visibility="{Binding RawPartParamVisibility, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<UniformGrid Grid.Row="0" Columns="2">
|
||||
<TextBlock Text="{Binding LenghtMsg}"/>
|
||||
<TextBox Text="{Binding Lenght}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Grid.Row="1" Columns="2">
|
||||
<TextBlock Text="{Binding WidthMsg}"/>
|
||||
<TextBox Text="{Binding Width}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Grid.Row="2" Columns="2">
|
||||
<TextBlock Text="{Binding HeightMsg}"/>
|
||||
<TextBox Text="{Binding Height}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Grid.Row="3" Columns="2">
|
||||
<TextBlock Text="{Binding PositionMsg}"/>
|
||||
<TextBox Text="{Binding Position}"/>
|
||||
</UniformGrid>
|
||||
<Button Grid.Row="4" Content="Ok" Command="{Binding OkCommand}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Public Class RawPartOptionView
|
||||
|
||||
End Class
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class RawPartOptionViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
Private m_MoveWithFixture As Boolean = False
|
||||
Public Property MoveWithFixture As Boolean
|
||||
Get
|
||||
Return m_MoveWithFixture
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_MoveWithFixture Then
|
||||
If value Then
|
||||
' Abilito la selezione di RawPart con autoselezione delle sue ventose
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
|
||||
' Seleziono le ventose associate ad uno dei grezzi selezionati
|
||||
' ciclo sui grezzi selezionati
|
||||
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelRawPartId <> GDB_ID.NULL
|
||||
' seleziono i sottopezzi del grezzo
|
||||
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
|
||||
nSelRawPartId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
Else
|
||||
' Abilito la selezione di RawPart
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
|
||||
' ciclo sui grezzi selezionati
|
||||
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
|
||||
While nSelRawPartId <> GDB_ID.NULL
|
||||
' deseleziono i sottopezzi del grezzo
|
||||
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
|
||||
nSelRawPartId = EgtGetNextSelectedObj()
|
||||
End While
|
||||
End If
|
||||
EgtDraw()
|
||||
m_MoveWithFixture = value
|
||||
OnPropertyChanged("MoveWithFixture")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_bRawPartParamVisibility As Visibility
|
||||
Public ReadOnly Property RawPartParamVisibility As Visibility
|
||||
Get
|
||||
Return m_bRawPartParamVisibility
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property NewMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 3)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property RemoveMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 4)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property LenghtMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 5)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property WidthMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 6)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property HeightMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 7)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property PositionMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_DISPOSITION + 8)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewRawPart As ICommand
|
||||
Private m_cmdRemoveRawPart As ICommand
|
||||
|
||||
Sub New()
|
||||
If EgtGetFirstSelectedObj() <> GDB_ID.NULL Then
|
||||
m_bRawPartParamVisibility = Visibility.Visible
|
||||
Else
|
||||
m_bRawPartParamVisibility = Visibility.Collapsed
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewRawPartCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Done.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewRawPartCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewRawPart Is Nothing Then
|
||||
m_cmdNewRawPart = New RelayCommand(AddressOf NewRawPart)
|
||||
End If
|
||||
Return m_cmdNewRawPart
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the DoneCommand.
|
||||
''' </summary>
|
||||
Public Sub NewRawPart()
|
||||
DispositionUtility.ShowParts()
|
||||
m_bRawPartParamVisibility = Visibility.Visible
|
||||
OnPropertyChanged("RawPartParamVisibility")
|
||||
End Sub
|
||||
|
||||
#End Region ' NewRawPartCommand
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
+499
@@ -0,0 +1,499 @@
|
||||
<UserControl x:Class="MachiningParameterExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
|
||||
|
||||
<UserControl.Resources>
|
||||
<EgtCAM5:OperationParamVisibilityConverter x:Key="OperationParamVisibilityConverter"/>
|
||||
<EgtCAM5:DepthUnitConverter x:Key="DepthUnitConverter"/>
|
||||
<sys:Int32 x:Key="Invert">0</sys:Int32>
|
||||
<sys:Int32 x:Key="LeaveTab">1</sys:Int32>
|
||||
<sys:Int32 x:Key="WorkSide">2</sys:Int32>
|
||||
<sys:Int32 x:Key="HeadSide">3</sys:Int32>
|
||||
<sys:Int32 x:Key="LeadInType">4</sys:Int32>
|
||||
<sys:Int32 x:Key="ExtLinkType">5</sys:Int32>
|
||||
<sys:Int32 x:Key="LeadOutType">6</sys:Int32>
|
||||
<sys:Int32 x:Key="CurveUse">7</sys:Int32>
|
||||
<sys:Int32 x:Key="StepType">8</sys:Int32>
|
||||
<sys:Int32 x:Key="LeadLinkType">9</sys:Int32>
|
||||
<sys:Int32 x:Key="Speed">10</sys:Int32>
|
||||
<sys:Int32 x:Key="Feed">11</sys:Int32>
|
||||
<sys:Int32 x:Key="StartFeed">12</sys:Int32>
|
||||
<sys:Int32 x:Key="EndFeed">13</sys:Int32>
|
||||
<sys:Int32 x:Key="TipFeed">14</sys:Int32>
|
||||
<sys:Int32 x:Key="OffSr">15</sys:Int32>
|
||||
<sys:Int32 x:Key="OffSl">16</sys:Int32>
|
||||
<sys:Int32 x:Key="SideAngle">17</sys:Int32>
|
||||
<sys:Int32 x:Key="Approx">18</sys:Int32>
|
||||
<sys:Int32 x:Key="StartPos">19</sys:Int32>
|
||||
<sys:Int32 x:Key="StartSlowLen">20</sys:Int32>
|
||||
<sys:Int32 x:Key="EndSlowLen">21</sys:Int32>
|
||||
<sys:Int32 x:Key="ThrouAddLen">22</sys:Int32>
|
||||
<sys:Int32 x:Key="StepPar">23</sys:Int32>
|
||||
<sys:Int32 x:Key="ReturnPos">24</sys:Int32>
|
||||
<sys:Int32 x:Key="TabLen">25</sys:Int32>
|
||||
<sys:Int32 x:Key="TabDist">26</sys:Int32>
|
||||
<sys:Int32 x:Key="TabHeight">27</sys:Int32>
|
||||
<sys:Int32 x:Key="TabAngle">28</sys:Int32>
|
||||
<sys:Int32 x:Key="LiTang">29</sys:Int32>
|
||||
<sys:Int32 x:Key="LiPerp">30</sys:Int32>
|
||||
<sys:Int32 x:Key="LiElev">31</sys:Int32>
|
||||
<sys:Int32 x:Key="LiCompLen">32</sys:Int32>
|
||||
<sys:Int32 x:Key="LoTang">33</sys:Int32>
|
||||
<sys:Int32 x:Key="LoPerp">34</sys:Int32>
|
||||
<sys:Int32 x:Key="LoElev">35</sys:Int32>
|
||||
<sys:Int32 x:Key="LoCompLen">36</sys:Int32>
|
||||
<sys:Int32 x:Key="StartAddLen">37</sys:Int32>
|
||||
<sys:Int32 x:Key="EndAddLen">38</sys:Int32>
|
||||
<sys:Int32 x:Key="StepExtArc">39</sys:Int32>
|
||||
<sys:Int32 x:Key="StepIntArc">40</sys:Int32>
|
||||
<sys:Int32 x:Key="SideStep">41</sys:Int32>
|
||||
<sys:Int32 x:Key="VertFeed">42</sys:Int32>
|
||||
<sys:Int32 x:Key="NamePar">43</sys:Int32>
|
||||
<sys:Int32 x:Key="Tool">44</sys:Int32>
|
||||
<sys:Int32 x:Key="DepthStr">45</sys:Int32>
|
||||
<sys:Int32 x:Key="UserNotes">46</sys:Int32>
|
||||
<sys:Int32 x:Key="OverLapStr">47</sys:Int32>
|
||||
<sys:Int32 x:Key="OffsetStr">48</sys:Int32>
|
||||
<sys:Int32 x:Key="SubType">49</sys:Int32>
|
||||
<sys:Int32 x:Key="SolChoiceType">50</sys:Int32>
|
||||
<sys:Int32 x:Key="AxRotRef">51</sys:Int32>
|
||||
<sys:Int32 x:Key="BlockedAxesRef">52</sys:Int32>
|
||||
<sys:Int32 x:Key="FaceUseType">53</sys:Int32>
|
||||
<sys:Int32 x:Key="InvertToolDir">54</sys:Int32>
|
||||
<sys:Int32 x:Key="ExpanderLeadIn">55</sys:Int32>
|
||||
<sys:Int32 x:Key="ExpanderLeadOut">56</sys:Int32>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel Name="OperationParametersStackPanel">
|
||||
<StackPanel Name="OperationFirstParametersStackPanel">
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource DepthStr}}">
|
||||
<TextBlock Text="{Binding DepthMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding DepthStr, UpdateSourceTrigger=PropertyChanged,
|
||||
Converter={StaticResource DepthUnitConverter}}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Height="20" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Invert}}">
|
||||
<TextBlock Text="{Binding InvertMsg}"/>
|
||||
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsChecked="{Binding Invert}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource HeadSide}}">
|
||||
<TextBlock Text="{Binding HeadSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding HeadSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedHeadSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource WorkSide}}">
|
||||
<TextBlock Text="{Binding WorkSideMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding WorkSideList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedWorkSide}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource UserNotes}}">
|
||||
<TextBlock Text="{Binding UserNotesMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding UserNotes, UpdateSourceTrigger=PropertyChanged}">
|
||||
<EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
<TextBlock Text="{Binding UserNotesTooltip}"/>
|
||||
</EgtWPFLib5:EgtTextBox.ToolTip>
|
||||
</EgtWPFLib5:EgtTextBox>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<StackPanel Name="AutomaticCloseExpanderStackPanel">
|
||||
<Expander Header="{Binding GenericExpanderHeader}" Name="GenericExpander"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1">
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StartPos}}">
|
||||
<TextBlock Text="{Binding StartPosMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StartPos, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource ReturnPos}}">
|
||||
<TextBlock Text="{Binding ReturnPosMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding ReturnPos, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource OverLapStr}}">
|
||||
<TextBlock Text="{Binding OverLapMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding OverLap, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource ThrouAddLen}}">
|
||||
<TextBlock Text="{Binding ThrouAddLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding ThrouAddLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StepType}}">
|
||||
<TextBlock Text="{Binding StepTypeMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding StepTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedStepType}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource SubType}}">
|
||||
<TextBlock Text="{Binding SubTypeMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding SubTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedSubType}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StepPar}}">
|
||||
<TextBlock Text="{Binding StepParMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StepPar, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource SideStep}}">
|
||||
<TextBlock Text="{Binding SideStepMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SideStep, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StartSlowLen}}">
|
||||
<TextBlock Text="{Binding StartSlowLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StartSlowLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource EndSlowLen}}">
|
||||
<TextBlock Text="{Binding EndSlowLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding EndSlowLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource SideAngle}}">
|
||||
<TextBlock Text="{Binding SideAngleMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding SideAngle, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource OffSr}}">
|
||||
<TextBlock Text="{Binding OffsetSrMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding OffSr, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource OffSl}}">
|
||||
<TextBlock Text="{Binding OffsetSlMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding OffSl, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander Header="{Binding AdvancedParamMsg}" Name="AdvancedParam"
|
||||
Style="{StaticResource ExpanderStyle}" Margin="0,1,0,1"
|
||||
Visibility="{Binding Type, Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource AxRotRef}}">
|
||||
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Height="20" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource InvertToolDir}}">
|
||||
<TextBlock Text="{Binding InvertToolDirMsg}"/>
|
||||
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
IsChecked="{Binding ToolInvert}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource FaceUseType}}">
|
||||
<TextBlock Text="{Binding FaceUseTypeMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding FaceUseTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedFaceUseType}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource AxRotRef}}">
|
||||
<TextBlock Text="{Binding InitAngsMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding InitAngs, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource BlockedAxesRef}}">
|
||||
<TextBlock Text="{Binding BlockedAxisMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding BlockedAxis, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource SolChoiceType}}">
|
||||
<TextBlock Text="{Binding SolChoiceTypeMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding SolChoiceTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedSolChoiceType}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
|
||||
</Expander>
|
||||
|
||||
<Expander Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource ExpanderLeadIn}}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding LeadInTypeMsg}" Margin="0,0,5,0"/>
|
||||
<ComboBox ItemsSource="{Binding LeadInTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedLeadInType,Mode=TwoWay}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LeadInType}}">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StartAddLen}}">
|
||||
<TextBlock Text="{Binding StartAddLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StartAddLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LiTang}}">
|
||||
<TextBlock Text="{Binding LiTangMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LiTang, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LiPerp}}">
|
||||
<TextBlock Text="{Binding LiPerpMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LiPerp, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LiElev}}">
|
||||
<TextBlock Text="{Binding LiElevMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LiElev, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LiCompLen}}">
|
||||
<TextBlock Text="{Binding LiCompLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LiCompLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource ExpanderLeadOut}}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding LeadOutTypeMsg}" Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding LeadOutTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedLeadOutType}"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LeadOutType}}">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
</Expander.Header>
|
||||
<StackPanel Margin="2">
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource EndAddLen}}">
|
||||
<TextBlock Text="{Binding EndAddLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding EndAddLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LoTang}}">
|
||||
<TextBlock Text="{Binding LoTangMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LoTang, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LoPerp}}">
|
||||
<TextBlock Text="{Binding LoPerpMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LoPerp, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LoElev}}">
|
||||
<TextBlock Text="{Binding LoElevMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LoElev, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LoCompLen}}">
|
||||
<TextBlock Text="{Binding LoCompLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding LoCompLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource ExtLinkType}}">
|
||||
<TextBlock Text="{Binding ExtLinkTypeMsg}"/>
|
||||
<ComboBox ItemsSource="{Binding ExtLinkTypeList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedExtLinkType}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
<Expander Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource CurveUse}}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding CurveUseMsg}" Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding CurveUseList, Mode=OneWay}"
|
||||
SelectedIndex="{Binding SelectedCurveUse}"
|
||||
IsSynchronizedWithCurrentItem="True">
|
||||
</ComboBox>
|
||||
</UniformGrid>
|
||||
</Expander.Header>
|
||||
<StackPanel Margin="2">
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Approx}}">
|
||||
<TextBlock Text="{Binding ApproxMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Approx, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StepExtArc}}">
|
||||
<TextBlock Text="{Binding StepExtArcMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StepExtArc, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StepIntArc}}">
|
||||
<TextBlock Text="{Binding StepIntArcMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StepIntArc, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource LeaveTab}}"
|
||||
Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<UniformGrid Columns="2">
|
||||
<TextBlock Text="{Binding LeaveTabMsg}"/>
|
||||
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding LeaveTab}" />
|
||||
</UniformGrid>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource TabLen}}">
|
||||
<TextBlock Text="{Binding TabLenMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding TabLen, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource TabHeight}}">
|
||||
<TextBlock Text="{Binding TabHeightMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding TabHeight, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource TabAngle}}">
|
||||
<TextBlock Text="{Binding TabAngleMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding TabAngle, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2" Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource TabDist}}">
|
||||
<TextBlock Text="{Binding TabDistMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding TabDist, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Style="{StaticResource ExpanderStyle}">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="{Binding ToolExpanderHeader}"/>
|
||||
</Expander.Header>
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Speed}}">
|
||||
<TextBlock Text="{Binding SpeedMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Speed, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource Feed}}">
|
||||
|
||||
<TextBlock Text="{Binding FeedMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding Feed, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource TipFeed}}">
|
||||
<TextBlock Text="{Binding TipFeedMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding TipFeed, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource StartFeed}}">
|
||||
<TextBlock Text="{Binding StartFeedMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding StartFeed, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
<UniformGrid Columns="2"
|
||||
Visibility="{Binding Type,
|
||||
Converter={StaticResource OperationParamVisibilityConverter},
|
||||
ConverterParameter={StaticResource EndFeed}}">
|
||||
<TextBlock Text="{Binding EndFeedMsg}"/>
|
||||
<EgtWPFLib5:EgtTextBox Text="{Binding EndFeed, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<EgtCAM5:AutomaticCloseExpander/>
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
</StackPanel>
|
||||
<Button Name="ApplyMachBtn" Height="30" Content="{Binding UpdateMachiningBtnMsg}"
|
||||
Command="{Binding UpdateMachiningCommand}" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ToggleButton Name="ViewToolBtn" Grid.Column="0" Height="30" Content="{Binding ViewToolBtnMsg}"
|
||||
IsChecked="{Binding ViewTool}" />
|
||||
<Button Name="NextStepToolBtn" Grid.Column="1" Height="30" Content="{Binding NextStepToolBtnMsg}"
|
||||
Command="{Binding NextStepToolCommand}" IsEnabled="{Binding IsChecked, ElementName=ViewToolBtn}"/>
|
||||
<Button Name="PrevStepToolBtn" Grid.Column="2" Height="30" Content="{Binding PrevStepToolBtnMsg}"
|
||||
Command="{Binding PrevStepToolCommand}" IsEnabled="{Binding IsChecked, ElementName=ViewToolBtn}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtWPFLib5.EgtFloating
|
||||
|
||||
Public Class MachiningParameterExpanderView
|
||||
|
||||
Private EgtFloatingTray As EgtFloatingTray
|
||||
Private EgtFloatingPanel As EgtFloatingPanel
|
||||
|
||||
Private m_bFirst As Boolean = True
|
||||
|
||||
Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
|
||||
If m_bFirst Then
|
||||
EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
|
||||
EgtFloatingPanel = FindAncestor(Of EgtFloatingPanel)(Me)
|
||||
AddHandler EgtFloatingTray.SizeChanged, AddressOf EgtFloatingTray_SizeChanged
|
||||
PanelHeight = EgtFloatingPanel.ActualHeight
|
||||
Me.AutomaticCloseExpanderStackPanelHeight = AutomaticCloseExpanderStackPanel.ActualHeight
|
||||
m_bFirst = False
|
||||
End If
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
End Sub
|
||||
|
||||
Dim m_bSizeChanging As Boolean = False
|
||||
|
||||
Private Sub EgtFloatingTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
|
||||
If m_bSizeChanging Then Return
|
||||
m_bSizeChanging = True
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
m_bSizeChanging = False
|
||||
End Sub
|
||||
|
||||
Dim PanelHeight As Double = 0
|
||||
Dim AutomaticCloseExpanderStackPanelHeight As Double = 0
|
||||
|
||||
Private Sub CalculateOperationParametersStackPanelMaxHeight()
|
||||
Dim AutomaticCloseExpanderStackPanelHeight As Double = 0
|
||||
Dim OpenedExpanderList As New List(Of Boolean)
|
||||
For Index = 0 To AutomaticCloseExpanderStackPanel.Children.Count - 1
|
||||
If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then
|
||||
Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander)
|
||||
If IndexedExpander.IsExpanded Then
|
||||
OpenedExpanderList.Add(True)
|
||||
IndexedExpander.IsExpanded = False
|
||||
Dim CurrExpanderContent As FrameworkElement = DirectCast(IndexedExpander.Content, FrameworkElement)
|
||||
CurrExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
AutomaticCloseExpanderStackPanelHeight -= CurrExpanderContent.DesiredSize.Height
|
||||
' Sottraggo anche i padding
|
||||
AutomaticCloseExpanderStackPanelHeight -= (IndexedExpander.Padding.Top + IndexedExpander.Padding.Bottom)
|
||||
Else
|
||||
OpenedExpanderList.Add(False)
|
||||
End If
|
||||
Else
|
||||
OpenedExpanderList.Add(False)
|
||||
End If
|
||||
Next
|
||||
Dim RemainingHeight As Double = EgtFloatingTray.ActualHeight - PanelHeight
|
||||
AutomaticCloseExpanderStackPanel.MaxHeight = Me.AutomaticCloseExpanderStackPanelHeight + RemainingHeight
|
||||
For Index = AutomaticCloseExpanderStackPanel.Children.Count - 1 To 0 Step -1
|
||||
If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then
|
||||
Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander)
|
||||
If OpenedExpanderList(Index) Then
|
||||
IndexedExpander.IsExpanded = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject
|
||||
Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T
|
||||
Dim target As DependencyObject = dependencyObject
|
||||
Do
|
||||
target = LogicalTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
If IsNothing(target) Then
|
||||
target = dependencyObject
|
||||
Do
|
||||
target = VisualTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
End If
|
||||
Return TryCast(target, T)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
+2572
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
<UserControl x:Class="OperationExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
|
||||
|
||||
<StackPanel Name="OperationExpanderViewStackPanel" IsEnabled="{Binding OperViewIsEnabled}">
|
||||
|
||||
<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>
|
||||
|
||||
<UniformGrid Rows="1">
|
||||
<Button Content="{Binding NewMachiningBtnContent}" Command="{Binding NewMachiningCommand}" Height="30"/>
|
||||
<Button Content="{Binding NewPositioningBtnContent}" Command="{Binding NewPositioningCommand}" Height="30"/>
|
||||
<Button Content="{Binding CancelOperationBtnContent}" Command="{Binding CancelOperationCommand}" Height="30"/>
|
||||
</UniformGrid>
|
||||
<ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding OperationList}" SelectedItem="{Binding SelectedOperation}"
|
||||
Height="200" x:Name="OperationList" IsEnabled="{Binding IsEnabledOperationList}">
|
||||
<ListBox.Resources>
|
||||
<DataTemplate DataType="{x:Type EgtCAM5:MachiningOpListBoxItem}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox IsChecked="{Binding Status}" Margin="0,0,5,0"/>
|
||||
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="0,0,5,0"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Info}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type EgtCAM5:DispositionOpListBoxItem}">
|
||||
<Border CornerRadius="1" Background="{StaticResource EgaltechBlue3}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Binding Name}" Foreground="White"
|
||||
FontSize="15" FontWeight="SemiBold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.Resources>
|
||||
<Interactivity:Interaction.Triggers>
|
||||
<Interactivity:EventTrigger EventName="MouseDoubleClick">
|
||||
<Interactivity:InvokeCommandAction Command="{Binding OperationListDoubleClickCommand}"/>
|
||||
</Interactivity:EventTrigger>
|
||||
</Interactivity:Interaction.Triggers>
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<EgtCAM5:ScrollIntoViewForListBox/>
|
||||
</Interactivity:Interaction.Behaviors>
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding CancelOperationCommand}"/>
|
||||
</ListBox.InputBindings>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
||||
<UniformGrid Rows="1">
|
||||
<Button Content="{Binding MoveUpMsg}" Command="{Binding MoveUpCommand}" Height="30"/>
|
||||
<Button Content="{Binding MoveDownMsg}" Command="{Binding MoveDownCommand}" Height="30"/>
|
||||
<Button Content="{Binding UpdateMsg}" Command="{Binding UpdateCommand}" Height="30"/>
|
||||
<Button Content="{Binding SetUpMsg}" Command="{Binding SetUpCommand}" Height="30"/>
|
||||
</UniformGrid>
|
||||
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Expander IsExpanded="{Binding ParametersIsExpanded}" Name="OperationParametersExpander"
|
||||
Style="{StaticResource ExpanderStyle}" Padding="3">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="{Binding ParametersExpanderName}"/>
|
||||
</Expander.Header>
|
||||
|
||||
<!--ContentPresenter that contains the OperationParameters-->
|
||||
<ContentPresenter Name="OperationParameters" Content="{Binding OperationParameters,Mode=OneWay}"/>
|
||||
|
||||
</Expander>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,109 @@
|
||||
Imports EgtWPFLib5
|
||||
Imports EgtWPFLib5.EgtFloating
|
||||
|
||||
Public Class OperationExpanderView
|
||||
|
||||
Private EgtFloatingTray As EgtFloatingTray
|
||||
Private OptionPanelView As UserControl
|
||||
Private OptionPanelViewStackPanel As StackPanel
|
||||
'Private OperationParameters As ContentPresenter
|
||||
Private MachiningTreeContentPresenter As ContentPresenter
|
||||
Private MachiningTreeUserControl As UserControl
|
||||
Private MachiningTreeExpander As Expander
|
||||
Private SimulationContentPresenter As ContentPresenter
|
||||
Private SimulationUserControl As UserControl
|
||||
Private SimulationExpanderStackPanel As StackPanel
|
||||
Private SimulationExpander As Expander
|
||||
Private GenerateButton As Button
|
||||
|
||||
Private m_bFirst As Boolean = True
|
||||
|
||||
Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
|
||||
If m_bFirst Then
|
||||
EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
|
||||
OptionPanelView = FindAncestor(Of UserControl)(Me)
|
||||
OptionPanelViewStackPanel = DirectCast(OptionPanelView.Content, StackPanel)
|
||||
MachiningTreeContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(1), ContentPresenter)
|
||||
MachiningTreeUserControl = DirectCast(MachiningTreeContentPresenter.Content, UserControl)
|
||||
MachiningTreeExpander = DirectCast(MachiningTreeUserControl.Content, Expander)
|
||||
SimulationContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(2), ContentPresenter)
|
||||
SimulationUserControl = DirectCast(SimulationContentPresenter.Content, UserControl)
|
||||
SimulationExpanderStackPanel = DirectCast(SimulationUserControl.Content, StackPanel)
|
||||
SimulationExpander = DirectCast(SimulationExpanderStackPanel.Children(0), Expander)
|
||||
GenerateButton = DirectCast(SimulationExpanderStackPanel.Children(1), Button)
|
||||
' Gestisco l'evento SizeChanged della Tray
|
||||
AddHandler EgtFloatingTray.SizeChanged, AddressOf OperationExpanderTray_SizeChanged
|
||||
m_bFirst = False
|
||||
End If
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
End Sub
|
||||
|
||||
Private Sub OperationExpanderTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
|
||||
CalculateOperationParametersStackPanelMaxHeight()
|
||||
'For Each Expander In OperationParametersStackPanel.Children
|
||||
' If TypeOf Expander Is Expander Then
|
||||
' Dim CurrExpander As Expander = DirectCast(Expander, Expander)
|
||||
' CurrExpander.IsExpanded = False
|
||||
' End If
|
||||
'Next
|
||||
End Sub
|
||||
|
||||
Private Sub CalculateOperationParametersStackPanelMaxHeight()
|
||||
Dim OccupiedHeight As Double = 0
|
||||
If Not MachiningTreeExpander.IsExpanded Then
|
||||
OccupiedHeight += MachiningTreeExpander.ActualHeight
|
||||
Else
|
||||
Dim MachiningTreeExpanderContent As FrameworkElement = DirectCast(MachiningTreeExpander.Content, FrameworkElement)
|
||||
MachiningTreeExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (MachiningTreeExpander.ActualHeight - MachiningTreeExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
If Not SimulationExpander.IsExpanded Then
|
||||
OccupiedHeight += SimulationExpander.ActualHeight
|
||||
Else
|
||||
Dim SimulationExpanderContent As FrameworkElement = DirectCast(SimulationExpander.Content, FrameworkElement)
|
||||
SimulationExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (SimulationExpander.ActualHeight - SimulationExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
OccupiedHeight += GenerateButton.ActualHeight
|
||||
'Aggiungo altezza OperationsList header Expander
|
||||
If Not OperationsListExpander.IsExpanded Then
|
||||
OccupiedHeight += OperationsListExpander.ActualHeight
|
||||
Else
|
||||
Dim OperationsListExpanderContent As FrameworkElement = DirectCast(OperationsListExpander.Content, FrameworkElement)
|
||||
OperationsListExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (OperationsListExpander.ActualHeight - OperationsListExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
If Not OperationParametersExpander.IsExpanded Then
|
||||
OccupiedHeight += OperationParametersExpander.ActualHeight
|
||||
Else
|
||||
Dim OperationParametersExpanderContent As FrameworkElement = DirectCast(OperationParametersExpander.Content, FrameworkElement)
|
||||
OperationParametersExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
OccupiedHeight += (OperationParametersExpander.ActualHeight - OperationParametersExpanderContent.DesiredSize.Height)
|
||||
End If
|
||||
'' Aggiungo altezza contenuto OperationParameters che però è fuori dallo Stackpanel
|
||||
'OperationFirstParametersStackPanel.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
|
||||
'If OperationFirstParametersStackPanel.DesiredSize.Height <> 0 Then
|
||||
' OccupiedHeight += OperationFirstParametersStackPanel.DesiredSize.Height
|
||||
'Else
|
||||
' ' aggiungo il valore calcolato provando se non viene calcolato dal sistema al momento
|
||||
' OccupiedHeight += 10
|
||||
'End If
|
||||
'OperationParametersStackPanel.MaxHeight = OptionPanelViewStackPanel.MaxHeight - OccupiedHeight
|
||||
End Sub
|
||||
|
||||
' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject
|
||||
Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T
|
||||
Dim target As DependencyObject = dependencyObject
|
||||
Do
|
||||
target = LogicalTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
If IsNothing(target) Then
|
||||
target = dependencyObject
|
||||
Do
|
||||
target = VisualTreeHelper.GetParent(target)
|
||||
Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
|
||||
End If
|
||||
Return TryCast(target, T)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,857 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class OperationExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
' Modalità di aggiunta attiva/disattiva
|
||||
Private m_NewMachining As Boolean = False
|
||||
|
||||
Private Sub StartNewMachining()
|
||||
m_NewMachining = True
|
||||
' Smarco la geometria eventualmente marcata
|
||||
If Not IsNothing(m_LastMarkedOperationId) Then EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
|
||||
' Deseleziono eventuali geometrie selezionate
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
' Blocco la lista operazioni
|
||||
IsEnabledOperationList = False
|
||||
' Abilito la selezione delle geometrie da lavorare
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
|
||||
' Abilito la selezione di curve e superfici
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.PARTCURVESANDSURFACES)
|
||||
' Abilito ed apro l'expander con l'albero delle lavorazioni
|
||||
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
|
||||
End Sub
|
||||
|
||||
Private Sub EndNewMachining(SelOpId As Integer)
|
||||
' Deseleziono eventuali geometrie selezionate
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
' Sblocco la lista operazioni
|
||||
IsEnabledOperationList = True
|
||||
' Disabilito e chiudo l'expander con l'albero delle lavorazioni
|
||||
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, False)
|
||||
' Disabilito la selezione
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
|
||||
' Disabilito la selezione di curve e superfici del pezzo
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
|
||||
' Apro i parametri della lavorazione aggiunta
|
||||
If SelOpId <> GDB_ID.NULL Then
|
||||
For Index = 0 To OperationList.Count - 1
|
||||
If OperationList(Index).Id = SelOpId Then
|
||||
SelectedOperation = OperationList(Index)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
ParametersIsExpanded = True
|
||||
m_NewMachining = False
|
||||
End Sub
|
||||
|
||||
Private m_NewPositioning As Boolean = False
|
||||
|
||||
' Ultima lavorazione evidenziata
|
||||
Private m_LastMarkedOperationId As Integer = GDB_ID.NULL
|
||||
|
||||
'Expander aperto tra quelli presenti nel MachiningOptionPanel
|
||||
Private m_CurrExpandedExpander As MachiningOptionPanelExpander = MachiningOptionPanelExpander.OPERATIONLIST
|
||||
Friend Enum MachiningOptionPanelExpander
|
||||
OPERATIONLIST
|
||||
OPERATIONPARAMETERS
|
||||
SIMULATION
|
||||
End Enum
|
||||
|
||||
Private m_OperViewIsEnabled As Boolean = True
|
||||
Public Property OperViewIsEnabled As Boolean
|
||||
Get
|
||||
Return m_OperViewIsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_OperViewIsEnabled = value
|
||||
OnPropertyChanged("OperViewIsEnabled")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ListIsExpanded As Boolean
|
||||
Public Property ListIsExpanded As Boolean
|
||||
Get
|
||||
Return m_ListIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_ListIsExpanded Then
|
||||
m_ListIsExpanded = value
|
||||
If value Then
|
||||
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS Then
|
||||
ParametersIsExpanded = False
|
||||
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
|
||||
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
|
||||
End If
|
||||
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST
|
||||
End If
|
||||
OnPropertyChanged("ListIsExpanded")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ParametersIsExpanded As Boolean
|
||||
Public Property ParametersIsExpanded As Boolean
|
||||
Get
|
||||
Return m_ParametersIsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_ParametersIsExpanded Then
|
||||
m_ParametersIsExpanded = value
|
||||
If value Then
|
||||
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
|
||||
ListIsExpanded = False
|
||||
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
|
||||
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
|
||||
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
|
||||
End If
|
||||
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
|
||||
If IsValidDispositionType(SelectedOperation.m_Type) Then
|
||||
ParametersExpanderName = m_SelectedOperation.Name
|
||||
' Abilito la selezione di tutti i tipi di geometria
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
|
||||
' Verifico se c'è un grezzo nella disposizione corrente
|
||||
Dim bFirstRaw As Boolean = True
|
||||
Dim nRawPartId As Integer = EgtGetFirstRawPart()
|
||||
While nRawPartId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
|
||||
bFirstRaw = False
|
||||
Exit While
|
||||
End If
|
||||
nRawPartId = EgtGetNextRawPart(nRawPartId)
|
||||
End While
|
||||
' Lancio funzione che inizializza la disposizione
|
||||
m_OpenDispositionFunction(bFirstRaw)
|
||||
' Nascondo tutte le lavorazioni
|
||||
Dim nOpId As Integer = EgtGetFirstOperation()
|
||||
While nOpId <> GDB_ID.NULL
|
||||
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
|
||||
EgtSetOperationStatus(nOpId, False)
|
||||
End If
|
||||
nOpId = EgtGetNextOperation(nOpId)
|
||||
End While
|
||||
EgtDraw()
|
||||
ElseIf IsValidMachiningType(SelectedOperation.m_Type) Then
|
||||
' Leggo il tipo di operazione per impostare il tipo di selezione
|
||||
EgtSetCurrMachining(SelectedOperation.m_Id)
|
||||
Dim sOpMach As String = String.Empty
|
||||
EgtGetMachiningParam(MCH_MP.NAME, sOpMach)
|
||||
ParametersExpanderName = m_SelectedOperation.Name & " (" & sOpMach & ")"
|
||||
Dim OperationType As Integer = -1
|
||||
EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
|
||||
' Abilito la selezione delle lavorazioni
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
|
||||
' Abilito la selezione dei giusti tipi di geometria
|
||||
Select Case OperationType
|
||||
Case MCH_OY.SAWING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawing)
|
||||
Case MCH_OY.DRILLING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomDrilling)
|
||||
Case MCH_OY.MILLING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMilling)
|
||||
Case MCH_OY.POCKETING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomPocketing)
|
||||
Case MCH_OY.MORTISING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMortising)
|
||||
Case MCH_OY.SAWROUGHING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawRoughing)
|
||||
Case MCH_OY.SAWFINISHING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawFinishing)
|
||||
Case MCH_OY.GENMACHINING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomGenMachining)
|
||||
Case MCH_OY.CHISELING
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomChiseling)
|
||||
End Select
|
||||
' Imposto visualizzazione utensile
|
||||
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = True
|
||||
End If
|
||||
Else
|
||||
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
|
||||
ListIsExpanded = True
|
||||
End If
|
||||
If SelectedOperation.m_Type = MCH_OY.DISP Then
|
||||
' Visualizzo tutte le lavorazioni della fase corrente
|
||||
Dim nCurrPhase = EgtGetCurrPhase()
|
||||
Dim nOpId As Integer = EgtGetFirstOperation()
|
||||
While nOpId <> GDB_ID.NULL
|
||||
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
|
||||
EgtSetOperationStatus(nOpId, (EgtGetOperationPhase(nOpId) = nCurrPhase))
|
||||
End If
|
||||
nOpId = EgtGetNextOperation(nOpId)
|
||||
End While
|
||||
EgtDraw()
|
||||
Else
|
||||
' Nascondo visualizzazione utensile
|
||||
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = False
|
||||
End If
|
||||
ParametersExpanderName = String.Empty
|
||||
' Disabilito la selezione delle lavorazioni
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
|
||||
' Resetto il tipo di selezione
|
||||
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
|
||||
End If
|
||||
OnPropertyChanged("ParametersIsExpanded")
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_ParametersExpanderName As String
|
||||
Public Property ParametersExpanderName As String
|
||||
Get
|
||||
If String.IsNullOrEmpty(m_ParametersExpanderName) Then
|
||||
Return EgtMsg(MSG_OPERATION + 2)
|
||||
Else
|
||||
Return m_ParametersExpanderName
|
||||
End If
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_ParametersExpanderName Then
|
||||
m_ParametersExpanderName = value
|
||||
End If
|
||||
OnPropertyChanged("ParametersExpanderName")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_IsEnabledOperationList As Boolean = True
|
||||
Public Property IsEnabledOperationList As Boolean
|
||||
Get
|
||||
Return m_IsEnabledOperationList
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsEnabledOperationList Then
|
||||
m_IsEnabledOperationList = value
|
||||
OnPropertyChanged("IsEnabledOperationList")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_OperationList As New ObservableCollection(Of OperationListBoxItem)
|
||||
Public Property OperationList As ObservableCollection(Of OperationListBoxItem)
|
||||
Get
|
||||
Return m_OperationList
|
||||
End Get
|
||||
Set(value As ObservableCollection(Of OperationListBoxItem))
|
||||
m_OperationList = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SelectedOperation As OperationListBoxItem
|
||||
Public Property SelectedOperation As OperationListBoxItem
|
||||
Get
|
||||
Return m_SelectedOperation
|
||||
End Get
|
||||
Set(value As OperationListBoxItem)
|
||||
If Not IsNothing(value) Then
|
||||
' Verifico se c'è l'operazione precedente
|
||||
If m_LastMarkedOperationId <> GDB_ID.NULL Then
|
||||
' La de-evidenzio
|
||||
Dim bEnabModif As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
|
||||
If bEnabModif Then EgtEnableModified()
|
||||
' Ne deseleziono la geometria
|
||||
EgtDeselectAll()
|
||||
End If
|
||||
' Imposto la fase di lavorazione corrente
|
||||
EgtSetCurrPhase(EgtGetOperationPhase(value.Id))
|
||||
' Verifico se l'operazione è una disposizione
|
||||
If EgtGetOperationType(value.Id) = MCH_OY.DISP Then
|
||||
'' Abilito la selezione delle Fixture
|
||||
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
|
||||
'' Abilito la selezione di tutti i tipi di geometria
|
||||
'Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
|
||||
' L'operazione è una lavorazione
|
||||
Else
|
||||
'' Disabilito la selezione di qualunque cosa
|
||||
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
|
||||
' Imposto come corrente la lavorazione(operazione) selezionata
|
||||
EgtSetCurrMachining(value.Id)
|
||||
' Evidenzio la lavorazione(operazione) selezionata
|
||||
'EgtSetMark(value.Id)
|
||||
Dim bEnabModif As Boolean = EgtGetEnableModified()
|
||||
EgtDisableModified()
|
||||
EgtSetMark(EgtGetFirstNameInGroup(value.Id, MCH_MGR_CL))
|
||||
If bEnabModif Then EgtEnableModified()
|
||||
' Seleziono la geometria della lavorazione
|
||||
Dim CountIndex = 0
|
||||
Dim EntityIndex As Integer = 0
|
||||
Dim SubEntityIndex As Integer = 0 ' Nell'interfaccia non si usa ma devo comunque definirla perchè la funzione la restituisce obbligatoriamente
|
||||
While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex)
|
||||
EgtSelectObj(EntityIndex)
|
||||
IniFile.m_LastSubEntityId = SubEntityIndex
|
||||
CountIndex += 1
|
||||
End While
|
||||
' La salvo come ultima operazione selezionata
|
||||
m_LastMarkedOperationId = value.Id
|
||||
End If
|
||||
m_SelectedOperation = value
|
||||
' Notifico al contentcontrol OperationParameter di aggiornarsi
|
||||
OnPropertyChanged("OperationParameters")
|
||||
' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili
|
||||
Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, value)
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
End If
|
||||
'OnPropertyChanged("ToolExpanderHeader")
|
||||
OnPropertyChanged("SelectedOperation")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Actions
|
||||
Private m_UpdateParamValues As Action
|
||||
Private m_OpenDispositionFunction As Action(Of Boolean)
|
||||
|
||||
Private m_MachiningParameterExpander As MachiningParameterExpanderView
|
||||
Private m_DispositionParameterExpander As DispositionParameterExpanderView
|
||||
Public ReadOnly Property OperationParameters As ContentControl
|
||||
Get
|
||||
If m_SelectedOperation.m_Type = MCH_OY.DISP Then
|
||||
If IsNothing(m_DispositionParameterExpander) Then
|
||||
m_DispositionParameterExpander = New DispositionParameterExpanderView
|
||||
m_DispositionParameterExpander.DataContext = New DispositionParameterExpanderViewModel(m_OpenDispositionFunction)
|
||||
End If
|
||||
Return m_DispositionParameterExpander
|
||||
Else
|
||||
If IsNothing(m_MachiningParameterExpander) Then
|
||||
m_MachiningParameterExpander = New MachiningParameterExpanderView
|
||||
m_MachiningParameterExpander.DataContext = New MachiningParameterExpanderViewModel(m_UpdateParamValues)
|
||||
End If
|
||||
m_UpdateParamValues()
|
||||
Return m_MachiningParameterExpander
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property OperationListHeader As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 1)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NewMachiningBtnContent As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 4)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property NewPositioningBtnContent As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 5)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property CancelOperationBtnContent As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 6)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MoveUpMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 8)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property MoveDownMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 9)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property UpdateMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_OPERATION + 10)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property SetUpMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SETUP + 1)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region ' Messages
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdNewMachining As ICommand
|
||||
Private m_cmdNewPositioning As ICommand
|
||||
Private m_cmdCancelOperation As ICommand
|
||||
Private m_cmdOperationListDoubleClick As ICommand
|
||||
Private m_cmdMoveUp As ICommand
|
||||
Private m_cmdMoveDown As ICommand
|
||||
Private m_cmdUpdate As ICommand
|
||||
Private m_cmdSetUp As ICommand
|
||||
|
||||
Sub New()
|
||||
Me.ListIsExpanded = True
|
||||
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
|
||||
LoadOperationList()
|
||||
SelectOperation(nSelectedOperation)
|
||||
ListIsExpanded = True
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.REMOVEMARKFROMLASTOPERATION, Sub()
|
||||
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.NEWMACHININGMODEISACTIVE, Sub(Params As NewMachOpParam)
|
||||
If Params.bActive Then
|
||||
StartNewMachining()
|
||||
Else
|
||||
EndNewMachining(Params.SelMachOpId)
|
||||
End If
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.OPERATIONVIEWEXPANDERISENABLED, Sub(bEnable As Boolean)
|
||||
OperViewIsEnabled = bEnable
|
||||
End Sub)
|
||||
|
||||
Application.Msn.Register(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
|
||||
If m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
|
||||
ListIsExpanded = True
|
||||
End If
|
||||
If bValue Then
|
||||
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
|
||||
ListIsExpanded = False
|
||||
ParametersIsExpanded = False
|
||||
m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
|
||||
Else
|
||||
' Deseleziono e riseleziono la lavorazione corrente per fargli riselezionare la geometria
|
||||
' di lavorazione che è stata deselezionata dalla simulazione
|
||||
Dim CurrSelectedOperation As OperationListBoxItem
|
||||
CurrSelectedOperation = SelectedOperation
|
||||
SelectedOperation = Nothing
|
||||
SelectedOperation = CurrSelectedOperation
|
||||
End If
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
|
||||
' Annullo creazione nuova lavorazione
|
||||
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
|
||||
' Disabilito visualizzazione utensile
|
||||
If Not IsNothing(m_MachiningParameterExpander) Then
|
||||
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = False
|
||||
End If
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
|
||||
CancelOperation(String.Empty)
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "NewMachiningCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewMachiningCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewMachining Is Nothing Then
|
||||
m_cmdNewMachining = New RelayCommand(AddressOf NewMachiningCmd)
|
||||
End If
|
||||
Return m_cmdNewMachining
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewMachiningCmd(ByVal param As Object)
|
||||
StartNewMachining()
|
||||
End Sub
|
||||
|
||||
#End Region ' NewMachiningCommand
|
||||
|
||||
#Region "NewPositioningCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property NewPositioningCommand As ICommand
|
||||
Get
|
||||
If m_cmdNewPositioning Is Nothing Then
|
||||
m_cmdNewPositioning = New RelayCommand(AddressOf NewPositioning)
|
||||
End If
|
||||
Return m_cmdNewPositioning
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub NewPositioning(ByVal param As Object)
|
||||
' Recupero grezzi e bloccaggi dell'ultima fase
|
||||
Dim nLastPhase As Integer = EgtGetPhaseCount()
|
||||
EgtSetCurrPhase(nLastPhase)
|
||||
Dim vRawId As New List(Of Integer)
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
While nRawId <> GDB_ID.NULL
|
||||
If EgtVerifyRawPartPhase(nRawId, nLastPhase) Then
|
||||
vRawId.Add(nRawId)
|
||||
End If
|
||||
nRawId = EgtGetNextRawPart(nRawId)
|
||||
End While
|
||||
Dim vFxtId As New List(Of Integer)
|
||||
Dim nFxtId As Integer = EgtGetFirstFixture()
|
||||
While nFxtId <> GDB_ID.NULL
|
||||
vFxtId.Add(nFxtId)
|
||||
nFxtId = EgtGetNextFixture(nFxtId)
|
||||
End While
|
||||
' Aggiungo la nuova fase
|
||||
Dim nPhase As Integer = EgtAddPhase()
|
||||
Dim nDispId As Integer = EgtGetPhaseDisposition(nPhase)
|
||||
' Confermo grezzi e bloccaggi sopra salvati
|
||||
For Each nId As Integer In vRawId
|
||||
EgtKeepRawPart(nId, nLastPhase)
|
||||
Next
|
||||
For Each nId As Integer In vFxtId
|
||||
EgtKeepFixture(nId, nLastPhase)
|
||||
Next
|
||||
' Ricarico la lista delle operazioni
|
||||
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nDispId)
|
||||
End Sub
|
||||
|
||||
#End Region ' NewPositioningCommand
|
||||
|
||||
#Region "CancelOperationCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property CancelOperationCommand As ICommand
|
||||
Get
|
||||
If m_cmdCancelOperation Is Nothing Then
|
||||
m_cmdCancelOperation = New RelayCommand(AddressOf CancelOperation)
|
||||
End If
|
||||
Return m_cmdCancelOperation
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' 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
|
||||
EndNewMachining(GDB_ID.NULL)
|
||||
ListIsExpanded = True
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
' Se sto inserendo una nuova lavorazione
|
||||
If m_NewMachining Then
|
||||
EndNewMachining(GDB_ID.NULL)
|
||||
ListIsExpanded = True
|
||||
' altrimenti sto cancellandone una vecchia
|
||||
Else
|
||||
If Not IsNothing(SelectedOperation) Then
|
||||
' Salvo indice operazione precedente a selezionata
|
||||
Dim nPrevOperId As Integer = EgtGetPrevOperation(SelectedOperation.Id)
|
||||
If SelectedOperation.Type = MCH_OY.DISP Then
|
||||
' Posso cancellare solo l'ultima disposizione
|
||||
If EgtGetOperationPhase(SelectedOperation.Id) = EgtGetPhaseCount() Then
|
||||
EgtRemoveLastPhase()
|
||||
Else
|
||||
Return
|
||||
End If
|
||||
Else
|
||||
' Smarco e deseleziono la geometria selezionata
|
||||
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
|
||||
EgtDeselectAll()
|
||||
EgtDraw()
|
||||
' Rimuovo l'operazione selezionata
|
||||
EgtRemoveOperation(SelectedOperation.Id)
|
||||
End If
|
||||
' Ricarico la lista delle operazioni
|
||||
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nPrevOperId)
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' CancelOperationCommand
|
||||
|
||||
#Region "OperationListDoubleClickCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property OperationListDoubleClickCommand As ICommand
|
||||
Get
|
||||
If m_cmdOperationListDoubleClick Is Nothing Then
|
||||
m_cmdOperationListDoubleClick = New RelayCommand(AddressOf OperationListDoubleClick)
|
||||
End If
|
||||
Return m_cmdOperationListDoubleClick
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub OperationListDoubleClick()
|
||||
If EgtGetOperationMode(SelectedOperation.Id) Then
|
||||
ParametersIsExpanded = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' OperationListDoubleClickCommand
|
||||
|
||||
#Region "MoveUpCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property MoveUpCommand As ICommand
|
||||
Get
|
||||
If m_cmdMoveUp Is Nothing Then
|
||||
m_cmdMoveUp = New RelayCommand(AddressOf MoveUp)
|
||||
End If
|
||||
Return m_cmdMoveUp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub MoveUp()
|
||||
If Not IsNothing(SelectedOperation) Then
|
||||
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
|
||||
' se è una disposizione esco perchè non si possono spostare
|
||||
If SelectedOperation.Type = MCH_OY.DISP Then Return
|
||||
' Trovo indice dell'entità selezionata
|
||||
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
|
||||
' Posso spostare solo se la precedente non è una disposizione (per non cambiare fase)
|
||||
If OperationList(SelectedIndex - 1).Type = MCH_OY.DISP Then Return
|
||||
' Recupero Id entità selezionata e precedente a quella selezionata
|
||||
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
|
||||
Dim PreviousId As Integer = OperationList(SelectedIndex - 1).Id
|
||||
' Sposto l'operazione selezionata nell'ambiente Egt
|
||||
If EgtRelocate(SelectedId, PreviousId, GDB_POS.BEFORE) Then
|
||||
' Sposto l'operazione selezionata nella grafica
|
||||
OperationList.Move(SelectedIndex, SelectedIndex - 1)
|
||||
' Ricalcolo la lavorazione selezionata e la precedente
|
||||
EgtSetCurrMachining(PreviousId)
|
||||
EgtApplyMachining(False)
|
||||
EgtSetCurrMachining(SelectedId)
|
||||
EgtApplyMachining(False)
|
||||
EgtDraw()
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveUpCommand
|
||||
|
||||
#Region "MoveDownCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property MoveDownCommand As ICommand
|
||||
Get
|
||||
If m_cmdMoveDown Is Nothing Then
|
||||
m_cmdMoveDown = New RelayCommand(AddressOf MoveDown)
|
||||
End If
|
||||
Return m_cmdMoveDown
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub MoveDown()
|
||||
If Not IsNothing(SelectedOperation) Then
|
||||
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
|
||||
' se è una disposizione esco perchè non si possono spostare
|
||||
If SelectedOperation.Type = MCH_OY.DISP Then Return
|
||||
' Trovo indice dell'entità selezionata
|
||||
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
|
||||
' Verifico che l'indice sia < della lunghezza della lista delle operazioni,altrimenti è già ultima e quindi non la posso spostare
|
||||
If SelectedIndex > OperationList.Count - 2 Then Return
|
||||
' Posso spostare solo se la successiva non è una disposizione (per non cambiare fase)
|
||||
If OperationList(SelectedIndex + 1).Type = MCH_OY.DISP Then Return
|
||||
' Recupero Id entitàselezionata e successiva a quella selezionata
|
||||
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
|
||||
Dim PostId As Integer = OperationList(SelectedIndex + 1).Id
|
||||
' Sposto l'operazione selezionata nell'ambiente Egt
|
||||
If EgtRelocate(SelectedId, PostId, GDB_POS.AFTER) Then
|
||||
' Sposto l'operazione selezionata nella grafica
|
||||
OperationList.Move(SelectedIndex, SelectedIndex + 1)
|
||||
' Ricalcolo la lavorazione selezionata e la successiva
|
||||
EgtSetCurrMachining(SelectedId)
|
||||
EgtApplyMachining(False)
|
||||
EgtSetCurrMachining(PostId)
|
||||
EgtApplyMachining(False)
|
||||
EgtDraw()
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' MoveDownCommand
|
||||
|
||||
#Region "UpdateCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property UpdateCommand As ICommand
|
||||
Get
|
||||
If m_cmdUpdate Is Nothing Then
|
||||
m_cmdUpdate = New RelayCommand(AddressOf Update)
|
||||
End If
|
||||
Return m_cmdUpdate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub Update()
|
||||
' Cursore di attesa
|
||||
Application.Current.MainWindow.ForceCursor = True
|
||||
Application.Current.MainWindow.Cursor = Cursors.Wait
|
||||
' Eseguo ricalcolo
|
||||
Dim bRecalc As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
|
||||
Dim sErr As String = String.Empty
|
||||
Dim bOk As Boolean = EgtApplyAllMachinings(bRecalc, False, sErr)
|
||||
EgtSetModified()
|
||||
' Aggiorno visualizzazione e ritorno a cursore standard
|
||||
EgtDraw()
|
||||
Application.Current.MainWindow.ForceCursor = False
|
||||
Application.Current.MainWindow.Cursor = Cursors.Arrow
|
||||
' In caso di errori, li segnalo
|
||||
If Not bOk Then
|
||||
If Not String.IsNullOrEmpty(sErr) Then
|
||||
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Else
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
End If
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_OPERATION + 11))
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End Sub
|
||||
|
||||
#End Region ' UpdateCommand
|
||||
|
||||
#Region "SetUpCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that do Point.
|
||||
''' </summary>
|
||||
Public ReadOnly Property SetUpCommand As ICommand
|
||||
Get
|
||||
If m_cmdSetUp Is Nothing Then
|
||||
m_cmdSetUp = New RelayCommand(AddressOf SetUp)
|
||||
End If
|
||||
Return m_cmdSetUp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Execute the Point. This method is invoked by the PointCommand.
|
||||
''' </summary>
|
||||
Public Sub SetUp()
|
||||
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
|
||||
If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
|
||||
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
|
||||
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
Return
|
||||
End If
|
||||
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
|
||||
' e testa e uscita dell'utensile attrezzato
|
||||
EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
|
||||
' verifico che le teste riportate in configurazione esistano
|
||||
Dim Index As Integer = 1
|
||||
Dim nErr As Integer = 0
|
||||
While nErr = 0
|
||||
Dim sHead As String = String.Empty
|
||||
nErr = 999
|
||||
EgtLuaSetGlobIntVar("STU.INDEX", Index)
|
||||
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
|
||||
' Leggo variabili
|
||||
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
If nErr = 0 Then
|
||||
If EgtGetHeadExitCount(sHead) = 0 Then
|
||||
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
' creo ed apro finestra SetUp
|
||||
Dim SetUpWindow As New SetUpWindowV
|
||||
SetUpWindow.Height = 614
|
||||
SetUpWindow.Width = 1024
|
||||
SetUpWindow.DataContext = New SetUpWindowVM
|
||||
SetUpWindow.Owner = Application.Current.MainWindow
|
||||
SetUpWindow.ShowDialog()
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End Sub
|
||||
|
||||
#End Region ' SetUpCommand
|
||||
|
||||
#End Region ' Commands
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Sub LoadOperationList()
|
||||
OperationList.Clear()
|
||||
Dim Id As Integer
|
||||
Dim OpStatus As Boolean = True
|
||||
Dim OpName As String = String.Empty
|
||||
Dim OpType As Integer = 0
|
||||
Dim OpTool As String = String.Empty
|
||||
Dim OpMach As String = String.Empty
|
||||
Id = EgtGetFirstOperation()
|
||||
While Id <> GDB_ID.NULL
|
||||
EgtGetOperationName(Id, OpName)
|
||||
OpType = EgtGetOperationType(Id)
|
||||
If IsValidMachiningType(OpType) Then
|
||||
EgtSetCurrMachining(Id)
|
||||
OpStatus = EgtGetOperationMode(Id)
|
||||
EgtGetMachiningParam(MCH_MP.TOOL, OpTool)
|
||||
EgtGetMachiningParam(MCH_MP.NAME, OpMach)
|
||||
OperationList.Add(New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach))
|
||||
ElseIf IsValidDispositionType(OpType) Then
|
||||
OpStatus = True
|
||||
OpTool = String.Empty
|
||||
OpMach = String.Empty
|
||||
OperationList.Add(New DispositionOpListBoxItem(Id, OpName, OpType))
|
||||
End If
|
||||
Id = EgtGetNextOperation(Id)
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Private Sub SelectOperation(nSelectedOperation As Integer)
|
||||
If nSelectedOperation < 0 Then
|
||||
SelectedOperation = OperationList(0)
|
||||
Else
|
||||
Dim OperationFound = False
|
||||
For Each Operation In OperationList
|
||||
If Operation.Id = nSelectedOperation Then
|
||||
OperationFound = True
|
||||
SelectedOperation = Operation
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If Not OperationFound Then
|
||||
SelectedOperation = OperationList(0)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
Public Class DispositionOpListBoxItem
|
||||
Inherits OperationListBoxItem
|
||||
|
||||
Private m_Image As String = String.Empty
|
||||
Public Property Image As String
|
||||
Get
|
||||
Return m_Image
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Image = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, sName As String, nType As Integer)
|
||||
m_Id = nId
|
||||
Me.Name = sName
|
||||
m_Type = nType
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class MachiningOpListBoxItem
|
||||
Inherits OperationListBoxItem
|
||||
|
||||
Private m_Status As Boolean
|
||||
Public Property Status As Boolean
|
||||
Get
|
||||
Return m_Status
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_Status Then
|
||||
If m_Type = MCH_OY.NONE Or m_Type = MCH_OY.DISP Then
|
||||
m_Status = True
|
||||
Else
|
||||
m_Status = value
|
||||
EgtSetOperationMode(Id, m_Status)
|
||||
EgtDraw()
|
||||
End If
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Image As String
|
||||
Public Property Image As String
|
||||
Get
|
||||
Return m_Image
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Image = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Info As String
|
||||
Public Property Info As String
|
||||
Get
|
||||
Return m_Info
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Info = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Tool As String
|
||||
Public Property Tool As String
|
||||
Get
|
||||
Return m_Tool
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Tool = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New(nId As Integer, bStatus As Boolean, sName As String, nType As Integer, sTool As String, sMach As String)
|
||||
m_Id = nId
|
||||
Me.Status = bStatus
|
||||
Me.Name = sName
|
||||
m_Type = nType
|
||||
Me.Image = ConvertTypeToImage(Type)
|
||||
If Type = MCH_OY.DISP Then
|
||||
Me.Info = String.Empty
|
||||
Me.Tool = String.Empty
|
||||
Else
|
||||
Me.Info = "(" & If(Not String.IsNullOrEmpty(sTool), sTool, String.Empty) & ", " &
|
||||
If(Not String.IsNullOrEmpty(sMach), sMach, String.Empty) & ")"
|
||||
Me.Tool = If(Not String.IsNullOrEmpty(sTool), "(" & sTool & ")", String.Empty)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ConvertTypeToImage(Type As Integer) As String
|
||||
Select Case Type
|
||||
Case MCH_OY.DISP
|
||||
Return ""
|
||||
Case MCH_OY.DRILLING
|
||||
Return ""
|
||||
Case MCH_OY.SAWING
|
||||
Return ""
|
||||
Case MCH_OY.MILLING
|
||||
Return ""
|
||||
Case MCH_OY.POCKETING
|
||||
Return ""
|
||||
Case MCH_OY.MORTISING
|
||||
Return ""
|
||||
Case MCH_OY.SAWROUGHING
|
||||
Return ""
|
||||
Case MCH_OY.SAWFINISHING
|
||||
Return ""
|
||||
Case MCH_OY.GENMACHINING
|
||||
Return ""
|
||||
Case MCH_OY.CHISELING
|
||||
Return ""
|
||||
Case Else
|
||||
Return String.Empty
|
||||
End Select
|
||||
End Function
|
||||
|
||||
End Class
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
Imports System.ComponentModel
|
||||
|
||||
Public Class OperationListBoxItem
|
||||
Implements INotifyPropertyChanged
|
||||
|
||||
Friend m_Type As Integer
|
||||
Public ReadOnly Property Type As Integer
|
||||
Get
|
||||
Return m_Type
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend m_Id As Integer
|
||||
Public ReadOnly Property Id As Integer
|
||||
Get
|
||||
Return m_Id
|
||||
End Get
|
||||
End Property
|
||||
|
||||
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
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,121 @@
|
||||
Imports System.ComponentModel
|
||||
Imports EgtUILib
|
||||
|
||||
Public Class MachineAxis
|
||||
Implements INotifyPropertyChanged
|
||||
|
||||
Private m_IsReadOnlyAxesValue As Boolean
|
||||
Public Property IsReadOnlyAxesValue As Boolean
|
||||
Get
|
||||
Return m_IsReadOnlyAxesValue
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsReadOnlyAxesValue Then
|
||||
m_IsReadOnlyAxesValue = value
|
||||
NotifyPropertyChanged("IsReadOnlyAxesValue")
|
||||
NotifyPropertyChanged("IsEnabledAxesValue")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property IsEnabledAxesValue As Boolean
|
||||
Get
|
||||
Return Not m_IsReadOnlyAxesValue
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdManualAxisModify As ICommand
|
||||
|
||||
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_Token As String
|
||||
Public Property Token As String
|
||||
Get
|
||||
Return m_Token
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_Token Then
|
||||
m_Token = value
|
||||
NotifyPropertyChanged("Token")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Linear As Boolean
|
||||
Public WriteOnly Property Linear As Boolean
|
||||
Set(value As Boolean)
|
||||
m_Linear = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Value As String
|
||||
Public Property Value As String
|
||||
Get
|
||||
Return m_Value
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_Value = value
|
||||
NotifyPropertyChanged("Value")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
IsReadOnlyAxesValue = True
|
||||
End Sub
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "ManualAxisModifyCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that create a new tool.
|
||||
''' </summary>
|
||||
Public ReadOnly Property ManualAxisModifyCommand As ICommand
|
||||
Get
|
||||
If m_cmdManualAxisModify Is Nothing Then
|
||||
m_cmdManualAxisModify = New Command(AddressOf ManualAxisModify)
|
||||
End If
|
||||
Return m_cmdManualAxisModify
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Creata the new tool. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub ManualAxisModify(ByVal param As Object)
|
||||
Dim dVal As Double
|
||||
If m_Linear Then
|
||||
StringToLen(m_Value, dVal)
|
||||
Else
|
||||
StringToDouble(m_Value, dVal)
|
||||
End If
|
||||
EgtSetAxisPos(m_Name, dVal)
|
||||
EgtGetAxisPos(m_Name, dVal)
|
||||
If m_Linear Then
|
||||
Value = LenToString(dVal, -3)
|
||||
Else
|
||||
Value = DoubleToString(dVal, -3)
|
||||
End If
|
||||
EgtDraw()
|
||||
End Sub
|
||||
|
||||
#End Region ' ManualAxisModifyCommand
|
||||
|
||||
#End Region
|
||||
|
||||
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Public Sub NotifyPropertyChanged(propName As String)
|
||||
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,110 @@
|
||||
<UserControl x:Class="SimulationExpanderView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
|
||||
|
||||
<StackPanel>
|
||||
<Expander Header="{Binding SimulationMsg}" IsExpanded="{Binding IsExpanded}" Style="{StaticResource ExpanderStyle}">
|
||||
<StackPanel>
|
||||
|
||||
<UniformGrid Columns="3" Margin="0,10,0,0">
|
||||
|
||||
<Button Command="{Binding StepCommand}" Grid.Column="0" Grid.Row="3"
|
||||
Style="{StaticResource EgtCAM5_SimulationButton}"
|
||||
ToolTip="{Binding OneStepToolTip}">
|
||||
<Image Source="/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/PlayStep.png"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Height="50" Width="50"/>
|
||||
</Button>
|
||||
|
||||
<Button Command="{Binding PlayPauseCommand}" Grid.Column="1" Grid.Row="3"
|
||||
Style="{StaticResource EgtCAM5_SimulationButton}"
|
||||
ToolTip="{Binding PlayPauseToolTip}">
|
||||
<Image Source="{Binding PlayPauseImage}" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" Height="50" Width="50"/>
|
||||
</Button>
|
||||
|
||||
<Button Command="{Binding StopCommand}" Grid.Column="2" Grid.Row="3"
|
||||
Style="{StaticResource EgtCAM5_SimulationButton}"
|
||||
ToolTip="{Binding StopHomeToolTip}">
|
||||
<Image Source="/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Stop.png"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Height="50" Width="50"/>
|
||||
</Button>
|
||||
|
||||
</UniformGrid>
|
||||
|
||||
<TextBlock Text="{Binding StatusMsg}" FontSize="15" TextAlignment="Center" Margin="10,5,10,0"/>
|
||||
|
||||
<Slider Name="SpeedSlider" Grid.Row="5" Grid.ColumnSpan="3" Height="30"
|
||||
Minimum="1" Maximum="100" TickPlacement="BottomRight" TickFrequency="10"
|
||||
Margin="10,5,10,0" Value="{Binding SliderValue}"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding VMill_Visibility}"
|
||||
IsEnabled="{Binding VMill_IsEnabled}" Margin="10,5,10,0">
|
||||
<CheckBox HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
IsChecked="{Binding VMillActive}"/>
|
||||
<TextBlock Text="{Binding VMillMsg}" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding OpeName}" Grid.Row="0" FontSize="15" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" TextAlignment="Center" Margin="5,5,5,0" Grid.ColumnSpan="3" />
|
||||
<TextBlock Text="{Binding TName}" Grid.Row="1" FontSize="15" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" TextAlignment="Center" Margin="5,1,5,0" Grid.ColumnSpan="2" />
|
||||
<TextBlock Text="{Binding SValue}" Grid.Row="1" Grid.Column="2" FontSize="15" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" TextAlignment="Right" Margin="0,1,5,0" />
|
||||
<TextBlock Text="{Binding GCode}" Grid.Row="2" FontSize="15" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" TextAlignment="Center" Margin="5,1,5,0" Grid.ColumnSpan="2" />
|
||||
<TextBlock Text="{Binding FValue}" Grid.Row="2" Grid.Column="2" FontSize="15" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" TextAlignment="Right" Margin="0,1,5,0" />
|
||||
</Grid>
|
||||
|
||||
<ItemsControl Grid.Row="10" Margin="0,5,0,5" ItemsSource="{Binding MachineAxisList}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="5,1,10,1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Token}" FontSize="15"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
<TextBox Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"
|
||||
IsReadOnly="{Binding IsReadOnlyAxesValue}"
|
||||
IsEnabled="{Binding IsEnabledAxesValue}"
|
||||
TextAlignment="Right">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding ManualAxisModifyCommand}"/>
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
|
||||
<Button Content="{Binding GenerateMsg}" Height="30"
|
||||
IsEnabled="{Binding GenerateIsEnabled}"
|
||||
Command="{Binding GenerateCommand}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Class SimulationExpanderView
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,773 @@
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class SimulationExpanderViewModel
|
||||
Inherits ViewModelBase
|
||||
|
||||
#Region "FIELDS & PROPERTIES"
|
||||
|
||||
'EGT PROPERTIES
|
||||
' Stato di visualizzazione della macchina
|
||||
Private m_nMachLook As Integer = MCH_LOOK.ALL
|
||||
' Utensile corrente
|
||||
Private m_sCurrTool As String = String.Empty
|
||||
' Stato e comando correnti
|
||||
Public Enum SIM_ST As Integer
|
||||
ST_STOP = 1
|
||||
ST_PLAY = 2
|
||||
ST_STEP = 3
|
||||
ST_PAUSE = 4
|
||||
End Enum
|
||||
Private m_nStatus As SIM_ST = SIM_ST.ST_STOP
|
||||
Private Property SimulationStatus As SIM_ST
|
||||
Get
|
||||
Return m_nStatus
|
||||
End Get
|
||||
Set(value As SIM_ST)
|
||||
m_nStatus = value
|
||||
If IniFile.m_nUserLevel >= 5 AndAlso (value = SIM_ST.ST_PAUSE OrElse value = SIM_ST.ST_STOP) Then
|
||||
For Index = 0 To m_MachineAxisList.Count - 1
|
||||
m_MachineAxisList(Index).IsReadOnlyAxesValue = False
|
||||
Next
|
||||
Else
|
||||
For Index = 0 To m_MachineAxisList.Count - 1
|
||||
m_MachineAxisList(Index).IsReadOnlyAxesValue = True
|
||||
Next
|
||||
End If
|
||||
EgtSimSetUiStatus(m_nStatus)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Stato bottone Play
|
||||
Private m_bShowPlay As Boolean = True
|
||||
' Coefficiente per valore Slider
|
||||
Private m_SliderX As Double = 1
|
||||
|
||||
' Flag di esecuzione in corso
|
||||
Private m_bSimExecuting As Boolean = False
|
||||
|
||||
'GRAPHICAL PROPERTIES
|
||||
|
||||
Private m_IsExpanded As Boolean
|
||||
Public Property IsExpanded As Boolean
|
||||
Get
|
||||
Return m_IsExpanded
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
If value <> m_IsExpanded Then
|
||||
If value Then
|
||||
EgtDeselectAll()
|
||||
Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION)
|
||||
Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
|
||||
Map.refTopCommandBarVM.SaveIsEnabled = False
|
||||
If IniFile.m_bShowOnlyTable Then
|
||||
EgtShowOnlyTable(False)
|
||||
EgtZoom(ZM.ALL, False)
|
||||
End If
|
||||
InitializeSimulation()
|
||||
EgtDraw()
|
||||
Else
|
||||
If m_bSimExecuting Then Return
|
||||
CloseSimulation()
|
||||
If IniFile.m_bShowOnlyTable Then
|
||||
EgtShowOnlyTable(True)
|
||||
EgtZoom(ZM.ALL)
|
||||
End If
|
||||
Map.refTopCommandBarVM.SaveIsEnabled = True
|
||||
End If
|
||||
m_IsExpanded = value
|
||||
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, value)
|
||||
OnPropertyChanged("IsExpanded")
|
||||
OnPropertyChanged("GenerateIsEnabled")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
Public ReadOnly Property GenerateIsEnabled As Boolean
|
||||
Get
|
||||
Return Not m_IsExpanded
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' lista degli assi
|
||||
Private m_MachineAxisList As New ObservableCollection(Of MachineAxis)
|
||||
Public ReadOnly Property MachineAxisList As ObservableCollection(Of MachineAxis)
|
||||
Get
|
||||
Return m_MachineAxisList
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_GCode As String
|
||||
Public Property GCode As String
|
||||
Get
|
||||
Return m_GCode
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_GCode Then
|
||||
m_GCode = value
|
||||
OnPropertyChanged("GCode")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_FValue As String
|
||||
Public Property FValue As String
|
||||
Get
|
||||
Return m_FValue
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_FValue Then
|
||||
m_FValue = value
|
||||
OnPropertyChanged("FValue")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_TName As String
|
||||
Public Property TName As String
|
||||
Get
|
||||
Return m_TName
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_TName Then
|
||||
m_TName = value
|
||||
OnPropertyChanged("TName")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SValue As String
|
||||
Public Property SValue As String
|
||||
Get
|
||||
Return m_SValue
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_SValue Then
|
||||
m_SValue = value
|
||||
OnPropertyChanged("SValue")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_OpeName As String
|
||||
Public Property OpeName As String
|
||||
Get
|
||||
Return m_OpeName
|
||||
End Get
|
||||
Set(value As String)
|
||||
If value <> m_OpeName Then
|
||||
m_OpeName = value
|
||||
OnPropertyChanged("OpeName")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_PlayPauseImage As String
|
||||
Public ReadOnly Property PlayPauseImage As String
|
||||
Get
|
||||
If m_bShowPlay Then
|
||||
Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png"
|
||||
Else
|
||||
Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png"
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_StatusMsg As String
|
||||
Public Property StatusMsg As String
|
||||
Get
|
||||
Return m_StatusMsg
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_StatusMsg = value
|
||||
OnPropertyChanged("StatusMsg")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_SliderValue As Double
|
||||
Public Property SliderValue As Double
|
||||
Get
|
||||
Return m_SliderValue
|
||||
End Get
|
||||
Set(value As Double)
|
||||
If value <> m_SliderValue Then
|
||||
m_SliderValue = value
|
||||
EgtSimSetStep(value * m_SliderX)
|
||||
OnPropertyChanged("SliderValue")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_VMillActive As Boolean = False
|
||||
Public Property VMillActive As Boolean
|
||||
Get
|
||||
Return m_VMillActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_VMillActive = value
|
||||
OnPropertyChanged("VMillActive")
|
||||
If m_VMillActive Then
|
||||
EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, m_VMillActive)
|
||||
Else
|
||||
EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM)
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.EMITTITLE)
|
||||
End Set
|
||||
End Property
|
||||
Public Sub SetVMillActive(value As Boolean)
|
||||
m_VMillActive = value
|
||||
OnPropertyChanged("VMillActive")
|
||||
End Sub
|
||||
|
||||
Private m_VMill_Visibility As Visibility = Visibility.Collapsed
|
||||
Public Property VMill_Visibility As Visibility
|
||||
Get
|
||||
Return m_VMill_Visibility
|
||||
End Get
|
||||
Set(value As Visibility)
|
||||
m_VMill_Visibility = value
|
||||
OnPropertyChanged("VMill_Visibility")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_VMill_IsEnabled As Boolean = False
|
||||
Public Property VMill_IsEnabled As Boolean
|
||||
Get
|
||||
Return m_VMill_IsEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_VMill_IsEnabled = value
|
||||
OnPropertyChanged("VMill_IsEnabled")
|
||||
End Set
|
||||
End Property
|
||||
|
||||
' Definizione comandi
|
||||
Private m_cmdStep As ICommand
|
||||
Private m_cmdPlayPause As ICommand
|
||||
Private m_cmdStop As ICommand
|
||||
Private m_cmdGenerate As ICommand
|
||||
|
||||
#Region "Messages"
|
||||
|
||||
Public ReadOnly Property SimulationMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property GenerateMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 30) 'GENERA
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property VMillMsg As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 16) 'Virtual Milling
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "ToolTip"
|
||||
|
||||
Public ReadOnly Property OneStepToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 8)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property PlayPauseToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 9)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property StopHomeToolTip As String
|
||||
Get
|
||||
Return EgtMsg(MSG_SIMULATION + 10)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSTRUCTOR"
|
||||
|
||||
Sub New()
|
||||
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
|
||||
If IsExpanded Then
|
||||
ResetSimulation()
|
||||
End If
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, Sub(bValue As Boolean)
|
||||
IsExpanded = bValue
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub()
|
||||
If IsExpanded Then
|
||||
ShowCncData()
|
||||
End If
|
||||
End Sub)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "COMMANDS"
|
||||
|
||||
#Region "StepCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that create a new tool.
|
||||
''' </summary>
|
||||
Public ReadOnly Property StepCommand As ICommand
|
||||
Get
|
||||
If m_cmdStep Is Nothing Then
|
||||
m_cmdStep = New RelayCommand(AddressOf StepCmd)
|
||||
End If
|
||||
Return m_cmdStep
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Creata the new tool. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub StepCmd(ByVal param As Object)
|
||||
StatusMsg = ""
|
||||
' Disabilito check VMill
|
||||
VMill_IsEnabled = False
|
||||
' Se stato stop, devo avviare simulazione
|
||||
If m_nStatus = SIM_ST.ST_STOP Then
|
||||
SimulationStatus = SIM_ST.ST_STEP
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = False
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
ExecSim()
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
' Alrimenti imposto solo il nuovo stato
|
||||
Else
|
||||
SimulationStatus = SIM_ST.ST_STEP
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
m_bShowPlay = False
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region ' StepCommand
|
||||
|
||||
#Region "PlayPauseCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that create a new tool.
|
||||
''' </summary>
|
||||
Public ReadOnly Property PlayPauseCommand As ICommand
|
||||
Get
|
||||
If m_cmdPlayPause Is Nothing Then
|
||||
m_cmdPlayPause = New RelayCommand(AddressOf PlayPause)
|
||||
End If
|
||||
Return m_cmdPlayPause
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Creata the new tool. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub PlayPause(ByVal param As Object)
|
||||
StatusMsg = ""
|
||||
If m_bShowPlay Then
|
||||
' Disabilito check VMill
|
||||
VMill_IsEnabled = False
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = False
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
' Eseguo
|
||||
If m_nStatus = SIM_ST.ST_STOP Then
|
||||
' Lancio simulazione
|
||||
SimulationStatus = SIM_ST.ST_PLAY
|
||||
ExecSim()
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
ElseIf m_nStatus = SIM_ST.ST_PAUSE Then
|
||||
SimulationStatus = SIM_ST.ST_PLAY
|
||||
End If
|
||||
Else
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
' Se play o step, imposto stato pausa
|
||||
If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then
|
||||
SimulationStatus = SIM_ST.ST_PAUSE
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region ' PlayPauseCommand
|
||||
|
||||
#Region "StopCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that create a new tool.
|
||||
''' </summary>
|
||||
Public ReadOnly Property StopCommand As ICommand
|
||||
Get
|
||||
If m_cmdStop Is Nothing Then
|
||||
m_cmdStop = New RelayCommand(AddressOf StopCmd)
|
||||
End If
|
||||
Return m_cmdStop
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Creata the new tool. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub StopCmd(ByVal param As Object)
|
||||
StatusMsg = ""
|
||||
' Abilito check VMill
|
||||
VMill_IsEnabled = True
|
||||
' Se stato già stop, porto in home
|
||||
If m_nStatus = SIM_ST.ST_STOP Then
|
||||
' Mi riporto all'inizio
|
||||
EgtSimStart()
|
||||
EgtDraw()
|
||||
' Aggiorno dati CNC
|
||||
ShowCncData()
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home
|
||||
Else
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 12) ' Stop
|
||||
End If
|
||||
' Aggiorno bottone
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
' Imposto il nuovo stato
|
||||
SimulationStatus = SIM_ST.ST_STOP
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region ' StopCommand
|
||||
|
||||
#Region "GenerateCommand"
|
||||
|
||||
''' <summary>
|
||||
''' Returns a command that create a new tool.
|
||||
''' </summary>
|
||||
Public ReadOnly Property GenerateCommand As ICommand
|
||||
Get
|
||||
If m_cmdGenerate Is Nothing Then
|
||||
m_cmdGenerate = New RelayCommand(AddressOf Generate)
|
||||
End If
|
||||
Return m_cmdGenerate
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Creata the new tool. This method is invoked by the NewCommand.
|
||||
''' </summary>
|
||||
Public Sub Generate(ByVal param As Object)
|
||||
' Recupero la fase corrente
|
||||
Dim nPhase As Integer = EgtGetCurrPhase()
|
||||
' Aggiorno le lavorazioni
|
||||
If Not UpdateAllMachinings() Then
|
||||
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
|
||||
Return
|
||||
End If
|
||||
' Eseguo
|
||||
Dim sCurrFilePath As String = String.Empty
|
||||
EgtGetCurrFilePath(sCurrFilePath)
|
||||
If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then
|
||||
' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ?
|
||||
If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then
|
||||
' Abbandono
|
||||
Return
|
||||
Else
|
||||
' Lancio salvataggio
|
||||
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
|
||||
' Se non salvato, abbandono
|
||||
If EgtGetModified() Then Return
|
||||
End If
|
||||
End If
|
||||
Dim sCncFile As String = Path.ChangeExtension(sCurrFilePath, Nothing)
|
||||
Dim sInfo As String = "EgtCAM5 - " & sCurrFilePath
|
||||
If IniFile.m_bMachiningGroup Then
|
||||
Dim sMGrpName As String = String.Empty
|
||||
If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then
|
||||
sCncFile &= "_" & sMGrpName & ".cnc"
|
||||
sInfo &= "-" & sMGrpName
|
||||
End If
|
||||
Else
|
||||
sCncFile &= ".cnc"
|
||||
End If
|
||||
If Not EgtGenerate(sCncFile, sInfo) Then
|
||||
If EgtGetLastMachMgrErrorId() <> 0 Then
|
||||
Dim sErr As String = EgtGetLastMachMgrErrorString()
|
||||
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Else
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
End If
|
||||
Else
|
||||
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_SIMULATION + 32))
|
||||
End If
|
||||
' Torno alla fase originale (o alla prima se non definita)
|
||||
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
|
||||
End Sub
|
||||
|
||||
#End Region ' GenerateCommand
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "METHODS"
|
||||
|
||||
Private Function UpdateAllMachinings() As Boolean
|
||||
' Eseguo ricalcolo
|
||||
Dim bModified As Boolean = EgtGetModified()
|
||||
Dim sErr As String = String.Empty
|
||||
Dim bOk As Boolean = EgtApplyAllMachinings(False, False, sErr)
|
||||
' In caso di errori, li segnalo
|
||||
If Not bOk Then
|
||||
If Not String.IsNullOrEmpty(sErr) Then
|
||||
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Else
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
|
||||
End If
|
||||
End If
|
||||
If Not bModified Then EgtResetModified()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Sub InitializeSimulation()
|
||||
' Recupero la fase corrente
|
||||
Dim nPhase As Integer = EgtGetCurrPhase()
|
||||
' Aggiorno le lavorazioni
|
||||
If Not UpdateAllMachinings() Then EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
' Imposto stato corrente
|
||||
SimulationStatus = SIM_ST.ST_STOP
|
||||
m_bShowPlay = True
|
||||
m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1)
|
||||
Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10)
|
||||
SliderValue = SliderVal
|
||||
' Gestione check VMill
|
||||
If IsKeyEnabledVirtualMilling() And EgtUILib.GetPrivateProfileInt(S_VMILL, K_VM_ENABLE, 0, m_sCurrMachIniFilePath) <> 0 Then
|
||||
VMill_Visibility = Visibility.Visible
|
||||
VMill_IsEnabled = True
|
||||
Dim bVal As Boolean
|
||||
SetVMillActive(EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, bVal) And bVal)
|
||||
Else
|
||||
VMill_Visibility = Visibility.Collapsed
|
||||
VMill_IsEnabled = False
|
||||
' Disabilito Vmill, ma inibisco dichiarazione progetto modificato
|
||||
EgtDisableModified()
|
||||
VMillActive = False
|
||||
EgtEnableModified()
|
||||
End If
|
||||
' Inizio simulazione
|
||||
If Not EgtSimStart() Then
|
||||
If EgtGetLastMachMgrErrorId() <> 0 Then
|
||||
Dim sErr As String = EgtGetLastMachMgrErrorString()
|
||||
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) '.... - ERRORE
|
||||
Else
|
||||
MessageBox.Show(EgtMsg(MSG_MESSAGEBOX + 10), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) 'Errore sconosciuto - ERRORE
|
||||
End If
|
||||
End If
|
||||
' Aggiorno visualizzazione dati macchina
|
||||
ShowCncData()
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home
|
||||
End Sub
|
||||
|
||||
Private Sub CloseSimulation()
|
||||
StatusMsg = ""
|
||||
' Mi assicuro di terminare la simulazione
|
||||
ResetSimulation()
|
||||
End Sub
|
||||
|
||||
Private Sub ResetSimulation()
|
||||
' Termino la simulazione
|
||||
SimulationStatus = SIM_ST.ST_STOP
|
||||
EgtSimStop()
|
||||
' Salvo valore dello slider
|
||||
Dim sVal As String = DoubleToString(SliderValue, 1)
|
||||
WritePrivateProfileString(S_SIMUL, K_SLIDERVAL, sVal)
|
||||
' Torno alla prima fase
|
||||
EgtSetCurrPhase(1, True)
|
||||
End Sub
|
||||
|
||||
Private Sub ExecSim()
|
||||
m_bSimExecuting = True
|
||||
IniFile.m_bSimulExecuting = True
|
||||
Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, False)
|
||||
Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, False)
|
||||
Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, False)
|
||||
EgtSimStart(False)
|
||||
EgtSimSetStep(SliderValue * m_SliderX)
|
||||
Dim nShowDataCounter As Integer = 0
|
||||
While m_nStatus <> SIM_ST.ST_STOP
|
||||
' Se simulazione in svolgimento
|
||||
If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then
|
||||
' Eseguo movimento
|
||||
Dim nMove As Integer
|
||||
Dim bMove As Boolean = EgtSimMove(nMove)
|
||||
' Se arrivato a fine step e sono in step
|
||||
If bMove Then
|
||||
If m_nStatus = SIM_ST.ST_STEP And nMove = MCH_SIM.END_STEP Then
|
||||
' Imposto stato Pausa
|
||||
SimulationStatus = SIM_ST.ST_PAUSE
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
End If
|
||||
' Se movimento non riuscito
|
||||
Else
|
||||
SimulationStatus = SIM_ST.ST_STOP
|
||||
' Aggiornamenti per bottone Play/Pause
|
||||
m_bShowPlay = True
|
||||
OnPropertyChanged("PlayPauseImage")
|
||||
' Abilito check VMill
|
||||
VMill_IsEnabled = True
|
||||
Select Case nMove
|
||||
Case MCH_SIM.END_
|
||||
StatusMsg = EgtMsg(MSG_SIMULATION + 1) 'Simulazione completata
|
||||
Case MCH_SIM.OUTSTROKE
|
||||
Dim sInfo As String = String.Empty
|
||||
EgtGetOutstrokeInfo(sInfo)
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 2) & " " & sInfo, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Extracorsa ...
|
||||
Case MCH_SIM.DIR_ERR
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 3), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Direzione utensile irraggiungibile
|
||||
Case Else
|
||||
MessageBox.Show(EgtMsg(MSG_SIMULATION + 4), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Errore
|
||||
End Select
|
||||
End If
|
||||
' Aggiorno stato visualizzazione macchina (dipende anche da utensile)
|
||||
UpdateMachView()
|
||||
' Aggiorno visualizzazione
|
||||
EgtDraw()
|
||||
' Aggiorno dati CNC
|
||||
If nShowDataCounter = 5 Or SimulationStatus = SIM_ST.ST_PAUSE Or SimulationStatus = SIM_ST.ST_STOP Then
|
||||
ShowCncData()
|
||||
nShowDataCounter = 0
|
||||
ElseIf nShowDataCounter > 5 Then
|
||||
nShowDataCounter = 0
|
||||
Else
|
||||
nShowDataCounter += 1
|
||||
End If
|
||||
Else
|
||||
' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU
|
||||
System.Threading.Thread.Sleep(4)
|
||||
End If
|
||||
' Costringo ad aggiornare UI
|
||||
UpdateUI()
|
||||
End While
|
||||
m_bSimExecuting = False
|
||||
IniFile.m_bSimulExecuting = False
|
||||
Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, True)
|
||||
Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, True)
|
||||
Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, True)
|
||||
End Sub
|
||||
|
||||
Private Sub ShowCncData()
|
||||
' Assi
|
||||
Dim nEgtIndex As Integer = 0
|
||||
Dim nAxisIndex As Integer = 0
|
||||
Dim sName As String = String.Empty
|
||||
Dim sToken As String = String.Empty
|
||||
Dim bLinear As Boolean = True
|
||||
Dim dVal As Double = 0
|
||||
While EgtSimGetAxisInfoPos(nEgtIndex, sName, sToken, bLinear, dVal)
|
||||
If sToken <> "**" Then
|
||||
IsValidAxisIndex(nAxisIndex)
|
||||
m_MachineAxisList(nAxisIndex).Name = sName
|
||||
m_MachineAxisList(nAxisIndex).Token = sToken
|
||||
m_MachineAxisList(nAxisIndex).Linear = bLinear
|
||||
m_MachineAxisList(nAxisIndex).Value = If(bLinear, LenToString(dVal, -3), DoubleToString(dVal, -3))
|
||||
nAxisIndex += 1
|
||||
End If
|
||||
nEgtIndex += 1
|
||||
End While
|
||||
For ClearIndex = m_MachineAxisList.Count - 1 To nAxisIndex Step -1
|
||||
m_MachineAxisList.RemoveAt(ClearIndex)
|
||||
Next
|
||||
' Tipo di movimento e feed
|
||||
ShowMoveTypeFeed()
|
||||
' Nome utensile e speed
|
||||
ShowToolNameSpeed()
|
||||
' Nome operazione e tipo
|
||||
ShowOperationName()
|
||||
End Sub
|
||||
|
||||
Private Sub IsValidAxisIndex(nIndex As Integer)
|
||||
For Index = m_MachineAxisList.Count To nIndex
|
||||
m_MachineAxisList.Add(New MachineAxis)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function ShowMoveTypeFeed() As Boolean
|
||||
Dim nG As Integer = 0
|
||||
Dim dFeed As Double = 0
|
||||
If EgtSimGetMoveInfo(nG, dFeed) Then
|
||||
If nG <> 0 Then
|
||||
GCode = "G" & nG.ToString()
|
||||
FValue = "F" & LenToString(dFeed, 0)
|
||||
Else
|
||||
GCode = "G" & nG.ToString()
|
||||
FValue = ""
|
||||
End If
|
||||
Return True
|
||||
Else
|
||||
GCode = ""
|
||||
FValue = ""
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function ShowToolNameSpeed() As Boolean
|
||||
Dim sTool As String = String.Empty
|
||||
Dim dSpeed As Double = 0
|
||||
If EgtSimGetToolInfo(sTool, dSpeed) Then
|
||||
TName = sTool
|
||||
If dSpeed > 1 Then
|
||||
SValue = "S" & DoubleToString(dSpeed, 0)
|
||||
Else
|
||||
SValue = ""
|
||||
End If
|
||||
Return True
|
||||
Else
|
||||
TName = ""
|
||||
SValue = ""
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function ShowOperationName() As Boolean
|
||||
Dim sName As String = String.Empty
|
||||
Dim nType As Integer = 0
|
||||
If EgtSimGetOperationInfo(sName, nType) Then
|
||||
OpeName = sName
|
||||
Return True
|
||||
Else
|
||||
OpeName = ""
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub UpdateMachView()
|
||||
' Se cambiato utensile, aggiorno stato visualizzazione macchina
|
||||
Dim sTool As String = String.Empty
|
||||
Dim dSpeed As Double = 0
|
||||
If EgtSimGetToolInfo(sTool, dSpeed) Then
|
||||
If sTool <> m_sCurrTool Then
|
||||
m_sCurrTool = sTool
|
||||
EgtSetMachineLook(m_nMachLook)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="OptionPanelV"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="250"
|
||||
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
|
||||
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
|
||||
|
||||
<StackPanel Name="ciao" Background="Transparent" MaxHeight="{Binding MaxHeight,RelativeSource={RelativeSource AncestorType={x:Type EgtFloating:EgtFloatingPanel}}}">
|
||||
<!--ContentPresenter that contains the ManageLayerExpander-->
|
||||
<ContentPresenter Content="{Binding ManageLayerExpander,Mode=OneWay}"/>
|
||||
<!--ContentPresenter that contains the InfoExpander-->
|
||||
<ContentPresenter Content="{Binding InfoExpander}"/>
|
||||
<!--ContentPresenter that contains the InputExpander-->
|
||||
<ContentPresenter Content="{Binding InputExpander}"/>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,7 @@
|
||||
Public Class OptionPanelV
|
||||
|
||||
Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
|
||||
Dim x = ciao.MaxHeight
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,96 @@
|
||||
Imports EgtUILib
|
||||
|
||||
Namespace EgtCAM5
|
||||
|
||||
Public Class OptionPanelVM
|
||||
Inherits ViewModelBase
|
||||
|
||||
Private m_DrawIsChecked As Boolean = True
|
||||
|
||||
Private m_MachiningIsChecked As Boolean = False
|
||||
|
||||
' GRAPHICAL ELEMENTS
|
||||
Private m_OperationExpander As OperationExpanderView
|
||||
Private m_ManageLayerExpander As ManageLayerExpanderView
|
||||
Public ReadOnly Property ManageLayerExpander As ContentControl
|
||||
Get
|
||||
If m_DrawIsChecked Then
|
||||
If IsNothing(m_ManageLayerExpander) Then
|
||||
m_ManageLayerExpander = New ManageLayerExpanderView
|
||||
m_ManageLayerExpander.DataContext = New ManageLayerExpanderViewModel
|
||||
End If
|
||||
Return m_ManageLayerExpander
|
||||
Else
|
||||
If IsNothing(m_OperationExpander) Then
|
||||
m_OperationExpander = New OperationExpanderView
|
||||
m_OperationExpander.DataContext = New OperationExpanderViewModel
|
||||
End If
|
||||
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
|
||||
Return m_OperationExpander
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_MachiningsTreeExpander As MachiningTreeExpanderView
|
||||
Private m_InfoExpander As InfoExpanderView
|
||||
Public ReadOnly Property InfoExpander As ContentControl
|
||||
Get
|
||||
If m_DrawIsChecked Then
|
||||
If IsNothing(m_InfoExpander) Then
|
||||
m_InfoExpander = New InfoExpanderView
|
||||
m_InfoExpander.DataContext = New InfoExpanderViewModel
|
||||
End If
|
||||
Return m_InfoExpander
|
||||
Else
|
||||
If IsNothing(m_MachiningsTreeExpander) Then
|
||||
m_MachiningsTreeExpander = New MachiningTreeExpanderView
|
||||
m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderViewModel
|
||||
End If
|
||||
Return m_MachiningsTreeExpander
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_SimulationExpander As SimulationExpanderView
|
||||
Private m_InputExpander As InputExpanderView
|
||||
Public ReadOnly Property InputExpander As ContentControl
|
||||
Get
|
||||
If m_DrawIsChecked Then
|
||||
If IsNothing(m_InputExpander) Then
|
||||
m_InputExpander = New InputExpanderView
|
||||
m_InputExpander.DataContext = New InputExpanderViewModel
|
||||
End If
|
||||
Return m_InputExpander
|
||||
Else
|
||||
If IsNothing(m_SimulationExpander) Then
|
||||
m_SimulationExpander = New SimulationExpanderView
|
||||
m_SimulationExpander.DataContext = New SimulationExpanderViewModel
|
||||
End If
|
||||
Return m_SimulationExpander
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Sub New()
|
||||
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
|
||||
m_DrawIsChecked = False
|
||||
m_MachiningIsChecked = True
|
||||
EgtZoom(ZM.ALL, False)
|
||||
OnPropertyChanged("ManageLayerExpander")
|
||||
OnPropertyChanged("InfoExpander")
|
||||
OnPropertyChanged("InputExpander")
|
||||
End Sub)
|
||||
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
|
||||
m_DrawIsChecked = True
|
||||
m_MachiningIsChecked = False
|
||||
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
|
||||
OnPropertyChanged("ManageLayerExpander")
|
||||
OnPropertyChanged("InfoExpander")
|
||||
OnPropertyChanged("InputExpander")
|
||||
End Sub)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user