- Introduzione db materiali

- Introduzione Db lavorazioni
- Gestione selezionati su lista layer
- Gestione media su lista layer
This commit is contained in:
Emmanuele Sassi
2022-08-24 08:58:04 +02:00
parent 185293847f
commit a5da2894e7
41 changed files with 5327 additions and 233 deletions
+35 -1
View File
@@ -100,6 +100,9 @@
<DependentUpon>CurrLayerSliderV.xaml</DependentUpon>
</Compile>
<Compile Include="CurrLayerSlider\CurrLayerSliderVM.vb" />
<Compile Include="DataGridMultiselectManaging\IListItemConverter.vb" />
<Compile Include="DataGridMultiselectManaging\MultiSelectorBehaviours.vb" />
<Compile Include="DataGridMultiselectManaging\TwoListSynchronizer.vb" />
<Compile Include="DispositionPanel\DispositionPanelV.xaml.vb">
<DependentUpon>DispositionPanelV.xaml</DependentUpon>
</Compile>
@@ -121,13 +124,21 @@
<DependentUpon>MachinePanelV.xaml</DependentUpon>
</Compile>
<Compile Include="MachinePanel\MachinePanelVM.vb" />
<Compile Include="MachiningDb\MachiningDbV.xaml.vb">
<DependentUpon>MachiningDbV.xaml</DependentUpon>
</Compile>
<Compile Include="MachiningDb\MachiningDbVM.vb" />
<Compile Include="MachiningManager\CurrMachining.vb" />
<Compile Include="MachiningManager\CurrMachiningPanelV.xaml.vb">
<DependentUpon>CurrMachiningPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="MachiningManager\CurrMachiningPanelVM.vb" />
<Compile Include="MachiningManager\Machining.vb" />
<Compile Include="MaterialManager\Material.vb" />
<Compile Include="MaterialDb\Material.vb" />
<Compile Include="MaterialDb\MaterialDbV.xaml.vb">
<DependentUpon>MaterialDbV.xaml</DependentUpon>
</Compile>
<Compile Include="MaterialDb\MaterialDbVM.vb" />
<Compile Include="Project\ProjectV.xaml.vb">
<DependentUpon>ProjectV.xaml</DependentUpon>
</Compile>
@@ -155,6 +166,13 @@
<DependentUpon>SliceManagerV.xaml</DependentUpon>
</Compile>
<Compile Include="SliceManager\SliceManagerVM.vb" />
<Compile Include="SliderManager\LayerAdvancementSliderV.xaml.vb">
<DependentUpon>LayerAdvancementSliderV.xaml</DependentUpon>
</Compile>
<Compile Include="SliderManager\LayerIndexSliderV.xaml.vb">
<DependentUpon>LayerIndexSliderV.xaml</DependentUpon>
</Compile>
<Compile Include="SliderManager\SliderManagerVM.vb" />
<Compile Include="Special-3dPrinting\Printing3DPanelV.xaml.vb">
<DependentUpon>Printing3DPanelV.xaml</DependentUpon>
</Compile>
@@ -223,6 +241,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MachiningDb\MachiningDbV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MachiningManager\CurrMachiningPanelV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -243,6 +265,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MaterialDb\MaterialDbV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Project\ProjectV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -271,6 +297,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SliderManager\LayerAdvancementSliderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SliderManager\LayerIndexSliderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Special-3dPrinting\Printing3DPanelV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+9 -6
View File
@@ -5,7 +5,7 @@
Public Const ORIGINAL_SOLID = "OriginalSolid"
Public Const PRINT_SOLID = "PrintSolid"
Public Const LAY_MACHSTART = "MachStart"
Public Const LAY_REFERENCE = "Reference"
Public Const LAY_REFERENCE = "Frame"
Public Const LAY_OTHERS = "Aux"
Public Const LAY_RIBS = "Ribs"
Public Const LAY_AUXSOLIDS = "AuxSolids"
@@ -28,6 +28,8 @@
Public Const KEY_FCUR = "FCur"
Public Const KEY_LENGTH = "Length"
Public Const KEY_SPEED = "Speed"
Public Const KEY_SLICEID = "SliceId"
' parametri Materiali
Public Const MAT_GUID = "GUID"
@@ -42,17 +44,18 @@
Public Const MAT_C2 = "C2"
Public Const MAT_DENSITY = "Density"
Public Const MAT_AMAX = "AMax"
Public Const MAT_ATrg = "ATrg"
Public Const MAT_AMin = "AMin"
Public Const MAT_ATRG = "ATrg"
Public Const MAT_AMIN = "AMin"
Public Const MAT_BMAX = "BMax"
Public Const MAT_BTrg = "BTrg"
Public Const MAT_BMin = "BMin"
Public Const MAT_BTRG = "BTrg"
Public Const MAT_BMIN = "BMin"
Public Const MAT_KW = "KW"
Public Const MAT_KZ = "KZ"
Public Const MAT_KN = "KN"
Public Const MAT_ORIG = "Orig"
' parametri Lavorazione
Public Const MAC_GUID = "MacGuid"
Public Const MAC_GUID = "GUID"
Public Const MAC_NAME = "Name"
Public Const MAC_SLICING45 = "Slicing45"
Public Const MAC_STRANDH = "StrandH"
@@ -0,0 +1,4 @@
Public Interface IListItemConverter
Function Convert(ByVal masterListItem As Object) As Object
Function ConvertBack(ByVal targetListItem As Object) As Object
End Interface
@@ -0,0 +1,80 @@
Imports System.Windows.Controls.Primitives
Imports System.ComponentModel
Public Class MultiSelectorBehaviours
Public Shared ReadOnly SynchronizedSelectedItemsProperty As DependencyProperty = DependencyProperty.RegisterAttached("SynchronizedSelectedItems", GetType(IList), GetType(MultiSelectorBehaviours), New PropertyMetadata(Nothing, AddressOf OnSynchronizedSelectedItemsChanged))
Public Shared ReadOnly SynchronizationManagerProperty As DependencyProperty = DependencyProperty.RegisterAttached("SynchronizationManager", GetType(SynchronizationManager), GetType(MultiSelectorBehaviours), New PropertyMetadata(Nothing))
Public Shared Function GetSynchronizedSelectedItems(ByVal dependencyObject As DependencyObject) As IList
Return CType(dependencyObject.GetValue(SynchronizedSelectedItemsProperty), IList)
End Function
Public Shared Sub SetSynchronizedSelectedItems(ByVal dependencyObject As DependencyObject, ByVal value As IList)
dependencyObject.SetValue(SynchronizedSelectedItemsProperty, value)
End Sub
Private Shared Function GetSynchronizationManager(ByVal dependencyObject As DependencyObject) As SynchronizationManager
Return CType(dependencyObject.GetValue(SynchronizationManagerProperty), SynchronizationManager)
End Function
Private Shared Sub SetSynchronizationManager(ByVal dependencyObject As DependencyObject, ByVal value As SynchronizationManager)
dependencyObject.SetValue(SynchronizationManagerProperty, value)
End Sub
Private Shared Sub OnSynchronizedSelectedItemsChanged(ByVal dependencyObject As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
If e.OldValue IsNot Nothing Then
Dim synchronizer As SynchronizationManager = GetSynchronizationManager(dependencyObject)
synchronizer.StopSynchronizing()
SetSynchronizationManager(dependencyObject, Nothing)
End If
Dim list As IList = TryCast(e.NewValue, IList)
Dim selector As Selector = TryCast(dependencyObject, Selector)
If list IsNot Nothing AndAlso selector IsNot Nothing Then
Dim synchronizer As SynchronizationManager = GetSynchronizationManager(dependencyObject)
If synchronizer Is Nothing Then
synchronizer = New SynchronizationManager(selector)
SetSynchronizationManager(dependencyObject, synchronizer)
End If
synchronizer.StartSynchronizingList()
End If
End Sub
Private Class SynchronizationManager
Private ReadOnly _multiSelector As Selector
Private _synchronizer As TwoListSynchronizer
Friend Sub New(ByVal selector As Selector)
_multiSelector = selector
End Sub
Public Sub StartSynchronizingList()
Dim list As IList = GetSynchronizedSelectedItems(_multiSelector)
If list IsNot Nothing Then
_synchronizer = New TwoListSynchronizer(GetSelectedItemsCollection(_multiSelector), list)
_synchronizer.StartSynchronizing()
End If
End Sub
Public Sub StopSynchronizing()
_synchronizer.StopSynchronizing()
End Sub
Public Shared Function GetSelectedItemsCollection(ByVal selector As Selector) As IList
If TypeOf selector Is MultiSelector Then
Return (TryCast(selector, MultiSelector)).SelectedItems
ElseIf TypeOf selector Is ListBox Then
Return (TryCast(selector, ListBox)).SelectedItems
Else
Throw New InvalidOperationException("Target object has no SelectedItems property to bind.")
End If
End Function
End Class
End Class
@@ -0,0 +1,163 @@
Imports System.Collections.Specialized
Public Class TwoListSynchronizer
Implements IWeakEventListener
Private Shared ReadOnly DefaultConverter As IListItemConverter = New DoNothingListItemConverter()
Private ReadOnly _masterList As IList
Private ReadOnly _masterTargetConverter As IListItemConverter
Private ReadOnly _targetList As IList
Public Sub New(ByVal masterList As IList, ByVal targetList As IList, ByVal masterTargetConverter As IListItemConverter)
_masterList = masterList
_targetList = targetList
_masterTargetConverter = masterTargetConverter
End Sub
Public Sub New(ByVal masterList As IList, ByVal targetList As IList)
Me.New(masterList, targetList, DefaultConverter)
End Sub
Private Delegate Sub ChangeListAction(ByVal list As IList, ByVal e As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
Public Sub StartSynchronizing()
ListenForChangeEvents(_masterList)
ListenForChangeEvents(_targetList)
SetListValuesFromSource(_masterList, _targetList, New Converter(Of Object, Object)(AddressOf ConvertFromMasterToTarget))
If Not TargetAndMasterCollectionsAreEqual() Then
SetListValuesFromSource(_targetList, _masterList, New Converter(Of Object, Object)(AddressOf ConvertFromTargetToMaster))
End If
End Sub
Public Sub StopSynchronizing()
StopListeningForChangeEvents(_masterList)
StopListeningForChangeEvents(_targetList)
End Sub
Public Function ReceiveWeakEvent(ByVal managerType As Type, ByVal sender As Object, ByVal e As EventArgs) As Boolean Implements IWeakEventListener.ReceiveWeakEvent
HandleCollectionChanged(TryCast(sender, IList), TryCast(e, NotifyCollectionChangedEventArgs))
Return True
End Function
Protected Sub ListenForChangeEvents(ByVal list As IList)
If TypeOf list Is INotifyCollectionChanged Then
CollectionChangedEventManager.AddListener(TryCast(list, INotifyCollectionChanged), Me)
End If
End Sub
Protected Sub StopListeningForChangeEvents(ByVal list As IList)
If TypeOf list Is INotifyCollectionChanged Then
CollectionChangedEventManager.RemoveListener(TryCast(list, INotifyCollectionChanged), Me)
End If
End Sub
Private Sub AddItems(ByVal list As IList, ByVal e As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
Dim itemCount As Integer = e.NewItems.Count
For i As Integer = 0 To itemCount - 1
Dim insertionPoint As Integer = e.NewStartingIndex + i
If insertionPoint > list.Count Then
list.Add(converter(e.NewItems(i)))
Else
list.Insert(insertionPoint, converter(e.NewItems(i)))
End If
Next
End Sub
Private Function ConvertFromMasterToTarget(ByVal masterListItem As Object) As Object
Return If(_masterTargetConverter Is Nothing, masterListItem, _masterTargetConverter.Convert(masterListItem))
End Function
Private Function ConvertFromTargetToMaster(ByVal targetListItem As Object) As Object
Return If(_masterTargetConverter Is Nothing, targetListItem, _masterTargetConverter.ConvertBack(targetListItem))
End Function
Private Sub HandleCollectionChanged(ByVal sender As Object, ByVal e As NotifyCollectionChangedEventArgs)
Dim sourceList As IList = TryCast(sender, IList)
Select Case e.Action
Case NotifyCollectionChangedAction.Add
PerformActionOnAllLists(AddressOf AddItems, sourceList, e)
Case NotifyCollectionChangedAction.Move
PerformActionOnAllLists(AddressOf MoveItems, sourceList, e)
Case NotifyCollectionChangedAction.Remove
PerformActionOnAllLists(AddressOf RemoveItems, sourceList, e)
Case NotifyCollectionChangedAction.Replace
PerformActionOnAllLists(AddressOf ReplaceItems, sourceList, e)
Case NotifyCollectionChangedAction.Reset
UpdateListsFromSource(TryCast(sender, IList))
Case Else
End Select
End Sub
Private Sub MoveItems(ByVal list As IList, ByVal e As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
RemoveItems(list, e, converter)
AddItems(list, e, converter)
End Sub
Private Sub PerformActionOnAllLists(ByVal action As ChangeListAction, ByVal sourceList As IList, ByVal collectionChangedArgs As NotifyCollectionChangedEventArgs)
If sourceList Is _masterList Then
PerformActionOnList(_targetList, action, collectionChangedArgs, New Converter(Of Object, Object)(AddressOf ConvertFromMasterToTarget))
Else
PerformActionOnList(_masterList, action, collectionChangedArgs, New Converter(Of Object, Object)(AddressOf ConvertFromTargetToMaster))
End If
End Sub
Private Sub PerformActionOnList(ByVal list As IList, ByVal action As ChangeListAction, ByVal collectionChangedArgs As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
StopListeningForChangeEvents(list)
action(list, collectionChangedArgs, converter)
ListenForChangeEvents(list)
End Sub
Private Sub RemoveItems(ByVal list As IList, ByVal e As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
If e.OldItems.Count = 1 AndAlso e.OldStartingIndex <= list.Count - 1 Then
list.RemoveAt(e.OldStartingIndex)
Else
For Each Item In e.OldItems
list.Remove(Item)
Next
End If
End Sub
Private Sub ReplaceItems(ByVal list As IList, ByVal e As NotifyCollectionChangedEventArgs, ByVal converter As Converter(Of Object, Object))
RemoveItems(list, e, converter)
AddItems(list, e, converter)
End Sub
Private Sub SetListValuesFromSource(ByVal sourceList As IList, ByVal targetList As IList, ByVal converter As Converter(Of Object, Object))
StopListeningForChangeEvents(targetList)
targetList.Clear()
For Each o As Object In sourceList
targetList.Add(converter(o))
Next
ListenForChangeEvents(targetList)
End Sub
Private Function TargetAndMasterCollectionsAreEqual() As Boolean
Return _masterList.Cast(Of Object)().SequenceEqual(_targetList.Cast(Of Object)().[Select](Function(item) ConvertFromTargetToMaster(item)))
End Function
Private Sub UpdateListsFromSource(ByVal sourceList As IList)
If sourceList Is _masterList Then
SetListValuesFromSource(_masterList, _targetList, New Converter(Of Object, Object)(AddressOf ConvertFromMasterToTarget))
Else
SetListValuesFromSource(_targetList, _masterList, New Converter(Of Object, Object)(AddressOf ConvertFromTargetToMaster))
End If
End Sub
Friend Class DoNothingListItemConverter
Implements IListItemConverter
Public Function Convert(ByVal masterListItem As Object) As Object Implements IListItemConverter.Convert
Return masterListItem
End Function
Public Function ConvertBack(ByVal targetListItem As Object) As Object Implements IListItemConverter.ConvertBack
Return targetListItem
End Function
End Class
End Class
+180
View File
@@ -0,0 +1,180 @@
<UserControl x:Class="MachiningDbV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:PrintApp="clr-namespace:_3dPrintApp"
Width="300">
<Border VerticalAlignment="Center"
Style="{StaticResource RightPanel_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Rows="1">
<Button Content="New"
Command="{Binding New_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Save"
Command="{Binding Save_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Delete"
Command="{Binding Delete_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
<ComboBox Grid.Row="1"
Name="MachiningCombo"
ItemsSource="{Binding MachiningList}"
SelectedItem="{Binding SelMachining}"
DisplayMemberPath="ghName"/>
<Grid Grid.Row="2"
Visibility="{Binding Name_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name_Msg}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SelectedItem.sName, ElementName=MachiningCombo, UpdateSourceTrigger=Explicit}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
<ScrollViewer Grid.Row="3"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MachiningCombo}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Expander Header="{Binding sName}"
IsExpanded="{Binding Cathegory_IsExpanded}"
VerticalContentAlignment="Top">
<ItemsControl ItemsSource="{Binding MachiningParamList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"
HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type PrintApp:NumericMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<TextBox Grid.Column="1"
Text="{Binding dValue}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:ComboMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"
HorizontalAlignment="Stretch"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:CheckMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<CheckBox Grid.Column="1"
IsChecked="{Binding bValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:MaterialMachiningParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<CheckBox Grid.Column="1"
IsChecked="{Binding bValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,3 @@
Public Class MachiningDbV
End Class
+242
View File
@@ -0,0 +1,242 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MachiningDbVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_MachiningList As New ObservableCollection(Of Machining)
Public ReadOnly Property MachiningList As ObservableCollection(Of Machining)
Get
Return m_MachiningList
End Get
End Property
Private m_SelMachining As Machining
Public Property SelMachining As Machining
Get
Return m_SelMachining
End Get
Set(value As Machining)
' verifico se modificato
If m_SelMachining.bIsModified Then
' chiedo se salvare
Select Case MessageBox.Show("Salvare le modifiche apportate alla lavorazione selezionata?", "Info", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
m_SelMachining.Save()
Case MessageBoxResult.No
m_SelMachining.ResetModification()
Case MessageBoxResult.Cancel
NotifyPropertyChanged(NameOf(SelMachining))
Return
End Select
End If
' recupero stato IsExpanded di tutte le categorie
Dim IsExpandedList As New List(Of Boolean)
For Each Cathegory In m_SelMachining.CathegoryList
IsExpandedList.Add(Cathegory.Cathegory_IsExpanded)
Next
m_SelMachining = value
' ripristino stato IsExpanded di tutte le categorie
For Index = 0 To m_SelMachining.CathegoryList.Count - 1
m_SelMachining.CathegoryList(Index).Cathegory_IsExpanded = IsExpandedList(Index)
Next
End Set
End Property
Private m_Name_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Name_Visibility As Visibility
Get
Return m_Name_Visibility
End Get
End Property
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
End Sub
' variabile che indica se una qualunque lavorazione e' stata modificata
Private m_bIsModified As Boolean
Public ReadOnly Property bIsModified As Boolean
Get
Return m_bIsModified
End Get
End Property
Friend Sub SetIsModified(value As Boolean)
m_bIsModified = value
End Sub
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdNew As ICommand
Private m_cmdSave As ICommand
Private m_cmdDelete As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTORS"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefMachiningDbVM(Me)
' inizializzo lista lavorazioni
Init()
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub Init()
Dim sMachiningIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
MachiningList.Clear()
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While GetPrivateProfileString(nIndex, MAC_GUID, "", sGUID, sMachiningIniFilePath) > 0
MachiningList.Add(New Machining(nIndex))
nIndex += 1
End While
Dim sCurrMachining As String = ""
GetMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, "", sCurrMachining)
m_SelMachining = MachiningList.FirstOrDefault(Function(x) x.sName = sCurrMachining)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
If m_SelMachining.bIsModified Then
' chiedo se salvare
Select Case MessageBox.Show("Salvare le modifiche apportate alla lavorazione selezionata?", "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_SelMachining.Save()
Case MessageBoxResult.No
m_SelMachining.ResetModification()
Case MessageBoxResult.Cancel
Return
End Select
End If
If m_bIsModified Then
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Dim sBakMacIniFilePath As String = Path.ChangeExtension(sMacIniFilePath, ".bak")
If File.Exists(sBakMacIniFilePath) Then
Try
' elimino vecchio file bak
File.Delete(sBakMacIniFilePath)
Catch ex As Exception
End Try
End If
If File.Exists(sMacIniFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
File.Move(sMacIniFilePath, sBakMacIniFilePath)
Catch ex As Exception
End Try
End If
' se ancora esiste lo elimino
If File.Exists(sMacIniFilePath) Then
Try
File.Delete(sMacIniFilePath)
Catch ex As Exception
End Try
End If
' creo nuovo file
If Not File.Exists(sMacIniFilePath) Then
Try
File.WriteAllLines(sMacIniFilePath, {"; Commento per evitare BOM con UTF-8"})
Catch ex As Exception
End Try
End If
' salvo tutte le lavorazioni sul Db
For Index = 0 To m_MachiningList.Count - 1
m_MachiningList(Index).WriteParamsOnDb(Index + 1)
Next
End If
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Ok
#Region "New"
Public ReadOnly Property New_Command As ICommand
Get
If m_cmdNew Is Nothing Then
m_cmdNew = New Command(AddressOf NewCmd)
End If
Return m_cmdNew
End Get
End Property
Public Sub NewCmd()
Dim sMachiningIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Dim nIndex As Integer = m_MachiningList.Max(Function(x) x.nIndex) + 1
Dim NewMachining As Machining = New Machining(nIndex)
MachiningList.Add(NewMachining)
m_SelMachining = NewMachining
NotifyPropertyChanged(NameOf(SelMachining))
SetNameVisibility(True)
End Sub
#End Region ' New
#Region "Save"
Public ReadOnly Property Save_Command As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New Command(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
Public Sub Save()
m_SelMachining.Save()
End Sub
#End Region ' Save
#Region "Delete"
Public ReadOnly Property Delete_Command As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New Command(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
Public Sub Delete()
' chiedo conferma
Select Case MessageBox.Show("Sei sicuro di voler cancellare la lavorazione selezionata?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_MachiningList.Remove(m_SelMachining)
Case MessageBoxResult.No
Return
End Select
End Sub
#End Region ' Delete
#End Region ' COMMANDS
End Class
@@ -0,0 +1,773 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class CurrMachining
Inherits Machining
Private m_OrigMachining As New Machining
Public ReadOnly Property OrigMachining As Machining
Get
Return m_OrigMachining
End Get
End Property
Friend Sub SetOrigMachining(OrigMachining As Machining)
m_OrigMachining = OrigMachining
End Sub
Private m_sCurrGUID As String = ""
Public Property sCurrGUID As String
Get
Return m_sCurrGUID
End Get
Set(value As String)
m_sCurrGUID = value
End Set
End Property
Private m_sCurrName As String = ""
Public Property sCurrName As String
Get
Return m_sCurrName
End Get
Set(value As String)
m_sCurrName = value
End Set
End Property
Private m_bCurrSlicing45 As Boolean
Public Property bCurrSlicing45 As Boolean
Get
Return m_bCurrSlicing45
End Get
Set(value As Boolean)
m_bCurrSlicing45 = value
NotifyPropertyChanged(NameOf(bCurrSlicing45))
End Set
End Property
Private m_dCurrStrandH As Double
Public Property dCurrStrandH As Double
Get
Return m_dCurrStrandH
End Get
Set(value As Double)
m_dCurrStrandH = value
NotifyPropertyChanged(NameOf(dCurrStrandH))
NotifyPropertyChanged(NameOf(bCurrStrandH_IsModified))
End Set
End Property
Public ReadOnly Property bCurrStrandH_IsModified As Boolean
Get
Return m_dCurrStrandH <> m_OrigMachining.dStrandH
End Get
End Property
Private m_dCurrStrandW As Double
Public Property dCurrStrandW As Double
Get
Return m_dCurrStrandW
End Get
Set(value As Double)
m_dCurrStrandW = value
NotifyPropertyChanged(NameOf(dCurrStrandW))
End Set
End Property
Private m_nCurrStrandCount As Integer
Public Property nCurrStrandCount As Integer
Get
Return m_nCurrStrandCount
End Get
Set(value As Integer)
m_nCurrStrandCount = value
NotifyPropertyChanged(NameOf(nCurrStrandCount))
End Set
End Property
Private m_dCurrOffset As Double
Public Property dCurrOffset As Double
Get
Return m_dCurrOffset
End Get
Set(value As Double)
m_dCurrOffset = value
NotifyPropertyChanged(NameOf(dCurrOffset))
End Set
End Property
Private m_dCurrStartPointOffsetOnSlice As Double
Public Property dCurrStartPointOffsetOnSlice As Double
Get
Return m_dCurrStartPointOffsetOnSlice
End Get
Set(value As Double)
m_dCurrStartPointOffsetOnSlice = value
End Set
End Property
Private m_StrandOrderList As New List(Of IdNameStruct)({New IdNameStruct(MPAR_STRANDORDERS.INTOOUT, "From Inside To Outside"),
New IdNameStruct(MPAR_STRANDORDERS.OUTTOIN, "From Outside To Inside")})
Public Property StrandOrderList As List(Of IdNameStruct)
Get
Return m_StrandOrderList
End Get
Set(value As List(Of IdNameStruct))
m_StrandOrderList = value
End Set
End Property
Public Property SelStrandOrder As IdNameStruct
Get
Return m_StrandOrderList.FirstOrDefault(Function(x) x.Id = m_nCurrStrandOrder)
End Get
Set(value As IdNameStruct)
m_nCurrStrandOrder = value.Id
End Set
End Property
Private m_nCurrStrandOrder As MPAR_STRANDORDERS
Public Property nCurrStrandOrder As MPAR_STRANDORDERS
Get
Return m_nCurrStrandOrder
End Get
Set(value As MPAR_STRANDORDERS)
m_nCurrStrandOrder = value
End Set
End Property
Friend Sub SetCurrStrandOrder(StrandOrder As Integer)
m_nCurrStrandOrder = StrandOrder
NotifyPropertyChanged(NameOf(SelStrandOrder))
End Sub
Private m_DirectionList As New List(Of IdNameStruct)({New IdNameStruct(MPAR_DIRECTIONS.CCW, "Counterclockwise"),
New IdNameStruct(MPAR_DIRECTIONS.CW, "Clockwise")})
Public Property DirectionList As List(Of IdNameStruct)
Get
Return m_DirectionList
End Get
Set(value As List(Of IdNameStruct))
m_DirectionList = value
End Set
End Property
Public Property SelDirection As IdNameStruct
Get
Return m_DirectionList.FirstOrDefault(Function(x) x.Id = m_nCurrDirection)
End Get
Set(value As IdNameStruct)
m_nCurrDirection = value.Id
End Set
End Property
Private m_nCurrDirection As MPAR_DIRECTIONS
Public Property nCurrDirection As MPAR_DIRECTIONS
Get
Return m_nCurrDirection
End Get
Set(value As MPAR_DIRECTIONS)
m_nCurrDirection = value
End Set
End Property
Friend Sub SetCurrDirection(Direction As Integer)
m_nCurrDirection = Direction
NotifyPropertyChanged(NameOf(SelDirection))
End Sub
Private m_LinkTypeList As New List(Of IdNameStruct)({New IdNameStruct(MPAR_LINKTYPES.NONE, "None"),
New IdNameStruct(MPAR_LINKTYPES.LINEAR, "Linear"),
New IdNameStruct(MPAR_LINKTYPES.BIARC, "Biarc")})
Public Property LinkTypeList As List(Of IdNameStruct)
Get
Return m_LinkTypeList
End Get
Set(value As List(Of IdNameStruct))
m_LinkTypeList = value
End Set
End Property
Public Property SelLinkType As IdNameStruct
Get
Return m_LinkTypeList.FirstOrDefault(Function(x) x.Id = m_nCurrLinkType)
End Get
Set(value As IdNameStruct)
m_nCurrLinkType = value.Id
End Set
End Property
Private m_nCurrLinkType As MPAR_LINKTYPES
Public Property nCurrLinkType As MPAR_LINKTYPES
Get
Return m_nCurrLinkType
End Get
Set(value As MPAR_LINKTYPES)
m_nCurrLinkType = value
End Set
End Property
Friend Sub SetCurrLinkType(LinkType As Integer)
m_nCurrLinkType = LinkType
NotifyPropertyChanged(NameOf(SelLinkType))
End Sub
Private m_dCurrLinkParam As Double
Public Property dCurrLinkParam As Double
Get
Return m_dCurrLinkParam
End Get
Set(value As Double)
m_dCurrLinkParam = value
End Set
End Property
Private m_dCurrLinkZup As Double
Public Property dCurrLinkZup As Double
Get
Return m_dCurrLinkZup
End Get
Set(value As Double)
m_dCurrLinkZup = value
End Set
End Property
Private m_dCurrOffsetLeadPoint As Double
Public Property dCurrOffsetLeadPoint As Double
Get
Return m_dCurrOffsetLeadPoint
End Get
Set(value As Double)
m_dCurrOffsetLeadPoint = value
End Set
End Property
Private m_LeadInList As New List(Of IdNameStruct)({New IdNameStruct(MPAR_LEADINOUT.NONE, "None"),
New IdNameStruct(MPAR_LEADINOUT.LINEAR, "Linear"),
New IdNameStruct(MPAR_LEADINOUT.ARC, "Arc")})
Public Property LeadInList As List(Of IdNameStruct)
Get
Return m_LeadInList
End Get
Set(value As List(Of IdNameStruct))
m_LeadInList = value
End Set
End Property
Public Property SelLeadIn As IdNameStruct
Get
Return m_LeadInList.FirstOrDefault(Function(x) x.Id = m_nCurrLeadIn)
End Get
Set(value As IdNameStruct)
m_nCurrLeadIn = value.Id
End Set
End Property
Private m_nCurrLeadIn As MPAR_LEADINOUT
Public Property nCurrLeadIn As MPAR_LEADINOUT
Get
Return m_nCurrLeadIn
End Get
Set(value As MPAR_LEADINOUT)
m_nCurrLeadIn = value
End Set
End Property
Friend Sub SetCurrLeadIn(LeadIn As Integer)
m_nCurrLeadIn = LeadIn
NotifyPropertyChanged(NameOf(SelLeadIn))
End Sub
Private m_dCurrLeadInTangDist As Double
Public Property dCurrLeadInTangDist As Double
Get
Return m_dCurrLeadInTangDist
End Get
Set(value As Double)
m_dCurrLeadInTangDist = value
End Set
End Property
Private m_dCurrLeadInOrthoDist As Double
Public Property dCurrLeadInOrthoDist As Double
Get
Return m_dCurrLeadInOrthoDist
End Get
Set(value As Double)
m_dCurrLeadInOrthoDist = value
End Set
End Property
Private m_LeadOutList As New List(Of IdNameStruct)({New IdNameStruct(MPAR_LEADINOUT.NONE, "None"),
New IdNameStruct(MPAR_LEADINOUT.LINEAR, "Linear"),
New IdNameStruct(MPAR_LEADINOUT.ARC, "Arc")})
Public Property LeadOutList As List(Of IdNameStruct)
Get
Return m_LeadOutList
End Get
Set(value As List(Of IdNameStruct))
m_LeadOutList = value
End Set
End Property
Public Property SelLeadOut As IdNameStruct
Get
Return m_LeadOutList.FirstOrDefault(Function(x) x.Id = m_nCurrLeadOut)
End Get
Set(value As IdNameStruct)
m_nCurrLeadOut = value.Id
End Set
End Property
Private m_nCurrLeadOut As MPAR_LEADINOUT
Public Property nCurrLeadOut As MPAR_LEADINOUT
Get
Return m_nCurrLeadOut
End Get
Set(value As MPAR_LEADINOUT)
m_nCurrLeadOut = value
End Set
End Property
Friend Sub SetCurrLeadOut(LeadOut As Integer)
m_nCurrLeadOut = LeadOut
NotifyPropertyChanged(NameOf(SelLeadOut))
End Sub
Private m_dCurrLeadOutTangDist As Double
Public Property dCurrLeadOutTangDist As Double
Get
Return m_dCurrLeadOutTangDist
End Get
Set(value As Double)
m_dCurrLeadOutTangDist = value
End Set
End Property
Private m_dCurrLeadOutOrthoDist As Double
Public Property dCurrLeadOutOrthoDist As Double
Get
Return m_dCurrLeadOutOrthoDist
End Get
Set(value As Double)
m_dCurrLeadOutOrthoDist = value
End Set
End Property
Private m_dCurrCoastingLen As Double
Public Property dCurrCoastingLen As Double
Get
Return m_dCurrCoastingLen
End Get
Set(value As Double)
m_dCurrCoastingLen = value
End Set
End Property
Private m_dCurrCoastingFeed As Double
Public Property dCurrCoastingFeed As Double
Get
Return m_dCurrCoastingFeed
End Get
Set(value As Double)
m_dCurrCoastingFeed = value
End Set
End Property
Private m_dCurrWipeLen As Double
Public Property dCurrWipeLen As Double
Get
Return m_dCurrWipeLen
End Get
Set(value As Double)
m_dCurrWipeLen = value
End Set
End Property
Private m_dCurrWipeFeedPu As Double
Public Property dCurrWipeFeedPu As Double
Get
Return m_dCurrWipeFeedPu
End Get
Set(value As Double)
m_dCurrWipeFeedPu = value
End Set
End Property
Private m_dCurrFloorCount As Integer
Public Property dCurrFloorCount As Double
Get
Return m_dCurrFloorCount
End Get
Set(value As Double)
m_dCurrFloorCount = value
End Set
End Property
Private m_dCurrG0Feed As Double
Public Property dCurrG0Feed As Double
Get
Return m_dCurrG0Feed
End Get
Set(value As Double)
m_dCurrG0Feed = value
End Set
End Property
Private m_dCurrToolDiam As Double
Public Property dCurrToolDiam As Double
Get
Return m_dCurrToolDiam
End Get
Set(value As Double)
m_dCurrToolDiam = value
End Set
End Property
Private m_dCurrRibsOverlap As Double
Public Property dCurrRibsOverlap As Double
Get
Return m_dCurrRibsOverlap
End Get
Set(value As Double)
m_dCurrRibsOverlap = value
End Set
End Property
Private m_dCurrRibsStrandCount As Integer
Public Property dCurrRibsStrandCount As Double
Get
Return m_dCurrRibsStrandCount
End Get
Set(value As Double)
m_dCurrRibsStrandCount = value
End Set
End Property
Private m_dCurrRibsLink As Boolean
Public Property dCurrRibsLink As Double
Get
Return m_dCurrRibsLink
End Get
Set(value As Double)
m_dCurrRibsLink = value
End Set
End Property
Private m_dCurrRibsInvertOrder As Boolean
Public Property dCurrRibsInvertOrder As Double
Get
Return m_dCurrRibsInvertOrder
End Get
Set(value As Double)
m_dCurrRibsInvertOrder = value
End Set
End Property
Private m_dCurrRibsInvertDirection As Boolean
Public Property dCurrRibsInvertDirection As Double
Get
Return m_dCurrRibsInvertDirection
End Get
Set(value As Double)
m_dCurrRibsInvertDirection = value
End Set
End Property
Private m_dCurrRibsLeadInInvert As Boolean
Public Property dCurrRibsLeadInInvert As Double
Get
Return m_dCurrRibsLeadInInvert
End Get
Set(value As Double)
m_dCurrRibsLeadInInvert = value
End Set
End Property
Private m_dCurrRibsLeadInLen As Double
Public Property dCurrRibsLeadInLen As Double
Get
Return m_dCurrRibsLeadInLen
End Get
Set(value As Double)
m_dCurrRibsLeadInLen = value
End Set
End Property
Private m_dCurrRibsLeadOutInvert As Boolean
Public Property dCurrRibsLeadOutInvert As Double
Get
Return m_dCurrRibsLeadOutInvert
End Get
Set(value As Double)
m_dCurrRibsLeadOutInvert = value
End Set
End Property
Private m_dCurrRibsLeadOutLen As Double
Public Property dCurrRibsLeadOutLen As Double
Get
Return m_dCurrRibsLeadOutLen
End Get
Set(value As Double)
m_dCurrRibsLeadOutLen = value
End Set
End Property
Private m_dCurrRibsLeadOutCoasting As Double
Public Property dCurrRibsLeadOutCoasting As Double
Get
Return m_dCurrRibsLeadOutCoasting
End Get
Set(value As Double)
m_dCurrRibsLeadOutCoasting = value
End Set
End Property
Private m_dCurrRibsLeadOutWipe As Double
Public Property dCurrRibsLeadOutWipe As Double
Get
Return m_dCurrRibsLeadOutWipe
End Get
Set(value As Double)
m_dCurrRibsLeadOutWipe = value
End Set
End Property
Private m_dCurrRibsLeadOutWipeDir As Double
Public Property dCurrRibsLeadOutWipeDir As Double
Get
Return m_dCurrRibsLeadOutWipeDir
End Get
Set(value As Double)
m_dCurrRibsLeadOutWipeDir = value
End Set
End Property
' Definizione comandi
Private m_cmdResetParam As ICommand
Sub New(nPartId As Integer)
ReadCurrMachParam(nPartId)
End Sub
Sub New(MachiningIndex As MachiningIndex)
' imposto Machining da Db
Dim Machining As New Machining(MachiningIndex.nIndex, MachiningIndex.sGUID, MachiningIndex.sName)
SetOrigMachining(Machining)
' Imposto parametri Curr copiando da Db
bCurrSlicing45 = m_OrigMachining.bSlicing45
dCurrStrandH = m_OrigMachining.dStrandH
dCurrStrandW = m_OrigMachining.dStrandW
nCurrStrandCount = m_OrigMachining.nStrandCount
dCurrOffset = m_OrigMachining.dOffset
dCurrStartPointOffsetOnSlice = m_OrigMachining.dStartPointOffsetOnSlice
SetCurrStrandOrder(m_OrigMachining.dStrandOrder)
SetCurrDirection(m_OrigMachining.dDirection)
SetCurrLinkType(m_OrigMachining.dLinkType)
dCurrLinkParam = m_OrigMachining.dLinkParam
dCurrLinkZup = m_OrigMachining.dLinkZup
dCurrOffsetLeadPoint = m_OrigMachining.dOffsetLeadPoint
SetCurrLeadIn(m_OrigMachining.dLeadIn)
dCurrLeadInTangDist = m_OrigMachining.dLeadInTangDist
dCurrLeadInOrthoDist = m_OrigMachining.dLeadInOrthoDist
SetCurrLeadOut(m_OrigMachining.dLeadOut)
dCurrLeadOutTangDist = m_OrigMachining.dLeadOutTangDist
dCurrLeadOutOrthoDist = m_OrigMachining.dLeadOutOrthoDist
dCurrCoastingLen = m_OrigMachining.dCoastingLen
dCurrCoastingFeed = m_OrigMachining.dCoastingFeed
dCurrWipeLen = m_OrigMachining.dWipeLen
dCurrWipeFeedPu = m_OrigMachining.dWipeFeedPu
dCurrFloorCount = m_OrigMachining.dFloorCount
dCurrG0Feed = m_OrigMachining.dG0Feed
dCurrToolDiam = m_OrigMachining.dToolDiam
dCurrRibsOverlap = m_OrigMachining.dRibsOverlap
dCurrRibsStrandCount = m_OrigMachining.dRibsStrandCount
dCurrRibsLink = m_OrigMachining.dRibsLink
dCurrRibsInvertOrder = m_OrigMachining.dRibsInvertOrder
dCurrRibsInvertDirection = m_OrigMachining.dRibsInvertDirection
dCurrRibsLeadInInvert = m_OrigMachining.dRibsLeadInInvert
dCurrRibsLeadInLen = m_OrigMachining.dRibsLeadInLen
dCurrRibsLeadOutInvert = m_OrigMachining.dRibsLeadOutInvert
dCurrRibsLeadOutLen = m_OrigMachining.dRibsLeadOutLen
dCurrRibsLeadOutCoasting = m_OrigMachining.dRibsLeadOutCoasting
dCurrRibsLeadOutWipe = m_OrigMachining.dRibsLeadOutWipe
dCurrRibsLeadOutWipeDir = m_OrigMachining.dRibsLeadOutWipeDir
End Sub
Sub New(sName As String, bSlicing45 As Boolean, dStrandH As Double, dStrandW As Double, nStrandCount As Integer, dOffset As Double, dStartPointOffsetOnSlice As Double,
dStrandOrder As MPAR_STRANDORDERS, dDirection As MPAR_DIRECTIONS, dLinkType As MPAR_LINKTYPES, dLinkParam As Double, dLinkZup As Double, dOffsetLeadPoint As Double,
dLeadIn As MPAR_LEADINOUT, dLeadInTangDist As Double, dLeadInOrthoDist As Double, dLeadOut As MPAR_LEADINOUT, dLeadOutTangDist As Double, dLeadOutOrthoDist As Double,
dCoastingLen As Double, dCoastingFeed As Double, dWipeLen As Double, dWipeFeedPu As Double, dFloorCount As Integer, dG0Feed As Double, dMaterial As String,
dToolDiam As Double, dRibsOverlap As Double, dRibsStrandCount As Integer, dRibsLink As Boolean, dRibsInvertOrder As Boolean, dRibsInvertDirection As Boolean,
dRibsLeadInInvert As Boolean, dRibsLeadInLen As Double, dRibsLeadOutInvert As Boolean, dRibsLeadOutLen As Double, dRibsLeadOutCoasting As Double,
dRibsLeadOutWipe As Double, dRibsLeadOutWipeDir As Double)
End Sub
#Region "METHODS"
Friend Function ReadCurrMachParam(nPartId As Integer) As MachiningIndex
' leggo parametri da pezzo
Dim nData As Integer = 0
EgtGetInfo(nPartId, MAC_GUID, m_sCurrGUID)
EgtGetInfo(nPartId, MAC_SLICING45, m_bCurrSlicing45)
EgtGetInfo(nPartId, MAC_STRANDH, m_dCurrStrandH)
EgtGetInfo(nPartId, MAC_STRANDW, m_dCurrStrandW)
EgtGetInfo(nPartId, MAC_STRANDCOUNT, m_nCurrStrandCount)
EgtGetInfo(nPartId, MAC_OFFSET, m_dCurrOffset)
EgtGetInfo(nPartId, MAC_STARTPOINTOFFSETONSLICE, m_dCurrStartPointOffsetOnSlice)
EgtGetInfo(nPartId, MAC_STRANDORDER, nData)
SetCurrStrandOrder(nData)
EgtGetInfo(nPartId, MAC_DIRECTION, nData)
SetCurrDirection(nData)
EgtGetInfo(nPartId, MAC_LINKTYPE, nData)
SetCurrLinkType(nData)
EgtGetInfo(nPartId, MAC_LINKPARAM, m_dCurrLinkParam)
EgtGetInfo(nPartId, MAC_LINKZUP, m_dCurrLinkZup)
EgtGetInfo(nPartId, MAC_OFFSETLEADPOINT, m_dCurrOffsetLeadPoint)
EgtGetInfo(nPartId, MAC_LEADIN, nData)
SetCurrLeadIn(nData)
EgtGetInfo(nPartId, MAC_LEADINTANGDIST, m_dCurrLeadInTangDist)
EgtGetInfo(nPartId, MAC_LEADINORTHODIST, m_dCurrLeadInOrthoDist)
EgtGetInfo(nPartId, MAC_LEADOUT, nData)
SetCurrLeadOut(nData)
EgtGetInfo(nPartId, MAC_LEADOUTTANGDIST, m_dCurrLeadOutTangDist)
EgtGetInfo(nPartId, MAC_LEADOUTORTHODIST, m_dCurrLeadOutOrthoDist)
EgtGetInfo(nPartId, MAC_COASTINGLEN, m_dCurrCoastingLen)
EgtGetInfo(nPartId, MAC_COASTINGFEED, m_dCurrCoastingFeed)
EgtGetInfo(nPartId, MAC_WIPELEN, m_dCurrWipeLen)
EgtGetInfo(nPartId, MAC_WIPEFEEDPU, m_dCurrWipeFeedPu)
EgtGetInfo(nPartId, MAC_FLOORCOUNT, m_dCurrFloorCount)
EgtGetInfo(nPartId, MAC_G0FEED, m_dCurrG0Feed)
EgtGetInfo(nPartId, MAC_TOOLDIAM, m_dCurrToolDiam)
EgtGetInfo(nPartId, MAC_RIBSOVERLAP, m_dCurrRibsOverlap)
EgtGetInfo(nPartId, MAC_RIBSSTRANDCOUNT, m_dCurrRibsStrandCount)
EgtGetInfo(nPartId, MAC_RIBSLINK, m_dCurrRibsLink)
EgtGetInfo(nPartId, MAC_RIBSINVERTORDER, m_dCurrRibsInvertOrder)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_dCurrRibsInvertDirection)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_dCurrRibsLeadInInvert)
EgtGetInfo(nPartId, MAC_RIBSLEADINLEN, m_dCurrRibsLeadInLen)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTINVERT, m_dCurrRibsLeadOutInvert)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTLEN, m_dCurrRibsLeadOutLen)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTCOASTING, m_dCurrRibsLeadOutCoasting)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTWIPE, m_dCurrRibsLeadOutWipe)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTWIPEDIR, m_dCurrRibsLeadOutWipeDir)
' ricavo lavorazione da lista
Dim CurrMachiningInDb As MachiningIndex = Map.refTopPanelVM.MachiningList.FirstOrDefault(Function(x) x.sGUID = m_sCurrGUID)
If Not IsNothing(CurrMachiningInDb) Then
' leggo parametri lavorazione originale
m_OrigMachining = New Machining(CurrMachiningInDb.nIndex, CurrMachiningInDb.sGUID, CurrMachiningInDb.sName)
'Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
'm_OrigMachining.bSlicing45 = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_SLICING45, 0, sMacIniFilePath)
'm_OrigMachining.dStrandH = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_STRANDH, 0, sMacIniFilePath)
'm_OrigMachining.dStrandW = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_STRANDW, 0, sMacIniFilePath)
'm_OrigMachining.nStrandCount = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_STRANDCOUNT, 0, sMacIniFilePath)
'm_OrigMachining.dOffset = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_OFFSET, 0, sMacIniFilePath)
'm_OrigMachining.dStartPointOffsetOnSlice = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_STARTPOINTOFFSETONSLICE, 0, sMacIniFilePath)
'm_OrigMachining.dStrandOrder = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_STRANDORDER, 0, sMacIniFilePath)
'm_OrigMachining.dDirection = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_DIRECTION, 0, sMacIniFilePath)
'm_OrigMachining.dLinkType = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LINKTYPE, 0, sMacIniFilePath)
'm_OrigMachining.dLinkParam = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LINKPARAM, 0, sMacIniFilePath)
'm_OrigMachining.dLinkZup = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LINKZUP, 0, sMacIniFilePath)
'm_OrigMachining.dOffsetLeadPoint = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_OFFSETLEADPOINT, 0, sMacIniFilePath)
'm_OrigMachining.dLeadIn = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADIN, 0, sMacIniFilePath)
'm_OrigMachining.dLeadInTangDist = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADINTANGDIST, 0, sMacIniFilePath)
'm_OrigMachining.dLeadInOrthoDist = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADINORTHODIST, 0, sMacIniFilePath)
'm_OrigMachining.dLeadOut = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADOUT, 0, sMacIniFilePath)
'm_OrigMachining.dLeadOutTangDist = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADOUTTANGDIST, 0, sMacIniFilePath)
'm_OrigMachining.dLeadOutOrthoDist = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_LEADOUTORTHODIST, 0, sMacIniFilePath)
'm_OrigMachining.dCoastingLen = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_COASTINGLEN, 0, sMacIniFilePath)
'm_OrigMachining.dCoastingFeed = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_COASTINGFEED, 0, sMacIniFilePath)
'm_OrigMachining.dWipeLen = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_WIPELEN, 0, sMacIniFilePath)
'm_OrigMachining.dWipeFeedPu = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_WIPEFEEDPU, 0, sMacIniFilePath)
'm_OrigMachining.dFloorCount = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_FLOORCOUNT, 0, sMacIniFilePath)
'm_OrigMachining.dG0Feed = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_G0FEED, 0, sMacIniFilePath)
'm_OrigMachining.dToolDiam = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_TOOLDIAM, 0, sMacIniFilePath)
'm_OrigMachining.dRibsOverlap = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSOVERLAP, 0, sMacIniFilePath)
'm_OrigMachining.dRibsStrandCount = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSSTRANDCOUNT, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLink = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLINK, 0, sMacIniFilePath)
'm_OrigMachining.dRibsInvertOrder = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSINVERTORDER, 0, sMacIniFilePath)
'm_OrigMachining.dRibsInvertDirection = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSINVERTDIRECTION, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadInInvert = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADININVERT, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadInLen = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADINLEN, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadOutInvert = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADOUTINVERT, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadOutLen = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADOUTLEN, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadOutCoasting = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADOUTCOASTING, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadOutWipe = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADOUTWIPE, 0, sMacIniFilePath)
'm_OrigMachining.dRibsLeadOutWipeDir = GetPrivateProfileDouble(CurrMachiningInDb.nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, sMacIniFilePath)
End If
Return CurrMachiningInDb
End Function
Friend Sub WriteMachParamOnPart(nPartId As Integer)
EgtSetInfo(nPartId, MAC_GUID, m_sCurrGUID)
EgtSetInfo(nPartId, MAC_SLICING45, m_bCurrSlicing45)
EgtSetInfo(nPartId, MAC_STRANDH, m_dCurrStrandH)
EgtSetInfo(nPartId, MAC_STRANDW, m_dCurrStrandW)
EgtSetInfo(nPartId, MAC_STRANDCOUNT, m_nCurrStrandCount)
EgtSetInfo(nPartId, MAC_OFFSET, m_dCurrOffset)
EgtSetInfo(nPartId, MAC_STARTPOINTOFFSETONSLICE, m_dCurrStartPointOffsetOnSlice)
EgtSetInfo(nPartId, MAC_STRANDORDER, m_nCurrStrandCount)
EgtSetInfo(nPartId, MAC_DIRECTION, m_nCurrDirection)
EgtSetInfo(nPartId, MAC_LINKTYPE, m_nCurrLinkType)
EgtSetInfo(nPartId, MAC_LINKPARAM, m_dCurrLinkParam)
EgtSetInfo(nPartId, MAC_LINKZUP, m_dCurrLinkZup)
EgtSetInfo(nPartId, MAC_OFFSETLEADPOINT, m_dCurrOffsetLeadPoint)
EgtSetInfo(nPartId, MAC_LEADIN, m_nCurrLeadIn)
EgtSetInfo(nPartId, MAC_LEADINTANGDIST, m_dCurrLeadInTangDist)
EgtSetInfo(nPartId, MAC_LEADINORTHODIST, m_dCurrLeadInOrthoDist)
EgtSetInfo(nPartId, MAC_LEADOUT, m_nCurrLeadOut)
EgtSetInfo(nPartId, MAC_LEADOUTTANGDIST, m_dCurrLeadOutTangDist)
EgtSetInfo(nPartId, MAC_LEADOUTORTHODIST, m_dCurrLeadOutOrthoDist)
EgtSetInfo(nPartId, MAC_COASTINGLEN, m_dCurrCoastingLen)
EgtSetInfo(nPartId, MAC_COASTINGFEED, m_dCurrCoastingFeed)
EgtSetInfo(nPartId, MAC_WIPELEN, m_dCurrWipeLen)
EgtSetInfo(nPartId, MAC_WIPEFEEDPU, m_dCurrWipeFeedPu)
EgtSetInfo(nPartId, MAC_FLOORCOUNT, m_dCurrFloorCount)
EgtSetInfo(nPartId, MAC_G0FEED, m_dCurrG0Feed)
EgtSetInfo(nPartId, MAC_TOOLDIAM, m_dCurrToolDiam)
EgtSetInfo(nPartId, MAC_RIBSOVERLAP, m_dCurrRibsOverlap)
EgtSetInfo(nPartId, MAC_RIBSSTRANDCOUNT, m_dCurrRibsStrandCount)
EgtSetInfo(nPartId, MAC_RIBSLINK, m_dCurrRibsLink)
EgtSetInfo(nPartId, MAC_RIBSINVERTORDER, m_dCurrRibsInvertOrder)
EgtSetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_dCurrRibsInvertDirection)
EgtSetInfo(nPartId, MAC_RIBSLEADININVERT, m_dCurrRibsLeadInInvert)
EgtSetInfo(nPartId, MAC_RIBSLEADINLEN, m_dCurrRibsLeadInLen)
EgtSetInfo(nPartId, MAC_RIBSLEADOUTINVERT, m_dCurrRibsLeadOutInvert)
EgtSetInfo(nPartId, MAC_RIBSLEADOUTLEN, m_dCurrRibsLeadOutLen)
EgtSetInfo(nPartId, MAC_RIBSLEADOUTCOASTING, m_dCurrRibsLeadOutCoasting)
EgtSetInfo(nPartId, MAC_RIBSLEADOUTWIPE, m_dCurrRibsLeadOutWipe)
EgtSetInfo(nPartId, MAC_RIBSLEADOUTWIPEDIR, m_dCurrRibsLeadOutWipeDir)
End Sub
Friend Sub UpdateMachParam()
NotifyPropertyChanged(NameOf(bCurrSlicing45))
NotifyPropertyChanged(NameOf(dCurrStrandH))
NotifyPropertyChanged(NameOf(dCurrStrandW))
NotifyPropertyChanged(NameOf(nCurrStrandCount))
NotifyPropertyChanged(NameOf(dCurrOffset))
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "ResetParam"
Public ReadOnly Property ResetParam_Command As ICommand
Get
If m_cmdResetParam Is Nothing Then
m_cmdResetParam = New Command(AddressOf ResetParam)
End If
Return m_cmdResetParam
End Get
End Property
Public Sub ResetParam(Param As Object)
Select Case Param
Case NameOf(dCurrStrandH)
dCurrStrandH = m_OrigMachining.dStrandH
End Select
End Sub
#End Region ' ResetParam
#End Region ' COMMANDS
End Class
@@ -549,6 +549,7 @@ Public Class CurrMachining
' imposto Machining da Db
Dim Machining As New Machining(MachiningIndex.nIndex, MachiningIndex.sGUID, MachiningIndex.sName)
SetOrigMachining(Machining)
sCurrGUID = MachiningIndex.sGUID
' Imposto parametri Curr copiando da Db
bCurrSlicing45 = m_OrigMachining.bSlicing45
dCurrStrandH = m_OrigMachining.dStrandH
@@ -0,0 +1,201 @@
<UserControl x:Class="CurrMachiningPanelV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PrintApp="clr-namespace:_3dPrintApp">
<Border VerticalAlignment="Center"
Style="{StaticResource RightPanel_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<UniformGrid Columns="1"
DataContext="{Binding CurrMachining}">
<!--<UniformGrid>
<TextBlock Text="Name"/>
<TextBox Text="{Binding sCurrName}"/>
</UniformGrid>-->
<UniformGrid Rows="1">
<TextBlock Text="45°"/>
<CheckBox IsChecked="{Binding bCurrSlicing45}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="StrandH"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding dCurrStrandH}"/>
<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>
</Grid>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="StrandW"/>
<TextBox Text="{Binding dCurrStrandW}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="StrandCount"/>
<TextBox Text="{Binding nCurrStrandCount}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="Offset"/>
<TextBox Text="{Binding dCurrOffset}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="StartPointOffsetOnSlice"/>
<TextBox Text="{Binding dCurrStartPointOffsetOnSlice}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="StrandOrder"/>
<ComboBox ItemsSource="{Binding StrandOrderList}"
SelectedItem="{Binding SelStrandOrder}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="Direction"/>
<ComboBox ItemsSource="{Binding DirectionList}"
SelectedItem="{Binding SelDirection}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LinkType"/>
<ComboBox ItemsSource="{Binding LinkTypeList}"
SelectedItem="{Binding SelLinkType}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LinkParam"/>
<TextBox Text="{Binding dCurrLinkParam}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LinkZup"/>
<TextBox Text="{Binding dCurrLinkZup}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="OffsetLeadPoint"/>
<TextBox Text="{Binding dCurrOffsetLeadPoint}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LinkType"/>
<ComboBox ItemsSource="{Binding LeadInList}"
SelectedItem="{Binding SelLeadIn}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LeadInTangDist"/>
<TextBox Text="{Binding dCurrLeadInTangDist}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LeadInOrthoDist"/>
<TextBox Text="{Binding dCurrLeadInOrthoDist}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LinkType"/>
<ComboBox ItemsSource="{Binding LeadOutList}"
SelectedItem="{Binding SelLeadOut}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="LeadOutTangDist"/>
<TextBox Text="{Binding dCurrLeadOutTangDist}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="CoastingLen"/>
<TextBox Text="{Binding dCurrCoastingLen}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="CoastingFeed"/>
<TextBox Text="{Binding dCurrCoastingFeed}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="WipeLen"/>
<TextBox Text="{Binding dCurrWipeLen}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="WipeFeedPu"/>
<TextBox Text="{Binding dCurrWipeFeedPu}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="FloorCount"/>
<TextBox Text="{Binding dCurrFloorCount}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="G0Feed"/>
<TextBox Text="{Binding dCurrG0Feed}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="ToolDiam"/>
<TextBox Text="{Binding dCurrToolDiam}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsOverlap"/>
<TextBox Text="{Binding dCurrRibsOverlap}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsStrandCount"/>
<TextBox Text="{Binding dCurrRibsStrandCount}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsStrandCount"/>
<TextBox Text="{Binding dCurrRibsStrandCount}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLink"/>
<TextBox Text="{Binding dCurrRibsLink}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsInvertOrder"/>
<TextBox Text="{Binding dCurrRibsInvertOrder}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsInvertDirection"/>
<TextBox Text="{Binding dCurrRibsInvertDirection}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadInInvert"/>
<TextBox Text="{Binding dCurrRibsLeadInInvert}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="dRibsLeadInLen"/>
<TextBox Text="{Binding dCurrRibsLeadInLen}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadOutInvert"/>
<TextBox Text="{Binding dCurrRibsLeadOutInvert}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadOutLen"/>
<TextBox Text="{Binding dCurrRibsLeadOutLen}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadOutCoasting"/>
<TextBox Text="{Binding dCurrRibsLeadOutCoasting}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadOutWipe"/>
<TextBox Text="{Binding dCurrRibsLeadOutWipe}"/>
</UniformGrid>
<UniformGrid Rows="1">
<TextBlock Text="RibsLeadOutWipeDir"/>
<TextBox Text="{Binding dCurrRibsLeadOutWipeDir}"/>
</UniformGrid>
</UniformGrid>
</ScrollViewer>
<UniformGrid Grid.Row="1" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Cancel"
Command="{Binding Cancel_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,3 @@
Public Class CurrMachiningPanelV
End Class
@@ -0,0 +1,88 @@
Imports EgtWPFLib5
Public Class CurrMachiningPanelVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_CurrMachining As CurrMachining
Public ReadOnly Property CurrMachining As CurrMachining
Get
Return m_CurrMachining
End Get
End Property
Friend Sub SetCurrMachining(CurrMachining As CurrMachining)
m_CurrMachining = CurrMachining
NotifyPropertyChanged(NameOf(CurrMachining))
Map.refTopPanelVM.UpdateCurrMachining()
End Sub
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCancel As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTORS"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefCurrMachiningPanelVM(Me)
End Sub
#End Region ' CONSTRUCTORS
Friend Sub ReadMachParamFromSelPart()
If IsNothing(Map.refTopPanelVM.SelPart) Then Return
Dim nData As Integer = 0
m_CurrMachining = New CurrMachining(Map.refTopPanelVM.SelPart.nPartId)
SetCurrMachining(m_CurrMachining)
' aggiorno parametri mostrati nella barra
NotifyPropertyChanged(NameOf(CurrMachining))
Map.refTopPanelVM.UpdateCurrMachining()
End Sub
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
' scrivo i parametri modificati
m_CurrMachining.WriteMachParamOnPart(Map.refTopPanelVM.SelPart.nPartId)
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Ok
#Region "Cancel"
Public ReadOnly Property Cancel_Command As ICommand
Get
If m_cmdCancel Is Nothing Then
m_cmdCancel = New Command(AddressOf Cancel)
End If
Return m_cmdCancel
End Get
End Property
Public Sub Cancel()
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Cancel
#End Region ' COMMANDS
End Class
@@ -86,3 +86,4 @@ Public Class CurrMachiningPanelVM
#End Region ' COMMANDS
End Class
@@ -0,0 +1,551 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class Machining
Inherits VMBase
Public Enum MPAR_STRANDORDERS As Integer
INTOOUT = 1
OUTTOIN = 2
End Enum
Public Enum MPAR_DIRECTIONS As Integer
CCW = 1
CW = 2
End Enum
Public Enum MPAR_LINKTYPES As Integer
NONE = 1
LINEAR = 2
BIARC = 3
End Enum
Public Enum MPAR_LEADINOUT As Integer
NONE = 1
LINEAR = 2
ARC = 3
End Enum
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String = ""
Public Property sGUID As String
Get
Return m_sGUID
End Get
Set(value As String)
m_sGUID = value
End Set
End Property
Private m_sName As String = ""
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
End Set
End Property
Private m_bSlicing45 As Boolean
Public Property bSlicing45 As Boolean
Get
Return m_bSlicing45
End Get
Set(value As Boolean)
m_bSlicing45 = value
End Set
End Property
Private m_dStrandH As Double
Public Property dStrandH As Double
Get
Return m_dStrandH
End Get
Set(value As Double)
m_dStrandH = value
End Set
End Property
Private m_dStrandW As Double
Public Property dStrandW As Double
Get
Return m_dStrandW
End Get
Set(value As Double)
m_dStrandW = value
End Set
End Property
Private m_nStrandCount As Integer
Public Property nStrandCount As Integer
Get
Return m_nStrandCount
End Get
Set(value As Integer)
m_nStrandCount = value
End Set
End Property
Private m_dOffset As Double
Public Property dOffset As Double
Get
Return m_dOffset
End Get
Set(value As Double)
m_dOffset = value
End Set
End Property
Private m_dStartPointOffsetOnSlice As Double
Public Property dStartPointOffsetOnSlice As Double
Get
Return m_dStartPointOffsetOnSlice
End Get
Set(value As Double)
m_dStartPointOffsetOnSlice = value
End Set
End Property
Private m_dStrandOrder As MPAR_STRANDORDERS
Public Property dStrandOrder As MPAR_STRANDORDERS
Get
Return m_dStrandOrder
End Get
Set(value As MPAR_STRANDORDERS)
m_dStrandOrder = value
End Set
End Property
Friend Sub SetStrandOrder(StrandOrder As Integer)
m_dStrandOrder = StrandOrder
End Sub
Private m_dDirection As MPAR_DIRECTIONS
Public Property dDirection As MPAR_DIRECTIONS
Get
Return m_dDirection
End Get
Set(value As MPAR_DIRECTIONS)
m_dDirection = value
End Set
End Property
Friend Sub SetDirection(Direction As Integer)
m_dDirection = Direction
End Sub
Private m_dLinkType As MPAR_LINKTYPES
Public Property dLinkType As MPAR_LINKTYPES
Get
Return m_dLinkType
End Get
Set(value As MPAR_LINKTYPES)
m_dLinkType = value
End Set
End Property
Friend Sub SetLinkType(LinkType As Integer)
m_dLinkType = LinkType
End Sub
Private m_dLinkParam As Double
Public Property dLinkParam As Double
Get
Return m_dLinkParam
End Get
Set(value As Double)
m_dLinkParam = value
End Set
End Property
Private m_dLinkZup As Double
Public Property dLinkZup As Double
Get
Return m_dLinkZup
End Get
Set(value As Double)
m_dLinkZup = value
End Set
End Property
Private m_dOffsetLeadPoint As Double
Public Property dOffsetLeadPoint As Double
Get
Return m_dOffsetLeadPoint
End Get
Set(value As Double)
m_dOffsetLeadPoint = value
End Set
End Property
Private m_dLeadIn As MPAR_LEADINOUT
Public Property dLeadIn As MPAR_LEADINOUT
Get
Return m_dLeadIn
End Get
Set(value As MPAR_LEADINOUT)
m_dLeadIn = value
End Set
End Property
Friend Sub SetLeadIn(LeadIn As Integer)
m_dLeadIn = LeadIn
End Sub
Private m_dLeadInTangDist As Double
Public Property dLeadInTangDist As Double
Get
Return m_dLeadInTangDist
End Get
Set(value As Double)
m_dLeadInTangDist = value
End Set
End Property
Private m_dLeadInOrthoDist As Double
Public Property dLeadInOrthoDist As Double
Get
Return m_dLeadInOrthoDist
End Get
Set(value As Double)
m_dLeadInOrthoDist = value
End Set
End Property
Private m_dLeadOut As MPAR_LEADINOUT
Public Property dLeadOut As MPAR_LEADINOUT
Get
Return m_dLeadOut
End Get
Set(value As MPAR_LEADINOUT)
m_dLeadOut = value
End Set
End Property
Friend Sub SetLeadOut(LeadOut As Integer)
m_dLeadOut = LeadOut
End Sub
Private m_dLeadOutTangDist As Double
Public Property dLeadOutTangDist As Double
Get
Return m_dLeadOutTangDist
End Get
Set(value As Double)
m_dLeadOutTangDist = value
End Set
End Property
Private m_dLeadOutOrthoDist As Double
Public Property dLeadOutOrthoDist As Double
Get
Return m_dLeadOutOrthoDist
End Get
Set(value As Double)
m_dLeadOutOrthoDist = value
End Set
End Property
Private m_dCoastingLen As Double
Public Property dCoastingLen As Double
Get
Return m_dCoastingLen
End Get
Set(value As Double)
m_dCoastingLen = value
End Set
End Property
Private m_dCoastingFeed As Double
Public Property dCoastingFeed As Double
Get
Return m_dCoastingFeed
End Get
Set(value As Double)
m_dCoastingFeed = value
End Set
End Property
Private m_dWipeLen As Double
Public Property dWipeLen As Double
Get
Return m_dWipeLen
End Get
Set(value As Double)
m_dWipeLen = value
End Set
End Property
Private m_dWipeFeedPu As Double
Public Property dWipeFeedPu As Double
Get
Return m_dWipeFeedPu
End Get
Set(value As Double)
m_dWipeFeedPu = value
End Set
End Property
Private m_dFloorCount As Integer
Public Property dFloorCount As Double
Get
Return m_dFloorCount
End Get
Set(value As Double)
m_dFloorCount = value
End Set
End Property
Private m_dG0Feed As Double
Public Property dG0Feed As Double
Get
Return m_dG0Feed
End Get
Set(value As Double)
m_dG0Feed = value
End Set
End Property
Private m_dMaterial As String
Public Property dMaterial As Double
Get
Return m_dMaterial
End Get
Set(value As Double)
m_dMaterial = value
End Set
End Property
Private m_dToolDiam As Double
Public Property dToolDiam As Double
Get
Return m_dToolDiam
End Get
Set(value As Double)
m_dToolDiam = value
End Set
End Property
Private m_dRibsOverlap As Double
Public Property dRibsOverlap As Double
Get
Return m_dRibsOverlap
End Get
Set(value As Double)
m_dRibsOverlap = value
End Set
End Property
Private m_dRibsStrandCount As Integer
Public Property dRibsStrandCount As Double
Get
Return m_dRibsStrandCount
End Get
Set(value As Double)
m_dRibsStrandCount = value
End Set
End Property
Private m_dRibsLink As Boolean
Public Property dRibsLink As Double
Get
Return m_dRibsLink
End Get
Set(value As Double)
m_dRibsLink = value
End Set
End Property
Private m_dRibsInvertOrder As Boolean
Public Property dRibsInvertOrder As Double
Get
Return m_dRibsInvertOrder
End Get
Set(value As Double)
m_dRibsInvertOrder = value
End Set
End Property
Private m_dRibsInvertDirection As Boolean
Public Property dRibsInvertDirection As Double
Get
Return m_dRibsInvertDirection
End Get
Set(value As Double)
m_dRibsInvertDirection = value
End Set
End Property
Private m_dRibsLeadInInvert As Boolean
Public Property dRibsLeadInInvert As Double
Get
Return m_dRibsLeadInInvert
End Get
Set(value As Double)
m_dRibsLeadInInvert = value
End Set
End Property
Private m_dRibsLeadInLen As Double
Public Property dRibsLeadInLen As Double
Get
Return m_dRibsLeadInLen
End Get
Set(value As Double)
m_dRibsLeadInLen = value
End Set
End Property
Private m_dRibsLeadOutInvert As Boolean
Public Property dRibsLeadOutInvert As Double
Get
Return m_dRibsLeadOutInvert
End Get
Set(value As Double)
m_dRibsLeadOutInvert = value
End Set
End Property
Private m_dRibsLeadOutLen As Double
Public Property dRibsLeadOutLen As Double
Get
Return m_dRibsLeadOutLen
End Get
Set(value As Double)
m_dRibsLeadOutLen = value
End Set
End Property
Private m_dRibsLeadOutCoasting As Double
Public Property dRibsLeadOutCoasting As Double
Get
Return m_dRibsLeadOutCoasting
End Get
Set(value As Double)
m_dRibsLeadOutCoasting = value
End Set
End Property
Private m_dRibsLeadOutWipe As Double
Public Property dRibsLeadOutWipe As Double
Get
Return m_dRibsLeadOutWipe
End Get
Set(value As Double)
m_dRibsLeadOutWipe = value
End Set
End Property
Private m_dRibsLeadOutWipeDir As Double
Public Property dRibsLeadOutWipeDir As Double
Get
Return m_dRibsLeadOutWipeDir
End Get
Set(value As Double)
m_dRibsLeadOutWipeDir = value
End Set
End Property
Sub New()
End Sub
Sub New(nIndex As Integer)
m_nIndex = nIndex
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
GetPrivateProfileString(m_nIndex, MAC_NAME, "", m_sName, sMacIniFilePath)
GetPrivateProfileString(m_nIndex, MAC_GUID, "", m_sGUID, sMacIniFilePath)
ReadAllParams()
End Sub
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sName = sName
m_sGUID = sGUID
ReadAllParams()
End Sub
Sub New(sName As String, bSlicing45 As Boolean, dStrandH As Double, dStrandW As Double, nStrandCount As Integer, dOffset As Double, dStartPointOffsetOnSlice As Double,
dStrandOrder As MPAR_STRANDORDERS, dDirection As MPAR_DIRECTIONS, dLinkType As MPAR_LINKTYPES, dLinkParam As Double, dLinkZup As Double, dOffsetLeadPoint As Double,
dLeadIn As MPAR_LEADINOUT, dLeadInTangDist As Double, dLeadInOrthoDist As Double, dLeadOut As MPAR_LEADINOUT, dLeadOutTangDist As Double, dLeadOutOrthoDist As Double,
dCoastingLen As Double, dCoastingFeed As Double, dWipeLen As Double, dWipeFeedPu As Double, dFloorCount As Integer, dG0Feed As Double, dMaterial As String,
dToolDiam As Double, dRibsOverlap As Double, dRibsStrandCount As Integer, dRibsLink As Boolean, dRibsInvertOrder As Boolean, dRibsInvertDirection As Boolean,
dRibsLeadInInvert As Boolean, dRibsLeadInLen As Double, dRibsLeadOutInvert As Boolean, dRibsLeadOutLen As Double, dRibsLeadOutCoasting As Double,
dRibsLeadOutWipe As Double, dRibsLeadOutWipeDir As Double)
End Sub
Private Sub ReadAllParams()
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
m_bSlicing45 = GetPrivateProfileDouble(m_nIndex, MAC_SLICING45, 0, sMacIniFilePath)
m_dStrandH = GetPrivateProfileDouble(m_nIndex, MAC_STRANDH, 0, sMacIniFilePath)
m_dStrandW = GetPrivateProfileDouble(m_nIndex, MAC_STRANDW, 0, sMacIniFilePath)
m_nStrandCount = GetPrivateProfileDouble(m_nIndex, MAC_STRANDCOUNT, 0, sMacIniFilePath)
m_dOffset = GetPrivateProfileDouble(m_nIndex, MAC_OFFSET, 0, sMacIniFilePath)
m_dStartPointOffsetOnSlice = GetPrivateProfileDouble(m_nIndex, MAC_STARTPOINTOFFSETONSLICE, 0, sMacIniFilePath)
m_dStrandOrder = GetPrivateProfileDouble(m_nIndex, MAC_STRANDORDER, 0, sMacIniFilePath)
m_dDirection = GetPrivateProfileDouble(m_nIndex, MAC_DIRECTION, 0, sMacIniFilePath)
m_dLinkType = GetPrivateProfileDouble(m_nIndex, MAC_LINKTYPE, 0, sMacIniFilePath)
m_dLinkParam = GetPrivateProfileDouble(m_nIndex, MAC_LINKPARAM, 0, sMacIniFilePath)
m_dLinkZup = GetPrivateProfileDouble(m_nIndex, MAC_LINKZUP, 0, sMacIniFilePath)
m_dOffsetLeadPoint = GetPrivateProfileDouble(m_nIndex, MAC_OFFSETLEADPOINT, 0, sMacIniFilePath)
m_dLeadIn = GetPrivateProfileDouble(m_nIndex, MAC_LEADIN, 0, sMacIniFilePath)
m_dLeadInTangDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADINTANGDIST, 0, sMacIniFilePath)
m_dLeadInOrthoDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADINORTHODIST, 0, sMacIniFilePath)
m_dLeadOut = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUT, 0, sMacIniFilePath)
m_dLeadOutTangDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUTTANGDIST, 0, sMacIniFilePath)
m_dLeadOutOrthoDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUTORTHODIST, 0, sMacIniFilePath)
m_dCoastingLen = GetPrivateProfileDouble(m_nIndex, MAC_COASTINGLEN, 0, sMacIniFilePath)
m_dCoastingFeed = GetPrivateProfileDouble(m_nIndex, MAC_COASTINGFEED, 0, sMacIniFilePath)
m_dWipeLen = GetPrivateProfileDouble(m_nIndex, MAC_WIPELEN, 0, sMacIniFilePath)
m_dWipeFeedPu = GetPrivateProfileDouble(m_nIndex, MAC_WIPEFEEDPU, 0, sMacIniFilePath)
m_dFloorCount = GetPrivateProfileDouble(m_nIndex, MAC_FLOORCOUNT, 0, sMacIniFilePath)
m_dG0Feed = GetPrivateProfileDouble(m_nIndex, MAC_G0FEED, 0, sMacIniFilePath)
m_dToolDiam = GetPrivateProfileDouble(m_nIndex, MAC_TOOLDIAM, 0, sMacIniFilePath)
m_dRibsOverlap = GetPrivateProfileDouble(m_nIndex, MAC_RIBSOVERLAP, 0, sMacIniFilePath)
m_dRibsStrandCount = GetPrivateProfileDouble(m_nIndex, MAC_RIBSSTRANDCOUNT, 0, sMacIniFilePath)
m_dRibsLink = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLINK, 0, sMacIniFilePath)
m_dRibsInvertOrder = GetPrivateProfileDouble(m_nIndex, MAC_RIBSINVERTORDER, 0, sMacIniFilePath)
m_dRibsInvertDirection = GetPrivateProfileDouble(m_nIndex, MAC_RIBSINVERTDIRECTION, 0, sMacIniFilePath)
m_dRibsLeadInInvert = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADININVERT, 0, sMacIniFilePath)
m_dRibsLeadInLen = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADINLEN, 0, sMacIniFilePath)
m_dRibsLeadOutInvert = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTINVERT, 0, sMacIniFilePath)
m_dRibsLeadOutLen = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTLEN, 0, sMacIniFilePath)
m_dRibsLeadOutCoasting = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTCOASTING, 0, sMacIniFilePath)
m_dRibsLeadOutWipe = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTWIPE, 0, sMacIniFilePath)
m_dRibsLeadOutWipeDir = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, sMacIniFilePath)
End Sub
End Class
Public Class MachiningIndex
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Get
Return m_sGUID
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sGUID = sGUID
m_sName = sName
End Sub
End Class
+897 -9
View File
@@ -1,4 +1,6 @@
Imports EgtUILib
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports EgtUILib
Imports EgtWPFLib5
Public Class Machining
@@ -26,6 +28,24 @@ Public Class Machining
ARC = 3
End Enum
Private m_CathegoryList As New ObservableCollection(Of MachiningCathegory)
Public ReadOnly Property CathegoryList As ObservableCollection(Of MachiningCathegory)
Get
Return m_CathegoryList
End Get
End Property
Private m_bIsModified As Boolean
Public ReadOnly Property bIsModified As Boolean
Get
Return m_bIsModified
End Get
End Property
Friend Sub UpdateIsModified()
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
End Sub
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
@@ -50,8 +70,15 @@ Public Class Machining
End Get
Set(value As String)
m_sName = value
Map.refMachiningDbVM.SetNameVisibility(False)
NotifyPropertyChanged(NameOf(ghName))
End Set
End Property
Public ReadOnly Property ghName As String
Get
Return m_sName & If(m_bIsModified, "*", "")
End Get
End Property
Private m_bSlicing45 As Boolean
Public Property bSlicing45 As Boolean
@@ -451,10 +478,50 @@ Public Class Machining
Sub New()
End Sub
Sub New(nIndex As Integer)
m_nIndex = nIndex
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
If GetPrivateProfileString(nIndex, MAC_GUID, "", m_sGUID, sMacIniFilePath) > 0 Then
GetPrivateProfileString(nIndex, MAC_NAME, "", m_sName, sMacIniFilePath)
Else
nIndex = -1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "PrintingParam"
End If
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.GENERAL, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.LINK, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.LEADIN, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.LEADOUT, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.COASTING, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.WIPE, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.TOOL, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.RIBS, nIndex))
m_CathegoryList.Add(New MachiningCathegory(MachiningCathegory.Cathegories.MATERIALS, nIndex))
For Each Cathegory In m_CathegoryList
For Each MachiningParam In Cathegory.MachiningParamList
AddHandler MachiningParam.PropertyChanged, AddressOf OnMachiningParamPropertyChanged
Next
Next
End Sub
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sName = sName
m_sGUID = sGUID
ReadAllParams()
End Sub
Sub New(sName As String, bSlicing45 As Boolean, dStrandH As Double, dStrandW As Double, nStrandCount As Integer, dOffset As Double, dStartPointOffsetOnSlice As Double,
dStrandOrder As MPAR_STRANDORDERS, dDirection As MPAR_DIRECTIONS, dLinkType As MPAR_LINKTYPES, dLinkParam As Double, dLinkZup As Double, dOffsetLeadPoint As Double,
dLeadIn As MPAR_LEADINOUT, dLeadInTangDist As Double, dLeadInOrthoDist As Double, dLeadOut As MPAR_LEADINOUT, dLeadOutTangDist As Double, dLeadOutOrthoDist As Double,
dCoastingLen As Double, dCoastingFeed As Double, dWipeLen As Double, dWipeFeedPu As Double, dFloorCount As Integer, dG0Feed As Double, dMaterial As String,
dToolDiam As Double, dRibsOverlap As Double, dRibsStrandCount As Integer, dRibsLink As Boolean, dRibsInvertOrder As Boolean, dRibsInvertDirection As Boolean,
dRibsLeadInInvert As Boolean, dRibsLeadInLen As Double, dRibsLeadOutInvert As Boolean, dRibsLeadOutLen As Double, dRibsLeadOutCoasting As Double,
dRibsLeadOutWipe As Double, dRibsLeadOutWipeDir As Double)
End Sub
Private Sub ReadAllParams()
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
m_bSlicing45 = GetPrivateProfileDouble(m_nIndex, MAC_SLICING45, 0, sMacIniFilePath)
m_dStrandH = GetPrivateProfileDouble(m_nIndex, MAC_STRANDH, 0, sMacIniFilePath)
@@ -495,19 +562,59 @@ Public Class Machining
m_dRibsLeadOutWipeDir = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, sMacIniFilePath)
End Sub
Sub New(sName As String, bSlicing45 As Boolean, dStrandH As Double, dStrandW As Double, nStrandCount As Integer, dOffset As Double, dStartPointOffsetOnSlice As Double,
dStrandOrder As MPAR_STRANDORDERS, dDirection As MPAR_DIRECTIONS, dLinkType As MPAR_LINKTYPES, dLinkParam As Double, dLinkZup As Double, dOffsetLeadPoint As Double,
dLeadIn As MPAR_LEADINOUT, dLeadInTangDist As Double, dLeadInOrthoDist As Double, dLeadOut As MPAR_LEADINOUT, dLeadOutTangDist As Double, dLeadOutOrthoDist As Double,
dCoastingLen As Double, dCoastingFeed As Double, dWipeLen As Double, dWipeFeedPu As Double, dFloorCount As Integer, dG0Feed As Double, dMaterial As String,
dToolDiam As Double, dRibsOverlap As Double, dRibsStrandCount As Integer, dRibsLink As Boolean, dRibsInvertOrder As Boolean, dRibsInvertDirection As Boolean,
dRibsLeadInInvert As Boolean, dRibsLeadInLen As Double, dRibsLeadOutInvert As Boolean, dRibsLeadOutLen As Double, dRibsLeadOutCoasting As Double,
dRibsLeadOutWipe As Double, dRibsLeadOutWipeDir As Double)
Friend Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
' resetto stato di modificata
UpdateIsModified()
' segno Db come modificato
Map.refMachiningDbVM.SetIsModified(True)
End If
End Sub
Private Sub SaveParams()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub ResetModification()
If bIsModified Then
' annullo le modifiche di tutti i parametri
SaveParams()
' resetto stato di modificata
UpdateIsModified()
End If
End Sub
Private Sub ResetParams()
For Each Cathegory In m_CathegoryList
Cathegory.ResetParams()
Next
End Sub
Friend Sub WriteParamsOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
WritePrivateProfileString(nIndex, MAC_GUID, m_sGUID, sMacIniFilePath)
WritePrivateProfileString(nIndex, MAC_NAME, m_sName, sMacIniFilePath)
For Each Cathegory In m_CathegoryList
Cathegory.WriteParamOnDb(nIndex)
Next
End Sub
Private Sub OnMachiningParamPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue)
m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
End Select
End Sub
End Class
Public Class MachiningIndex
Inherits VMBase
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
@@ -536,4 +643,785 @@ Public Class MachiningIndex
m_sName = sName
End Sub
End Class
End Class
Public Class MachiningCathegory
Inherits VMBase
Public Enum Cathegories As Integer
GENERAL = 1
LINK = 2
LEADIN = 3
LEADOUT = 4
COASTING = 5
WIPE = 6
TOOL = 7
RIBS = 8
MATERIALS = 9
End Enum
Private m_Type As Cathegories
Public Overloads ReadOnly Property Type As Cathegories
Get
Return m_Type
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Private m_MachiningParamList As List(Of MachiningParam)
Public ReadOnly Property MachiningParamList As List(Of MachiningParam)
Get
Return m_MachiningParamList
End Get
End Property
Private m_Cathegory_IsExpanded As Boolean
Public Property Cathegory_IsExpanded As Boolean
Get
Return m_Cathegory_IsExpanded
End Get
Set(value As Boolean)
m_Cathegory_IsExpanded = value
End Set
End Property
Sub New(Type As Cathegories, nIndex As Integer)
m_Type = Type
Select Case m_Type
Case Cathegories.GENERAL
m_sName = "General"
m_MachiningParamList = New List(Of MachiningParam)({New CheckMachiningParam(MachiningParam.Params.SLICING45, nIndex),
New NumericMachiningParam(MachiningParam.Params.STRANDH, nIndex),
New NumericMachiningParam(MachiningParam.Params.STRANDW, nIndex),
New NumericMachiningParam(MachiningParam.Params.STRANDCOUNT, nIndex),
New NumericMachiningParam(MachiningParam.Params.OFFSET, nIndex),
New NumericMachiningParam(MachiningParam.Params.STARTPOINTOFFSETONSLICE, nIndex),
New ComboMachiningParam(MachiningParam.Params.STRANDORDER, nIndex),
New ComboMachiningParam(MachiningParam.Params.DIRECTION, nIndex),
New NumericMachiningParam(MachiningParam.Params.FLOORCOUNT, nIndex),
New NumericMachiningParam(MachiningParam.Params.G0FEED, nIndex)})
Case Cathegories.LINK
m_sName = "Link"
m_MachiningParamList = New List(Of MachiningParam)({New ComboMachiningParam(MachiningParam.Params.LINKTYPE, nIndex),
New NumericMachiningParam(MachiningParam.Params.LINKPARAM, nIndex),
New NumericMachiningParam(MachiningParam.Params.LINKZUP, nIndex)})
Case Cathegories.LEADIN
m_sName = "Lead In"
m_MachiningParamList = New List(Of MachiningParam)({New NumericMachiningParam(MachiningParam.Params.OFFSETLEADPOINT, nIndex),
New ComboMachiningParam(MachiningParam.Params.LEADIN, nIndex),
New NumericMachiningParam(MachiningParam.Params.LEADINTANGDIST, nIndex),
New NumericMachiningParam(MachiningParam.Params.LEADINORTHODIST, nIndex)})
Case Cathegories.LEADOUT
m_sName = "Lead Out"
m_MachiningParamList = New List(Of MachiningParam)({New ComboMachiningParam(MachiningParam.Params.LEADOUT, nIndex),
New NumericMachiningParam(MachiningParam.Params.LEADOUTTANGDIST, nIndex),
New NumericMachiningParam(MachiningParam.Params.LEADOUTORTHODIST, nIndex)})
Case Cathegories.COASTING
m_sName = "Coasting"
m_MachiningParamList = New List(Of MachiningParam)({New NumericMachiningParam(MachiningParam.Params.COASTINGLEN, nIndex),
New NumericMachiningParam(MachiningParam.Params.COASTINGFEED, nIndex)})
Case Cathegories.WIPE
m_sName = "Wipe"
m_MachiningParamList = New List(Of MachiningParam)({New NumericMachiningParam(MachiningParam.Params.WIPELEN, nIndex),
New NumericMachiningParam(MachiningParam.Params.WIPEFEEDPU, nIndex)})
Case Cathegories.TOOL
m_sName = "Tool"
m_MachiningParamList = New List(Of MachiningParam)({New NumericMachiningParam(MachiningParam.Params.TOOLDIAM, nIndex)})
Case Cathegories.RIBS
m_sName = "Ribs"
m_MachiningParamList = New List(Of MachiningParam)({New NumericMachiningParam(MachiningParam.Params.RIBSOVERLAP, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSSTRANDCOUNT, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLINK, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSINVERTORDER, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADOUTLEN, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADOUTCOASTING, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADOUTWIPE, nIndex),
New NumericMachiningParam(MachiningParam.Params.RIBSLEADOUTWIPEDIR, nIndex)})
Case Cathegories.MATERIALS
m_sName = "Materials"
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Dim sMaterials As String = ""
GetPrivateProfileString(nIndex, MAC_MATERIALS, "", sMaterials, sMacIniFilePath)
Dim MaterialGuidList As List(Of String) = sMaterials.Split(";"c).ToList()
m_MachiningParamList = New List(Of MachiningParam)
For Each Material In Map.refTopPanelVM.MaterialList
m_MachiningParamList.Add(New MaterialMachiningParam(Material.sName, Material.sGUID, MaterialGuidList.Contains(Material.sGUID)))
Next
End Select
End Sub
Friend Sub SaveParams()
For Each Param In m_MachiningParamList
Param.SaveParam()
Next
End Sub
Friend Sub ResetParams()
For Each Param In m_MachiningParamList
Param.ResetParam()
Next
End Sub
Friend Sub WriteParamOnDb(nIndex As Integer)
If Type = Cathegories.MATERIALS Then
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
WritePrivateProfileString(nIndex, MAC_MATERIALS, "", sMacIniFilePath)
End If
For Each Param In m_MachiningParamList
Param.WriteParamOnDb(nIndex)
Next
End Sub
End Class
Public MustInherit Class MachiningParam
Inherits VMBase
Public Enum Params As Integer
NAME = 2
SLICING45 = 3
STRANDH = 4
STRANDW = 5
STRANDCOUNT = 6
OFFSET = 7
STARTPOINTOFFSETONSLICE = 8
STRANDORDER = 9
DIRECTION = 10
LINKTYPE = 11
LINKPARAM = 12
LINKZUP = 13
OFFSETLEADPOINT = 14
LEADIN = 15
LEADINTANGDIST = 16
LEADINORTHODIST = 17
LEADOUT = 18
LEADOUTTANGDIST = 19
LEADOUTORTHODIST = 20
COASTINGLEN = 21
COASTINGFEED = 22
WIPELEN = 23
WIPEFEEDPU = 24
FLOORCOUNT = 25
G0FEED = 26
TOOLDIAM = 27
RIBSOVERLAP = 28
RIBSSTRANDCOUNT = 29
RIBSLINK = 30
RIBSINVERTORDER = 31
RIBSINVERTDIRECTION = 32
RIBSLEADININVERT = 33
RIBSLEADINLEN = 34
RIBSLEADOUTINVERT = 35
RIBSLEADOUTLEN = 36
RIBSLEADOUTCOASTING = 37
RIBSLEADOUTWIPE = 38
RIBSLEADOUTWIPEDIR = 39
MATERIALS = 40
End Enum
Private m_Type As Params
Public ReadOnly Property Type As Params
Get
Return m_Type
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Public MustOverride ReadOnly Property bIsModified As Boolean
Sub New(Type As Params)
m_Type = Type
Select Case m_Type
Case Params.SLICING45
m_sName = "Slicing 45°"
Case Params.STRANDH
m_sName = "StrandH"
Case Params.STRANDW
m_sName = "StrandW"
Case Params.STRANDCOUNT
m_sName = "Strand Count"
Case Params.OFFSET
m_sName = "Offset"
Case Params.STARTPOINTOFFSETONSLICE
m_sName = "Start Point Offset On Slice"
Case Params.STRANDORDER
m_sName = "Strand Order"
Case Params.DIRECTION
m_sName = "Direction"
Case Params.LINKTYPE
m_sName = "Link Type"
Case Params.LINKPARAM
m_sName = "Link Param"
Case Params.LINKZUP
m_sName = "Link Z Up"
Case Params.OFFSETLEADPOINT
m_sName = "Offset Lead Point"
Case Params.LEADIN
m_sName = "Lead In"
Case Params.LEADINTANGDIST
m_sName = "Lead In Tang Dist"
Case Params.LEADINORTHODIST
m_sName = "Lead In Ortho Dist"
Case Params.LEADOUT
m_sName = "Lead Out"
Case Params.LEADOUTTANGDIST
m_sName = "Lead Out Tang Dist"
Case Params.LEADOUTORTHODIST
m_sName = "Lead Out Ortho Dist"
Case Params.COASTINGLEN
m_sName = "Coasting Len"
Case Params.COASTINGFEED
m_sName = "Coasting Feed"
Case Params.WIPELEN
m_sName = "Wipe Len"
Case Params.WIPEFEEDPU
m_sName = "Wipe Feed Pu"
Case Params.FLOORCOUNT
m_sName = "Floor Count"
Case Params.G0FEED
m_sName = "G0 Feed"
Case Params.TOOLDIAM
m_sName = "Tool Diam"
Case Params.RIBSOVERLAP
m_sName = "Ribs Overlap"
Case Params.RIBSSTRANDCOUNT
m_sName = "Ribs Starnd Count"
Case Params.RIBSLINK
m_sName = "Ribs Link"
Case Params.RIBSINVERTORDER
m_sName = "Ribs Invert Order"
Case Params.RIBSINVERTDIRECTION
m_sName = "Ribs Invert Direction"
Case Params.RIBSLEADININVERT
m_sName = "Ribs Lead In Invert"
Case Params.RIBSLEADINLEN
m_sName = "Ribs Lead In Len"
Case Params.RIBSLEADOUTINVERT
m_sName = "Ribs Lead Out Invert"
Case Params.RIBSLEADOUTLEN
m_sName = "Ribs Lead Out Len"
Case Params.RIBSLEADOUTCOASTING
m_sName = "Ribs Lead Out Coasting"
Case Params.RIBSLEADOUTWIPE
m_sName = "Ribs Lead Out Wipe"
Case Params.RIBSLEADOUTWIPEDIR
m_sName = "Ribs Lead Out Wipe Dir"
End Select
End Sub
Sub New(sName As String)
m_Type = Params.MATERIALS
m_sName = sName
End Sub
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer)
Friend MustOverride Sub SaveParam()
Friend MustOverride Sub ResetParam()
End Class
Public Class NumericMachiningParam
Inherits MachiningParam
Private m_bIsLen As Boolean = False
Private m_dValue As Double
Public Property dValue As String
Get
Return If(m_bIsLen, LenToString(m_dValue, 1), m_dValue)
End Get
Set(value As String)
If m_bIsLen Then
StringToLen(value, m_dValue)
Else
m_dValue = value
End If
NotifyPropertyChanged(NameOf(dValue))
End Set
End Property
Private m_dOrigValue As Double
Public ReadOnly Property dOrigValue As Double
Get
Return m_dOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_dValue <> m_dOrigValue
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.STRANDH
m_dValue = GetPrivateProfileDouble(nIndex, MAC_STRANDH, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.STRANDW
m_dValue = GetPrivateProfileDouble(nIndex, MAC_STRANDW, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.STRANDCOUNT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_STRANDCOUNT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.OFFSET
m_dValue = GetPrivateProfileDouble(nIndex, MAC_OFFSET, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.STARTPOINTOFFSETONSLICE
m_dValue = GetPrivateProfileDouble(nIndex, MAC_STARTPOINTOFFSETONSLICE, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LINKPARAM
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LINKPARAM, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LINKZUP
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LINKZUP, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.OFFSETLEADPOINT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_OFFSETLEADPOINT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LEADINTANGDIST
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LEADINTANGDIST, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LEADINORTHODIST
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LEADINORTHODIST, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LEADOUTTANGDIST
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LEADOUTTANGDIST, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.LEADOUTORTHODIST
m_dValue = GetPrivateProfileDouble(nIndex, MAC_LEADOUTORTHODIST, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.COASTINGLEN
m_dValue = GetPrivateProfileDouble(nIndex, MAC_COASTINGLEN, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.COASTINGFEED
m_dValue = GetPrivateProfileDouble(nIndex, MAC_COASTINGFEED, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.WIPELEN
m_dValue = GetPrivateProfileDouble(nIndex, MAC_WIPELEN, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.WIPEFEEDPU
m_dValue = GetPrivateProfileDouble(nIndex, MAC_WIPEFEEDPU, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.FLOORCOUNT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_FLOORCOUNT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.G0FEED
m_dValue = GetPrivateProfileDouble(nIndex, MAC_G0FEED, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.TOOLDIAM
m_dValue = GetPrivateProfileDouble(nIndex, MAC_TOOLDIAM, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSOVERLAP
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSOVERLAP, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSSTRANDCOUNT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSSTRANDCOUNT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLINK
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLINK, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSINVERTORDER
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSINVERTORDER, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSINVERTDIRECTION
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSINVERTDIRECTION, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADININVERT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADININVERT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADINLEN
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADINLEN, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADOUTINVERT
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADOUTINVERT, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADOUTLEN
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADOUTLEN, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADOUTCOASTING
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADOUTCOASTING, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADOUTWIPE
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADOUTWIPE, 0, sMacIniFilePath)
m_bIsLen = True
Case Params.RIBSLEADOUTWIPEDIR
m_dValue = GetPrivateProfileDouble(nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, sMacIniFilePath)
m_bIsLen = True
End Select
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Dim sWriteValue As String = ""
If m_bIsLen Then
sWriteValue = LenToString(m_dValue, 2)
Else
sWriteValue = DoubleToString(m_dValue, 2)
End If
Select Case Type
Case Params.STRANDH
WritePrivateProfileString(nIndex, MAC_STRANDH, sWriteValue, sMacIniFilePath)
Case Params.STRANDW
WritePrivateProfileString(nIndex, MAC_STRANDW, sWriteValue, sMacIniFilePath)
Case Params.STRANDCOUNT
WritePrivateProfileString(nIndex, MAC_STRANDCOUNT, sWriteValue, sMacIniFilePath)
Case Params.OFFSET
WritePrivateProfileString(nIndex, MAC_OFFSET, sWriteValue, sMacIniFilePath)
Case Params.STARTPOINTOFFSETONSLICE
WritePrivateProfileString(nIndex, MAC_STARTPOINTOFFSETONSLICE, sWriteValue, sMacIniFilePath)
Case Params.LINKPARAM
WritePrivateProfileString(nIndex, MAC_LINKPARAM, sWriteValue, sMacIniFilePath)
Case Params.LINKZUP
WritePrivateProfileString(nIndex, MAC_LINKZUP, sWriteValue, sMacIniFilePath)
Case Params.OFFSETLEADPOINT
WritePrivateProfileString(nIndex, MAC_OFFSETLEADPOINT, sWriteValue, sMacIniFilePath)
Case Params.LEADINTANGDIST
WritePrivateProfileString(nIndex, MAC_LEADINTANGDIST, sWriteValue, sMacIniFilePath)
Case Params.LEADINORTHODIST
WritePrivateProfileString(nIndex, MAC_LEADINORTHODIST, sWriteValue, sMacIniFilePath)
Case Params.LEADOUTTANGDIST
WritePrivateProfileString(nIndex, MAC_LEADOUTTANGDIST, sWriteValue, sMacIniFilePath)
Case Params.LEADOUTORTHODIST
WritePrivateProfileString(nIndex, MAC_LEADOUTORTHODIST, sWriteValue, sMacIniFilePath)
Case Params.COASTINGLEN
WritePrivateProfileString(nIndex, MAC_COASTINGLEN, sWriteValue, sMacIniFilePath)
Case Params.COASTINGFEED
WritePrivateProfileString(nIndex, MAC_COASTINGFEED, sWriteValue, sMacIniFilePath)
Case Params.WIPELEN
WritePrivateProfileString(nIndex, MAC_WIPELEN, sWriteValue, sMacIniFilePath)
Case Params.WIPEFEEDPU
WritePrivateProfileString(nIndex, MAC_WIPEFEEDPU, sWriteValue, sMacIniFilePath)
Case Params.FLOORCOUNT
WritePrivateProfileString(nIndex, MAC_FLOORCOUNT, sWriteValue, sMacIniFilePath)
Case Params.G0FEED
WritePrivateProfileString(nIndex, MAC_G0FEED, sWriteValue, sMacIniFilePath)
Case Params.TOOLDIAM
WritePrivateProfileString(nIndex, MAC_TOOLDIAM, sWriteValue, sMacIniFilePath)
Case Params.RIBSOVERLAP
WritePrivateProfileString(nIndex, MAC_RIBSOVERLAP, sWriteValue, sMacIniFilePath)
Case Params.RIBSSTRANDCOUNT
WritePrivateProfileString(nIndex, MAC_RIBSSTRANDCOUNT, sWriteValue, sMacIniFilePath)
Case Params.RIBSLINK
WritePrivateProfileString(nIndex, MAC_RIBSLINK, sWriteValue, sMacIniFilePath)
Case Params.RIBSINVERTORDER
WritePrivateProfileString(nIndex, MAC_RIBSINVERTORDER, sWriteValue, sMacIniFilePath)
Case Params.RIBSINVERTDIRECTION
WritePrivateProfileString(nIndex, MAC_RIBSINVERTDIRECTION, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADININVERT
WritePrivateProfileString(nIndex, MAC_RIBSLEADININVERT, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADINLEN
WritePrivateProfileString(nIndex, MAC_RIBSLEADINLEN, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADOUTINVERT
WritePrivateProfileString(nIndex, MAC_RIBSLEADOUTINVERT, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADOUTLEN
WritePrivateProfileString(nIndex, MAC_RIBSLEADOUTLEN, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADOUTCOASTING
WritePrivateProfileString(nIndex, MAC_RIBSLEADOUTCOASTING, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADOUTWIPE
WritePrivateProfileString(nIndex, MAC_RIBSLEADOUTWIPE, sWriteValue, sMacIniFilePath)
Case Params.RIBSLEADOUTWIPEDIR
WritePrivateProfileString(nIndex, MAC_RIBSLEADOUTWIPEDIR, sWriteValue, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub ResetParam()
m_dValue = m_dOrigValue
End Sub
End Class
Public Class StringMachiningParam
Inherits MachiningParam
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sOrigValue As String
Public ReadOnly Property sOrigValue As String
Get
Return m_sOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_sValue <> m_sOrigValue
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
m_sValue = sValue
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.STRANDH
'WritePrivateProfileString(nIndex, MAC_STRANDH, sWriteValue, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub ResetParam()
m_sValue = m_sOrigValue
End Sub
End Class
Public Class ComboMachiningParam
Inherits MachiningParam
Private m_ValueList As List(Of IdNameStruct)
Public ReadOnly Property ValueList As List(Of IdNameStruct)
Get
Return m_ValueList
End Get
End Property
Private m_SelValue As IdNameStruct
Public Property SelValue As IdNameStruct
Get
Return m_SelValue
End Get
Set(value As IdNameStruct)
m_SelValue = value
NotifyPropertyChanged(NameOf(SelValue))
End Set
End Property
Private m_OrigSelValue As IdNameStruct
Public ReadOnly Property OrigSelValue As IdNameStruct
Get
Return m_OrigSelValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_SelValue.Id <> m_OrigSelValue.Id
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.STRANDORDER
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_STRANDORDERS.INTOOUT, "From Inside To Outside"),
New IdNameStruct(Machining.MPAR_STRANDORDERS.OUTTOIN, "From Outside To Inside")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_STRANDORDER, 0, sMacIniFilePath))
Case Params.DIRECTION
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_DIRECTIONS.CCW, "Counterclockwise"),
New IdNameStruct(Machining.MPAR_DIRECTIONS.CW, "Clockwise")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_DIRECTION, 0, sMacIniFilePath))
Case Params.LINKTYPE
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_LINKTYPES.NONE, "None"),
New IdNameStruct(Machining.MPAR_LINKTYPES.LINEAR, "Linear"),
New IdNameStruct(Machining.MPAR_LINKTYPES.BIARC, "Biarc")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_LINKTYPE, 0, sMacIniFilePath))
Case Params.LEADIN
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_LEADINOUT.NONE, "None"),
New IdNameStruct(Machining.MPAR_LEADINOUT.LINEAR, "Linear"),
New IdNameStruct(Machining.MPAR_LEADINOUT.ARC, "Arc")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_LEADIN, 0, sMacIniFilePath))
Case Params.LEADOUT
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_LEADINOUT.NONE, "None"),
New IdNameStruct(Machining.MPAR_LEADINOUT.LINEAR, "Linear"),
New IdNameStruct(Machining.MPAR_LEADINOUT.ARC, "Arc")})
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_LEADOUT, 0, sMacIniFilePath))
End Select
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.STRANDORDER
WritePrivateProfileString(nIndex, MAC_STRANDORDER, m_SelValue.Id, sMacIniFilePath)
Case Params.DIRECTION
WritePrivateProfileString(nIndex, MAC_DIRECTION, m_SelValue.Id, sMacIniFilePath)
Case Params.LINKTYPE
WritePrivateProfileString(nIndex, MAC_LINKTYPE, m_SelValue.Id, sMacIniFilePath)
Case Params.LEADIN
WritePrivateProfileString(nIndex, MAC_LEADIN, m_SelValue.Id, sMacIniFilePath)
Case Params.LEADOUT
WritePrivateProfileString(nIndex, MAC_LEADOUT, m_SelValue.Id, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub ResetParam()
m_SelValue = m_OrigSelValue
End Sub
End Class
Public Class CheckMachiningParam
Inherits MachiningParam
Private m_bValue As Boolean
Public Property bValue As Boolean
Get
Return m_bValue
End Get
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
End Set
End Property
Private m_bOrigValue As String
Public ReadOnly Property bOriValue As String
Get
Return m_bOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_bValue <> m_bOrigValue
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.SLICING45
m_bValue = GetPrivateProfileDouble(nIndex, MAC_SLICING45, 0, sMacIniFilePath)
End Select
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Select Case Type
Case Params.SLICING45
WritePrivateProfileString(nIndex, MAC_SLICING45, If(m_bValue, 1, 0), sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub ResetParam()
m_bValue = m_bOrigValue
End Sub
End Class
Public Class MaterialMachiningParam
Inherits MachiningParam
Private m_sGUID As String
Public Property sGUID As String
Get
Return m_sGUID
End Get
Set(value As String)
m_sGUID = value
End Set
End Property
Private m_bValue As Boolean
Public Property bValue As Boolean
Get
Return m_bValue
End Get
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
End Set
End Property
Private m_bOrigValue As String
Public ReadOnly Property bOriValue As String
Get
Return m_bOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_bValue <> m_bOrigValue
End Get
End Property
Sub New(sName As String, sGUID As String, bValue As Boolean)
MyBase.New(sName)
m_sGUID = sGUID
m_bValue = bValue
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
Dim sMaterials As String = ""
GetPrivateProfileString(nIndex, MAC_MATERIALS, "", sMaterials, sMacIniFilePath)
Dim MaterialGuidList As New List(Of String)
If Not String.IsNullOrWhiteSpace(sMaterials) Then
MaterialGuidList = sMaterials.Split(";"c).ToList()
End If
If Not bValue Then
MaterialGuidList.Remove(m_sGUID)
ElseIf Not MaterialGuidList.Contains(m_sGUID) Then
MaterialGuidList.Add(m_sGUID)
End If
sMaterials = ""
For Index = 0 To MaterialGuidList.Count - 1
sMaterials &= MaterialGuidList(Index) & If(Index < MaterialGuidList.Count - 1, ";"c, "")
Next
WritePrivateProfileString(nIndex, MAC_MATERIALS, sMaterials, sMacIniFilePath)
End Sub
Friend Overrides Sub SaveParam()
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub ResetParam()
m_bValue = m_bOrigValue
End Sub
End Class
+906
View File
@@ -0,0 +1,906 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Text
Imports EgtUILib
Imports EgtWPFLib5
Public Class Material
Inherits VMBase
Private m_CathegoryList As New ObservableCollection(Of MaterialCathegory)
Public ReadOnly Property CathegoryList As ObservableCollection(Of MaterialCathegory)
Get
Return m_CathegoryList
End Get
End Property
Private m_bIsModified As Boolean
Public ReadOnly Property bIsModified As Boolean
Get
Return m_bIsModified
End Get
End Property
Friend Sub UpdateIsModified()
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
End Sub
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Get
Return m_sGUID
End Get
End Property
Private m_sName As String
Public Property sName As String
Get
Return m_sName
End Get
Set(value As String)
m_sName = value
Map.refMaterialDbVM.SetNameVisibility(False)
NotifyPropertyChanged(NameOf(ghName))
End Set
End Property
Public ReadOnly Property ghName As String
Get
Return m_sName & If(m_bIsModified, "*", "")
End Get
End Property
Private m_dK As Double
Public ReadOnly Property dK As Double
Get
Return m_dK
End Get
End Property
Private m_dC1 As Double
Public ReadOnly Property dC1 As Double
Get
Return m_dC1
End Get
End Property
Private m_dC2 As Double
Public ReadOnly Property dC2 As Double
Get
Return m_dC2
End Get
End Property
Private m_dDensity As Double
Public ReadOnly Property dDensity As Double
Get
Return m_dDensity
End Get
End Property
Private m_dAMax As Double
Public ReadOnly Property dAMax As Double
Get
Return m_dAMax
End Get
End Property
Private m_dATrg As Double
Public ReadOnly Property dATrg As Double
Get
Return m_dATrg
End Get
End Property
Private m_dAMin As Double
Public ReadOnly Property dAMin As Double
Get
Return m_dAMin
End Get
End Property
Private m_dBMax As Double
Public ReadOnly Property dBMax As Double
Get
Return m_dBMax
End Get
End Property
Private m_dBTrg As Double
Public ReadOnly Property dBTrg As Double
Get
Return m_dBTrg
End Get
End Property
Private m_dBMin As Double
Public ReadOnly Property dBMin As Double
Get
Return m_dBMin
End Get
End Property
Private m_dKW As Double
Friend ReadOnly Property dKW As Double
Get
Return m_dKW
End Get
End Property
Private m_dKZ As Double
Friend ReadOnly Property dKZ As Double
Get
Return m_dKZ
End Get
End Property
Private m_dKN As Double
Friend ReadOnly Property dKN As Double
Get
Return m_dKN
End Get
End Property
' per lettura da file
Sub New(nIndex As Integer)
m_nIndex = nIndex
Dim sMatIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
GetPrivateProfileString(nIndex, MAT_GUID, "", m_sGUID, sMatIniFilePath)
GetPrivateProfileString(nIndex, MAT_NAME, "", m_sName, sMatIniFilePath)
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nIndex))
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.TEMPERATURES, nIndex))
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.CONSTANT, nIndex))
For Each Cathegory In m_CathegoryList
For Each MaterialParam In Cathegory.MaterialParamList
AddHandler MaterialParam.PropertyChanged, AddressOf OnMaterialParamPropertyChanged
Next
Next
End Sub
' per copia
Sub New()
m_nIndex = Map.refMaterialDbVM.MaterialList.Max(Function(x) x.nIndex) + 1
m_sGUID = Guid.NewGuid.ToString()
m_sName = "New Material Param"
Dim nCopyIndex As Integer = Map.refMaterialDbVM.SelMaterial.m_nIndex
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.GENERAL, nCopyIndex))
Dim Orig As StringMaterialParam = m_CathegoryList(0).MaterialParamList.FirstOrDefault(Function(x) x.Type = MaterialParam.Params.ORIG)
If Not IsNothing(Orig) Then
Orig.SetGuid(Map.refMaterialDbVM.SelMaterial.m_sGUID)
End If
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.TEMPERATURES, nCopyIndex))
m_CathegoryList.Add(New MaterialCathegory(MaterialCathegory.Cathegories.CONSTANT, nCopyIndex))
For Each Cathegory In m_CathegoryList
For Each MaterialParam In Cathegory.MaterialParamList
AddHandler MaterialParam.PropertyChanged, AddressOf OnMaterialParamPropertyChanged
Next
Next
m_bIsModified = True
End Sub
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sName = sName
m_sGUID = sGUID
Dim sMatIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
m_dK = GetPrivateProfileDouble(m_nIndex, MAT_K, 0, sMatIniFilePath)
m_dC1 = GetPrivateProfileDouble(m_nIndex, MAT_C1, 0, sMatIniFilePath)
m_dC2 = GetPrivateProfileDouble(m_nIndex, MAT_C2, 0, sMatIniFilePath)
m_dDensity = GetPrivateProfileDouble(m_nIndex, MAT_DENSITY, 0, sMatIniFilePath)
m_dAMax = GetPrivateProfileDouble(m_nIndex, MAT_AMAX, 0, sMatIniFilePath)
m_dATrg = GetPrivateProfileDouble(m_nIndex, MAT_ATRG, 0, sMatIniFilePath)
m_dAMin = GetPrivateProfileDouble(m_nIndex, MAT_AMIN, 0, sMatIniFilePath)
m_dBMax = GetPrivateProfileDouble(m_nIndex, MAT_BMAX, 0, sMatIniFilePath)
m_dBTrg = GetPrivateProfileDouble(m_nIndex, MAT_BTRG, 0, sMatIniFilePath)
m_dBMin = GetPrivateProfileDouble(m_nIndex, MAT_BMIN, 0, sMatIniFilePath)
m_dKW = GetPrivateProfileDouble(m_nIndex, MAT_KW, 0, sMatIniFilePath)
m_dKZ = GetPrivateProfileDouble(m_nIndex, MAT_KZ, 0, sMatIniFilePath)
m_dKN = GetPrivateProfileDouble(m_nIndex, MAT_KN, 0, sMatIniFilePath)
End Sub
Private Sub ReadAllParams()
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini"
'm_bSlicing45 = GetPrivateProfileDouble(m_nIndex, MAC_SLICING45, 0, sMacIniFilePath)
'm_dStrandH = GetPrivateProfileDouble(m_nIndex, MAC_STRANDH, 0, sMacIniFilePath)
'm_dStrandW = GetPrivateProfileDouble(m_nIndex, MAC_STRANDW, 0, sMacIniFilePath)
'm_nStrandCount = GetPrivateProfileDouble(m_nIndex, MAC_STRANDCOUNT, 0, sMacIniFilePath)
'm_dOffset = GetPrivateProfileDouble(m_nIndex, MAC_OFFSET, 0, sMacIniFilePath)
'm_dStartPointOffsetOnSlice = GetPrivateProfileDouble(m_nIndex, MAC_STARTPOINTOFFSETONSLICE, 0, sMacIniFilePath)
'm_dStrandOrder = GetPrivateProfileDouble(m_nIndex, MAC_STRANDORDER, 0, sMacIniFilePath)
'm_dDirection = GetPrivateProfileDouble(m_nIndex, MAC_DIRECTION, 0, sMacIniFilePath)
'm_dLinkType = GetPrivateProfileDouble(m_nIndex, MAC_LINKTYPE, 0, sMacIniFilePath)
'm_dLinkParam = GetPrivateProfileDouble(m_nIndex, MAC_LINKPARAM, 0, sMacIniFilePath)
'm_dLinkZup = GetPrivateProfileDouble(m_nIndex, MAC_LINKZUP, 0, sMacIniFilePath)
'm_dOffsetLeadPoint = GetPrivateProfileDouble(m_nIndex, MAC_OFFSETLEADPOINT, 0, sMacIniFilePath)
'm_dLeadIn = GetPrivateProfileDouble(m_nIndex, MAC_LEADIN, 0, sMacIniFilePath)
'm_dLeadInTangDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADINTANGDIST, 0, sMacIniFilePath)
'm_dLeadInOrthoDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADINORTHODIST, 0, sMacIniFilePath)
'm_dLeadOut = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUT, 0, sMacIniFilePath)
'm_dLeadOutTangDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUTTANGDIST, 0, sMacIniFilePath)
'm_dLeadOutOrthoDist = GetPrivateProfileDouble(m_nIndex, MAC_LEADOUTORTHODIST, 0, sMacIniFilePath)
'm_dCoastingLen = GetPrivateProfileDouble(m_nIndex, MAC_COASTINGLEN, 0, sMacIniFilePath)
'm_dCoastingFeed = GetPrivateProfileDouble(m_nIndex, MAC_COASTINGFEED, 0, sMacIniFilePath)
'm_dWipeLen = GetPrivateProfileDouble(m_nIndex, MAC_WIPELEN, 0, sMacIniFilePath)
'm_dWipeFeedPu = GetPrivateProfileDouble(m_nIndex, MAC_WIPEFEEDPU, 0, sMacIniFilePath)
'm_dFloorCount = GetPrivateProfileDouble(m_nIndex, MAC_FLOORCOUNT, 0, sMacIniFilePath)
'm_dG0Feed = GetPrivateProfileDouble(m_nIndex, MAC_G0FEED, 0, sMacIniFilePath)
'm_dToolDiam = GetPrivateProfileDouble(m_nIndex, MAC_TOOLDIAM, 0, sMacIniFilePath)
'm_dRibsOverlap = GetPrivateProfileDouble(m_nIndex, MAC_RIBSOVERLAP, 0, sMacIniFilePath)
'm_dRibsStrandCount = GetPrivateProfileDouble(m_nIndex, MAC_RIBSSTRANDCOUNT, 0, sMacIniFilePath)
'm_dRibsLink = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLINK, 0, sMacIniFilePath)
'm_dRibsInvertOrder = GetPrivateProfileDouble(m_nIndex, MAC_RIBSINVERTORDER, 0, sMacIniFilePath)
'm_dRibsInvertDirection = GetPrivateProfileDouble(m_nIndex, MAC_RIBSINVERTDIRECTION, 0, sMacIniFilePath)
'm_dRibsLeadInInvert = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADININVERT, 0, sMacIniFilePath)
'm_dRibsLeadInLen = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADINLEN, 0, sMacIniFilePath)
'm_dRibsLeadOutInvert = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTINVERT, 0, sMacIniFilePath)
'm_dRibsLeadOutLen = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTLEN, 0, sMacIniFilePath)
'm_dRibsLeadOutCoasting = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTCOASTING, 0, sMacIniFilePath)
'm_dRibsLeadOutWipe = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTWIPE, 0, sMacIniFilePath)
'm_dRibsLeadOutWipeDir = GetPrivateProfileDouble(m_nIndex, MAC_RIBSLEADOUTWIPEDIR, 0, sMacIniFilePath)
End Sub
Friend Sub Save()
If bIsModified Then
' salvo tutti i parametri su orig
SaveParams()
' resetto stato di modificata
UpdateIsModified()
' segno Db come modificato
Map.refMaterialDbVM.SetIsModified(True)
End If
End Sub
Private Sub SaveParams()
For Each Cathegory In m_CathegoryList
Cathegory.SaveParams()
Next
End Sub
Friend Sub ResetModification()
If bIsModified Then
' annullo le modifiche di tutti i parametri
SaveParams()
' resetto stato di modificata
UpdateIsModified()
End If
End Sub
Private Sub ResetParams()
For Each Cathegory In m_CathegoryList
Cathegory.ResetParams()
Next
End Sub
Friend Sub WriteParamsOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
WritePrivateProfileString(nIndex, MAC_GUID, m_sGUID, sMacIniFilePath)
WritePrivateProfileString(nIndex, MAC_NAME, m_sName, sMacIniFilePath)
For Each Cathegory In m_CathegoryList
Cathegory.WriteParamOnDb(nIndex)
Next
End Sub
Private Sub OnMaterialParamPropertyChanged(sender As Object, e As PropertyChangedEventArgs)
Select Case e.PropertyName
Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue)
m_bIsModified = m_CathegoryList.Any(Function(x) x.MaterialParamList.Any(Function(y) y.bIsModified))
NotifyPropertyChanged(NameOf(ghName))
End Select
End Sub
End Class
Public Class MaterialIndex
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Get
Return m_sGUID
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sGUID = sGUID
m_sName = sName
End Sub
End Class
Public Class MaterialCathegory
Inherits VMBase
Public Enum Cathegories As Integer
GENERAL = 1
TEMPERATURES = 2
CONSTANT = 3
End Enum
Private m_Type As Cathegories
Public ReadOnly Property Type As Cathegories
Get
Return m_Type
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Private m_MaterialParamList As List(Of MaterialParam)
Public ReadOnly Property MaterialParamList As List(Of MaterialParam)
Get
Return m_MaterialParamList
End Get
End Property
Private m_Cathegory_IsExpanded As Boolean
Public Property Cathegory_IsExpanded As Boolean
Get
Return m_Cathegory_IsExpanded
End Get
Set(value As Boolean)
m_Cathegory_IsExpanded = value
End Set
End Property
Private m_Cathegory_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Cathegory_Visibility As Visibility
Get
Return m_Cathegory_Visibility
End Get
End Property
Sub New(Type As Cathegories, nIndex As Integer)
m_Type = Type
Select Case m_Type
Case Cathegories.GENERAL
m_sName = "General"
m_MaterialParamList = New List(Of MaterialParam)({New NumericMaterialParam(MaterialParam.Params.K, nIndex),
New NumericMaterialParam(MaterialParam.Params.DENSITY, nIndex),
New StringMaterialParam(MaterialParam.Params.ORIG, nIndex)})
m_Cathegory_Visibility = Visibility.Visible
Case Cathegories.TEMPERATURES
m_sName = "Temperatures"
m_MaterialParamList = New List(Of MaterialParam)({New NumericMaterialParam(MaterialParam.Params.T1, nIndex),
New NumericMaterialParam(MaterialParam.Params.T2, nIndex),
New NumericMaterialParam(MaterialParam.Params.T3, nIndex),
New NumericMaterialParam(MaterialParam.Params.T4, nIndex),
New NumericMaterialParam(MaterialParam.Params.T5, nIndex)})
m_Cathegory_Visibility = Visibility.Visible
Case Cathegories.CONSTANT
m_sName = "Constant"
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
m_MaterialParamList = New List(Of MaterialParam)({New NumericMaterialParam(MaterialParam.Params.C1, nIndex),
New NumericMaterialParam(MaterialParam.Params.C2, nIndex),
New NumericMaterialParam(MaterialParam.Params.AMAX, nIndex),
New NumericMaterialParam(MaterialParam.Params.ATRG, nIndex),
New NumericMaterialParam(MaterialParam.Params.AMIN, nIndex),
New NumericMaterialParam(MaterialParam.Params.BMAX, nIndex),
New NumericMaterialParam(MaterialParam.Params.BTRG, nIndex),
New NumericMaterialParam(MaterialParam.Params.BMIN, nIndex),
New NumericMaterialParam(MaterialParam.Params.KW, nIndex),
New NumericMaterialParam(MaterialParam.Params.KZ, nIndex),
New NumericMaterialParam(MaterialParam.Params.KN, nIndex)})
m_Cathegory_Visibility = Visibility.Visible
Else
m_MaterialParamList = New List(Of MaterialParam)
End If
End Select
End Sub
Friend Sub SaveParams()
For Each Param In m_MaterialParamList
Param.SaveParam()
Next
End Sub
Friend Sub ResetParams()
For Each Param In m_MaterialParamList
Param.ResetParam()
Next
End Sub
Friend Sub WriteParamOnDb(nIndex As Integer)
For Each Param In m_MaterialParamList
Param.WriteParamOnDb(nIndex)
Next
End Sub
End Class
Public MustInherit Class MaterialParam
Inherits VMBase
Public Enum Params As Integer
NAME = 2
T1 = 3
T2 = 4
T3 = 5
T4 = 6
T5 = 7
K = 8
C1 = 9
C2 = 10
DENSITY = 11
AMAX = 12
ATRG = 13
AMIN = 14
BMAX = 15
BTRG = 16
BMIN = 17
KW = 18
KZ = 19
KN = 20
ORIG = 21
End Enum
Private m_Type As Params
Public ReadOnly Property Type As Params
Get
Return m_Type
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Public MustOverride ReadOnly Property bIsModified As Boolean
Sub New(Type As Params)
m_Type = Type
Select Case m_Type
Case Params.T1
m_sName = "Temperature 1"
Case Params.T2
m_sName = "Temperature 2"
Case Params.T3
m_sName = "Temperature 3"
Case Params.T4
m_sName = "Temperature 4"
Case Params.T5
m_sName = "Temperature 5"
Case Params.K
m_sName = "Constant"
Case Params.C1
m_sName = "C1"
Case Params.C2
m_sName = "C2"
Case Params.DENSITY
m_sName = "Density"
Case Params.AMAX
m_sName = "A Max"
Case Params.ATRG
m_sName = "A Target"
Case Params.AMIN
m_sName = "A Min"
Case Params.BMAX
m_sName = "B Max"
Case Params.BTRG
m_sName = "B Target"
Case Params.BMIN
m_sName = "B Min"
Case Params.KW
m_sName = "KW"
Case Params.KZ
m_sName = "KZ"
Case Params.KN
m_sName = "KN"
Case Params.ORIG
m_sName = "Original"
End Select
End Sub
Friend MustOverride Sub WriteParamOnDb(nIndex As Integer)
Friend MustOverride Sub SaveParam()
Friend MustOverride Sub ResetParam()
End Class
Public Class NumericMaterialParam
Inherits MaterialParam
Private m_bIsLen As Boolean = False
Private m_dValue As Double
Public Property dValue As String
Get
Return If(m_bIsLen, LenToString(m_dValue, 1), m_dValue)
End Get
Set(value As String)
If m_bIsLen Then
StringToLen(value, m_dValue)
Else
m_dValue = value
End If
NotifyPropertyChanged(NameOf(dValue))
End Set
End Property
Private m_dOrigValue As Double
Public ReadOnly Property dOrigValue As Double
Get
Return m_dOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_dValue <> m_dOrigValue
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
Case Params.T1
m_dValue = GetPrivateProfileDouble(nIndex, MAT_T1, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.T2
m_dValue = GetPrivateProfileDouble(nIndex, MAT_T2, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.T3
m_dValue = GetPrivateProfileDouble(nIndex, MAT_T3, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.T4
m_dValue = GetPrivateProfileDouble(nIndex, MAT_T4, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.T5
m_dValue = GetPrivateProfileDouble(nIndex, MAT_T5, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.K
m_dValue = GetPrivateProfileDouble(nIndex, MAT_K, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.C1
m_dValue = GetPrivateProfileDouble(nIndex, MAT_C1, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.C2
m_dValue = GetPrivateProfileDouble(nIndex, MAT_C2, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.DENSITY
m_dValue = GetPrivateProfileDouble(nIndex, MAT_DENSITY, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.AMAX
m_dValue = GetPrivateProfileDouble(nIndex, MAT_AMAX, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.ATRG
m_dValue = GetPrivateProfileDouble(nIndex, MAT_ATRG, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.AMIN
m_dValue = GetPrivateProfileDouble(nIndex, MAT_AMIN, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.BMAX
m_dValue = GetPrivateProfileDouble(nIndex, MAT_BMAX, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.BTRG
m_dValue = GetPrivateProfileDouble(nIndex, MAT_BTRG, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.BMIN
m_dValue = GetPrivateProfileDouble(nIndex, MAT_BMIN, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.KW
m_dValue = GetPrivateProfileDouble(nIndex, MAT_KW, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.KZ
m_dValue = GetPrivateProfileDouble(nIndex, MAT_KZ, 0, sMacIniFilePath)
m_bIsLen = False
Case Params.KN
m_dValue = GetPrivateProfileDouble(nIndex, MAT_KN, 0, sMacIniFilePath)
m_bIsLen = False
End Select
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Dim sWriteValue As String = ""
If m_bIsLen Then
sWriteValue = LenToString(m_dValue, 5)
Else
sWriteValue = DoubleToString(m_dValue, 5)
End If
Select Case Type
Case Params.T1
WritePrivateProfileString(nIndex, MAT_T1, sWriteValue, sMacIniFilePath)
Case Params.T2
WritePrivateProfileString(nIndex, MAT_T2, sWriteValue, sMacIniFilePath)
Case Params.T3
WritePrivateProfileString(nIndex, MAT_T3, sWriteValue, sMacIniFilePath)
Case Params.T4
WritePrivateProfileString(nIndex, MAT_T4, sWriteValue, sMacIniFilePath)
Case Params.T5
WritePrivateProfileString(nIndex, MAT_T5, sWriteValue, sMacIniFilePath)
Case Params.K
WritePrivateProfileString(nIndex, MAT_K, sWriteValue, sMacIniFilePath)
Case Params.C1
WritePrivateProfileString(nIndex, MAT_C1, sWriteValue, sMacIniFilePath)
Case Params.C2
WritePrivateProfileString(nIndex, MAT_C2, sWriteValue, sMacIniFilePath)
Case Params.DENSITY
WritePrivateProfileString(nIndex, MAT_DENSITY, sWriteValue, sMacIniFilePath)
Case Params.AMAX
WritePrivateProfileString(nIndex, MAT_AMAX, sWriteValue, sMacIniFilePath)
Case Params.ATRG
WritePrivateProfileString(nIndex, MAT_ATRG, sWriteValue, sMacIniFilePath)
Case Params.AMIN
WritePrivateProfileString(nIndex, MAT_AMIN, sWriteValue, sMacIniFilePath)
Case Params.BMAX
WritePrivateProfileString(nIndex, MAT_BMAX, sWriteValue, sMacIniFilePath)
Case Params.BTRG
WritePrivateProfileString(nIndex, MAT_BTRG, sWriteValue, sMacIniFilePath)
Case Params.BMIN
WritePrivateProfileString(nIndex, MAT_BMIN, sWriteValue, sMacIniFilePath)
Case Params.KW
WritePrivateProfileString(nIndex, MAT_KW, sWriteValue, sMacIniFilePath)
Case Params.KZ
WritePrivateProfileString(nIndex, MAT_KZ, sWriteValue, sMacIniFilePath)
Case Params.KN
WritePrivateProfileString(nIndex, MAT_KN, sWriteValue, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_dOrigValue = m_dValue
End Sub
Friend Overrides Sub ResetParam()
m_dValue = m_dOrigValue
End Sub
End Class
Public Class StringMaterialParam
Inherits MaterialParam
Private m_sGUID As String
Public Property sGUID As String
Get
Return m_sGUID
End Get
Set(value As String)
m_sGUID = value
End Set
End Property
Friend Sub SetGuid(sGUID As String)
Dim OrigMaterial As MaterialIndex = Map.refTopPanelVM.MaterialList.FirstOrDefault(Function(x) x.sGUID = sGUID)
If Not IsNothing(OrigMaterial) Then
m_sGUID = OrigMaterial.sGUID
m_sValue = OrigMaterial.sName
End If
End Sub
Private m_sValue As String
Public Property sValue As String
Get
Return m_sValue
End Get
Set(value As String)
m_sValue = value
NotifyPropertyChanged(NameOf(sValue))
End Set
End Property
Private m_sOrigValue As String
Public ReadOnly Property sOrigValue As String
Get
Return m_sOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_sValue <> m_sOrigValue
End Get
End Property
Private m_bIsReadOnly As Boolean = True
Public ReadOnly Property bIsReadOnly As Boolean
Get
Return m_bIsReadOnly
End Get
End Property
Private m_String_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property String_Visibility As Visibility
Get
Return m_String_Visibility
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "\Materials.ini"
Select Case Type
Case Params.ORIG
Dim sOrigGUID As String = ""
GetPrivateProfileString(nIndex, MAT_ORIG, "", sOrigGUID, sMacIniFilePath)
If sOrigGUID = "***" Then
m_sGUID = sOrigGUID
m_sValue = sOrigGUID
' se livello alto, lo visualizzo comunque
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
m_String_Visibility = Visibility.Visible
End If
Else
Dim OrigMaterial As MaterialIndex = Map.refTopPanelVM.MaterialList.FirstOrDefault(Function(x) x.sGUID = sOrigGUID)
If Not IsNothing(OrigMaterial) Then
m_sGUID = OrigMaterial.sGUID
Dim bytes() = Encoding.Default.GetBytes(OrigMaterial.sName)
m_sValue = Encoding.UTF8.GetString(bytes)
' m_sValue = OrigMaterial.sName
End If
m_String_Visibility = Visibility.Visible
End If
End Select
' verifico chiave per assegnare readonly
If Map.refMainWindowVM.MainWindowM.nUserLevel >= 5 Then
m_bIsReadOnly = False
End If
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
Case Params.ORIG
WritePrivateProfileString(nIndex, MAT_ORIG, m_sGUID, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_sOrigValue = m_sValue
End Sub
Friend Overrides Sub ResetParam()
m_sValue = m_sOrigValue
End Sub
End Class
Public Class ComboMaterialParam
Inherits MaterialParam
Private m_ValueList As List(Of IdNameStruct)
Public ReadOnly Property ValueList As List(Of IdNameStruct)
Get
Return m_ValueList
End Get
End Property
Private m_SelValue As IdNameStruct
Public Property SelValue As IdNameStruct
Get
Return m_SelValue
End Get
Set(value As IdNameStruct)
m_SelValue = value
NotifyPropertyChanged(NameOf(SelValue))
End Set
End Property
Private m_OrigSelValue As IdNameStruct
Public ReadOnly Property OrigSelValue As IdNameStruct
Get
Return m_OrigSelValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_SelValue.Id <> m_OrigSelValue.Id
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
'Case Params.STRANDORDER
' m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Material.MPAR_STRANDORDERS.INTOOUT, "From Inside To Outside"),
' New IdNameStruct(Material.MPAR_STRANDORDERS.OUTTOIN, "From Outside To Inside")})
' m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = GetPrivateProfileDouble(nIndex, MAC_STRANDORDER, 0, sMacIniFilePath))
End Select
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
'Case Params.STRANDORDER
' WritePrivateProfileString(nIndex, MAC_STRANDORDER, m_SelValue.Id, sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub ResetParam()
m_SelValue = m_OrigSelValue
End Sub
End Class
Public Class CheckMaterialParam
Inherits MaterialParam
Private m_bValue As Boolean
Public Property bValue As Boolean
Get
Return m_bValue
End Get
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
End Set
End Property
Private m_bOrigValue As String
Public ReadOnly Property bOriValue As String
Get
Return m_bOrigValue
End Get
End Property
Public Overrides ReadOnly Property bIsModified As Boolean
Get
Return m_bValue <> m_bOrigValue
End Get
End Property
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
'Case Params.SLICING45
' m_bValue = GetPrivateProfileDouble(nIndex, MAC_SLICING45, 0, sMacIniFilePath)
End Select
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub WriteParamOnDb(nIndex As Integer)
Dim sMacIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Select Case Type
'Case Params.SLICING45
' WritePrivateProfileString(nIndex, MAC_SLICING45, If(m_bValue, 1, 0), sMacIniFilePath)
End Select
End Sub
Friend Overrides Sub SaveParam()
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub ResetParam()
m_bValue = m_bOrigValue
End Sub
End Class
+171
View File
@@ -0,0 +1,171 @@
<UserControl x:Class="MaterialDbV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:PrintApp="clr-namespace:_3dPrintApp">
<Border VerticalAlignment="Center"
Style="{StaticResource RightPanel_Border}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<UniformGrid Rows="1">
<Button Content="Copy"
Command="{Binding Copy_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Save"
Command="{Binding Save_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Delete"
Command="{Binding Delete_Command}"
IsEnabled="{Binding Delete_IsEnabled}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
<ComboBox Grid.Row="1"
Name="MaterialCombo"
ItemsSource="{Binding MaterialList}"
SelectedItem="{Binding SelMaterial}"
DisplayMemberPath="ghName"/>
<Grid Grid.Row="2"
Visibility="{Binding Name_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name_Msg}"/>
<EgtWPFLib5:EgtTextBox Grid.Column="1"
Text="{Binding SelectedItem.sName, ElementName=MaterialCombo, UpdateSourceTrigger=Explicit}"/>
</Grid>
<ScrollViewer Grid.Row="3"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<ItemsControl Grid.Row="1"
ItemsSource="{Binding SelectedItem.CathegoryList, ElementName=MaterialCombo}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Expander Header="{Binding sName}"
IsExpanded="{Binding Cathegory_IsExpanded}"
VerticalContentAlignment="Top"
Visibility="{Binding Cathegory_Visibility}">
<ItemsControl ItemsSource="{Binding MaterialParamList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"
HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type PrintApp:NumericMaterialParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<TextBox Grid.Column="1"
Text="{Binding dValue}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:StringMaterialParam}">
<Grid Visibility="{Binding String_Visibility}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<TextBox Grid.Column="1"
Text="{Binding sValue}"
IsReadOnly="{Binding bIsReadOnly}"/>
<!--<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:ComboMaterialParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<ComboBox Grid.Column="1"
ItemsSource="{Binding ValueList}"
SelectedItem="{Binding SelValue}"
HorizontalAlignment="Stretch"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type PrintApp:CheckMaterialParam}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="Auto"/>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding sName}"/>
<CheckBox Grid.Column="1"
IsChecked="{Binding bValue}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--<Button Grid.Column="1"
Content="R"
Command="{Binding ResetParam_Command}"
CommandParameter="dCurrStrandH"
IsEnabled="{Binding bCurrStrandH_IsModified}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
Style="{StaticResource ToolBar_SmallButton}"/>-->
</Grid>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="4" Rows="1">
<Button Content="Ok"
Command="{Binding Ok_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</UniformGrid>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,3 @@
Public Class MaterialDbV
End Class
+251
View File
@@ -0,0 +1,251 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
Public Class MaterialDbVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_MaterialList As New ObservableCollection(Of Material)
Public ReadOnly Property MaterialList As ObservableCollection(Of Material)
Get
Return m_MaterialList
End Get
End Property
Private m_SelMaterial As Material
Public Property SelMaterial As Material
Get
Return m_SelMaterial
End Get
Set(value As Material)
' verifico se modificato
If Not IsNothing(m_SelMaterial) AndAlso m_SelMaterial.bIsModified Then
' chiedo se salvare
Select Case MessageBox.Show("Salvare le modifiche apportate alla lavorazione selezionata?", "Info", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)
Case MessageBoxResult.Yes
m_SelMaterial.Save()
Case MessageBoxResult.No
m_SelMaterial.ResetModification()
Case MessageBoxResult.Cancel
NotifyPropertyChanged(NameOf(SelMaterial))
Return
End Select
End If
' recupero stato IsExpanded di tutte le categorie
Dim IsExpandedList As New List(Of Boolean)
For Each Cathegory In m_SelMaterial.CathegoryList
IsExpandedList.Add(Cathegory.Cathegory_IsExpanded)
Next
m_SelMaterial = value
' ripristino stato IsExpanded di tutte le categorie
For Index = 0 To m_SelMaterial.CathegoryList.Count - 1
m_SelMaterial.CathegoryList(Index).Cathegory_IsExpanded = IsExpandedList(Index)
Next
End Set
End Property
Private m_Name_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property Name_Visibility As Visibility
Get
Return m_Name_Visibility
End Get
End Property
Friend Sub SetNameVisibility(bValue As Boolean)
m_Name_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(Name_Visibility))
End Sub
' variabile che indica se una qualunque lavorazione e' stata modificata
Private m_bIsModified As Boolean
Public ReadOnly Property bIsModified As Boolean
Get
Return m_bIsModified
End Get
End Property
Friend Sub SetIsModified(value As Boolean)
m_bIsModified = value
End Sub
' Definizione comandi
Private m_cmdOk As ICommand
Private m_cmdCopy As ICommand
Private m_cmdSave As ICommand
Private m_cmdDelete As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTORS"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefMaterialDbVM(Me)
' inizializzo lista lavorazioni
Init()
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub Init()
Dim sMachiningIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "\Materials.ini"
MaterialList.Clear()
Dim nIndex As Integer = 1
Dim sGUID As String = ""
Dim sName As String = ""
While GetPrivateProfileString(nIndex, MAT_GUID, "", sGUID, sMachiningIniFilePath) > 0
MaterialList.Add(New Material(nIndex))
nIndex += 1
End While
Dim sCurrMaterial As String = ""
GetMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, "", sCurrMaterial)
m_SelMaterial = MaterialList.FirstOrDefault(Function(x) x.sName = sCurrMaterial)
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "Ok"
Public ReadOnly Property Ok_Command As ICommand
Get
If m_cmdOk Is Nothing Then
m_cmdOk = New Command(AddressOf Ok)
End If
Return m_cmdOk
End Get
End Property
Public Sub Ok()
If m_SelMaterial.bIsModified Then
' chiedo se salvare
Select Case MessageBox.Show("Salvare le modifiche apportate al materiale selezionato?", "Warning", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_SelMaterial.Save()
Case MessageBoxResult.No
m_SelMaterial.ResetModification()
Case MessageBoxResult.Cancel
Return
End Select
End If
If m_bIsModified Then
Dim sMatIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
Dim sBakMatIniFilePath As String = Path.ChangeExtension(sMatIniFilePath, ".bak")
If File.Exists(sBakMatIniFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
File.Delete(sBakMatIniFilePath)
Catch ex As Exception
End Try
End If
If File.Exists(sMatIniFilePath) Then
Try
' cambio estensione in bak a file Db vecchio
File.Move(sMatIniFilePath, sBakMatIniFilePath)
Catch ex As Exception
End Try
End If
' se ancora esiste lo elimino
If File.Exists(sMatIniFilePath) Then
Try
File.Delete(sMatIniFilePath)
Catch ex As Exception
End Try
End If
' creo nuovo file
If Not File.Exists(sMatIniFilePath) Then
Try
File.WriteAllLines(sMatIniFilePath, {"; Commento per evitare BOM con UTF-8"})
Catch ex As Exception
End Try
End If
' salvo tutte le lavorazioni sul Db
For Index = 0 To m_MaterialList.Count - 1
m_MaterialList(Index).WriteParamsOnDb(Index + 1)
Next
m_bIsModified = False
End If
' ripristino modalita' standard
Map.refTopPanelVM.SelPage = Pages.MODIFY
End Sub
#End Region ' Ok
#Region "Copy"
Public ReadOnly Property Copy_Command As ICommand
Get
If m_cmdCopy Is Nothing Then
m_cmdCopy = New Command(AddressOf Copy)
End If
Return m_cmdCopy
End Get
End Property
Public Sub Copy()
If IsNothing(m_SelMaterial) Then Return
' recupero stato IsExpanded di tutte le categorie
Dim IsExpandedList As New List(Of Boolean)
For Each Cathegory In m_SelMaterial.CathegoryList
IsExpandedList.Add(Cathegory.Cathegory_IsExpanded)
Next
Dim NewMaterial As Material = New Material()
MaterialList.Add(NewMaterial)
m_SelMaterial = NewMaterial
NotifyPropertyChanged(NameOf(SelMaterial))
' ripristino stato IsExpanded di tutte le categorie
For Index = 0 To m_SelMaterial.CathegoryList.Count - 1
m_SelMaterial.CathegoryList(Index).Cathegory_IsExpanded = IsExpandedList(Index)
Next
SetNameVisibility(True)
End Sub
#End Region ' Copy
#Region "Save"
Public ReadOnly Property Save_Command As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New Command(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
Public Sub Save()
m_SelMaterial.Save()
End Sub
#End Region ' Save
#Region "Delete"
Public ReadOnly Property Delete_Command As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New Command(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
Public Sub Delete()
' chiedo conferma
Select Case MessageBox.Show("Sei sicuro di voler cancellare la lavorazione selezionata?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning)
Case MessageBoxResult.Yes
m_MaterialList.Remove(m_SelMaterial)
Case MessageBoxResult.No
Return
End Select
End Sub
#End Region ' Delete
#End Region ' COMMANDS
End Class
-168
View File
@@ -1,168 +0,0 @@
Imports EgtUILib
Public Class Material
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Get
Return m_sGUID
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Private m_dK As Double
Public ReadOnly Property dK As Double
Get
Return m_dK
End Get
End Property
Private m_dC1 As Double
Public ReadOnly Property dC1 As Double
Get
Return m_dC1
End Get
End Property
Private m_dC2 As Double
Public ReadOnly Property dC2 As Double
Get
Return m_dC2
End Get
End Property
Private m_dDensity As Double
Public ReadOnly Property dDensity As Double
Get
Return m_dDensity
End Get
End Property
Private m_dAMax As Double
Public ReadOnly Property dAMax As Double
Get
Return m_dAMax
End Get
End Property
Private m_dATrg As Double
Public ReadOnly Property dATrg As Double
Get
Return m_dATrg
End Get
End Property
Private m_dAMin As Double
Public ReadOnly Property dAMin As Double
Get
Return m_dAMin
End Get
End Property
Private m_dBMax As Double
Public ReadOnly Property dBMax As Double
Get
Return m_dBMax
End Get
End Property
Private m_dBTrg As Double
Public ReadOnly Property dBTrg As Double
Get
Return m_dBTrg
End Get
End Property
Private m_dBMin As Double
Public ReadOnly Property dBMin As Double
Get
Return m_dBMin
End Get
End Property
Private m_dKW As Double
Friend ReadOnly Property dKW As Double
Get
Return m_dKW
End Get
End Property
Private m_dKZ As Double
Friend ReadOnly Property dKZ As Double
Get
Return m_dKZ
End Get
End Property
Private m_dKN As Double
Friend ReadOnly Property dKN As Double
Get
Return m_dKN
End Get
End Property
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sName = sName
m_sGUID = sGUID
Dim sMatIniFilePath As String = Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini"
m_dK = GetPrivateProfileDouble(m_nIndex, MAT_K, 0, sMatIniFilePath)
m_dC1 = GetPrivateProfileDouble(m_nIndex, MAT_C1, 0, sMatIniFilePath)
m_dC2 = GetPrivateProfileDouble(m_nIndex, MAT_C2, 0, sMatIniFilePath)
m_dDensity = GetPrivateProfileDouble(m_nIndex, MAT_DENSITY, 0, sMatIniFilePath)
m_dAMax = GetPrivateProfileDouble(m_nIndex, MAT_AMAX, 0, sMatIniFilePath)
m_dATrg = GetPrivateProfileDouble(m_nIndex, MAT_ATrg, 0, sMatIniFilePath)
m_dAMin = GetPrivateProfileDouble(m_nIndex, MAT_AMin, 0, sMatIniFilePath)
m_dBMax = GetPrivateProfileDouble(m_nIndex, MAT_BMAX, 0, sMatIniFilePath)
m_dBTrg = GetPrivateProfileDouble(m_nIndex, MAT_BTrg, 0, sMatIniFilePath)
m_dBMin = GetPrivateProfileDouble(m_nIndex, MAT_BMin, 0, sMatIniFilePath)
m_dKW = GetPrivateProfileDouble(m_nIndex, MAT_KW, 0, sMatIniFilePath)
m_dKZ = GetPrivateProfileDouble(m_nIndex, MAT_KZ, 0, sMatIniFilePath)
m_dKN = GetPrivateProfileDouble(m_nIndex, MAT_KN, 0, sMatIniFilePath)
End Sub
End Class
Public Class MaterialIndex
Private m_nIndex As Integer
Public ReadOnly Property nIndex As Integer
Get
Return m_nIndex
End Get
End Property
Private m_sGUID As String
Public ReadOnly Property sGUID As String
Get
Return m_sGUID
End Get
End Property
Private m_sName As String
Public ReadOnly Property sName As String
Get
Return m_sName
End Get
End Property
Sub New(nIndex As Integer, sGUID As String, sName As String)
m_nIndex = nIndex
m_sGUID = sGUID
m_sName = sName
End Sub
End Class
+6 -9
View File
@@ -77,10 +77,9 @@
<PrintApp:SliceManagerV DockPanel.Dock="Right"
DataContext="{StaticResource SliceManagerVM}"
Margin="5"/>
<Slider DockPanel.Dock="Bottom"
HorizontalAlignment="Center"
Width="400"
Value="{Binding dLayerAdvancement}"/>
<PrintApp:LayerAdvancementSliderV DockPanel.Dock="Bottom"
DataContext="{StaticResource SliderManagerVM}"
HorizontalAlignment="Center"/>
<Grid DockPanel.Dock="Bottom"
HorizontalAlignment="Center">
<PrintApp:ControllerInputPanelV DataContext="{StaticResource ControllerInputPanelVM}"/>
@@ -98,11 +97,9 @@
<PrintApp:RightPanelV DockPanel.Dock="Right"
DataContext="{StaticResource RightPanelVM}"/>
<Slider DockPanel.Dock="Right"
Orientation="Vertical"
VerticalAlignment="Center"
Height="400"
Value="{Binding dLayerNumber}"/>
<PrintApp:LayerIndexSliderV DockPanel.Dock="Right"
DataContext="{StaticResource SliderManagerVM}"
VerticalAlignment="Center"/>
<!--<Grid Grid.Column="2" Grid.Row="1">
<Grid.RowDefinitions>
+5 -2
View File
@@ -15,10 +15,13 @@
<TabItem Header="NULL">
</TabItem>
<TabItem Header="MATERIALDB">
<Button Height="100" Width="200"/>
<PrintApp:MaterialDbV DataContext="{StaticResource MaterialDbVM}"/>
</TabItem>
<TabItem Header="CURRPRINTPARAM">
<PrintApp:CurrMachiningPanelV DataContext="{StaticResource CurrMachiningPanelVM}"/>
</TabItem>
<TabItem Header="PRINTPARAMDB">
<PrintApp:CurrMachiningPanelV DataContext="{StaticResource CurrMachiningPanelVM}"/>
<PrintApp:MachiningDbV DataContext="{StaticResource MachiningDbVM}"/>
</TabItem>
<TabItem Header="TFSEDITOR">
<PrintApp:TFSEditorV DataContext="{StaticResource TFSEditorVM}"/>
+3 -2
View File
@@ -8,8 +8,9 @@ Public Class RightPanelVM
Public Enum Panels As Integer
NULL = 0
MATERIALDB = 1
PRINTPARAMDB = 2
TFSEDITOR = 3
CURRPRINTPARAM = 2
PRINTPARAMDB = 3
TFSEDITOR = 4
End Enum
Private m_SelPanel As Panels
+8 -2
View File
@@ -537,6 +537,7 @@ Public Class MySceneHostVM
If Not bOk Then
MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error
End If
Map.refTopPanelVM.PartList.Clear()
EgtZoom(ZM.ALL)
MainScene.SetStatusNull()
Map.refMainWindowVM.SetTitle("New - ")
@@ -561,6 +562,11 @@ Public Class MySceneHostVM
Map.refTopPanelVM.PartList.Clear()
Dim nPartId As Integer = EgtGetFirstPart()
While nPartId <> GDB_ID.NULL
Dim nIsOnTable As Integer = 0
If Not EgtGetInfo(nPartId, "PartOnTable", nIsOnTable) OrElse nIsOnTable <> 1 Then
nPartId = EgtGetNextPart(nPartId)
Continue While
End If
Dim nPrintPartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, PRINT_SOLID)
Dim nPrintPartId As Integer = EgtGetFirstInGroup(nPrintPartLayerId)
Dim nOriginalPartLayerId As Integer = EgtGetFirstNameInGroup(nPartId, ORIGINAL_SOLID)
@@ -570,8 +576,8 @@ Public Class MySceneHostVM
Dim nMachStartId As Integer = EgtGetFirstInGroup(nMachStartLayerId)
Dim sFilePath As String = ""
EgtGetInfo(nPartId, FILE_PATH, sFilePath)
Dim nOthersLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_OTHERS)
Dim nFrameId As Integer = EgtGetFirstInGroup(nOthersLayerId)
Dim nReferenceLayerId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_REFERENCE)
Dim nFrameId As Integer = EgtGetFirstInGroup(nReferenceLayerId)
Dim NewPart As New Print3dPartVM(nPartId, nPrintPartLayerId, nPrintPartId, nOriginalPartLayerId, nFrameId, nMachStartLayerId, nMachStartId, nAuxSolidsLayerId, nRibsLayerId, sFilePath)
Map.refTopPanelVM.PartList.Add(NewPart)
nPartId = EgtGetNextPart(nPartId)
+2 -1
View File
@@ -1,6 +1,7 @@
<UserControl x:Class="SliceManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="260">
<Border Style="{StaticResource LeftPanelPopup_Border}">
<Grid>
<Grid.RowDefinitions>
+67 -4
View File
@@ -69,6 +69,8 @@ Public Class SliceManagerVM
' Definizione comandi
Private m_cmdSlice As ICommand
Private m_cmdSimulate As ICommand
Private m_cmdGenerate As ICommand
Private m_cmdExit As ICommand
#Region "CONSTRUCTORS"
@@ -122,6 +124,14 @@ Public Class SliceManagerVM
'End If
End Function
Friend Sub CalcSlice(bSlice As Boolean, bCalcTFS As Boolean)
' eseguo file Lua
SetLoadingVisibility(True)
ExecSlice(bSlice, bCalcTFS)
SetLoadingVisibility(False)
Map.refTFSEditorVM.Refresh()
Map.refTopPanelVM.SelPart.RefreshPrintLayers()
End Sub
#End Region ' METHODS
@@ -145,15 +155,21 @@ Public Class SliceManagerVM
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Slice()
If IsNothing(Map.refTopPanelVM.SelPart) Then
MessageBox.Show("No parts to slice!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
If IsNothing(Map.refTopPanelVM.SelMachining) Then
MessageBox.Show("No print parameters set!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
If Map.refTopPanelVM.SelPage <> Pages.SLICE Then
End If
' eseguo file Lua
SetLoadingVisibility(True)
ExecSlice(True, True)
SetLoadingVisibility(False)
Map.refTFSEditorVM.Refresh()
CalcSlice(True, True)
Map.refTopPanelVM.SelPage = Pages.SLICE
Map.refSliderManagerVM.SetLayerIndexToMax()
End Sub
#End Region ' Slice
@@ -181,6 +197,53 @@ Public Class SliceManagerVM
#End Region ' Exit
#Region "Simulate"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Simulate_Command As ICommand
Get
If m_cmdSimulate Is Nothing Then
m_cmdSimulate = New Command(AddressOf Simulate)
End If
Return m_cmdSimulate
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Simulate()
End Sub
#End Region ' Simulate
#Region "Generate"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Generate_Command As ICommand
Get
If m_cmdGenerate Is Nothing Then
m_cmdGenerate = New Command(AddressOf Generate)
End If
Return m_cmdGenerate
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Generate()
' eseguo file Lua
ExecGenerate()
End Sub
#End Region ' Generate
#End Region ' COMMANDS
End Class
@@ -0,0 +1,7 @@
<Slider x:Class="LayerAdvancementSliderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400"
Value="{Binding dLayerAdvancement}"
Visibility="{Binding LayerAdvancement_Visibility}"/>
@@ -0,0 +1,3 @@
Public Class LayerAdvancementSliderV
End Class
@@ -0,0 +1,11 @@
<Slider x:Class="LayerIndexSliderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Vertical"
VerticalAlignment="Center"
Height="400"
Value="{Binding nLayerIndex}"
Minimum="{Binding nLayerIndex_Minimum}"
Maximum="{Binding nLayerIndex_Maximum}"
Visibility="{Binding LayerIndex_Visibility}"/>
@@ -0,0 +1,3 @@
Public Class LayerIndexSliderV
End Class
+124
View File
@@ -0,0 +1,124 @@
Imports EgtUILib
Imports EgtWPFLib5
Public Class SliderManagerVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_nLayerIndex As Integer
Public Property nLayerIndex As Integer
Get
Return m_nLayerIndex
End Get
Set(value As Integer)
m_nLayerIndex = value
' ciclo tutti i layer per nasconderli/mostrarli
If IsNothing(Map.refTopPanelVM.SelPart) OrElse IsNothing(Map.refTopPanelVM.SelPart.LayerList) Then Return
For Each Layer In Map.refTopPanelVM.SelPart.LayerList
If Layer.nLayerIndex <= m_nLayerIndex Then
EgtSetStatus(Layer.nLayerId, GDB_ST.ON_)
Else
EgtSetStatus(Layer.nLayerId, GDB_ST.OFF)
End If
Next
EgtDraw()
End Set
End Property
Private m_dLayerAdvancement As Double
Public Property dLayerAdvancement As Double
Get
Return m_dLayerAdvancement
End Get
Set(value As Double)
m_dLayerAdvancement = value
End Set
End Property
Private m_LayerIndex_Visibility As Visibility = Visibility.Collapsed
Public Property LayerIndex_Visibility As Visibility
Get
Return m_LayerIndex_Visibility
End Get
Set(value As Visibility)
m_LayerIndex_Visibility = value
End Set
End Property
Private m_LayerAdvancement_Visibility As Visibility = Visibility.Collapsed
Public Property LayerAdvancement_Visibility As Visibility
Get
Return m_LayerAdvancement_Visibility
End Get
Set(value As Visibility)
m_LayerAdvancement_Visibility = value
End Set
End Property
Private m_nLayerIndex_Minimum As Double
Public Property nLayerIndex_Minimum As Double
Get
Return m_nLayerIndex_Minimum
End Get
Set(value As Double)
m_nLayerIndex_Minimum = value
End Set
End Property
Private m_nLayerIndex_Maximum As Double
Public Property nLayerIndex_Maximum As Double
Get
Return m_nLayerIndex_Maximum
End Get
Set(value As Double)
m_nLayerIndex_Maximum = value
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefSliderManagerVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub SetSliderVisibility(bValue As Boolean)
m_LayerIndex_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
m_LayerAdvancement_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(LayerIndex_Visibility))
NotifyPropertyChanged(NameOf(LayerAdvancement_Visibility))
End Sub
Friend Sub RefreshSlider(nMin As Integer, nMax As Integer)
m_nLayerIndex_Minimum = nMin
m_nLayerIndex_Maximum = nMax
NotifyPropertyChanged(NameOf(nLayerIndex_Minimum))
NotifyPropertyChanged(NameOf(nLayerIndex_Maximum))
nLayerIndex = m_nLayerIndex
End Sub
Friend Sub SetLayerIndexToMax()
nLayerIndex = m_nLayerIndex_Maximum
NotifyPropertyChanged(NameOf(nLayerIndex))
End Sub
Friend Sub SetLayerIndexToMin()
nLayerIndex = m_nLayerIndex_Minimum
NotifyPropertyChanged(NameOf(nLayerIndex))
End Sub
Friend Sub SetLayerIndexToZero()
nLayerIndex = 0
NotifyPropertyChanged(NameOf(nLayerIndex))
End Sub
#End Region ' METHODS
End Class
+46 -3
View File
@@ -1,17 +1,53 @@
<UserControl x:Class="TFSEditorV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:PrintApp="clr-namespace:_3dPrintApp"
MaxHeight="600"
MaxWidth="600">
<Border VerticalAlignment="Center"
Style="{StaticResource RightPanel_Border}">
<Grid>
<DataGrid ItemsSource="{Binding LayerList}"
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<ComboBox ItemsSource="{Binding MediaTypeList}"
SelectedIndex="{Binding ghSelMediaType}"
Style="{StaticResource PartParam_ComboBox}"/>
<TextBlock Text="Slice Number:"
Visibility="{Binding MediaHeight_Visibility}"
Style="{StaticResource OptionTextBlock}"/>
<TextBox Text="{Binding sMediaHeight}"
Width="50"
Visibility="{Binding MediaHeight_Visibility}"
Style="{StaticResource ControllerInputPanel_TextBox}"/>
<TextBlock Text="F:"
Visibility="{Binding FCurr_Visibility}"
Style="{StaticResource OptionTextBlock}"/>
<TextBox Text="{Binding sFCurr}"
Width="50"
Visibility="{Binding FCurr_Visibility}"
Style="{StaticResource ControllerInputPanel_TextBox}"/>
<Button Content="Set"
Command="{Binding Set_Command}"
Visibility="{Binding FCurr_Visibility}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Media"
Command="{Binding Media_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
<Button Content="Reset"
Command="{Binding Reset_Command}"
Style="{StaticResource ToolBar_TextButton}"/>
</StackPanel>
<DataGrid Grid.Row="1"
ItemsSource="{Binding LayerList}"
PrintApp:MultiSelectorBehaviours.SynchronizedSelectedItems="{Binding SelLayers}"
SelectedItem="{Binding SelLayer}"
CanUserAddRows="False"
AutoGenerateColumns="False"
CanUserResizeRows="False"
SelectionMode="Single"
SelectionMode="Extended"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
@@ -22,7 +58,7 @@
IsReadOnly="True"
Width="Auto"/>
<DataGridTextColumn Header="Length"
Binding="{Binding dLength}"
Binding="{Binding sLength}"
IsReadOnly="True"
Width="2*"/>
<DataGridTextColumn Header="TMin"
@@ -61,6 +97,13 @@
IsReadOnly="True"
Width="1*"/>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
<Setter Property="Background" Value="{Binding Background}"/>
<!--<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>-->
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
</Border>
+349 -7
View File
@@ -1,4 +1,5 @@
Imports System.Collections.ObjectModel
Imports System.Collections.Specialized
Imports EgtUILib
Imports EgtWPFLib5
@@ -7,6 +8,12 @@ Public Class TFSEditorVM
#Region "FIELDS & PROPERTIES"
Public Enum MediaTypes As Integer
HEIGHT = 1
SECTIONCHANGE = 2
SELECTION = 3
End Enum
Private m_LayerList As New ObservableCollection(Of TFSLayer)
Public ReadOnly Property LayerList As ObservableCollection(Of TFSLayer)
Get
@@ -14,16 +21,101 @@ Public Class TFSEditorVM
End Get
End Property
Private m_SelLayer As TFSLayer
Public Property SelLayer As TFSLayer
Private m_SelLayers As New ObservableCollection(Of TFSLayer)
Public Property SelLayers As ObservableCollection(Of TFSLayer)
Get
Return m_SelLayer
Return m_SelLayers
End Get
Set(value As TFSLayer)
m_SelLayer = value
Set(value As ObservableCollection(Of TFSLayer))
m_SelLayers = value
End Set
End Property
Private m_MediaTypeList As New List(Of String)({"Slice Number", "Section change", "Selection"})
Public ReadOnly Property MediaTypeList As List(Of String)
Get
Return m_MediaTypeList
End Get
End Property
Private m_nSelMediaType As MediaTypes
Public Property ghSelMediaType As Integer
Get
Return m_nSelMediaType - 1
End Get
Set(value As Integer)
m_nSelMediaType = value + 1
Select Case m_nSelMediaType
Case MediaTypes.HEIGHT
SetMediaHeightVisibility(True)
SetFCurrVisibility(False)
Case MediaTypes.SECTIONCHANGE
SetMediaHeightVisibility(False)
SetFCurrVisibility(False)
Case MediaTypes.SELECTION
SetMediaHeightVisibility(False)
SetFCurrVisibility(True)
End Select
End Set
End Property
Private m_nMediaHeight As Integer
Public Property sMediaHeight As String
Get
Return m_nMediaHeight
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If Integer.TryParse(value, nNewValue) Then
m_nMediaHeight = nNewValue
Else
NotifyPropertyChanged(NameOf(sMediaHeight))
End If
End Set
End Property
Private m_MediaHeight_Visibility As Visibility
Public ReadOnly Property MediaHeight_Visibility As Visibility
Get
Return m_MediaHeight_Visibility
End Get
End Property
Private Sub SetMediaHeightVisibility(bValue As Boolean)
m_MediaHeight_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(MediaHeight_Visibility))
End Sub
Private m_dFCurr As Double
Public Property sFCurr As String
Get
Return LenToString(m_dFCurr, 2)
End Get
Set(value As String)
Dim nNewValue As Integer = 0
If StringToLen(value, nNewValue) Then
m_dFCurr = nNewValue
Else
NotifyPropertyChanged(NameOf(sFCurr))
End If
End Set
End Property
Private m_FCurr_Visibility As Visibility = Visibility.Collapsed
Public ReadOnly Property FCurr_Visibility As Visibility
Get
Return m_FCurr_Visibility
End Get
End Property
Private Sub SetFCurrVisibility(bValue As Boolean)
m_FCurr_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed)
NotifyPropertyChanged(NameOf(FCurr_Visibility))
End Sub
' Definizione comandi
Private m_cmdSet As ICommand
Private m_cmdMedia As ICommand
Private m_cmdReset As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTORS"
@@ -31,12 +123,40 @@ Public Class TFSEditorVM
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefTFSEditorVM(Me)
m_nSelMediaType = MediaTypes.HEIGHT
NotifyPropertyChanged(NameOf(ghSelMediaType))
AddHandler m_SelLayers.CollectionChanged, AddressOf SelLayers_CollectionChanged
End Sub
#End Region ' CONSTRUCTORS
#Region "METHODS"
Private Sub SelLayers_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
Select Case e.Action
Case NotifyCollectionChangedAction.Add
For Each AddedSelLayer In e.NewItems
For Each nSliceId In AddedSelLayer.GeomSliceIdList
EgtSelectObj(nSliceId)
Next
Next
Case NotifyCollectionChangedAction.Remove
For Each RemovedSelLayer In e.OldItems
For Each nSliceId In RemovedSelLayer.GeomSliceIdList
EgtDeselectObj(nSliceId)
Next
Next
Case NotifyCollectionChangedAction.Replace
Case NotifyCollectionChangedAction.Move
Case NotifyCollectionChangedAction.Reset
EgtDeselectAll()
End Select
EgtDraw()
End Sub
Friend Sub Refresh()
m_LayerList.Clear()
Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC)
@@ -49,9 +169,175 @@ Public Class TFSEditorVM
#End Region ' METHODS
#Region "COMMANDS"
#Region "Set"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Set_Command As ICommand
Get
If m_cmdSet Is Nothing Then
m_cmdSet = New Command(AddressOf SetCmd)
End If
Return m_cmdSet
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub SetCmd()
If m_LayerList.Count <= 0 Then Return
Select Case m_nSelMediaType
Case MediaTypes.SELECTION
For Each Layer In m_SelLayers
Layer.SetFCurr(m_dFCurr)
Next
End Select
' salvo selezione corrente
Dim SelIndexList As New List(Of Integer)
For Each SelLayer In m_SelLayers
SelIndexList.Add(SelLayer.nIndex)
Next
' ricalcolo valori
Map.refSliceManagerVM.CalcSlice(False, True)
' ripristino layer selezionati
For Each Index In SelIndexList
Dim NewLayer As TFSLayer = m_LayerList.FirstOrDefault(Function(x) x.nIndex = Index)
If Not IsNothing(NewLayer) Then
m_SelLayers.Add(NewLayer)
End If
Next
End Sub
#End Region ' Set
#Region "Media"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Media_Command As ICommand
Get
If m_cmdMedia Is Nothing Then
m_cmdMedia = New Command(AddressOf Media)
End If
Return m_cmdMedia
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Media()
If m_LayerList.Count <= 0 Then Return
Select Case m_nSelMediaType
Case MediaTypes.HEIGHT
If m_nMediaHeight <= 0 Then Return
For Index = 0 To Math.Ceiling(m_LayerList.Count() / m_nMediaHeight) - 1
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Index2 = (m_nMediaHeight * Index) To Math.Min(m_nMediaHeight * (Index + 1), m_LayerList.Count() - 1)
dFSum += m_LayerList(Index2).dFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Index2 = (m_nMediaHeight * Index) To Math.Min(m_nMediaHeight * (Index + 1), m_LayerList.Count() - 1)
m_LayerList(Index2).SetFCurr(dNewFCurr)
Next
Next
Case MediaTypes.SECTIONCHANGE
Dim ChangeIndexList As New List(Of Integer)({0})
Dim dPrevLength As Double = m_LayerList(0).dLength
' recupero punti di rottura
For Index = 1 To m_LayerList.Count() - 1
Dim dCurrLength = m_LayerList(Index)
If dPrevLength < m_LayerList(Index).dLength * 0.9 OrElse dPrevLength > m_LayerList(Index).dLength * 1.1 Then
ChangeIndexList.Add(Index)
End If
dPrevLength = m_LayerList(Index).dLength
Next
If ChangeIndexList(ChangeIndexList.Count - 1) <> m_LayerList.Count() - 1 Then
ChangeIndexList.Add(m_LayerList.Count() - 1)
End If
' ricalcolo media sugli intervalli trovati
For Index = 0 To ChangeIndexList.Count() - 2
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Index2 = ChangeIndexList(Index) To ChangeIndexList(Index + 1)
dFSum += m_LayerList(Index2).dFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Index2 = ChangeIndexList(Index) To ChangeIndexList(Index + 1)
m_LayerList(Index2).SetFCurr(dNewFCurr)
Next
Next
Case MediaTypes.SELECTION
If m_SelLayers.Count <= 0 Then Return
Dim dFSum As Double = 0
Dim dFIndex As Double = 0
For Each Layer In m_SelLayers
dFSum += Layer.dFCurr
dFIndex += 1
Next
Dim dNewFCurr As Double = dFSum / dFIndex
For Each Layer In m_SelLayers
Layer.SetFCurr(dNewFCurr)
Next
End Select
' salvo selezione corrente
Dim SelIndexList As New List(Of Integer)
For Each SelLayer In m_SelLayers
SelIndexList.Add(SelLayer.nIndex)
Next
' ricalcolo valori
Map.refSliceManagerVM.CalcSlice(False, True)
' ripristino layer selezionati
For Each Index In SelIndexList
Dim NewLayer As TFSLayer = m_LayerList.FirstOrDefault(Function(x) x.nIndex = Index)
If Not IsNothing(NewLayer) Then
m_SelLayers.Add(NewLayer)
End If
Next
End Sub
#End Region ' Media
#Region "Reset"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property Reset_Command As ICommand
Get
If m_cmdReset Is Nothing Then
m_cmdReset = New Command(AddressOf Reset)
End If
Return m_cmdReset
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub Reset()
' cancello gruppo della tabella
Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC)
EgtEmptyGroup(nLayTFSCalcId)
Map.refSliceManagerVM.CalcSlice(False, True)
End Sub
#End Region ' Reset
#End Region ' COMMANDS
End Class
Public Class TFSLayer
Inherits VMBase
Private m_nId As Integer
Public ReadOnly Property nId As Integer
@@ -68,11 +354,16 @@ Public Class TFSLayer
End Property
Private m_dLength As Double
Public ReadOnly Property dLength As Double
Public ReadOnly Property sLength As String
Get
Return LenToString(m_dLength, 2)
End Get
End Property
Public ReadOnly Property dLength As Double
Get
Return m_dLength
End Get
End Property
Private m_dTMin As Double
Public ReadOnly Property dTMin As Double
@@ -130,8 +421,25 @@ Public Class TFSLayer
End Get
Set(value As Double)
m_dFCurr = value
EgtSetInfo(nId, "FCur", m_dFCurr)
m_bFCurr_IsModified = True
NotifyPropertyChanged(NameOf(Background))
End Set
End Property
Friend Sub SetFCurr(value As Double)
m_dFCurr = value
EgtSetInfo(nId, "FCur", m_dFCurr)
m_bFCurr_IsModified = True
NotifyPropertyChanged(NameOf(Background))
NotifyPropertyChanged(NameOf(dFCurr))
End Sub
Private m_bFCurr_IsModified As Boolean
Public ReadOnly Property bFCurr_IsModified As Boolean
Get
Return m_bFCurr_IsModified
End Get
End Property
Private m_dSpeed As Double
Public ReadOnly Property dSpeed As Double
@@ -140,7 +448,29 @@ Public Class TFSLayer
End Get
End Property
Private m_GeomSliceIdList As New List(Of Integer)
Public ReadOnly Property GeomSliceIdList As List(Of Integer)
Get
Return m_GeomSliceIdList
End Get
End Property
Public ReadOnly Property Background As SolidColorBrush
Get
If m_bFCurr_IsModified Then
Return Brushes.White
ElseIf m_dTCurr < m_dTMin Then
Return Brushes.Red
ElseIf m_dTCurr > m_dTMax Then
Return Brushes.MediumSlateBlue
Else
Return Brushes.LightGreen
End If
End Get
End Property
Sub New(nId As Integer)
m_nId = nId
Dim sIndex As String = ""
EgtGetName(nId, sIndex)
Integer.TryParse(sIndex, m_nIndex)
@@ -154,7 +484,18 @@ Public Class TFSLayer
EgtGetInfo(nId, KEY_FMAX, m_dFMax)
EgtGetInfo(nId, KEY_FCUR, m_dFCurr)
EgtGetInfo(nId, KEY_SPEED, m_dSpeed)
If EgtGetInfo(nId, KEY_SLICEID, sIndex) Then
Dim sSliceIdList() As String = sIndex.Split(";"c)
If sSliceIdList.Count > 0 Then
For Each sSliceId In sSliceIdList
Dim nSliceId As Integer = GDB_ID.NULL
If Integer.TryParse(sSliceId, nSliceId) Then
m_GeomSliceIdList.Add(nSliceId)
End If
Next
End If
End If
NotifyPropertyChanged(NameOf(Background))
End Sub
Sub New(nId As Integer, nIndex As Integer, dLength As Double, dTMin As Double, dTTrg As Double, dTMax As Double, dTCurr As Double, dFMin As Double, dFTrg As Double, dFMax As Double, dFCurr As Double, dSpeed As Double)
@@ -171,4 +512,5 @@ Public Class TFSLayer
m_dFCurr = dFCurr
m_dSpeed = dSpeed
End Sub
End Class
+20 -5
View File
@@ -136,11 +136,26 @@
HorizontalContentAlignment="Stretch"
Style="{StaticResource PrintParam_ToggleButton}">
<UniformGrid Rows="1" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding CurrMachining.bCurrSlicing45}"/>
<TextBlock Text="{Binding CurrMachining.dCurrStrandH, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="{Binding CurrMachining.dCurrStrandW}"/>
<TextBlock Text="{Binding CurrMachining.nCurrStrandCount}"/>
<TextBlock Text="{Binding CurrMachining.dCurrOffset}"/>
<TextBlock Text="45°:"
HorizontalAlignment="Right"/>
<TextBlock Text="{Binding CurrMachining.bCurrSlicing45}"
HorizontalAlignment="Left"/>
<TextBlock Text="StrandH:"
HorizontalAlignment="Right"/>
<TextBlock Text="{Binding CurrMachining.dCurrStrandH}"
HorizontalAlignment="Left"/>
<TextBlock Text="StrandW:"
HorizontalAlignment="Right"/>
<TextBlock Text="{Binding CurrMachining.dCurrStrandW}"
HorizontalAlignment="Left"/>
<TextBlock Text="StrandCount:"
HorizontalAlignment="Right"/>
<TextBlock Text="{Binding CurrMachining.nCurrStrandCount}"
HorizontalAlignment="Left"/>
<TextBlock Text="Offset:"
HorizontalAlignment="Right"/>
<TextBlock Text="{Binding CurrMachining.dCurrOffset}"
HorizontalAlignment="Left"/>
</UniformGrid>
</ToggleButton>
</Grid>
+20 -11
View File
@@ -130,9 +130,10 @@ Public Class TopPanelVM
If Not IsNothing(value) Then
' Eseguo la selezione
EgtDeselectAll()
EgtSetStatus(m_SelPart.nPartId, GDB_ST.ON_)
EgtSelectPartObjs(m_SelPart.nPartId)
EgtDraw()
' imposto lavorazione del pezzo selezionato
' imposto lavorazione e materiale del pezzo selezionato
Map.refCurrMachiningPanelVM.ReadMachParamFromSelPart()
SetSelMachining(MachiningList.FirstOrDefault(Function(x) x.sGUID = Map.refCurrMachiningPanelVM.CurrMachining.OrigMachining.sGUID))
' notifico posizione pezzo
@@ -184,15 +185,15 @@ Public Class TopPanelVM
Set(value As MachiningIndex)
' verifico se vecchia modificata e chiedo se salvare??
If Not IsNothing(m_SelMachining) Then WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, value.sName)
If Not IsNothing(value) Then WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, value.sName)
' imposto selezionata come corrente
If Not IsNothing(m_SelPart) AndAlso value.sGUID <> m_SelMachining.sGUID Then
If Not IsNothing(m_SelPart) AndAlso (IsNothing(m_SelMachining) OrElse value.sGUID <> m_SelMachining.sGUID) Then
Map.refCurrMachiningPanelVM.SetCurrMachining(New CurrMachining(value))
'm_CurrMachining.UpdateMachParam()
End If
m_SelMachining = value
'' riporto parametri nel pezzo selezionato
'WriteMachParamOnSelPart()
' riporto parametri nel pezzo selezionato
If Not IsNothing(m_SelPart) Then CurrMachining.WriteMachParamOnPart(m_SelPart.nPartId)
' aggiorno parametri mostrati nella barra
If Not IsNothing(CurrMachining) Then CurrMachining.UpdateMachParam()
End Set
@@ -205,7 +206,7 @@ Public Class TopPanelVM
'Private m_CurrMachining As CurrMachining
Public ReadOnly Property CurrMachining As CurrMachining
Get
Return Map.refCurrMachiningPanelVM.CurrMachining
Return If(Not IsNothing(Map.refCurrMachiningPanelVM), Map.refCurrMachiningPanelVM.CurrMachining, Nothing)
End Get
End Property
Friend Sub UpdateCurrMachining()
@@ -266,6 +267,7 @@ Public Class TopPanelVM
#Region "Machining"
Friend Sub InitMachiningsList()
If IsNothing(m_SelMaterial) Then Return
MachiningList.Clear()
Dim nIndex As Integer = 1
Dim sGUID As String = ""
@@ -283,7 +285,7 @@ Public Class TopPanelVM
End While
Dim sCurrMachining As String = ""
GetMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, "", sCurrMachining)
m_SelMachining = MachiningList.FirstOrDefault(Function(x) x.sName = sCurrMachining)
SelMachining = MachiningList.FirstOrDefault(Function(x) x.sName = sCurrMachining)
End Sub
Friend Function GetSelMachining() As Machining
@@ -323,11 +325,17 @@ Public Class TopPanelVM
Private Sub InitSLICE()
Map.refSliceManagerVM.UpdateState(True)
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.TFSEDITOR)
Map.refSliderManagerVM.SetSliderVisibility(True)
Map.refSliderManagerVM.SetLayerIndexToMax()
EgtDeselectAll()
End Sub
Private Function ExitSLICE()
Map.refSliceManagerVM.UpdateState(False)
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL)
Map.refSliderManagerVM.SetSliderVisibility(False)
Map.refSliderManagerVM.SetLayerIndexToZero()
SelPart = SelPart
Return True
End Function
@@ -341,7 +349,7 @@ Public Class TopPanelVM
End Function
Private Sub InitMATERIALDB()
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.MATERIALDB)
End Sub
Private Function ExitMATERIALDB()
@@ -350,6 +358,7 @@ Public Class TopPanelVM
End Function
Private Sub InitMACHININGDB()
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB)
End Sub
Private Function ExitMACHININGDB()
@@ -358,7 +367,7 @@ Public Class TopPanelVM
End Function
Private Sub InitCURRMACHINING()
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB)
Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.CURRPRINTPARAM)
End Sub
Private Function ExitCURRMACHINING()
@@ -522,7 +531,7 @@ Public Class TopPanelVM
''' </summary>
Public Sub PrintParamDb()
'Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB)
'Map.refTopPanelVM.SelPage = Pages.SLICE
SelPage = Pages.MACHININGDB
End Sub
#End Region ' PrintParamDb
@@ -546,7 +555,7 @@ Public Class TopPanelVM
''' </summary>
Public Sub MaterialDb()
'Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB)
'Map.refTopPanelVM.SelPage = Pages.SLICE
SelPage = Pages.MATERIALDB
End Sub
#End Region ' MaterialDb
+3
View File
@@ -34,6 +34,9 @@
<PrintApp:SliceManagerVM x:Key="SliceManagerVM"/>
<PrintApp:TFSEditorVM x:Key="TFSEditorVM"/>
<PrintApp:CurrMachiningPanelVM x:Key="CurrMachiningPanelVM"/>
<PrintApp:MachiningDbVM x:Key="MachiningDbVM"/>
<PrintApp:MaterialDbVM x:Key="MaterialDbVM"/>
<PrintApp:SliderManagerVM x:Key="SliderManagerVM"/>
<!--<EgtBEAMWALL:CALCPanelVM x:Key="CALCPanelVM"/>
<EgtBEAMWALL:PartParametersVM x:Key="PartParametersVM"/>
<EgtBEAMWALL:LeftPanelVM x:Key="LeftPanelVM"/>
+7
View File
@@ -48,4 +48,11 @@ Module LuaExec
Return bOk
End Function
Friend Function ExecGenerate() As Boolean
EgtOutLog("-- Start ExecGenerate --")
' eseguo generazione
Map.refSceneHostVM.ExecScript(Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\GcodeGenerate.lua")
Return True
End Function
End Module
+36
View File
@@ -50,6 +50,9 @@ Module Map
Private m_refSliceManagerVM As SliceManagerVM
Private m_refTFSEditorVM As TFSEditorVM
Private m_refCurrMachiningPanelVM As CurrMachiningPanelVM
Private m_refMachiningDbVM As MachiningDbVM
Private m_refMaterialDbVM As MaterialDbVM
Private m_refSliderManagerVM As SliderManagerVM
#Region "Get"
@@ -352,6 +355,24 @@ Module Map
End Get
End Property
Public ReadOnly Property refMachiningDbVM As MachiningDbVM
Get
Return m_refMachiningDbVM
End Get
End Property
Public ReadOnly Property refMaterialDbVM As MaterialDbVM
Get
Return m_refMaterialDbVM
End Get
End Property
Public ReadOnly Property refSliderManagerVM As SliderManagerVM
Get
Return m_refSliderManagerVM
End Get
End Property
#End Region ' Get
#Region "Set"
@@ -605,6 +626,21 @@ Module Map
Return Not IsNothing(m_refCurrMachiningPanelVM)
End Function
Friend Function SetRefMachiningDbVM(MachiningDbVM As MachiningDbVM) As Boolean
m_refMachiningDbVM = MachiningDbVM
Return Not IsNothing(m_refMachiningDbVM)
End Function
Friend Function SetRefMaterialDbVM(MaterialDbVM As MaterialDbVM) As Boolean
m_refMaterialDbVM = MaterialDbVM
Return Not IsNothing(m_refMaterialDbVM)
End Function
Friend Function SetRefSliderManagerVM(SliderManagerVM As SliderManagerVM) As Boolean
m_refSliderManagerVM = SliderManagerVM
Return Not IsNothing(m_refSliderManagerVM)
End Function
#End Region ' Set
#Region "Init"
+23 -1
View File
@@ -1,3 +1,25 @@
Public Class Print3dLayerVM
Imports EgtUILib
Imports EgtWPFLib5
Public Class Print3dLayerVM
Private m_nLayerId As Integer = GDB_ID.NULL
Public ReadOnly Property nLayerId As Integer
Get
Return m_nLayerId
End Get
End Property
Private m_nLayerIndex As Integer = -1
Public ReadOnly Property nLayerIndex As Integer
Get
Return m_nLayerIndex
End Get
End Property
Sub New(nLayerId As Integer, nLayerIndex As Integer)
m_nLayerId = nLayerId
m_nLayerIndex = nLayerIndex
End Sub
End Class
+22 -2
View File
@@ -87,7 +87,7 @@ Public Class Print3dPartVM
End Set
End Property
Private m_LayerList As ObservableCollection(Of Print3dLayerVM)
Private m_LayerList As New ObservableCollection(Of Print3dLayerVM)
Public ReadOnly Property LayerList As ObservableCollection(Of Print3dLayerVM)
Get
Return m_LayerList
@@ -96,9 +96,10 @@ Public Class Print3dPartVM
#Region "Default Machining Params"
#End Region ' Default Machining Params
#Region "CONSTRUCTOR"
Sub New(nPartId As Integer, sImportedFilePath As String)
m_nPartId = nPartId
m_sImportedFilePath = sImportedFilePath
@@ -119,4 +120,23 @@ Public Class Print3dPartVM
m_sImportedFilePath = sImportedFilePath
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub RefreshPrintLayers()
m_LayerList.Clear()
Dim nSliceId As Integer = EgtGetFirstInGroup(nPartId)
While nSliceId <> GDB_ID.NULL
Dim nSliceIndex As Integer = 0
If EgtGetInfo(nSliceId, "SliceNbr", nSliceIndex) Then
m_LayerList.Add(New Print3dLayerVM(nSliceId, nSliceIndex))
End If
nSliceId = EgtGetNextGroup(nSliceId)
End While
Map.refSliderManagerVM.RefreshSlider(1, m_LayerList.Count())
End Sub
#End Region ' METHODS
End Class