diff --git a/Base/TreeView/TreeViewItemBase.vb b/Base/TreeView/TreeViewItemBase.vb
index 8129309..8ace23e 100644
--- a/Base/TreeView/TreeViewItemBase.vb
+++ b/Base/TreeView/TreeViewItemBase.vb
@@ -1,5 +1,7 @@
Imports System.Collections.ObjectModel
Imports System.ComponentModel
+Imports EgtUILib
+Imports EgtUILib.EgtInterface
' Classe che definisce un elemento di base del TreeView
Public Class TreeViewItemBase
@@ -31,7 +33,7 @@ Public Class TreeViewItemBase
End Set
End Property
- Private m_isExpanded As Boolean
+ Friend m_isExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_isExpanded
@@ -39,6 +41,25 @@ Public Class TreeViewItemBase
Set(value As Boolean)
If (value <> m_isExpanded) Then
m_isExpanded = value
+ If Not Map.refProjectVM.bSelObjOnScene Then
+ Dim m_onldObjTreeOldId As Integer = Map.refManageLayerExpanderVM.m_nObjTreeOldId
+ If Not m_isExpanded Then
+ Else
+ For Each Item As LayerTreeViewItem In Map.refManageLayerExpanderVM.LayerList
+ For Each LayerItem As LayerTreeViewItem In Item.Items
+ If m_isExpanded = LayerItem.m_isExpanded Then
+ If m_onldObjTreeOldId = LayerItem.Id Then
+ Map.refProjectVM.SetLastInteger(LayerItem.Id)
+ Map.refProjectVM.ExecuteCommand(Controller.CMD.DESELECTPARTLAYEROBJ)
+ Else
+ Map.refManageLayerExpanderVM.SelectIdInObjTree(LayerItem.Id)
+ 'Map.refProjectVM.ExecuteCommand(Controller.CMD.SETCURRPARTLAYER)
+ End If
+ End If
+ Next
+ Next
+ End If
+ End If
NotifyPropertyChanged(NameOf(IsExpanded))
End If
End Set
@@ -92,6 +113,7 @@ Public Class InheritableTreeViewItem
Implements INotifyPropertyChanged
Friend m_Name As String
+
Public Property Name As String
Get
Return m_Name
@@ -195,7 +217,6 @@ Public Class ParentItem
Inherits TreeViewItemBase
Private m_sPictureString As String
- Private m_Items As ObservableCollection(Of ChildItem)
Public Property PictureString As String
Get
@@ -209,6 +230,7 @@ Public Class ParentItem
End Set
End Property
+ Private m_Items As ObservableCollection(Of ChildItem)
Public Property Items As ObservableCollection(Of ChildItem)
Get
Return m_Items
@@ -255,4 +277,4 @@ Public Class ChildItem
MyBase.New(Name, IsSelected, IsExpanded, IsActive)
End Sub
-End Class
+End Class
\ No newline at end of file
diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb
index 7c0766c..0ca0448 100644
--- a/Constants/ConstIni.vb
+++ b/Constants/ConstIni.vb
@@ -105,11 +105,15 @@ Module ConstIni
Public Const S_IMPORT As String = "Import"
Public Const K_DXFSCALE As String = "DxfScale"
Public Const K_STLSCALE As String = "StlScale"
+ Public Const K_OFFSCALE As String = "OffScale"
+ Public Const K_PLYSCALE As String = "PlyScale"
Public Const K_IMGSCALE As String = "ImgScale"
Public Const K_CNCFLAG As String = "CncFlag"
Public Const K_BTLFLAG As String = "BtlFlag"
Public Const K_BTLAUXDIR As String = "BtlAuxDir"
+ Public Const K_3MFFLAG As String = "3mfFlag"
Public Const K_ADVFLAG As String = "AdvFlag"
+ Public Const K_ADVTOLER As String = "AdvToler"
Public Const S_EXPORT As String = "Export"
Public Const K_DXFFLAG As String = "DxfFlag"
@@ -155,6 +159,7 @@ Module ConstIni
Public Const K_TABLESDIR As String = "TablesDir"
Public Const K_CURRMTABLE As String = "CurrMTable"
Public Const K_MTABLEWINPLACE As String = "MTableWinPlace"
+ Public Const K_OPTIMIZEMACHFORLINE As String = "OptimizeMachForLine"
Public Const S_GUNSTOCK As String = "GunStock"
Public Const K_GUNSTOCKENABLE As String = "GsEnable"
@@ -184,6 +189,7 @@ Module ConstIni
Public Const K_SELGEOMSURFFINISHING As String = "SelGeomSurfFinishing"
Public Const K_SELGEOMSURFROUGHING As String = "SelGeomSurfRoughing"
Public Const K_SELGEOMFIVEAXMILLING As String = "SelGeomFiveAxMilling"
+ Public Const K_SELVMILLQUALITY As String = "VMillQuality"
Public Const K_MACHININGGROUP As String = "MachiningGroup"
Public Const K_SHOWONLYTABLE As String = "ShowOnlyTable"
Public Const K_MOVETHROUGHDISPS As String = "MoveThroughDisps"
diff --git a/DataGridMultiselectManaging/IListItemConverter.vb b/DataGridMultiselectManaging/IListItemConverter.vb
new file mode 100644
index 0000000..6b19886
--- /dev/null
+++ b/DataGridMultiselectManaging/IListItemConverter.vb
@@ -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
diff --git a/DataGridMultiselectManaging/MultiSelectorBehaviours.vb b/DataGridMultiselectManaging/MultiSelectorBehaviours.vb
new file mode 100644
index 0000000..1b43aee
--- /dev/null
+++ b/DataGridMultiselectManaging/MultiSelectorBehaviours.vb
@@ -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
diff --git a/DataGridMultiselectManaging/TwoListSynchronizer.vb b/DataGridMultiselectManaging/TwoListSynchronizer.vb
new file mode 100644
index 0000000..f443d53
--- /dev/null
+++ b/DataGridMultiselectManaging/TwoListSynchronizer.vb
@@ -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
diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 4c78803..b0e2381 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -170,6 +170,9 @@
EgtMessageBoxV.xaml
+
+
+ LeftTrayV.xaml
diff --git a/MachGroupPanel/MyMachGroupPanelVM.vb b/MachGroupPanel/MyMachGroupPanelVM.vb
index 0b7b307..aced8f7 100644
--- a/MachGroupPanel/MyMachGroupPanelVM.vb
+++ b/MachGroupPanel/MyMachGroupPanelVM.vb
@@ -104,7 +104,10 @@ Public Class MyMachGroupPanelVM
Else
' se ci sono gruppi di lavorazione
If bMachGroup Then
- nGroupId = EgtGetLastMachGroup()
+ nGroupId = EgtGetCurrMachGroup()
+ If nGroupId = GDB_ID.NULL Then
+ nGroupId = EgtGetFirstMachGroup()
+ End If
Return If(EgtSetCurrMachGroup(nGroupId), 0, 1)
' se altrimenti ammessi gruppi di lavoro vuoti
ElseIf bAllowEmpty Then
diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb
index 5173569..d93c2cc 100644
--- a/MainWindow/MainWindowVM.vb
+++ b/MainWindow/MainWindowVM.vb
@@ -386,8 +386,8 @@ Public Class MainWindowVM
EgtSetLockId(sLockId)
End If
' Recupero livello e opzioni della chiave
- Dim bKey As Boolean = EgtGetKeyLevel(3279, 2608, 1, IniFile.m_nKeyLevel) And
- EgtGetKeyOptions(3279, 2608, 1, IniFile.m_nKeyOptions)
+ Dim bKey As Boolean = EgtGetKeyLevel(3279, 2703, 1, IniFile.m_nKeyLevel) And
+ EgtGetKeyOptions(3279, 2703, 1, IniFile.m_nKeyOptions)
' Leggo e imposto livello utilizzatore
IniFile.m_nUserLevel = Math.Min(IniFile.m_nKeyLevel, GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' Imposto abilitazione lavorazioni avanzate
@@ -423,14 +423,6 @@ Public Class MainWindowVM
GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
GetPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", OptionModule.m_sFontText)
EgtSetFont(sNfeDir, OptionModule.m_sFontText)
- ' Imposto direttorio ausiliario per import/gestione BTL
- Dim sBtlAuxDir As String = String.Empty
- GetPrivateProfileString(S_IMPORT, K_BTLAUXDIR, "", sBtlAuxDir)
- EgtSetBtlAuxDir(sBtlAuxDir)
- ' Imposto direttorio libreria per export ThreeJs
- Dim sThreeJSLibDir As String = String.Empty
- GetPrivateProfileString(S_EXPORT, K_THREEJSLIBDIR, "", sThreeJSLibDir)
- EgtSetThreeJSLibDir(sThreeJSLibDir)
' Imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
@@ -438,6 +430,14 @@ Public Class MainWindowVM
Dim sLuaBaseLib As String = String.Empty
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
+ ' Imposto direttorio ausiliario per import/gestione BTL (sempre dopo impostazioni lua)
+ Dim sBtlAuxDir As String = String.Empty
+ GetPrivateProfileString(S_IMPORT, K_BTLAUXDIR, "", sBtlAuxDir)
+ EgtSetBtlAuxDir(sBtlAuxDir)
+ ' Imposto direttorio libreria per export ThreeJs
+ Dim sThreeJSLibDir As String = String.Empty
+ GetPrivateProfileString(S_EXPORT, K_THREEJSLIBDIR, "", sThreeJSLibDir)
+ EgtSetThreeJSLibDir(sThreeJSLibDir)
' Imposto direttorio temporaneo a EgtInterface
EgtSetTempDir(m_sTempDir)
' Imposto IniFile a EgtInterface
@@ -598,9 +598,17 @@ Public Class MainWindowVM
' pulisco output
Map.refStatusBarVM.NotifyStatusOutput("")
Map.refInputExpanderVM.ResetInputBox()
- ElseIf e.Key = Key.Left OrElse e.Key = Key.Right OrElse e.Key = Key.Up OrElse e.Key = Key.Down AndAlso Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then
+ If not IsNothing( Map.refMachiningParameterExpanderVM) Then
+ ' Nascondo la combobox delle usernotes
+ Map.refMachiningParameterExpanderVM.CurrOperation.SetComboAddVisibility(Visibility.Collapsed)
+ 'riattivo il pulsante per visualizzare la combobox delle note
+ Map.refMachiningParameterExpanderVM.CurrOperation.SetShowNoteListCombo_IsEnable(True)
+ End If
+ ElseIf e.Key = Key.Left OrElse e.Key = Key.Right OrElse e.Key = Key.Up OrElse e.Key = Key.Down AndAlso
+ Map.refTopCommandBarVM.MachiningIsChecked AndAlso Map.refOperationParametersExpanderVM.OperationParameters.IsEnabled Then
Map.refMachiningParameterExpanderVM.FocusSlider()
- Map.refMachiningParameterExpanderVM.SetSliderValue(1)
+ Dim nStep As Integer = If(e.Key = Key.Right OrElse e.Key = Key.Up, 1, -1)
+ Map.refMachiningParameterExpanderVM.SetSliderValue(nStep)
e.Handled = True
End If
End Sub
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 81f3937..86dd809 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -30,7 +30,7 @@ Imports System.Windows
#End If
-
+
@@ -70,6 +70,6 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml
index 8a7bc32..66842fe 100644
--- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml
+++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml
@@ -1,6 +1,6 @@
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -16,17 +16,66 @@
-->
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Visibility="{Binding ComboVisibility}" Margin="5,5,5,5"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb
index 9440c4f..21b1a47 100644
--- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb
+++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb
@@ -14,4 +14,12 @@
Me.TextBoxFocus.Focus()
End Sub
+ Private Sub TextBox_PreviewKeyDown(sender As Object, e As KeyEventArgs)
+ If e.Key = Key.Enter And Keyboard.Modifiers = ModifierKeys.Shift Then
+ Txt.AcceptsReturn = True
+ Txt.TextWrapping = TextWrapping.Wrap
+ Txt.AppendText(Environment.NewLine)
+ End If
+ End Sub
+
End Class
diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb
index 5a62f30..bde6a30 100644
--- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb
+++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb
@@ -1,5 +1,6 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
+Imports MS.Internal
Public Class InputExpanderVM
Inherits ViewModelBase
@@ -8,6 +9,23 @@ Public Class InputExpanderVM
Friend Event m_FocusOnTextBox()
+ ' Variabile temporanea per salvare bShow
+ Private m_tmpbShow As Boolean
+
+ Private m_tmpInfoList As New ObservableCollection(Of InfoItem)
+ '''
+ ''' Lista temporanea delle info
+ '''
+ Private Property tmpInfoList As ObservableCollection(Of InfoItem)
+ Get
+ Return m_tmpInfoList
+ End Get
+ Set(value As ObservableCollection(Of InfoItem))
+ m_tmpInfoList = value
+ OnPropertyChanged("tmpInfoList")
+ End Set
+ End Property
+
' Expander fields
Private m_IsExpanded As Boolean
Public Property IsExpanded As Boolean
@@ -142,15 +160,61 @@ Public Class InputExpanderVM
End Set
End Property
+ Private m_InfoList As New ObservableCollection(Of InfoItem)
+ '''
+ ''' Lista delle info modificate
+ '''
+ Public Property InfoList As ObservableCollection(Of InfoItem)
+ Get
+ Return m_InfoList
+ End Get
+ Set(value As ObservableCollection(Of InfoItem))
+ m_InfoList = value
+ OnPropertyChanged("InfoList")
+ End Set
+ End Property
+
+ Private m_InfoList As New ObservableCollection(Of InfoItem)
+ '''
+ ''' Lista delle info modificate
+ '''
+ Public Property InfoList As ObservableCollection(Of InfoItem)
+ Get
+ Return m_InfoList
+ End Get
+ Set(value As ObservableCollection(Of InfoItem))
+ m_InfoList = value
+ OnPropertyChanged("InfoList")
+ End Set
+ End Property
+
Private m_ComboSelectedIndex As Integer
Public Property ComboSelectedIndex As Integer
Get
Return m_ComboSelectedIndex
End Get
Set(value As Integer)
- Map.refProjectVM.SetLastInteger(value)
+ If m_tmpbShow Then Map.refProjectVM.SetLastInteger(value)
m_ComboSelectedIndex = value
+ ' Assegno l'indice selezionato ad una variabile temporanea per utilizzarlo quando rimuovo l'info dalla lista
+ Dim tmpComboSelectedIndex As Integer = ComboSelectedIndex
+ ' Controllo se l'indice è maggiore o uguale a zero e la lista tmp contiene valori
+ If m_ComboSelectedIndex >= 0 AndAlso tmpInfoList.Count > 0 Then
+ ' Controllo se la info è contenuta nella lista ComboItemsList
+ If ComboItemsList.Contains(tmpInfoList(m_ComboSelectedIndex).sKey) Then
+ ' Aggiungo la info alla lista per visualizzarla
+ InfoList.Add(New InfoItem(tmpInfoList(m_ComboSelectedIndex).nId, tmpInfoList(m_ComboSelectedIndex).sKey, m_tmpInfoList(m_ComboSelectedIndex).sValour))
+ ' Nascondo la combobox
+ ComboVisibility = Visibility.Collapsed
+ ' Rimuovo la info dalla ComboItemsList
+ ComboItemsList.Remove(tmpInfoList(m_ComboSelectedIndex).sKey)
+ End If
+ ' Rimuovo la info dalla tmpInfoList
+ tmpInfoList.Remove(tmpInfoList(tmpComboSelectedIndex))
+ End If
OnPropertyChanged(NameOf(ComboSelectedIndex))
+ OnPropertyChanged("ComboItemsList")
+ OnPropertyChanged("InfoList")
End Set
End Property
@@ -179,9 +243,75 @@ Public Class InputExpanderVM
End Set
End Property
+ Private m_ShowInfoItemVisibility As Visibility
+ '''
+ ''' Propietà visibilità bottone +
+ '''
+ Public Property ShowInfoItemVisibility As Visibility
+ Get
+ Return m_ShowInfoItemVisibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_ShowInfoItemVisibility Then
+ m_ShowInfoItemVisibility = value
+ OnPropertyChanged("ShowInfoItemVisibility")
+ End If
+ End Set
+ End Property
+
+ Private m_InfoVisibility As Visibility
+ '''
+ ''' Propietà visibilità lista info modificate
+ '''
+ Public Property InfoVisibility As Visibility
+ Get
+ Return m_InfoVisibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_InfoVisibility Then
+ m_InfoVisibility = value
+ OnPropertyChanged("InfoVisibility")
+ End If
+ End Set
+ End Property
+
+ Private m_ShowInfoItemVisibility As Visibility
+ '''
+ ''' Propietà visibilità bottone +
+ '''
+ Public Property ShowInfoItemVisibility As Visibility
+ Get
+ Return m_ShowInfoItemVisibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_ShowInfoItemVisibility Then
+ m_ShowInfoItemVisibility = value
+ OnPropertyChanged("ShowInfoItemVisibility")
+ End If
+ End Set
+ End Property
+
+ Private m_InfoVisibility As Visibility
+ '''
+ ''' Propietà visibilità lista info modificate
+ '''
+ Public Property InfoVisibility As Visibility
+ Get
+ Return m_InfoVisibility
+ End Get
+ Set(value As Visibility)
+ If value <> m_InfoVisibility Then
+ m_InfoVisibility = value
+ OnPropertyChanged("InfoVisibility")
+ End If
+ End Set
+ End Property
+
' Commands definition
Private m_cmdShow As ICommand
Private m_cmdDone As ICommand
+ Private m_cmdShowInfoItem As ICommand
+ Private m_cmdRemoveInfoItem As ICommand
#Region "Messages"
@@ -259,6 +389,15 @@ Public Class InputExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
'''
Public Sub Done(ByVal param As Object)
+ ' Controllo se la lista contenente la info modificata sia presente
+ If InfoList.Count > 0 Then
+ ' Ciclo sulla lista
+ For Each Item As InfoItem In InfoList
+ Map.refProjectVM.NotifyInputText((Item.Key & "=" & Item.Valour).Trim())
+ ' Assegno a m_TextBox la info modificata
+ m_TextBox &= vbCrLf & (Item.Key & "=" & Item.Valour).Trim() & vbCrLf
+ Next
+ End If
Map.refProjectVM.Done(m_TextBox)
End Sub
@@ -271,6 +410,30 @@ Public Class InputExpanderVM
#End Region ' DoneCommand
+#Region "ShowInfoItemCommand"
+
+ '''
+ ''' Comando per la visualizzazione della combobox
+ '''
+ Public ReadOnly Property ShowInfoItemCommand As ICommand
+ Get
+ If m_cmdShowInfoItem Is Nothing Then
+ m_cmdShowInfoItem = New Command(AddressOf ShowInfoItem)
+ End If
+ Return m_cmdShowInfoItem
+ End Get
+ End Property
+
+ '''
+ ''' Funzione per la visualizzazione della combobox
+ '''
+ '''
+ Public Sub ShowInfoItem(ByVal param As Object)
+ ComboVisibility = Visibility.Visible
+ End Sub
+
+#End Region ' ShowInfoItemCommand
+
#End Region
#Region "METHODS"
@@ -285,13 +448,37 @@ Public Class InputExpanderVM
TextBlock = PrepareInputBoxParam.sLabel
TextBox = ""
TextVisibility = Visibility.Visible
+ ' Controllo se il titolo è uguale a INFO se si
+ If Title = EgtMsg(5359).ToUpper() Then
+ ' Metto tmpbShow a false
+ m_tmpbShow = False
+ ' Rendo visibile il pulsante che mostra la lista delle info
+ ShowInfoItemVisibility = Visibility.Visible
+ ' Rendo visibile la lista delle info selezionate
+ InfoVisibility = Visibility.Visible
+ ' Pulisco la lista tmpInfoList
+ tmpInfoList.Clear()
+ ' Pulisco la lista InfoList
+ InfoList.Clear()
+ ' Pulisco la lista ComboItemsList
+ ComboItemsList.Clear()
+ ' Popolo la lista ComboItemsList
+ ComboInfo()
+ End If
End If
If PrepareInputBoxParam.sCheckLabel <> "" Then
CheckBoxText = PrepareInputBoxParam.sCheckLabel
CheckVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowCombo Then
+ ' Assegno a tmpbShow PrepareInputBoxParam.bShowCombo
+ m_tmpbShow = PrepareInputBoxParam.bShowCombo
+ ' Pulisco la lista ComboItemsList
ComboItemsList.Clear()
+ ' Pulisco la lista tmpInfoList
+ tmpInfoList.Clear()
+ ' Pulisco la lista InfoList
+ InfoList.Clear()
ComboVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowBtn Then
@@ -309,6 +496,8 @@ Public Class InputExpanderVM
CheckVisibility = Visibility.Collapsed
ComboVisibility = Visibility.Collapsed
ShowBtnVisibility = Visibility.Collapsed
+ ShowInfoItemVisibility = Visibility.Collapsed
+ InfoVisibility = Visibility.Collapsed
IsExpanded = False
IsEnabled = False
End Sub
@@ -337,12 +526,44 @@ Public Class InputExpanderVM
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
ComboItemsList.Add(sText)
+
If bSelected Then
ComboSelectedIndex = ComboItemsList.Count - 1
End If
Return True
End Function
+ '''
+ ''' Rimovi nota da info lista
+ '''
+ ''' Informazione da eliminare
+ Friend Sub RemoveItemInfo(InfoItem As InfoItem)
+ ' Rimuovo info da lista modifica
+ InfoList.Remove(InfoItem)
+ ' Riaggiungo la info eliminata
+ ComboItemsList.Add(InfoItem.sKey)
+ ' Riaggiungo la info eliminata
+ tmpInfoList.Add(InfoItem)
+ End Sub
+
+ '''
+ ''' Funzione che popola la lista ComboItemsList
+ '''
+ Private Sub ComboInfo()
+ '''''''''''''''''''''''''''''' Recuperare funzione egtgetallinfo quando sarà pronta
+ Dim val As Integer
+ If Not m_tmpbShow Then
+ For Ind As Integer = 0 To 6
+ val += Ind
+ tmpInfoList.Add(New InfoItem(Ind, "A" & +Ind, val.ToString()))
+ Next
+
+ For Each InfoItem As InfoItem In tmpInfoList
+ ComboItemsList.Add(InfoItem.sKey)
+ Next
+ End If
+ End Sub
+
#End Region ' Methods
End Class
diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/LayerTreeView.vb b/OptionPanel/DrawOptionPanel/ManageLayerExpander/LayerTreeView.vb
index ac1c4c9..54cded7 100644
--- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/LayerTreeView.vb
+++ b/OptionPanel/DrawOptionPanel/ManageLayerExpander/LayerTreeView.vb
@@ -69,7 +69,7 @@ Public Class LayerTreeViewItem
Return m_bOnOff
End Get
Set(value As Boolean)
- If Map.refProjectVM.GetController().GetStep() <> 0 Then Return
+ 'If Map.refProjectVM.GetController().GetStep() <> 0 Then Return
If m_bOnOff <> value Then
m_bOnOff = value
' se abilitato, eseguo operazione
diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml
index 9e631b9..18fe76f 100644
--- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml
+++ b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml
@@ -21,8 +21,8 @@
-
@@ -50,8 +50,8 @@
-
+
diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderVM.vb b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderVM.vb
index 1bab74f..05d0162 100644
--- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderVM.vb
+++ b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderVM.vb
@@ -526,7 +526,7 @@ Public Class ManageLayerExpanderVM
#Region "METHODS"
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
- Private m_nObjTreeOldId As Integer = GDB_ID.NULL
+ Friend m_nObjTreeOldId As Integer = GDB_ID.NULL
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
Private m_bEnableUpdateObjInObjTree As Boolean = True
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
index 05f5c84..790e4df 100644
--- a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb
@@ -179,14 +179,17 @@ Public Class EstimationsExpanderVM
If Not bOk Then Return False
' Calcolo della stima
If Not EgtEstimate(sEstFile, sInfo) Then
- If EgtGetLastMachMgrErrorId() <> 0 Then
+ Dim nErr As Integer = EgtGetLastMachMgrErrorId()
+ If nErr = 1000 Then
+ MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr = 1001 Then
+ MessageBox.Show(EgtMsg(5334), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
sErr = sErr.Replace("Cnc", "Est")
- 'MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' ERRORE
+ MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Else
- 'MessageBox.Show(EgtMsg(MSG_SIMULATION + 17), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
- EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(5317), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore nel calcolo delle stime! ERRORE
+ MessageBox.Show(EgtMsg(5317), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error)
End If
bOk = False
End If
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
index 945c96f..d8932aa 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
@@ -275,7 +275,7 @@ Public Class DispositionParameterExpanderVM
End If
Select Case m_ActiveObject
Case ObjectType.RAWPART
- ' Abilito la selezione delle Fixture
+ ' Abilito la selezione dei Grezzi
Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART
Case ObjectType.FIXTURE
' Abilito la selezione delle Fixture
@@ -283,6 +283,7 @@ Public Class DispositionParameterExpanderVM
End Select
Map.refRawPartOptionVM.SetMoveWithFixture(False)
Map.refFixtureParametersVM.UpdateFixtureTypeList()
+ DispositionUtility.InitHookData()
End Sub
#End Region ' METHODS
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
index 6e93bb0..dd992be 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionUtility.vb
@@ -1,17 +1,16 @@
-Imports EgtUILib
+Imports System.Windows.Forms.AxHost
+Imports EgtUILib
+Imports Microsoft.VisualBasic.ApplicationServices
Public NotInheritable Class DispositionUtility
- Friend Const MOBILE As String = "MOBILE"
- Friend Const MDIR As String = "MDir"
- Friend Const STROKE As String = "Stroke"
- Friend Const POS As String = "Val"
Friend Const PDIST As String = "PDist"
Friend Const MDIST As String = "MDist"
- Friend Const HOOK As String = "HOOK"
+ Friend Const PREV As String = "Prev"
+ Friend Const NEXT_ As String = "Next"
+ Friend Const HOOK As String = "HOOK*"
Friend Const CLASS_ As String = "CLASS"
- Friend Const USED As String = "USED"
- Friend Const FIXED As String = "FIXED"
+ Friend Const FIXED As String = "FIXED*"
Friend Const TYPE As String = "TYPE"
Friend Const FREE As String = "FREE"
Friend Const LINE As String = "LINE"
@@ -22,9 +21,84 @@ Public NotInheritable Class DispositionUtility
LINE = 2
End Enum
- Friend Shared m_vtHook As Vector3d = Vector3d.NULL
- Friend Shared m_nUsedHookId As Integer = GDB_ID.NULL
- Friend Shared m_nPrevUsedHookId As Integer = GDB_ID.NULL
+ Private Shared m_vtHook As Vector3d = Vector3d.NULL
+ Private Shared m_nUsedHookId As Integer = GDB_ID.NULL
+ Private Shared m_nPrevUsedHookId As Integer = GDB_ID.NULL
+ Private Shared m_nPrevFixtureId As Integer = GDB_ID.NULL
+
+ Friend Class HookData
+ Public m_sName As String
+ Public m_sParent As String
+ Public m_bParentAxis As Boolean
+ Public m_sGrParentAxis As String
+ Public m_nId As Integer
+ Public m_nType As HOOKTYPE
+ Public m_ptP1 As Point3d
+ Public m_ptP2 As Point3d
+ Public m_nClass As Integer
+ Public m_nHooked As Integer
+ Public m_sHooked As String
+ Sub New()
+ m_sName = ""
+ m_sParent = ""
+ m_bParentAxis = False
+ m_sGrParentAxis = ""
+ m_nId = GDB_ID.NULL
+ m_nType = HOOKTYPE.FREE
+ m_ptP1 = Point3d.ORIG()
+ m_ptP2 = Point3d.ORIG()
+ m_nClass = 0
+ m_nHooked = GDB_ID.NULL
+ m_sHooked = ""
+ End Sub
+ Sub New(sName As String, sParent As String, bParentAxis As Boolean, sGrParentAxis As String,
+ nId As Integer, ptP As Point3d, nClass As Integer)
+ m_sName = sName
+ m_sParent = sParent
+ m_bParentAxis = bParentAxis
+ m_sGrParentAxis = sGrParentAxis
+ m_nId = nId
+ m_nType = HOOKTYPE.POINT
+ m_ptP1 = ptP
+ m_ptP2 = Point3d.ORIG()
+ m_nClass = nClass
+ m_nHooked = GDB_ID.NULL
+ m_sHooked = ""
+ End Sub
+ Sub New(sName As String, sParent As String, bParentAxis As Boolean, sGrParentAxis As String,
+ nId As Integer, ptP1 As Point3d, ptP2 As Point3d, nClass As Integer)
+ m_sName = sName
+ m_sParent = sParent
+ m_bParentAxis = bParentAxis
+ m_sGrParentAxis = sGrParentAxis
+ m_nId = nId
+ m_nType = HOOKTYPE.LINE
+ m_ptP1 = ptP1
+ m_ptP2 = ptP2
+ m_nClass = nClass
+ m_nHooked = GDB_ID.NULL
+ m_sHooked = ""
+ End Sub
+ End Class
+ Friend Shared m_vHookData As New List(Of HookData)
+
+ Friend Shared Function DistPointSegment( ptP As Point3d, ptS1 As Point3d, ptS2 As Point3d) As Point3d
+ If AreSamePointApprox( ptS1, ptS2) Then
+ Return Point3d.Media( ptS1, ptS2)
+ End If
+ Dim vtDir As Vector3d = ptS2 - ptS1
+ vtDir.z = 0
+ Dim dLen As Double = vtDir.Len()
+ vtDir /= dLen
+ Dim dProSca As Double = vtDir * ( ptP - ptS1)
+ If dProSca < EPS_SMALL Then
+ Return ptS1
+ ElseIf dProSca > dLen - EPS_SMALL Then
+ Return ptS2
+ Else
+ Return ptS1 + dProSca * vtDir
+ End If
+ End Function
' Identificativi per elemento da selezionare/deselezionare
Friend Enum SelType As Integer
@@ -108,10 +182,8 @@ Public NotInheritable Class DispositionUtility
End If
End While
Else
- Dim sName As String = ""
- EgtGetName(EgtGetParent(nMoveId), sName)
If EgtVerifyFixture(nMoveId) Then
- VerifyHookFixture(nMoveId, vtMove, ptCurr, True)
+ VerifyHookFixture(nMoveId, vtMove, ptCurr, False)
If Not EgtMoveFixture(nMoveId, vtMove) Then
bErrorMoving = True
End If
@@ -167,9 +239,11 @@ Public NotInheritable Class DispositionUtility
Else
If EgtVerifyFixture(nMoveId) Then
EgtMoveFixture(nMoveId, -vtMove)
- ' segno hook occupato prima del movimento correttivo come non utilizzato
- SetHookUsed(m_nPrevUsedHookId, nMoveId, True)
+ ' ripristino occupazione hooks
SetHookUsed(m_nPrevUsedHookId, nMoveId, False)
+ SetHookUsed(m_nUsedHookId, m_nPrevFixtureId, True)
+ ' rieseguo verifica nel punto iniziale
+ VerifyHookFixture(nMoveId, Vector3d.NULL(), Point3d.ORIG(), True)
Else
EgtMoveRawPart(nMoveId, -vtMove)
End If
@@ -186,6 +260,8 @@ Public NotInheritable Class DispositionUtility
Return VerifyFixturePosition(nMovedObjId, vtRefMove)
ElseIf EgtVerifyRawPartCurrPhase(nMovedObjId) Then
Return VerifyRawPosition(nMovedObjId, vtOrigMove, vtRefMove)
+ Elseif VerifyTableAxis( nMovedObjId) Then
+ Return True
Else
Return False
End If
@@ -409,89 +485,94 @@ Public NotInheritable Class DispositionUtility
' calcolo il BBox del sottopezzo
EgtGetBBoxGlob(nFixtureId, GDB_BB.ONLY_VISIBLE, bboxFixture)
' verifico se c'è sovrapposizione
- If bboxRawPartId.OverlapsXY(bboxFixture) Then
- Select Case FixtureType(nFixtureId)
- ' se il sottopezzo è una ventosa
- Case FIX_TYPE.VACUUM
- ' recupero altezza ventosa
- Dim dFixtureHeight As Double = 0
- EgtGetInfo(nFixtureId, "H", dFixtureHeight)
- ' la confronto con quella massima
- If dFixtureHeight > dMaxFixtureHeight Then
- dMaxFixtureHeight = dFixtureHeight
- End If
- ' se l'altezza grezzo è diversa da quella della ventosa, lo sposto alla stessa altezza
- If dRawPartMin.z < dFixtureHeight - EPS_SMALL Then
- Dim vtMove As New Vector3d(0, 0, dFixtureHeight - dRawPartMin.z)
- EgtMoveRawPart(nRawId, vtMove)
- ' recupero il solido del grezzo
- Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawId, RAWSOLID)
- ' ricalcolo il BBox del solido del grezzo per averlo aggiornato con la nuova Z
- EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPartId)
- dRawPartMin = bboxRawPartId.Min
- dRawPartMin.ToLoc(TableFrame)
- End If
- bIsFixtureUnderRawPart = True
- ' se il sottopezzo è un riferimento
- Case FIX_TYPE.REFERENCE
- ' recupero arco del riferimento
- Dim arcRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_ARC)
- ' calcolo bbox dell'arco di riferimento
- Dim bboxArcRef As New BBox3d
- EgtGetBBoxGlob(arcRefId, GDB_BB.STANDARD, bboxArcRef)
- ' ne faccio l'offset ??
- 'bboxArcRef.Expand(10)
- If bboxRawPartId.OverlapsXY(bboxArcRef) Then
- ' recupero contorno del grezzo
- Dim ccompoRawPartOutlineId As Integer = EgtGetFirstNameInGroup(nRawId, RAWOUTLINE)
- 'recupero il raggio dell'arco di riferimento
- Dim dArcRadius As Double
- EgtArcRadius(arcRefId, dArcRadius)
- ' faccio copia e offset del contorno grezzo
- Dim ccompoRawPartOutlineOffsetId As Integer = EgtCopyGlob(ccompoRawPartOutlineId, ccompoRawPartOutlineId, GDB_POS.AFTER)
- EgtOffsetCurve(ccompoRawPartOutlineOffsetId, dArcRadius, OFF_TYPE.FILLET)
- ' recupero centro dell'arco di riferimento
- Dim ptArcCenter As Point3d
- EgtCenterPoint(arcRefId, ccompoRawPartOutlineId, ptArcCenter)
- ' Creo un segmento avente origine nel centro dell'arco e direzione opposta a quella del movimento
- Dim nDistLine As Integer = EgtCreateLinePVL(EgtGetParent(ccompoRawPartOutlineId), ptArcCenter, vtOrigMove.Loc(ccompoRawPartOutlineId), 10000)
- ' cerco punto di intersezione tra il segmento e l'offset
- Dim ptDist As Point3d
- If EgtIntersectionPoint(nDistLine, ccompoRawPartOutlineOffsetId, ptArcCenter, ptDist) Then
- ' calcolo il vettore di spostamento necessario ad allinearli
- Dim vtDelta As Vector3d = -(ptDist - ptArcCenter)
- vtDelta.z = 0
- ' se il vettore non è nullo
- If vtDelta.IsSmall() Then
- ' il grezzo è in battuta sul riferimento
- Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
- EgtSetColor(nContactColDisk, ReferenceContactColGreen)
+ If bboxRawPartId.OverlapsXY(bboxFixture) Then
+ ' recupero il tipo di fixture
+ Dim nFxtType As FIX_TYPE = FixtureType(nFixtureId)
+ ' Se è ventosa o morsa
+ If nFxtType = FIX_TYPE.VACUUM Or nFxtType = FIX_TYPE.VISE Then
+ ' recupero altezza ventosa
+ Dim dFixtureHeight As Double = 0
+ EgtGetInfo(nFixtureId, "H", dFixtureHeight)
+ ' la confronto con quella massima
+ If dFixtureHeight > dMaxFixtureHeight Then
+ dMaxFixtureHeight = dFixtureHeight
+ End If
+ ' se l'altezza grezzo è diversa da quella della ventosa, lo sposto alla stessa altezza
+ If dRawPartMin.z < dFixtureHeight - EPS_SMALL Then
+ Dim vtMove As New Vector3d(0, 0, dFixtureHeight - dRawPartMin.z)
+ EgtMoveRawPart(nRawId, vtMove)
+ ' recupero il solido del grezzo
+ Dim nRawSolidId As Integer = EgtGetFirstNameInGroup(nRawId, RAWSOLID)
+ ' ricalcolo il BBox del solido del grezzo per averlo aggiornato con la nuova Z
+ EgtGetBBoxGlob(nRawSolidId, GDB_BB.ONLY_VISIBLE, bboxRawPartId)
+ dRawPartMin = bboxRawPartId.Min
+ dRawPartMin.ToLoc(TableFrame)
+ End If
+ bIsFixtureUnderRawPart = True
+ End If
+ ' Se è morsa
+ If nFxtType = FIX_TYPE.VISE Then
+ ' regolo la posizione in Z della morsa
+ EgtSetFixtureMobile( nFixtureId, bboxRawPartId.DimZ())
+ End If
+ ' Se è un riferimento o una morsa
+ If nFxtType = FIX_TYPE.REFERENCE Or nFxtType = FIX_TYPE.VISE Then
+ ' recupero arco del riferimento
+ Dim arcRefId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_ARC)
+ ' calcolo bbox dell'arco di riferimento
+ Dim bboxArcRef As New BBox3d
+ EgtGetBBoxGlob(arcRefId, GDB_BB.STANDARD, bboxArcRef)
+ If bboxRawPartId.OverlapsXY(bboxArcRef) Then
+ ' recupero contorno del grezzo
+ Dim ccompoRawPartOutlineId As Integer = EgtGetFirstNameInGroup(nRawId, RAWOUTLINE)
+ 'recupero il raggio dell'arco di riferimento
+ Dim dArcRadius As Double
+ EgtArcRadius(arcRefId, dArcRadius)
+ ' faccio copia e offset del contorno grezzo
+ Dim ccompoRawPartOutlineOffsetId As Integer = EgtCopyGlob(ccompoRawPartOutlineId, ccompoRawPartOutlineId, GDB_POS.AFTER)
+ EgtOffsetCurve(ccompoRawPartOutlineOffsetId, dArcRadius, OFF_TYPE.FILLET)
+ ' recupero centro dell'arco di riferimento
+ Dim ptArcCenter As Point3d
+ EgtCenterPoint(arcRefId, ccompoRawPartOutlineId, ptArcCenter)
+ ' Creo un segmento avente origine nel centro dell'arco e direzione opposta a quella del movimento
+ Dim nDistLine As Integer = EgtCreateLinePVL(EgtGetParent(ccompoRawPartOutlineId), ptArcCenter, vtOrigMove.Loc(ccompoRawPartOutlineId), 10000)
+ ' cerco punto di intersezione tra il segmento e l'offset
+ Dim ptDist As Point3d
+ If EgtIntersectionPoint(nDistLine, ccompoRawPartOutlineOffsetId, ptArcCenter, ptDist) Then
+ ' calcolo il vettore di spostamento necessario ad allinearli
+ Dim vtDelta As Vector3d = -(ptDist - ptArcCenter)
+ vtDelta.z = 0
+ ' se il vettore non è nullo
+ If vtDelta.IsSmall() Then
+ ' il grezzo è in battuta sul riferimento
+ Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
+ EgtSetColor(nContactColDisk, ReferenceContactColGreen)
+ Else
+ vtDelta = vtDelta.Glob(ccompoRawPartOutlineId)
+ ' il vettore da restituire è nullo, quindi lo inizializzo
+ If vtRefMove.IsSmall() Then
+ vtRefMove = vtDelta
+ ' altrimenti lo confronto
Else
- vtDelta = vtDelta.Glob(ccompoRawPartOutlineId)
- ' il vettore da restituire è nullo, quindi lo inizializzo
- If vtRefMove.IsSmall() Then
+ ' per ogni coordinata devo prendere il massimo in direzione opposta allo spostamento originale
+ ' calcolo il versore nella direzione del movimento
+ Dim vtMoveVers As New Vector3d(vtOrigMove)
+ vtMoveVers.Normalize()
+ If (vtDelta * vtMoveVers) < (vtRefMove * vtMoveVers) Then
vtRefMove = vtDelta
- ' altrimenti lo confronto
- Else
- ' per ogni coordinata devo prendere il massimo in direzione opposta allo spostamento originale
- ' calcolo il versore nella direzione del movimento
- Dim vtMoveVers As New Vector3d(vtOrigMove)
- vtMoveVers.Normalize()
- If (vtDelta * vtMoveVers) < (vtRefMove * vtMoveVers) Then
- vtRefMove = vtDelta
- End If
End If
End If
End If
- ' cancello segmento e offset
- EgtErase(nDistLine)
- EgtErase(ccompoRawPartOutlineOffsetId)
- Else
- ' il grezzo non è in battuta sul riferimento
- Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
- EgtSetColor(nContactColDisk, ReferenceContactColRed)
End If
- End Select
+ ' cancello segmento e offset
+ EgtErase(nDistLine)
+ EgtErase(ccompoRawPartOutlineOffsetId)
+ Else
+ ' il grezzo non è in battuta sul riferimento
+ Dim nContactColDisk As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(nFixtureId, SOLID), REF_DISK)
+ EgtSetColor(nContactColDisk, ReferenceContactColRed)
+ End If
+ End If
' se non c'è sovrapposizione
ElseIf FixtureType(nFixtureId) = FIX_TYPE.REFERENCE Then
' il grezzo non è in battuta sul riferimento
@@ -517,100 +598,84 @@ Public NotInheritable Class DispositionUtility
Return True
End Function
+' Funzione che verifica se asse o sottoasse di tavola (e quindi barra o carrello)
+ Friend Shared Function VerifyTableAxis( nObjId As Integer) As Boolean
+ ' Verifico se asse
+ Dim sObjName As String = ""
+ If Not EgtGetName( nObjId, sObjName) OrElse EgtGetAxisId( sObjName) = GDB_ID.NULL Then Return False
+ ' Recupero il padre
+ Dim nParId As Integer = EgtGetParent( nObjId)
+ Dim sParName As String = ""
+ If Not EgtGetName( nParId, sParName) Then Return False
+ ' Verifico se tavola
+ If EgtGetTableId( sParName) <> GDB_ID.NULL Then Return True
+ ' Verifico se asse di tavola
+ Return VerifyTableAxis( nParId)
+ End Function
+
' Funzione che verifica i movimenti della barra
Private Shared Function VerifyBarPosition(nMoveId As Integer, vtMove As Vector3d) As Boolean
- ' verifico direzione di spostamento consentita
- Dim sMDir As String = ""
- EgtGetInfo(nMoveId, MDIR, sMDir)
- Dim aMDir() As String = sMDir.Split(","c)
- Dim vX As Integer = 0
- Dim vY As Integer = 0
- Dim vZ As Integer = 0
- Integer.TryParse(aMDir(0), vX)
- Integer.TryParse(aMDir(1), vY)
- Integer.TryParse(aMDir(2), vZ)
- Dim vtMDir As New Vector3d(vX, vY, vZ)
- vtMDir.Normalize()
- vtMove = vtMove * vtMDir * vtMDir
- ' recupero corsa
- Dim sStroke As String = ""
- Dim sStrokes() As String
- Dim PStroke As Double = 0
- Dim MStroke As Double = 0
- EgtGetInfo(nMoveId, STROKE, sStroke)
- sStrokes = sStroke.Split(","c)
- StringToDouble(sStrokes(0), MStroke)
- StringToDouble(sStrokes(1), PStroke)
- ' recupero dati barra corrente
- Dim dCurrBarYPos As Double = 0
- Dim dCurrBarMVal As Double = 0
- Dim dCurrBarPVal As Double = 0
- GetBarExtreme(nMoveId, dCurrBarYPos, dCurrBarMVal, dCurrBarPVal)
- ' recupero indice barra da spostare
- Dim sBarName As String = ""
- EgtGetName(nMoveId, sBarName)
- Dim nBarId As Integer = 0
- sBarName = sBarName.Substring(6, sBarName.Length - 6)
- Integer.TryParse(sBarName, nBarId)
- ' recupero dati barra precedente
- Dim dMinYMove As Double
- Dim dMaxYMove As Double
- Dim dPrevBarYPos As Double = 0
- Dim dPrevBarMVal As Double = 0
- Dim dPrevBarPVal As Double = 0
- If nBarId > 1 Then
- ' recupero eventuale barra precedente
- Dim nPrevBarId As Integer = EgtGetFirstNameInGroup(EgtGetParent(nMoveId), MOBILE & nBarId - 1)
- If Not nPrevBarId = GDB_ID.NULL Then
- GetBarExtreme(nPrevBarId, dPrevBarYPos, dPrevBarMVal, dPrevBarPVal)
- ' calcolo il massimo tra corsa di spostamento ed ingombro della barra precedente
- dMinYMove = Math.Max(dPrevBarYPos + dPrevBarPVal + dCurrBarMVal, MStroke)
- Else
- dMinYMove = MStroke
- End If
- Else
- dMinYMove = MStroke
+ ' Nome dell'asse
+ Dim sName As String = ""
+ If Not EgtGetName( nMoveId, sName) Then Return False
+ ' Recupero la direzione di spostamento
+ Dim vtDir As New Vector3d
+ If Not EgtGetAxisDir( sName, VtDir) Then Return False
+ ' Recupero la corsa
+ Dim dAxMin As Double = 0
+ Dim dAxMax As Double = 0
+ If Not EgtGetAxisMin( sName, dAxMin) OrElse Not EgtGetAxisMax( sName, dAxMax) Then Return False
+ ' Recupero dati barra corrente
+ Dim dCurrBarPos As Double = 0
+ Dim dCurrBarMEnc As Double = 0
+ Dim dCurrBarPEnc As Double = 0
+ GetBarExtreme(nMoveId, dCurrBarPos, dCurrBarMEnc, dCurrBarPEnc)
+ ' Recupero dati eventuale barra precedente
+ Dim sPrevBarName As String = ""
+ If EgtGetInfo( nMoveId, PREV, sPrevBarName) Then
+ Dim nPrevBarId As Integer = EgtGetAxisId( sPrevBarName)
+ Dim dPrevBarPos As Double = 0
+ Dim dPrevBarMEnc As Double = 0
+ Dim dPrevBarPEnc As Double = 0
+ If Not GetBarExtreme(nPrevBarId, dPrevBarPos, dPrevBarMEnc, dPrevBarPEnc) Then Return False
+ dAxMin = Math.Max( dAxMin, dPrevBarPos + dPrevBarPEnc + dCurrBarMEnc)
End If
- ' recupero eventuale barra successiva
- Dim dNextBarYPos As Double = 0
- Dim dNextBarMVal As Double = 0
- Dim dNextBarPVal As Double = 0
- Dim nNextBarId As Integer = EgtGetFirstNameInGroup(EgtGetParent(nMoveId), MOBILE & nBarId + 1)
- If Not nNextBarId = GDB_ID.NULL Then
- GetBarExtreme(nNextBarId, dNextBarYPos, dNextBarMVal, dNextBarPVal)
- ' calcolo il minimo tra corsa di spostamento ed ingombro della barra successiva
- dMaxYMove = Math.Min(dNextBarYPos - dNextBarMVal - dCurrBarPVal, PStroke)
- Else
- dMaxYMove = PStroke
+ ' Recupero dati eventuale barra successiva
+ Dim sNextBarName As String = ""
+ If EgtGetInfo( nMoveId, NEXT_, sNextBarName) Then
+ Dim nNextBarId As Integer = EgtGetAxisId( sNextBarName)
+ Dim dNextBarPos As Double = 0
+ Dim dNextBarMEnc As Double = 0
+ Dim dNextBarPEnc As Double = 0
+ if Not GetBarExtreme(nNextBarId, dNextBarPos, dNextBarMEnc, dNextBarPEnc) Then Return False
+ dAxMax = Math.Min( dAxMax, dNextBarPos - dNextBarMEnc - dCurrBarPEnc)
End If
- ' verifico che lo spostamento sia entro le corse
- If dCurrBarYPos + vtMove.y <= dMinYMove Then
- vtMove.y = dMinYMove - dCurrBarYPos
- ElseIf dCurrBarYPos + vtMove.y >= dMaxYMove Then
- vtMove.y = dMaxYMove - dCurrBarYPos
- End If
- EgtMove(nMoveId, vtMove)
- ' scrivo nuova posizione
- EgtSetInfo(nMoveId, POS, DoubleToString(dCurrBarYPos + vtMove.y, 4))
+ ' Limito lo spostamento alle corse ammesse
+ If dAxMax < dAxMin Then Return False
+ Dim dNewBarPos As Double = dCurrBarPos + vtMove * vtDir
+ dNewBarPos = Math.Min( Math.Max( dNewBarPos,dAxMin), dAxMax)
+ ' Eseguo lo spostamento
+ EgtMoveDispAxis( sName, dNewBarPos)
+ Dim vtRealMove As Vector3d = ( dNewBarPos - dCurrBarPos) * vtDir
+ UpdateFixturesForDispAxisMove( sName, vtRealMove)
Return True
End Function
- Private Shared Function GetBarExtreme(nMoveId As Integer, ByRef YPos As Double, ByRef PVal As Double, ByRef MVal As Double) As Boolean
- ' recupero posizione
- EgtGetInfo(nMoveId, POS, YPos)
- ' recupero ingombro negativo
- Dim dMDist As Double = 0
- EgtGetInfo(nMoveId, MDIST, dMDist)
+ Private Shared Function GetBarExtreme(nMoveId As Integer, ByRef dPos As Double, ByRef dMEnc As Double, ByRef dPEnc As Double) As Boolean
+ ' Recupero la posizione
+ Dim sName As String = ""
+ If Not EgtGetName( nMoveId, sName) OrElse Not EgtGetAxisPos( sName, dPos) Then Return False
+ ' Recupero ingombro negativo
+ dMEnc = 0
+ EgtGetInfo(nMoveId, MDIST, dMEnc)
' recupero ingombro positivo
- Dim dPDist As Double = 0
- EgtGetInfo(nMoveId, PDIST, dPDist)
- MVal = dMDist
- PVal = dPDist
+ dPEnc = 0
+ EgtGetInfo(nMoveId, PDIST, dPEnc)
Return True
End Function
' Funzione che verifica l'agganciamento dei sottopezzi
- Friend Shared Function VerifyHookFixture(nMoveId As Integer, ByRef vtMove As Vector3d, ptCurr As Point3d, bTolerance As Boolean) As Boolean
+ Private Shared Function VerifyHookFixture(nMoveId As Integer, ByRef vtMove As Vector3d, ptCurr As Point3d, bInPlace As Boolean) As Boolean
' cerco punto hook sulla ventosa
Dim nFixtSolidId As Integer = EgtGetFirstNameInGroup(nMoveId, SOLID)
Dim nFixtHookId As Integer = EgtGetFirstNameInGroup(nFixtSolidId, HOOK)
@@ -623,7 +688,6 @@ Public NotInheritable Class DispositionUtility
ElseIf sType.Equals(LINE) Then
nFixtHookType = HOOKTYPE.LINE
Else 'FREE
- nFixtHookType = HOOKTYPE.FREE
' esco perchè non devo cercare alcun punto
Return True
End If
@@ -633,140 +697,395 @@ Public NotInheritable Class DispositionUtility
Dim ptFixtHook As Point3d
EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
' calcolo vtMove nel caso normale
- If Not IsNothing(ptCurr) Then
- vtMove = ptCurr - m_vtHook - ptFixtHook
+ If bInPlace Then
+ ptCurr = ptFixtHook - m_vtHook
+ ElseIf Not IsNothing(ptCurr) Then
+ vtMove = ptCurr + m_vtHook - ptFixtHook
+ Else
+ ptCurr = ptFixtHook - m_vtHook + vtMove
End If
- ' cerco id tavola
- Dim sTableName As String = ""
- EgtGetTableName(sTableName)
- Dim nTableId As Integer = EgtGetTableId(sTableName)
- ' cerco hook su tavola macchina
- Dim nTableSolidId As Integer = EgtGetFirstNameInGroup(nTableId, SOLID)
- Dim nCurrHookId As Integer = EgtGetFirstNameInGroup(nTableSolidId, HOOK)
- ' variabili per tenere da parte l'entità, la distanza e il punto di hook più vicino alla ventosa
+ ' Variabili per tenere da parte l'entità, la distanza e il punto di hook più vicino alla ventosa
Dim nNearestHookId As Integer = GDB_ID.NULL
Dim dNearestHookDist As Double = 99999999
Dim ptNearestHook As Point3d = Nothing
- While nCurrHookId <> GDB_ID.NULL
- 'HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, nNearestHookId, dNearestHookDist)
- HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nNearestHookId, dNearestHookDist, ptNearestHook, nMoveId)
- nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
- End While
- ' cerco hook su barra fissa
- Dim nTableFixedId As Integer = EgtGetFirstNameInGroup(nTableId, FIXED)
- nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, HOOK)
- While nCurrHookId <> GDB_ID.NULL
- 'HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, nNearestHookId, dNearestHookDist)
- HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nNearestHookId, dNearestHookDist, ptNearestHook, nMoveId)
- nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
- End While
- ' cerco hook su barre mobili
- Dim nMobileInd As Integer = 1
- Dim nMobile As Integer = EgtGetFirstNameInGroup(nTableId, MOBILE & nMobileInd)
- While nMobile <> GDB_ID.NULL
- nCurrHookId = EgtGetFirstNameInGroup(nMobile, HOOK)
- While nCurrHookId <> GDB_ID.NULL
- 'HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, nNearestHookId, dNearestHookDist)
- HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nNearestHookId, dNearestHookDist, ptNearestHook, nMoveId)
- nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
- End While
- nMobileInd += 1
- nMobile = EgtGetFirstNameInGroup(nTableId, MOBILE & nMobileInd)
- End While
- ' se non ho trovato hook compatibili e liberi esco
- If nNearestHookId = GDB_ID.NULL Then Return False
- ' verifico se la distanza minima è inferiore al raggio dell'area di aggancio
- Dim dHookTolerance As Double = EgtUILib.GetPrivateProfileDouble(S_FIXTURES, K_HOOKTOLERANCE, 50, IniFile.m_sCurrMachIniFilePath)
- If bTolerance AndAlso dNearestHookDist > dHookTolerance Then Return False
- ' sostituisco spostamento mouse con spostamento ad hook
- vtMove = ptNearestHook - ptFixtHook
- m_nUsedHookId = nNearestHookId
- ' segno hook come utilizzato
- SetHookUsed(m_nUsedHookId, nMoveId, True)
- 'EgtSetInfo(m_nUsedHookId, USED, nMoveId)
- Return True
- End Function
-
- ' funzione di debug
- Private Shared Sub DebugHookInfo()
- ' salvo in outlog tutte le info sugli hook per poter debuggare
- ' cerco id tavola
+ ' Recupero Id tavola corrente
Dim sTableName As String = ""
EgtGetTableName(sTableName)
Dim nTableId As Integer = EgtGetTableId(sTableName)
- ' cerco hook su tavola macchina
+ ' *** Cerco hook su tavola ***
Dim nTableSolidId As Integer = EgtGetFirstNameInGroup(nTableId, SOLID)
Dim nCurrHookId As Integer = EgtGetFirstNameInGroup(nTableSolidId, HOOK)
- EgtOutLog("TABLE")
While nCurrHookId <> GDB_ID.NULL
- Dim sUsed As String = ""
- EgtGetInfo(nCurrHookId, USED, sUsed)
- EgtOutLog(nCurrHookId & " -> " & sUsed)
+ HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nMoveId, nNearestHookId, dNearestHookDist, ptNearestHook)
nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
End While
- ' cerco hook su barra fissa
- EgtOutLog("FIXED")
+ ' *** Cerco hook su barre fisse ***
Dim nTableFixedId As Integer = EgtGetFirstNameInGroup(nTableId, FIXED)
- nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, HOOK)
- While nCurrHookId <> GDB_ID.NULL
- Dim sUsed As String = ""
- EgtGetInfo(nCurrHookId, USED, sUsed)
- EgtOutLog(nCurrHookId & " -> " & sUsed)
- nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
- End While
- ' cerco hook su barre mobili
- Dim nMobileInd As Integer = 1
- Dim nMobile As Integer = EgtGetFirstNameInGroup(nTableId, MOBILE & nMobileInd)
- While nMobile <> GDB_ID.NULL
- EgtOutLog("MOBILE" & nMobile)
- nCurrHookId = EgtGetFirstNameInGroup(nMobile, HOOK)
+ While nTableFixedId <> GDB_ID.NULL
+ nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, HOOK)
While nCurrHookId <> GDB_ID.NULL
- Dim sUsed As String = ""
- EgtGetInfo(nCurrHookId, USED, sUsed)
- EgtOutLog(nCurrHookId & " -> " & sUsed)
+ HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nMoveId, nNearestHookId, dNearestHookDist, ptNearestHook)
nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
End While
- nMobileInd += 1
- nMobile = EgtGetFirstNameInGroup(nTableId, MOBILE & nMobileInd)
+ nTableFixedId = EgtGetNextName(nTableFixedId, FIXED)
+ End While
+ ' *** Cerco hook su barre mobili ***
+ Dim nBarId As Integer = EgtGetFirstGroupInGroup(nTableId)
+ While nBarId <> GDB_ID.NULL
+ Dim sBarName As String = ""
+ If EgtGetName( nBarId, sBarName) AndAlso EgtGetAxisId( sBarName) <> GDB_ID.NULL Then
+ nCurrHookId = EgtGetFirstNameInGroup(nBarId, HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nMoveId, nNearestHookId, dNearestHookDist, ptNearestHook)
+ nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
+ End While
+ ' Cerco su eventuali carrelli
+ Dim nCharId As Integer = EgtGetFirstGroupInGroup(nBarId)
+ While nCharId <> GDB_ID.NULL
+ Dim sCharName As String = ""
+ If EgtGetName( nCharId, sCharName) AndAlso EgtGetAxisId( sCharName) <> GDB_ID.NULL Then
+ nCurrHookId = EgtGetFirstNameInGroup(nCharId, DispositionUtility.HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptCurr + m_vtHook, nMoveId, nNearestHookId, dNearestHookDist, ptNearestHook)
+ nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
+ End While
+ End If
+ nCharId = EgtGetNextGroup(nCharId)
+ End While
+ End If
+ nBarId = EgtGetNextGroup(nBarId)
+ End While
+
+ ' Se non ho trovato hook compatibili e liberi esco
+ If nNearestHookId = GDB_ID.NULL Then Return False
+
+ ' Verifico se la distanza minima è inferiore al raggio dell'area di aggancio
+ Dim dHookTolerance As Double = 1
+ If Not bInPlace Then
+ dHookTolerance = EgtUILib.GetPrivateProfileDouble(S_FIXTURES, K_HOOKTOLERANCE, 50, IniFile.m_sCurrMachIniFilePath)
+ End If
+ If dNearestHookDist > dHookTolerance Then Return False
+
+ ' Sostituisco spostamento mouse con spostamento ad hook
+ vtMove = ptNearestHook - ptFixtHook
+ m_nUsedHookId = nNearestHookId
+ ' Segno hook come utilizzato
+ SetHookUsed(m_nUsedHookId, nMoveId, True)
+ Dim sLinkName As String = ""
+ EgtGetName( EgtGetParent( m_nUsedHookId), sLinkName)
+ EgtSetFixtureLink( nMoveId, sLinkName)
+ Return True
+ End Function
+
+ ' Funzioni gestione tabella degli Hook
+ Private Shared Function AddOneHookData( nHookId As Integer, sParent As String, bParentAxis As Boolean) As Boolean
+ Dim sHook As String = ""
+ EgtGetName( nHookId, sHook)
+ Dim sGrParentAxis As String = ""
+ If bParentAxis Then
+ Dim nIdGrParent As Integer = EgtGetParent( EgtGetParent( nHookId))
+ Dim sParentName As String = ""
+ If EgtGetName( nIdGrParent, sParentName) AndAlso EgtGetAxisId( sParentName) = nIdGrParent Then
+ sGrParentAxis = sParentName
+ End If
+ End If
+ Dim nClass As Integer = 0
+ EgtGetInfo(nHookId, CLASS_, nClass)
+ Dim nType As Integer = EgtGetType( nHookId)
+ If nType = GDB_TY.GEO_POINT Then
+ Dim ptP As Point3d
+ EgtStartPoint( nHookId, GDB_ID.ROOT, ptP)
+ Dim hdCurr As New HookData( sHook, sParent, bParentAxis, sGrParentAxis, nHookId, ptP, nClass)
+ m_vHookData.Add( hdCurr)
+ Return True
+ Else If nType = GDB_TY.CRV_LINE Then
+ Dim ptP1 As Point3d
+ EgtStartPoint( nHookId, GDB_ID.ROOT, ptP1)
+ Dim ptP2 As Point3d
+ EgtEndPoint( nHookId, GDB_ID.ROOT, ptP2)
+ Dim hdCurr As New HookData( sHook, sParent, bParentAxis, sGrParentAxis, nHookId, ptP1, ptP2, nClass)
+ m_vHookData.Add( hdCurr)
+ Return True
+ End If
+ Return False
+ End Function
+
+ Private Shared Sub PrepareHookData()
+ ' Pulisco lista di Hook
+ m_vHookData.Clear()
+ ' Recupero Id tavola corrente
+ Dim sTableName As String = ""
+ EgtGetTableName(sTableName)
+ Dim nTableId As Integer = EgtGetTableId(sTableName)
+ ' *** Cerco hook su tavola ***
+ Dim nTableSolidId As Integer = EgtGetFirstNameInGroup(nTableId, SOLID)
+ Dim nCurrHookId As Integer = EgtGetFirstNameInGroup(nTableSolidId, HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ AddOneHookData( nCurrHookId, SOLID, False)
+ nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
+ End While
+ ' *** Cerco hook su barre fisse ***
+ Dim nTableFixedId As Integer = EgtGetFirstNameInGroup(nTableId, FIXED)
+ While nTableFixedId <> GDB_ID.NULL
+ Dim sName As String = ""
+ EgtGetName( nTableFixedId, sName)
+ nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ AddOneHookData( nCurrHookId, sName, False)
+ nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
+ End While
+ nTableFixedId = EgtGetNextName(nTableFixedId, FIXED)
+ End While
+ ' *** Cerco hook su barre mobili ***
+ Dim nBarId As Integer = EgtGetFirstGroupInGroup(nTableId)
+ While nBarId <> GDB_ID.NULL
+ Dim sBarName As String = ""
+ If EgtGetName( nBarId, sBarName) AndAlso EgtGetAxisId( sBarName) = nBarId Then
+ nCurrHookId = EgtGetFirstNameInGroup(nBarId, HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ AddOneHookData( nCurrHookId, sBarName, True)
+ nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
+ End While
+ ' Cerco su eventuali carrelli
+ Dim nCharId As Integer = EgtGetFirstGroupInGroup(nBarId)
+ While nCharId <> GDB_ID.NULL
+ Dim sCharName As String = ""
+ If EgtGetName( nCharId, sCharName) AndAlso EgtGetAxisId( sCharName) = nCharId Then
+ nCurrHookId = EgtGetFirstNameInGroup(nCharId, DispositionUtility.HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ AddOneHookData( nCurrHookId, sCharName, True)
+ nCurrHookId = EgtGetNextName(nCurrHookId, HOOK)
+ End While
+ End If
+ nCharId = EgtGetNextGroup(nCharId)
+ End While
+ End If
+ nBarId = EgtGetNextGroup(nBarId)
End While
End Sub
- ' funzioni che leggono e settano le ventose agganciate agli hook
- Private Shared Function GetHookUsed(nHookId As Integer, nFixtureId As Integer, nFixtureUsed As Integer) As Boolean
- ' cerco punto hook sulla ventosa
- Dim nFixtSolidId As Integer = EgtGetFirstNameInGroup(nFixtureId, SOLID)
- Dim nFixtHookId As Integer = EgtGetFirstNameInGroup(nFixtSolidId, HOOK)
- ' leggo tipo e classe
- Dim nFixtHookType As HOOKTYPE = HOOKTYPE.FREE
- Dim sType As String = ""
- EgtGetInfo(nFixtHookId, TYPE, sType)
- If sType.Equals(POINT) Then
- nFixtHookType = HOOKTYPE.POINT
- ElseIf sType.Equals(LINE) Then
- nFixtHookType = HOOKTYPE.LINE
- Else 'FREE
- nFixtHookType = HOOKTYPE.FREE
- ' esco perchè non devo cercare alcun punto
- Return False
- End If
- Select Case nFixtHookType
- Case HOOKTYPE.POINT
- Return EgtGetInfo(m_nUsedHookId, USED, nFixtureUsed)
- Case HOOKTYPE.LINE
- Dim sInfo As String = String.Empty
- EgtGetInfo(m_nUsedHookId, USED, sInfo)
- Dim SplitInfo() As String = sInfo.Split(";"c)
- For Each Info In SplitInfo
- Dim nInfo As Integer = GDB_ID.NULL
- Integer.TryParse(sInfo, nInfo)
- If nInfo = nFixtureId Then Return True
+ Private Shared Sub PrepareHookedFixtures()
+ ' Ciclo su tutte le fixtures in tavola
+ Dim nFixtId As Integer = EgtGetFirstFixture()
+ While nFixtId <> GDB_ID.NULL
+ Dim nHookId As Integer = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( nFixtId, SOLID), HOOK)
+ Dim ptP As Point3d
+ If EgtStartPoint( nHookId, GDB_ID.ROOT, ptP) Then
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ If Point3d.SqDistXY( ptP, hkCurr.m_ptP1) < 1 Then
+ hkCurr.m_nHooked = nFixtId
+ Exit For
+ End If
+ ElseIf hkCurr.m_nType = HOOKTYPE.LINE Then
+ Dim dSqDist As Double = Point3d.SqDistXY( ptP, DistPointSegment( ptP, hkCurr.m_ptP1, hkCurr.m_ptP2))
+ If dSqDist < 1 Then
+ AddHookUsed( hkCurr.m_nId, nFixtId)
+ Exit For
+ End If
+ End If
Next
- Return False
- Case Else
- Return False
- End Select
+ End If
+ nFixtId = EgtGetNextFixture( nFixtId)
+ End While
+ End Sub
+
+ Friend Shared Sub InitHookData()
+ ' Carico i dati degli agganci
+ PrepareHookData()
+ ' Determino eventuali fixtures agganciate
+ PrepareHookedFixtures()
+ ' Log di debug
+ If Map.refMainWindowVM.DebugLevel() >= 4 then
+ EgtOutLog( " *** HOOK DATA TABLE ***")
+ Dim sCurrParent As String = ""
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_sParent <> sCurrParent Then
+ sCurrParent = hkCurr.m_sParent
+ If String.IsNullOrWhiteSpace( hkCurr.m_sGrParentAxis) Then
+ EgtOutLog( sCurrParent & If( hkCurr.m_bParentAxis, " Axis", " Fixed"))
+ Else
+ EgtOutLog( sCurrParent & " (" & hkCurr.m_sGrParentAxis & ") Axis")
+ End If
+ End If
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ EgtOutLog( " " & hkCurr.m_sName & " (" & hkCurr.m_nId &
+ ") Point(" & hkCurr.m_ptP1.ToString() & ") Class=" & hkCurr.m_nClass &
+ If( hkCurr.m_nHooked = GDB_ID.NULL, " Free", " Fixt " & hkCurr.m_nHooked))
+ Else If hkCurr.m_nType = HOOKTYPE.LINE Then
+ EgtOutLog( " " & hkCurr.m_sName & " (" & hkCurr.m_nId &
+ ") Line(" & hkCurr.m_ptP1.ToString() & "),(" & hkCurr.m_ptP2.ToString() & ") Class=" & hkCurr.m_nClass &
+ If( String.IsNullOrWhiteSpace( hkCurr.m_sHooked), " Free", " Fixt " & hkCurr.m_sHooked))
+ End If
+ Next
+ End If
+ End Sub
+
+ Friend Shared Function GetHookClass( nHookId As Integer) As Integer
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then Return hkCurr.m_nClass
+ Next
+ Return -1
End Function
+ Friend Shared Function GetIsHookUsed( nHookId As Integer) As Boolean
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ Return ( hkCurr.m_nHooked <> GDB_ID.NULL)
+ Else
+ Return Not String.IsNullOrWhiteSpace( hkCurr.m_sHooked)
+ End If
+ End If
+ Next
+ Return True
+ End Function
+
+ Friend Shared Function GetHookUsed( nHookId As Integer, nFixtureId As Integer) As Integer
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ If hkCurr.m_nHooked = nFixtureId then
+ Return hkCurr.m_nHooked
+ End If
+ Else
+ Dim sFixtureId As String = nFixtureId.ToString & ";"
+ If hkCurr.m_sHooked.IndexOf( sFixtureId) <> -1 Then
+ Return nFixtureId
+ End If
+ End If
+ Return GDB_ID.NULL
+ End If
+ Next
+ Return GDB_ID.NULL
+ End Function
+
+ Friend Shared Function SetHookUsed( nHookId As Integer, nFixtureId As Integer) As Boolean
+ ' Rimuovo da eventuale precedente aggancio
+ RemoveFixtureFromHook( nFixtureId)
+ ' Inserisco in nuovo aggancio
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ m_nPrevFixtureId = hkCurr.m_nHooked
+ hkCurr.m_nHooked = nFixtureId
+ Return True
+ Else
+ Return False
+ End If
+ End If
+ Next
+ Return False
+ End Function
+
+ Friend Shared Function ResetHookUsed( nHookId As Integer) As Boolean
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ hkCurr.m_nHooked = GDB_ID.NULL
+ Return True
+ Else
+ Return False
+ End If
+ End If
+ Next
+ Return False
+ End Function
+
+ Friend Shared Function AddHookUsed( nHookId As Integer, nFixtureId As Integer) As Boolean
+ ' Rimuovo da eventuale precedente aggancio
+ RemoveFixtureFromHook( nFixtureId)
+ ' Inserisco in nuovo aggancio
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ Return False
+ Else
+ ' Verifico non sia già presente
+ Dim SplitInfo() As String = hkCurr.m_sHooked.Split(";"c)
+ For Each sInfo As String In SplitInfo
+ Dim nInfo As Integer = GDB_ID.NULL
+ Integer.TryParse(sInfo, nInfo)
+ If nInfo = nFixtureId Then Return True
+ Next
+ ' Lo aggiungo
+ hkCurr.m_sHooked &= nFixtureId.ToString() & ";"
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ End Function
+
+ Friend Shared Function RemoveHookUsed( nHookId As Integer, nFixtureId As Integer) As Boolean
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nId = nHookId Then
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ Return False
+ Else
+ ' Se lo trovo, lo tolgo dall'elenco
+ Dim SplitInfo() As String = hkCurr.m_sHooked.Split(";"c)
+ hkCurr.m_sHooked = ""
+ For Each sInfo As String In SplitInfo
+ Dim nInfo As Integer
+ If Integer.TryParse(sInfo, nInfo) AndAlso nInfo <> nFixtureId Then
+ hkCurr.m_sHooked &= sInfo & ";"
+ End If
+ Next
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ End Function
+
+ Friend Shared Function RemoveFixtureFromHook( nFixtureId As Integer) As Boolean
+ Dim sFixtureId As String = nFixtureId.ToString & ";"
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ If hkCurr.m_nHooked = nFixtureId Then
+ hkCurr.m_nHooked = GDB_ID.NULL
+ Return True
+ End If
+ Else
+ Dim nInd As Integer = hkCurr.m_sHooked.IndexOf( sFixtureId)
+ If nInd <> -1 Then
+ hkCurr.m_sHooked = hkCurr.m_sHooked.Remove( nInd, sFixtureId.Length())
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ End Function
+
+ Private Shared Function UpdateFixturesForDispAxisMove( sName As String, vtMove As Vector3d) As Boolean
+ For Each hkCurr As HookData In m_vHookData
+ If hkCurr.m_sParent = sName OrElse hkCurr.m_sGrParentAxis = sName Then
+ ' Aggiorno posizione di aggancio
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ hkCurr.m_ptP1 += vtMove
+ Else ' HOOKTYPE.LINE
+ hkCurr.m_ptP1 += vtMove
+ hkCurr.m_ptP2 += vtMove
+ End If
+ ' Sposto anche eventuali ventosa/e agganciata/e
+ If hkCurr.m_nType = HOOKTYPE.POINT Then
+ If hkCurr.m_nHooked <> GDB_ID.NULL Then EgtMoveFixture( hkCurr.m_nHooked, vtMove)
+ Else ' HOOKTYPE.LINE
+ Dim SplitInfo() As String = hkCurr.m_sHooked.Split(";"c)
+ For Each sInfo As String In SplitInfo
+ Dim nInfo As Integer = GDB_ID.NULL
+ If Integer.TryParse(sInfo, nInfo) Then
+ EgtMoveFixture( nInfo, vtMove)
+ End If
+ Next
+ End If
+ End If
+ Next
+ Return True
+ End Function
+
+ ' Funzioni che leggono e settano le ventose agganciate agli hook
Private Shared Sub SetHookUsed(nHookId As Integer, nFixtureId As Integer, bUsed As Boolean)
' cerco punto hook sulla ventosa
Dim nFixtSolidId As Integer = EgtGetFirstNameInGroup(nFixtureId, SOLID)
@@ -787,83 +1106,76 @@ Public NotInheritable Class DispositionUtility
Select Case nFixtHookType
Case HOOKTYPE.POINT
If bUsed Then
- EgtSetInfo(m_nUsedHookId, USED, nFixtureId)
+ SetHookUsed(nHookId, nFixtureId)
Else
- EgtRemoveInfo(m_nUsedHookId, USED)
+ ResetHookUsed(nHookId)
End If
Case HOOKTYPE.LINE
If bUsed Then
- Dim sInfo As String = String.Empty
- EgtGetInfo(m_nUsedHookId, USED, sInfo)
- Dim SplitInfo() As String = sInfo.Split(";"c)
- For Each Info In SplitInfo
- Dim nInfo As Integer = GDB_ID.NULL
- Integer.TryParse(sInfo, nInfo)
- If nInfo = nFixtureId Then Return
- Next
- sInfo = sInfo & nFixtureId & ";"
- EgtSetInfo(m_nUsedHookId, USED, sInfo)
+ AddHookUsed( nHookId, nFixtureId)
Else
- Dim sInfo As String = String.Empty
- EgtGetInfo(m_nUsedHookId, USED, sInfo)
- Dim SplitInfo() As String = sInfo.Split(";"c)
- sInfo = ""
- For Each Info In SplitInfo
- Dim nInfo As Integer = GDB_ID.NULL
- Integer.TryParse(sInfo, nInfo)
- If nInfo <> nFixtureId Then
- sInfo = sInfo & Info & ";"
- End If
- Next
- EgtSetInfo(m_nUsedHookId, USED, sInfo)
+ RemoveHookUsed( nHookId, nFixtureId)
End If
End Select
End Sub
' Funzione che analizza gli hook
- Private Shared Sub HookAnalyzer(nCurrHookId As Integer, nFixtHookType As Integer, nFixtHookClass As Integer, ptFixtHook As Point3d, ByRef nNearestHookId As Integer, ByRef dNearestHookDist As Double, ByRef ptNearestHook As Point3d, nMoveId As Integer)
- ' verifico se del tipo giusto
+ Private Shared Sub HookAnalyzer(nCurrHookId As Integer, nFixtHookType As Integer, nFixtHookClass As Integer,
+ ptFixtHook As Point3d, nMoveId As Integer,
+ ByRef nNearestHookId As Integer, ByRef dNearestHookDist As Double, ByRef ptNearestHook As Point3d)
+ ' Verifico se del tipo giusto
Dim nTableHookType As GDB_TY = EgtGetType(nCurrHookId)
- If (nTableHookType = GDB_TY.GEO_POINT And nFixtHookType = HOOKTYPE.POINT) OrElse (nTableHookType = GDB_TY.CRV_LINE And nFixtHookType = HOOKTYPE.LINE) Then
- ' verifico se della stessa classe
- Dim nTableHookClass As Integer = 0
- EgtGetInfo(nCurrHookId, CLASS_, nTableHookClass)
- If nTableHookClass = nFixtHookClass Then
- Dim dDist As Double = 0
- ' punto a distanza minima sull'hook
- Dim ptCurrHook As Point3d
- If nTableHookType = GDB_TY.GEO_POINT Then
- ' verifico se utilizzato
- Dim nTableHookUsed As Integer = GDB_ID.NULL
- If EgtGetInfo(nCurrHookId, USED, nTableHookUsed) AndAlso nTableHookUsed <> nMoveId Then Return
- If nTableHookUsed = nMoveId Then
- SetHookUsed(nCurrHookId, nMoveId, False)
- m_nPrevUsedHookId = nCurrHookId
- End If
- ' calcolo distanza punto hook tavola dal punto hook della ventosa
- EgtStartPoint(nCurrHookId, GDB_ID.ROOT, ptCurrHook)
- dDist = Point3d.Dist(ptCurrHook, ptFixtHook)
- ElseIf nTableHookType = GDB_TY.CRV_LINE Then
- ' calcolo distanza linea hook tavola dal punto hook della ventosa
- Dim nRefId As Integer = 0
- Dim dU As Double = 0
- EgtPointCurveDist(ptFixtHook, nCurrHookId, nRefId, dDist, dU)
- EgtAtParamPoint(nCurrHookId, dU, GDB_ID.ROOT, ptCurrHook)
- Else
- Return
- End If
- ' se minore della distanza minima, sostituisco il valore
- If dDist < dNearestHookDist Then
- nNearestHookId = nCurrHookId
- dNearestHookDist = dDist
- ptNearestHook = ptCurrHook
- End If
- Else
+ If Not (nTableHookType = GDB_TY.GEO_POINT And nFixtHookType = HOOKTYPE.POINT) AndAlso
+ Not (nTableHookType = GDB_TY.CRV_LINE And nFixtHookType = HOOKTYPE.LINE) Then
+ Return
+ End If
+
+ ' Verifico se della stessa classe
+ Dim nTableHookClass As Integer = GetHookClass( nCurrHookId)
+ If nTableHookClass <> nFixtHookClass Then
+ Return
+ End If
+
+ Dim dDist As Double = 0
+ ' punto a distanza minima sull'hook
+ Dim ptCurrHook As Point3d
+ If nTableHookType = GDB_TY.GEO_POINT Then
+ ' verifico se utilizzato
+ Dim nTableHookUsed As Integer = GetHookUsed( nCurrHookId, nMoveId)
+ If nTableHookUsed <> GDB_ID.NULL AndAlso nTableHookUsed <> nMoveId Then
Return
End If
+ If nTableHookUsed = nMoveId Then
+ SetHookUsed(nCurrHookId, nMoveId, False)
+ m_nPrevUsedHookId = nCurrHookId
+ End If
+ ' calcolo distanza punto hook tavola dal punto hook della ventosa
+ EgtStartPoint(nCurrHookId, GDB_ID.ROOT, ptCurrHook)
+ dDist = Point3d.DistXY(ptCurrHook, ptFixtHook)
+ ElseIf nTableHookType = GDB_TY.CRV_LINE Then
+ ' verifico se utilizzato
+ Dim nTableHookUsed As Integer = GetHookUsed( nCurrHookId, nMoveId)
+ If nTableHookUsed <> GDB_ID.NULL AndAlso nTableHookUsed <> nMoveId Then
+ Return
+ End If
+ If nTableHookUsed = nMoveId Then
+ SetHookUsed(nCurrHookId, nMoveId, False)
+ m_nPrevUsedHookId = nCurrHookId
+ End If
+ ' calcolo distanza linea hook tavola dal punto hook della ventosa
+ Dim ptL1 As Point3d : EgtStartPoint( nCurrHookId, GDB_ID.ROOT, ptL1)
+ Dim ptL2 As Point3d : EgtEndPoint( nCurrHookId, GDB_ID.ROOT, ptL2)
+ ptCurrHook = DistPointSegment( ptFixtHook, ptL1, ptL2)
+ dDist = Point3d.DistXY( ptFixtHook, ptCurrHook)
Else
Return
End If
+ ' se minore della distanza minima, sostituisco il valore
+ If dDist < dNearestHookDist Then
+ nNearestHookId = nCurrHookId
+ dNearestHookDist = dDist
+ ptNearestHook = ptCurrHook
+ End If
End Sub
' Funzione che fissa il vettore di hook
@@ -874,7 +1186,7 @@ Public NotInheritable Class DispositionUtility
' recupero punto di hook
Dim ptFixtHook As Point3d
EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
- m_vtHook = ptCurr - ptFixtHook
+ m_vtHook = ptFixtHook - ptCurr
End Sub
' Funzione che restituisce il tipo di sottopezzo passatogli
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb
index 80454be..e534f10 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb
@@ -5,8 +5,6 @@ Imports EgtUILib
Public Class FixtureParametersVM
Inherits ViewModelBase
- Friend Const USED As String = "USED"
-
Private m_FixtureTypeList As ObservableCollection(Of FixtureListItem)
Public ReadOnly Property FixtureTypeList As ObservableCollection(Of FixtureListItem)
Get
@@ -64,8 +62,8 @@ Public Class FixtureParametersVM
Dim nUsedFixtureId As Integer = EgtGetFirstFixture()
While nUsedFixtureId <> GDB_ID.NULL
Dim sUsedFixtureName As String = String.Empty
+ EgtGetName(nUsedFixtureId, sUsedFixtureName)
For Index = 0 To m_FixtureTypeList.Count - 1
- EgtGetName(nUsedFixtureId, sUsedFixtureName)
If sUsedFixtureName = m_FixtureTypeList(Index).Name Then
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber += 1
@@ -78,6 +76,7 @@ Public Class FixtureParametersVM
Friend Sub UpdateFixtureTypeList()
m_FixtureTypeList = New ObservableCollection(Of FixtureListItem)(FixtureType.ReadFixtureTypeFromMachIni())
+ UpdateFixtureCount()
OnPropertyChanged(NameOf(FixtureTypeList))
End Sub
@@ -122,26 +121,34 @@ Public Class FixtureParametersVM
OnPropertyChanged(NameOf(FixtureErrorMsg))
Return
End If
+ ' dimensioni tavola
+ Dim vtTabDim As Vector3d = ptTableMax - ptTableMin
' calcolo il centro della tavola
- Dim ptTableMid As New Point3d((ptTableMax.x - ptTableMin.x) / 2, (ptTableMax.y - ptTableMin.y) / 2, (ptTableMax.z - ptTableMin.z) / 2)
+ Dim ptTableMid As Point3d = Point3d.ORIG() + 0.5 * vtTabDim
' posiziono il nuovo sottopezzo al centro della tavola
- Dim nAddedFixtureId As Integer = EgtAddFixture(SelectedFixture.Name, ptTableMid, 0, 0)
+ Dim nAddedFixtureId As Integer = EgtAddFixture(SelectedFixture.Name, ptTableMid, 0, 20)
If nAddedFixtureId = GDB_ID.NULL Then
m_FixtureErrorMsg = "Impossibile posizionare la ventosa sulla tavola"
OnPropertyChanged(NameOf(FixtureErrorMsg))
Return
End If
- ' verifico se la ventosa ha punti di hook da ancorare
+ ' Se la ventosa ha punti di hook da ancorare
If IsFixtureWithHook(nAddedFixtureId) Then
If Not PositionFixtureOnNearestHook(nAddedFixtureId) Then
- ' non ci sono punti liberi, quindi rimuovo la ventosa e segnalo
- EgtRemoveFixture(nAddedFixtureId)
- 'MessageBox.Show("No free hook point!", "ERROR")
- EgtMessageBoxV.Show(Application.Current.MainWindow, "No free hook point!", "ERROR")
- Return
+ EgtMoveFixture( nAddedFixtureId, 0.2 * vtTabDim.y * Vector3d.Y_AX())
+ If Not PositionFixtureOnNearestHook(nAddedFixtureId) Then
+ EgtMoveFixture( nAddedFixtureId, 0.2 * vtTabDim.y * Vector3d.Y_AX())
+ If Not PositionFixtureOnNearestHook(nAddedFixtureId) Then
+ ' non ci sono punti liberi, quindi rimuovo la ventosa e segnalo
+ EgtRemoveFixture(nAddedFixtureId)
+ EgtSetFixtureLink( nAddedFixtureId, "")
+ MessageBox.Show("No free hook point!", "ERROR")
+ Return
+ End If
+ End If
End If
+ ' altrimenti ventosa con movimento continuo
Else
- ' se non ha punti di ancoraggio
' verifico se è in una posizione valida
If Not DispositionUtility.VerifyFixturePosition(nAddedFixtureId, New Vector3d) Then
' se non trovo una posizione valida, esco
@@ -199,8 +206,8 @@ Public Class FixtureParametersVM
' verifico se c'è almeno un bordo
If nTableFrBorderCount = 0 Then
m_FixtureErrorMsg = "Impossibile posizionare la ventosa sulla tavola"
- OnPropertyChanged(NameOf(FixtureErrorMsg))
- Return False
+ OnPropertyChanged("FixtureErrorMsg")
+ Return False
End If
' converto il punto medio della tavola in coordinate globali
Dim PtTableRef As Point3d
@@ -240,9 +247,7 @@ Public Class FixtureParametersVM
' leggo tipo
Dim sType As String = ""
EgtGetInfo(nFixtHookId, DispositionUtility.TYPE, sType)
- If sType.Equals(DispositionUtility.FREE) Then
- Return False
- ElseIf sType.Equals(DispositionUtility.POINT) Then
+ If sType.Equals(DispositionUtility.POINT) Then
Return True
ElseIf sType.Equals(DispositionUtility.LINE) Then
Return True
@@ -251,7 +256,7 @@ Public Class FixtureParametersVM
End If
End Function
- ' Funzione che aggancia la ventosa al più vicino hook libero
+ ' Funzione che cerca un hook libero adatto alla ventosa e se trovato la posiziona
Friend Shared Function PositionFixtureOnNearestHook(nFixtureId As Integer) As Boolean
' cerco punto hook sulla ventosa
Dim nFixtSolidId As Integer = EgtGetFirstNameInGroup(nFixtureId, SOLID)
@@ -263,26 +268,21 @@ Public Class FixtureParametersVM
Dim nFixtHookType As DispositionUtility.HOOKTYPE = DispositionUtility.HOOKTYPE.FREE
Dim sType As String = ""
EgtGetInfo(nFixtHookId, DispositionUtility.TYPE, sType)
- If sType.Equals(DispositionUtility.FREE) Then
- nFixtHookType = DispositionUtility.HOOKTYPE.FREE
- ' esco perchè non devo cercare alcun punto
- Return True
- ElseIf sType.Equals(DispositionUtility.POINT) Then
+ If sType.Equals(DispositionUtility.POINT) Then
nFixtHookType = DispositionUtility.HOOKTYPE.POINT
ElseIf sType.Equals(DispositionUtility.LINE) Then
nFixtHookType = DispositionUtility.HOOKTYPE.LINE
Else
- nFixtHookType = DispositionUtility.HOOKTYPE.FREE
' esco perchè non devo cercare alcun punto
Return True
End If
Dim nFixtHookClass As Integer = 0
EgtGetInfo(nFixtHookId, DispositionUtility.CLASS_, nFixtHookClass)
- ' cerco id tavola
+ ' Recupero Id tavola corrente
Dim sTableName As String = ""
EgtGetTableName(sTableName)
Dim nTableId As Integer = EgtGetTableId(sTableName)
- ' cerco hook su tavola macchina
+ ' *** Cerco hook su tavola ***
Dim nTableSolidId As Integer = EgtGetFirstNameInGroup(nTableId, SOLID)
Dim nCurrHookId As Integer = EgtGetFirstNameInGroup(nTableSolidId, DispositionUtility.HOOK)
' Punto di hook a cui spostare la ventosa
@@ -294,33 +294,23 @@ Public Class FixtureParametersVM
EgtMoveFixture(nFixtureId, ptCurrHook - ptFixtHook)
' verifico se è in una posizione valida
If DispositionUtility.VerifyFixturePosition(nFixtureId, New Vector3d) Then
- EgtSetInfo(nCurrHookId, USED, nFixtureId)
+ If nFixtHookType = DispositionUtility.HOOKTYPE.POINT then
+ DispositionUtility.SetHookUsed( nCurrHookId, nFixtureId)
+ Else
+ DispositionUtility.AddHookUsed( nCurrHookId, nFixtureId)
+ End If
+ EgtSetFixtureLink( nFixtureId, "")
Return True
+ Else
+ EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
End If
End If
nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
End While
- ' cerco hook su barra fissa
+ ' *** Cerco hook su barre fisse ***
Dim nTableFixedId As Integer = EgtGetFirstNameInGroup(nTableId, DispositionUtility.FIXED)
- nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, DispositionUtility.HOOK)
- While nCurrHookId <> GDB_ID.NULL
- ' se punto di aggancio valido
- If HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, ptCurrHook) Then
- ' sposto la ventosa
- EgtMoveFixture(nFixtureId, ptCurrHook - ptFixtHook)
- ' verifico se è in una posizione valida
- If DispositionUtility.VerifyFixturePosition(nFixtureId, New Vector3d) Then
- EgtSetInfo(nCurrHookId, USED, nFixtureId)
- Return True
- End If
- End If
- nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
- End While
- ' cerco hook su barre mobili
- Dim nMobileInd As Integer = 1
- Dim nMobile As Integer = EgtGetFirstNameInGroup(nTableId, DispositionUtility.MOBILE & nMobileInd)
- While nMobile <> GDB_ID.NULL
- nCurrHookId = EgtGetFirstNameInGroup(nMobile, DispositionUtility.HOOK)
+ While nTableFixedId <> GDB_ID.NULL
+ nCurrHookId = EgtGetFirstNameInGroup(nTableFixedId, DispositionUtility.HOOK)
While nCurrHookId <> GDB_ID.NULL
' se punto di aggancio valido
If HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, ptCurrHook) Then
@@ -328,46 +318,114 @@ Public Class FixtureParametersVM
EgtMoveFixture(nFixtureId, ptCurrHook - ptFixtHook)
' verifico se è in una posizione valida
If DispositionUtility.VerifyFixturePosition(nFixtureId, New Vector3d) Then
- EgtSetInfo(nCurrHookId, USED, nFixtureId)
+ If nFixtHookType = DispositionUtility.HOOKTYPE.POINT then
+ DispositionUtility.SetHookUsed( nCurrHookId, nFixtureId)
+ Else
+ DispositionUtility.AddHookUsed( nCurrHookId, nFixtureId)
+ End If
+ EgtSetFixtureLink( nFixtureId, "")
Return True
+ Else
+ EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
End If
End If
nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
End While
- nMobileInd += 1
- nMobile = EgtGetFirstNameInGroup(nTableId, DispositionUtility.MOBILE & nMobileInd)
+ nTableFixedId = EgtGetNextName( nTableFixedId, DispositionUtility.FIXED)
+ End While
+ ' *** Cerco hook su barre mobili ***
+ Dim nBarId As Integer = EgtGetFirstGroupInGroup(nTableId)
+ While nBarId <> GDB_ID.NULL
+ Dim sBarName As String = ""
+ If EgtGetName( nBarId, sBarName) AndAlso EgtGetAxisId( sBarName) <> GDB_ID.NULL Then
+ nCurrHookId = EgtGetFirstNameInGroup(nBarId, DispositionUtility.HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ ' se punto di aggancio valido
+ If HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, ptCurrHook) Then
+ ' sposto la ventosa
+ Dim vtMove As Vector3d = ptCurrHook - ptFixtHook
+ EgtMoveFixture(nFixtureId, vtMove)
+ ' verifico se è in una posizione valida
+ If DispositionUtility.VerifyFixturePosition(nFixtureId, New Vector3d) Then
+ If nFixtHookType = DispositionUtility.HOOKTYPE.POINT then
+ DispositionUtility.SetHookUsed( nCurrHookId, nFixtureId)
+ Else
+ DispositionUtility.AddHookUsed( nCurrHookId, nFixtureId)
+ End If
+ EgtSetFixtureLink( nFixtureId, sBarName)
+ Return True
+ Else
+ EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
+ End If
+ End If
+ nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
+ End While
+ ' Cerco su eventuali carrelli
+ Dim nCharId As Integer = EgtGetFirstGroupInGroup(nBarId)
+ While nCharId <> GDB_ID.NULL
+ Dim sCharName As String = ""
+ If EgtGetName( nCharId, sCharName) AndAlso EgtGetAxisId( sCharName) <> GDB_ID.NULL Then
+ nCurrHookId = EgtGetFirstNameInGroup(nCharId, DispositionUtility.HOOK)
+ While nCurrHookId <> GDB_ID.NULL
+ ' se punto di aggancio valido
+ If HookAnalyzer(nCurrHookId, nFixtHookType, nFixtHookClass, ptFixtHook, ptCurrHook) Then
+ ' sposto la ventosa
+ EgtMoveFixture(nFixtureId, ptCurrHook - ptFixtHook)
+ ' verifico se è in una posizione valida
+ If DispositionUtility.VerifyFixturePosition(nFixtureId, New Vector3d) Then
+ If nFixtHookType = DispositionUtility.HOOKTYPE.POINT then
+ DispositionUtility.SetHookUsed( nCurrHookId, nFixtureId)
+ Else
+ DispositionUtility.AddHookUsed( nCurrHookId, nFixtureId)
+ End If
+ EgtSetFixtureLink( nFixtureId, sCharName)
+ Return True
+ Else
+ EgtStartPoint(nFixtHookId, GDB_ID.ROOT, ptFixtHook)
+ End If
+ End If
+ nCurrHookId = EgtGetNextName(nCurrHookId, DispositionUtility.HOOK)
+ End While
+ End If
+ nCharId = EgtGetNextGroup(nCharId)
+ End While
+ End If
+ nBarId = EgtGetNextGroup(nBarId)
End While
Return False
End Function
- ' Funzione che analizza l'hook e se valido ne prestituisce lo posizione(punto)
- Private Shared Function HookAnalyzer(nCurrHookId As Integer, nFixtHookType As Integer, nFixtHookClass As Integer, ptFixtHook As Point3d, ByRef ptCurrHook As Point3d) As Boolean
- ' verifico se del tipo giusto
+ ' Funzione che analizza l'hook e se valido ne restituisce la posizione (punto)
+ Private Shared Function HookAnalyzer(nCurrHookId As Integer, nFixtHookType As Integer, nFixtHookClass As Integer,
+ ptFixtHook As Point3d, ByRef ptCurrHook As Point3d) As Boolean
+ ' Verifico se del tipo giusto
Dim nTableHookType As GDB_TY = EgtGetType(nCurrHookId)
- If (nTableHookType = GDB_TY.GEO_POINT And nFixtHookType = DispositionUtility.HOOKTYPE.POINT) OrElse (nTableHookType = GDB_TY.CRV_LINE And nFixtHookType = DispositionUtility.HOOKTYPE.LINE) Then
- ' verifico se della stessa classe
- Dim nTableHookClass As Integer = 0
- EgtGetInfo(nCurrHookId, DispositionUtility.CLASS_, nTableHookClass)
- If nTableHookClass = nFixtHookClass Then
- Dim dDist As Double = 0
- ' punto a distanza minima sull'hook
- If nTableHookType = GDB_TY.GEO_POINT Then
- ' verifico se utilizzato
- Dim nTableHookUsed As Boolean = False
- If Not EgtGetInfo(nCurrHookId, DispositionUtility.USED, nTableHookUsed) Then
- ' calcolo distanza punto hook tavola dal punto hook della ventosa
- EgtStartPoint(nCurrHookId, GDB_ID.ROOT, ptCurrHook)
- Return True
- End If
- ElseIf nTableHookType = GDB_TY.CRV_LINE Then
- ' calcolo distanza linea hook tavola dal punto hook della ventosa
- Dim nRefId As Integer = 0
- Dim dU As Double = 0
- EgtPointCurveDist(ptFixtHook, nCurrHookId, nRefId, dDist, dU)
- EgtAtParamPoint(nCurrHookId, dU, GDB_ID.ROOT, ptCurrHook)
- Return True
- End If
+ If Not (nTableHookType = GDB_TY.GEO_POINT And nFixtHookType = DispositionUtility.HOOKTYPE.POINT) AndAlso
+ Not (nTableHookType = GDB_TY.CRV_LINE And nFixtHookType = DispositionUtility.HOOKTYPE.LINE) Then
+ Return False
+ End If
+
+ ' Verifico se della stessa classe
+ Dim nTableHookClass As Integer = DispositionUtility.GetHookClass( nCurrHookId)
+ If nTableHookClass <> nFixtHookClass Then
+ Return False
+ End If
+
+ Dim dDist As Double = 0
+ ' punto a distanza minima sull'hook
+ If nTableHookType = GDB_TY.GEO_POINT Then
+ ' verifico se utilizzato
+ If Not DispositionUtility.GetIsHookUsed( nCurrHookId) Then
+ ' calcolo distanza punto hook tavola dal punto hook della ventosa
+ EgtStartPoint(nCurrHookId, GDB_ID.ROOT, ptCurrHook)
+ Return True
End If
+ ElseIf nTableHookType = GDB_TY.CRV_LINE Then
+ ' calcolo distanza linea hook tavola dal punto hook della ventosa
+ Dim ptL1 As Point3d : EgtStartPoint( nCurrHookId, GDB_ID.ROOT, ptL1)
+ Dim ptL2 As Point3d : EgtEndPoint( nCurrHookId, GDB_ID.ROOT, ptL2)
+ ptCurrHook = DispositionUtility.DistPointSegment( ptFixtHook, ptL1, ptL2)
+ Return True
End If
Return False
End Function
@@ -397,6 +455,7 @@ Public Class FixtureParametersVM
Dim NextSelectedId As Integer = EgtGetNextSelectedObj()
If EgtVerifyFixture(SelectedFixtureId) Then
EgtRemoveFixture(SelectedFixtureId)
+ DispositionUtility.RemoveFixtureFromHook( SelectedFixtureId)
For Index = 0 To FixtureTypeList.Count - 1
Dim SelFixtureName As String = String.Empty
EgtGetName(SelectedFixtureId, SelFixtureName)
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml
index acaa68d..52f1277 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml
@@ -7,7 +7,7 @@
-
+
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
index 2c1344e..563a77f 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
@@ -116,7 +116,7 @@ Public Class RawPartOptionVM
End Property
'''
- ''' Execute the Point. This method is invoked by the DoneCommand.
+ ''' Execute NewRawPart. This method is invoked by the DoneCommand.
'''
Public Sub NewRawPart()
DispositionUtility.ShowParts()
@@ -126,6 +126,36 @@ Public Class RawPartOptionVM
#End Region ' NewRawPartCommand
+#Region "RemoveRawPartCommand"
+
+ '''
+ ''' Returns a command that do Done.
+ '''
+ Public ReadOnly Property RemoveRawPartCommand As ICommand
+ Get
+ If m_cmdRemoveRawPart Is Nothing Then
+ m_cmdRemoveRawPart = New RelayCommand(AddressOf RemoveRawPart)
+ End If
+ Return m_cmdRemoveRawPart
+ End Get
+ End Property
+
+ '''
+ ''' Execute RemoveRawPart. This method is invoked by the DoneCommand.
+ '''
+ Public Sub RemoveRawPart()
+ ' ciclo sui grezzi selezionati
+ Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
+ While nSelRawPartId <> GDB_ID.NULL
+ ' rimuovo il grezzo dalla disposizione
+ EgtRemoveRawPart(nSelRawPartId)
+ nSelRawPartId = EgtGetNextSelectedObj()
+ End While
+ EgtDraw()
+ End Sub
+
+#End Region ' RemoveRawPartCommand
+
#End Region ' Commands
End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb
index fbcdc76..1798cf0 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderVM.vb
@@ -125,7 +125,13 @@ Public Class MachiningParameterExpanderVM
NotifyPropertyChanged(NameOf(SliderValue))
End Sub
Friend Sub SetSliderValue(value As Integer)
- m_SliderValue += value
+ Dim nOldSliderValue As Integer = m_SliderValue
+ m_SliderValue = Math.Min( Math.Max( m_SliderValue + value, 1), m_SliderScale)
+ Dim nStep As Integer = m_SliderValue - nOldSliderValue
+ If nStep = 0 Then Return
+ Dim nId As Integer = EgtPreviewMachiningTool(m_nPtEntId, nStep)
+ If nId <> GDB_ID.NULL Then m_nPtEntId = nId
+ EgtDraw()
NotifyPropertyChanged(NameOf(SliderValue))
End Sub
diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb
index 6071c95..40617a1 100644
--- a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb
@@ -321,10 +321,11 @@ Public Class OperationsListExpanderVM
' Aggiungo la nuova fase
Dim nPhase As Integer = EgtAddPhase()
Dim nDispId As Integer = EgtGetPhaseDisposition(nPhase)
- ' Confermo grezzi e bloccaggi sopra salvati
+ ' Confermo grezzi, movimenti assi di disposizione e bloccaggi sopra salvati
For Each nId As Integer In vRawId
EgtKeepRawPart(nId, nLastPhase)
Next
+ EgtKeepAllDispAxes( nLastPhase)
For Each nId As Integer In vFxtId
EgtKeepFixture(nId, nLastPhase)
Next
@@ -423,8 +424,10 @@ Public Class OperationsListExpanderVM
If EgtGetOperationMode(selOperation.Id) Then
Map.refOperationParametersExpanderVM.ParametersIsExpanded = True
- Map.refMachiningParameterExpanderVM.SetSliderScale( EgtGetPreviewMachiningToolStepCount())
- Map.refMachiningParameterExpanderVM.ResetSliderValue()
+ If EgtGetOperationType(selOperation.Id) <> MCH_OY.DISP Then
+ Map.refMachiningParameterExpanderVM.SetSliderScale( EgtGetPreviewMachiningToolStepCount())
+ Map.refMachiningParameterExpanderVM.ResetSliderValue()
+ End If
End If
End Sub
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
index 26c0af8..ac04762 100644
--- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
@@ -100,10 +100,11 @@ Public Class SimulationExpanderVM
If Not GetCncFileName(True, sCncFile, sInfo) Then Return
' Eseguo
If Not EgtGenerate(sCncFile, sInfo) Then
- Dim nErr = EgtGetLastMachMgrErrorId()
+ Dim nErr As Integer = EgtGetLastMachMgrErrorId()
If nErr = 1000 Then
- 'MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
- EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information) ' La licenza non permette la Generazione CN INFORMAZIONE
+ MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr = 1001 Then
+ MessageBox.Show(EgtMsg(5334), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
ElseIf nErr <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
'MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation)
@@ -229,13 +230,16 @@ Public Class SimulationExpanderVM
UpdateUI()
' Messaggio in caso di errore
If Not bOk Then
- If EgtGetLastMachMgrErrorId() <> 0 Then
+ Dim nErr As Integer = EgtGetLastMachMgrErrorId()
+ If nErr = 1000 Then
+ MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr = 1001 Then
+ MessageBox.Show(EgtMsg(5334), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
- 'MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' .... - ERRORE
- EgtMessageBoxV.Show(Application.Current.MainWindow, sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' .... - ERRORE
+ MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation) '.... - ERRORE
Else
- 'MessageBox.Show(EgtMsg(MSG_MESSAGEBOX + 10), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore sconosciuto - ERRORE
- EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(15010), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore sconosciuto - ERRORE
+ MessageBox.Show(EgtMsg(15010), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error) 'Errore sconosciuto - ERRORE
End If
End If
' Imposto stato corrente
@@ -273,13 +277,16 @@ Public Class SimulationExpanderVM
Map.refEstimationsExpanderVM.NotifyPropertyChanged(NameOf(Map.refEstimationsExpanderVM.Estimation_IsEnabled))
m_bStopOnNextCollision = True
If Not EgtSimStart(False) Then
- If EgtGetLastMachMgrErrorId() <> 0 Then
+ Dim nErr As Integer = EgtGetLastMachMgrErrorId()
+ If nErr = 1000 Then
+ MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr = 1001 Then
+ MessageBox.Show(EgtMsg(5334), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ ElseIf nErr <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
- 'MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' .... - ERRORE
- EgtMessageBoxV.Show(Application.Current.MainWindow, sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' .... - ERRORE
+ MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation) '.... - ERRORE
Else
- 'MessageBox.Show(EgtMsg(MSG_MESSAGEBOX + 10), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore sconosciuto - ERRORE
- EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(15010), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore sconosciuto - ERRORE
+ MessageBox.Show(EgtMsg(15010), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error) 'Errore sconosciuto - ERRORE
End If
SetSimulationStatus(MCH_SIM_ST.UI_STOP)
End If
@@ -349,8 +356,10 @@ Public Class SimulationExpanderVM
End If
' Aggiorno stato visualizzazione macchina (dipende anche da utensile)
UpdateMachView()
- ' Aggiorno visualizzazione
- EgtDraw()
+ ' Aggiorno visualizzazione (solo se interfaccia non minimizzata, per aumentare velocità)
+ If Application.Current.MainWindow.WindowState <> WindowState.Minimized Then
+ EgtDraw()
+ End If
' Aggiorno dati CNC
If nShowDataCounter = 5 Or GetSimulationStatus() = MCH_SIM_ST.UI_PAUSE Or GetSimulationStatus() = MCH_SIM_ST.UI_STOP Then
ShowCncData()
diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb
index 969abe5..206ff45 100644
--- a/OptionsWindow/OptionModule.vb
+++ b/OptionsWindow/OptionModule.vb
@@ -23,7 +23,10 @@ Friend Module OptionModule
' Parametri per import
Friend m_dDxfScaleFactor As Double
Friend m_dStlScaleFactor As Double
+ Friend m_dOffScaleFactor As Double
+ Friend m_dPlyScaleFactor As Double
Friend m_dImgScaleFactor As Double
+ Friend m_dAdvImpTolerance As Double
' Parametri per export
Friend m_nExportDxfFlag As Integer
@@ -56,6 +59,7 @@ Friend Module OptionModule
Friend m_SelGeomSurfRoughing As SceneSelModeOpt
Friend m_SelGeomWaterJetting As SceneSelModeOpt
Friend m_SelGeomFiveAxMilling As SceneSelModeOpt
+ Friend m_SelVMillQuality As VMillSelTypeOpt
' Flag per aggiungere una nuova lavorazione alla fine della fase o subito dopo la lavorazione selezionata
Friend m_bNewMachiningIsLastOne As Boolean
' Variabile che indica se usare lo script per calcolare automaticamente la disposizione quando si passa in lavorazione
@@ -117,7 +121,10 @@ Friend Module OptionModule
' Inizializzo variabili per import
m_dDxfScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_DXFSCALE, 1)
m_dStlScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_STLSCALE, 1)
+ m_dOffScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_OFFSCALE, 1)
+ m_dPlyScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_PLYSCALE, 1)
m_dImgScaleFactor = GetPrivateProfileDouble(S_IMPORT, K_IMGSCALE, 1)
+ m_dAdvImpTolerance = GetPrivateProfileDouble(S_IMPORT, K_ADVTOLER, 0.05)
' Inizializzo variabili per export
m_nExportDxfFlag = GetPrivateProfileInt(S_EXPORT, K_DXFFLAG, EEX_FL.COMP_LAYER)
m_nImgWidth = GetPrivateProfileInt(S_EXPORT, K_IMGWIDTH, 400)
@@ -148,6 +155,8 @@ Friend Module OptionModule
m_SelGeomSurfRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMFIVEAXMILLING, -1)
m_SelGeomFiveAxMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt))
+ Temp = GetPrivateProfileInt(S_MACH, K_SELVMILLQUALITY, 0)
+ m_SelVMillQuality = If(Temp < -2 Or Temp > 2, VMillSelTypeOpt.HIGHER, DirectCast(Temp, VMillSelTypeOpt))
m_SelGeomWaterJetting = SceneSelModeOpt.PARTCURVES
' Inizializzo variabile che indica posizione nuova operazione di lavorazione
m_bNewMachiningIsLastOne = (GetPrivateProfileInt(S_OPTIONS, K_NEWMACHININGISLASTONE, 0) <> 0)
diff --git a/OptionsWindow/OptionWindowV.xaml b/OptionsWindow/OptionWindowV.xaml
index 3ea66b6..348c0d5 100644
--- a/OptionsWindow/OptionWindowV.xaml
+++ b/OptionsWindow/OptionWindowV.xaml
@@ -9,12 +9,12 @@
WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False"
IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"
MinWidth="400" MinHeight="382"
- Width="400" Height="520"
+ Width="400" Height="575"
CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}">
-
+
@@ -136,6 +136,9 @@
+
@@ -147,10 +150,12 @@
+
+
+ Text="{Binding UnitScaleMsg}"/>
@@ -159,12 +164,12 @@
+ Margin="10,5,0,5"/>
+ Margin="10,5,0,5"/>
+ Text="{Binding OffScaleFactorMsg}" VerticalAlignment="Center"/>
+
+
+
+
+
+
-
+
+
+
+
+
@@ -308,30 +343,41 @@
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb
index a502585..8559514 100644
--- a/OptionsWindow/OptionWindowVM.vb
+++ b/OptionsWindow/OptionWindowVM.vb
@@ -2,6 +2,7 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
+Imports System.Globalization
Imports EgtWPFLib5
Imports System.Globalization
@@ -21,6 +22,13 @@ Public Class OptionWindowVM
End Get
End Property
+ Private m_VMillTypeList As ObservableCollection(Of VMillSelTypeOpt) = New ObservableCollection(Of VMillSelTypeOpt)({VMillSelTypeOpt.LOWER, VMillSelTypeOpt.LOW, VMillSelTypeOpt.STANDARD, VMillSelTypeOpt.HIGH, VMillSelTypeOpt.HIGHER})
+ Public ReadOnly Property VMillTypeList As ObservableCollection(Of VMillSelTypeOpt)
+ Get
+ Return m_VMillTypeList
+ End Get
+ End Property
+
Private m_UnitMeasureList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6545)}) ' Unità corrente
Public ReadOnly Property UnitMeasureList As List(Of String)
Get
@@ -59,6 +67,34 @@ Public Class OptionWindowVM
End Get
End Property
+ Private m_ScaleOffList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)}) ' Altra
+ Public ReadOnly Property ScaleOffList As List(Of String)
+ Get
+ Return m_ScaleOffList
+ End Get
+ End Property
+
+ Private m_ScalePlyList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)}) ' Altra
+ Public ReadOnly Property ScalePlyList As List(Of String)
+ Get
+ Return m_ScalePlyList
+ End Get
+ End Property
+
+ Private m_ScaleOffList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)}) ' Altra
+ Public ReadOnly Property ScaleOffList As List(Of String)
+ Get
+ Return m_ScaleOffList
+ End Get
+ End Property
+
+ Private m_ScalePlyList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)}) ' Altra
+ Public ReadOnly Property ScalePlyList As List(Of String)
+ Get
+ Return m_ScalePlyList
+ End Get
+ End Property
+
Private m_ScaleImageList As List(Of String) = New List(Of String)({"mm", "inch", EgtMsg(6546)}) ' Altra
Public ReadOnly Property ScaleImageList As List(Of String)
Get
@@ -183,6 +219,17 @@ Public Class OptionWindowVM
End Set
End Property
+ Public Property SelectedVMillTypeType As VMillSelTypeOpt
+ Get
+ Return OptionModule.m_SelVMillQuality
+ End Get
+ Set(value As VMillSelTypeOpt)
+ If WritePrivateProfileString(S_MACH, K_SELVMILLQUALITY, CInt(value).ToString()) Then
+ OptionModule.m_SelVMillQuality = value
+ End If
+ End Set
+ End Property
+
Public Property GeometryTolerance As String
Get
Return LenToString(OptionModule.m_dGeometryTolerance, 5)
@@ -318,6 +365,36 @@ Public Class OptionWindowVM
End Set
End Property
+ Public Property OffScaleFactor As String
+ Get
+ Return LenToString(OptionModule.m_dOffScaleFactor, 5)
+ End Get
+ Set(value As String)
+ Dim dVal As Double = 0
+ If StringToLen(value, dVal) AndAlso dVal > 0 Then
+ OptionModule.m_dOffScaleFactor = dVal
+ WritePrivateProfileString(S_IMPORT, K_OFFSCALE, DoubleToString(OptionModule.m_dOffScaleFactor, 5))
+ Map.refProjectVM.GetController().SetScaleForOffImport(OptionModule.m_dOffScaleFactor)
+ NotifyPropertyChanged("OffScaleFactor")
+ End If
+ End Set
+ End Property
+
+ Public Property PlyScaleFactor As String
+ Get
+ Return LenToString(OptionModule.m_dPlyScaleFactor, 5)
+ End Get
+ Set(value As String)
+ Dim dVal As Double = 0
+ If StringToLen(value, dVal) AndAlso dVal > 0 Then
+ OptionModule.m_dPlyScaleFactor = dVal
+ WritePrivateProfileString(S_IMPORT, K_PLYSCALE, DoubleToString(OptionModule.m_dPlyScaleFactor, 5))
+ Map.refProjectVM.GetController().SetScaleForPLyImport(OptionModule.m_dPlyScaleFactor)
+ NotifyPropertyChanged("PlyScaleFactor")
+ End If
+ End Set
+ End Property
+
Public Property ImageScaleFactor As String
Get
Return LenToString(OptionModule.m_dImgScaleFactor, 5)
@@ -333,6 +410,20 @@ Public Class OptionWindowVM
End Set
End Property
+ Public Property AdvImpTolerance As String
+ Get
+ Return LenToString(OptionModule.m_dAdvImpTolerance, 5)
+ End Get
+ Set(value As String)
+ Dim dVal As Double = 0
+ If StringToLen(value, dVal) AndAlso dVal > 0 Then
+ OptionModule.m_dAdvImpTolerance = dVal
+ Map.refProjectVM.GetController.SetAdvImpTolerance(OptionModule.m_dAdvImpTolerance)
+ WritePrivateProfileString(S_IMPORT, K_ADVTOLER, DoubleToString(OptionModule.m_dAdvImpTolerance, 5))
+ End If
+ End Set
+ End Property
+
Public Property ImageWidth As String
Get
Return OptionModule.m_nImgWidth.ToString()
@@ -487,6 +578,28 @@ Public Class OptionWindowVM
End Set
End Property
+ Private m_OffScaleEnable As Boolean = False
+ Public Property OffScaleEnable As Boolean
+ Get
+ Return m_OffScaleEnable
+ End Get
+ Set(value As Boolean)
+ m_OffScaleEnable = value
+ NotifyPropertyChanged("OffScaleEnable")
+ End Set
+ End Property
+
+ Private m_PlyScaleEnable As Boolean = False
+ Public Property PlyScaleEnable As Boolean
+ Get
+ Return m_PlyScaleEnable
+ End Get
+ Set(value As Boolean)
+ m_PlyScaleEnable = value
+ NotifyPropertyChanged("PlyScaleEnable")
+ End Set
+ End Property
+
Private m_ImageScaleEnable As Boolean = False
Public Property ImageScaleEnable As Boolean
Get
@@ -548,6 +661,56 @@ Public Class OptionWindowVM
End Set
End Property
+ Public Property SelectedOffScale As String
+ Get
+ If Math.Abs(OptionModule.m_dOffScaleFactor - ONEMM) < EPS_SMALL * 10 Then
+ Return ScaleOffList(ScaleOffList.IndexOf("mm"))
+ ElseIf Math.Abs(OptionModule.m_dOffScaleFactor - ONEINCH) < EPS_SMALL * 10 Then
+ Return ScaleOffList(ScaleOffList.IndexOf("inch"))
+ Else
+ OffScaleEnable = True
+ Return ScaleOffList(ScaleOffList.IndexOf(EgtMsg(MSG_OPTIONPAGE + 46)))
+ End If
+ End Get
+ Set(value As String)
+ If value = "mm" Then
+ OffScaleFactor = LenToString(ONEMM, 3)
+ OffScaleEnable = False
+ ElseIf value = "inch" Then
+ OffScaleFactor = LenToString(ONEINCH, 4)
+ OffScaleEnable = False
+ Else
+ OffScaleFactor = LenToString(OptionModule.m_dOffScaleFactor, 4)
+ OffScaleEnable = True
+ End If
+ End Set
+ End Property
+
+ Public Property SelectedPlyScale As String
+ Get
+ If Math.Abs(OptionModule.m_dPlyScaleFactor - ONEMM) < EPS_SMALL * 10 Then
+ Return ScalePlyList(ScalePlyList.IndexOf("mm"))
+ ElseIf Math.Abs(OptionModule.m_dPlyScaleFactor - ONEINCH) < EPS_SMALL * 10 Then
+ Return ScalePlyList(ScalePlyList.IndexOf("inch"))
+ Else
+ PlyScaleEnable = True
+ Return ScalePlyList(ScalePlyList.IndexOf(EgtMsg(MSG_OPTIONPAGE + 46)))
+ End If
+ End Get
+ Set(value As String)
+ If value = "mm" Then
+ PlyScaleFactor = LenToString(ONEMM, 3)
+ PlyScaleEnable = False
+ ElseIf value = "inch" Then
+ PlyScaleFactor = LenToString(ONEINCH, 4)
+ PLyScaleEnable = False
+ Else
+ PLyScaleFactor = LenToString(OptionModule.m_dPlyScaleFactor, 4)
+ PLyScaleEnable = True
+ End If
+ End Set
+ End Property
+
Public Property SelectedImageScale As String
Get
If Math.Abs(OptionModule.m_dImgScaleFactor - ONEMM) < EPS_SMALL * 10 Then
@@ -770,17 +933,17 @@ Public Class OptionWindowVM
End Property
Public ReadOnly Property ThickLineMsg As String
Get
- Return EgtMsg(6536) ' Linee spesse
+ Return EgtMsg(6536) ' Linee spesse
End Get
End Property
Public ReadOnly Property SmoothTriMeshMsg As String
Get
- Return EgtMsg(6518) ' Superfici smussate
+ Return EgtMsg(6518) ' Superfici smussate
End Get
End Property
Public ReadOnly Property UpdateLicenceMsg As String
Get
- Return EgtMsg(6553) ' Aggiorna licenza
+ Return EgtMsg(6553) ' Aggiorna licenza
End Get
End Property
@@ -842,25 +1005,39 @@ Public Class OptionWindowVM
Public ReadOnly Property ImportMsg As String
Get
- Return EgtMsg(6519) ' Import
+ Return EgtMsg(6519) ' Import
End Get
End Property
Public ReadOnly Property DxfScaleFactorMsg As String
Get
- Return EgtMsg(6520) ' DXF
+ Return EgtMsg(6520) ' DXF
End Get
End Property
Public ReadOnly Property StlScaleFactorMsg As String
Get
- Return EgtMsg(6521) ' STL
+ Return EgtMsg(6521) ' STL
+ End Get
+ End Property
+ Public ReadOnly Property OffScaleFactorMsg As String
+ Get
+ Return EgtMsg(6561) ' OFF
+ End Get
+ End Property
+ Public ReadOnly Property PlyScaleFactorMsg As String
+ Get
+ Return EgtMsg(6563) ' PLY
End Get
End Property
Public ReadOnly Property ImageScaleFactorMsg As String
Get
- Return EgtMsg(6522) ' Immagini
+ Return EgtMsg(6522) ' Immagini
+ End Get
+ End Property
+ Public ReadOnly Property AdvImpToleranceMsg As String
+ Get
+ Return EgtMsg(6562) ' Tolleranza di importazione
End Get
End Property
-
Public ReadOnly Property ExportMsg As String
Get
Return EgtMsg(6523) ' Export
@@ -1062,6 +1239,13 @@ Public Class OptionWindowVM
End Get
End Property
+ Public ReadOnly Property VMillQualityMsg As String
+ Get
+ Return EgtMsg(31214)
+ End Get
+ End Property
+
+
#End Region
#Region "COMMANDS"
@@ -1344,10 +1528,9 @@ Public Class OptionWindowVM
' Ripristino lo stato originale ed esco
My.Computer.FileSystem.MoveDirectory(sBackupDir, sMachDir, True)
' L'aggiornamento della macchina "{0}" non è riuscito.
- Dim sKo As String = String.Format(EgtMsg(6535), sMachName)
+ Dim sKo As String = String.Format(EgtMsg(MSG_OPTIONPAGE + 35), sMachName)
EgtOutLog(sKo)
- 'MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sKo, EgtMsg(15001), MessageBoxButton.OK) ' Errore
+ MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End Try
End If
@@ -1420,10 +1603,9 @@ Public Class OptionWindowVM
End If
End If
'La macchina "{0}" è stata aggiornata con successo.
- Dim sOk As String = String.Format(EgtMsg(6530), sMachName)
+ Dim sOk As String = String.Format(EgtMsg(MSG_OPTIONPAGE + 30), sMachName)
EgtOutLog(sOk)
- 'MessageBox.Show(sOk, EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK) ' Informazione
+ MessageBox.Show(sOk, EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK)
' Rimuovo il direttorio temporaneo
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
' Aggiorno la lista delle macchina
@@ -1485,8 +1667,7 @@ Public Class OptionWindowVM
' L'esportazione della macchina "{0}" non è riuscita.
Dim sKo As String = String.Format(EgtMsg(6551), sCurrMachineName)
EgtOutLog(sKo)
- 'MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sKo, EgtMsg(15001), MessageBoxButton.OK) ' Errore
+ MessageBox.Show(sKo, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK)
Return
End Try
'La macchina "{0}" è stata esportata con successo.
@@ -1517,8 +1698,7 @@ Public Class OptionWindowVM
If String.IsNullOrEmpty(sBeamVer) Then
' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso
Dim sOut As String = String.Format(EgtMsg(6555), "Beam")
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' AvvisoS
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
' Esco
Return
End If
@@ -1559,8 +1739,7 @@ Public Class OptionWindowVM
If String.Compare(sNewName, "Beam") <> 0 Then
' Il file zip non contiene il modulo "{0}". - Avviso
Dim sOut As String = String.Format(EgtMsg(6556), "Beam")
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Avviso
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1579,8 +1758,7 @@ Public Class OptionWindowVM
If String.Compare(sNewVer, sBeamVer) < 0 Then
' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ?
Dim sOut As String = String.Format(EgtMsg(6558), "Beam")
- 'If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
- If EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then ' Informazione
+ If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1599,8 +1777,7 @@ Public Class OptionWindowVM
' L'aggiornamento del modulo "{0}" non è riuscito. - Errore
Dim sOut As String = String.Format(EgtMsg(6559), "Beam")
EgtOutLog(sOut)
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1610,8 +1787,7 @@ Public Class OptionWindowVM
' Il modulo "{0}" è stata aggiornato con successo. - Info
Dim sOk As String = String.Format(EgtMsg(6560), "Beam")
EgtOutLog(sOk)
- 'MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK) ' Informazione
+ MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
End Sub
#End Region ' UpdateBeam
@@ -1634,8 +1810,7 @@ Public Class OptionWindowVM
If String.IsNullOrEmpty(sWallVer) Then
' Il modulo "{0}" non è stato trovato, impossibile aggiornare. - Avviso
Dim sOut As String = String.Format(EgtMsg(6555), "Wall")
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Avviso
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
' Esco
Return
End If
@@ -1676,8 +1851,7 @@ Public Class OptionWindowVM
If String.Compare(sNewName, "Wall") <> 0 Then
' Il file zip non contiene il modulo "{0}". - Avviso
Dim sOut As String = String.Format(EgtMsg(6556), "Wall")
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning) ' Avviso
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15002), MessageBoxButton.OK, MessageBoxImage.Warning)
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1696,8 +1870,7 @@ Public Class OptionWindowVM
If String.Compare(sNewVer, sWallVer) < 0 Then
' La versione del nuovo modulo "{0}" è più vecchia dell'attuale. Vuoi sovrascrivere lo stesso ?
Dim sOut As String = String.Format(EgtMsg(6558), "Wall")
- 'If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
- If EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then ' Informazione
+ If MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15003), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.No Then
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1716,8 +1889,7 @@ Public Class OptionWindowVM
' L'aggiornamento del modulo "{0}" non è riuscito. - Errore
Dim sOut As String = String.Format(EgtMsg(6559), "Wall")
EgtOutLog(sOut)
- 'MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error) ' Errore
+ MessageBox.Show(Application.Current.MainWindow, sOut, EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
' Rimuovo il direttorio temporaneo ed esco
My.Computer.FileSystem.DeleteDirectory(sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
Return
@@ -1727,8 +1899,7 @@ Public Class OptionWindowVM
' Il modulo "{0}" è stata aggiornato con successo. - Info
Dim sOk As String = String.Format(EgtMsg(6560), "Wall")
EgtOutLog(sOk)
- 'MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK) ' Informazione
+ MessageBox.Show(Application.Current.MainWindow, sOk, EgtMsg(15003), MessageBoxButton.OK)
End Sub
@@ -1845,27 +2016,24 @@ Public Class GeomTypeConverter
End Class
-Public Class ComboBoxNameConverter
+Public Class VMillTypeConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
- If TypeOf value Is Integer Then
- Select Case CInt(value)
- Case 0
- Return "Not Visualizing"
- Case 1
- Return "Top Right"
- Case 2
- Return "Top Left"
- Case 3
- Return "Bottom Left"
- Case 4
- Return "Bottom Right"
- Case Else
- Return Nothing
- End Select
- End If
- Return Nothing
+ Select Case CInt(value)
+ Case VMillSelTypeOpt.LOWER
+ Return EgtMsg(31215)
+ Case VMillSelTypeOpt.LOW
+ Return EgtMsg(31216)
+ Case VMillSelTypeOpt.STANDARD
+ Return EgtMsg(31217)
+ Case VMillSelTypeOpt.HIGH
+ Return EgtMsg(31218)
+ Case VMillSelTypeOpt.HIGHER
+ Return EgtMsg(31219)
+ Case Else
+ Return ""
+ End Select
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb
index 332e806..e267e5f 100644
--- a/Project/ProjectVM.vb
+++ b/Project/ProjectVM.vb
@@ -4,6 +4,7 @@ Imports System.IO
Imports System.Globalization
Imports EgtUILib
Imports EgtWPFLib5
+Imports System.Windows.Forms.AxHost
Public Class ProjectVM
Inherits TabViewModel
@@ -57,14 +58,16 @@ Public Class ProjectVM
End Get
End Property
-#End Region
+
+#End Region
#Region "EGTUILIB FIELDS"
Private m_bCPlaneTypePos As Boolean
' Variabile per implementazione eventi
Private m_InputText As String
+ Friend bSelObjOnScene As Boolean = False
#End Region
@@ -245,10 +248,9 @@ Public Class ProjectVM
ElseIf IniFile.m_nKeyLevel = -9 Then
EgtOutLog("Missing Link with Net Dongle")
' Box di avviso chiave mancante : "Collegamento con la Chiave di rete non riuscito. \n Verificare la connessione." "Errore"
- Dim sText As String = EgtMsg(10108) & vbCrLf & EgtMsg(10109) ' Collegamento con la Chiave di rete non riuscito. Verificare la connessione.
- Dim sTitle As String = EgtMsg(10101) ' Errore !
- 'MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
- EgtMessageBoxV.Show(Application.Current.MainWindow, sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
+ Dim sText As String = EgtMsg(10108) & vbCrLf & EgtMsg(10109)
+ Dim sTitle As String = EgtMsg(10101)
+ MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error)
' Altrimenti manca la licenza
Else
EgtOutLog("Problems with Licence")
@@ -357,6 +359,7 @@ Public Class ProjectVM
End If
End If
m_Controller.SetSurfTmTolerance(OptionModule.m_dGeometryTolerance)
+ m_Controller.SetAdvImpTolerance(OptionModule.m_dAdvImpTolerance)
m_Controller.SetUseCustomColors(True, S_SCENE, K_CUSTOMCOLORS)
' imposto unità di misura per interfaccia utente
IniFile.m_bMmUnits = (GetPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0)
@@ -414,6 +417,8 @@ Public Class ProjectVM
' Imposto default per import
m_Controller.SetScaleForDxfImport(OptionModule.m_dDxfScaleFactor)
m_Controller.SetScaleForStlImport(OptionModule.m_dStlScaleFactor)
+ m_Controller.SetScaleForOffImport(OptionModule.m_dOffScaleFactor)
+ m_Controller.SetScaleForPlyImport(OptionModule.m_dPlyScaleFactor)
m_Controller.SetScaleForImageImport(OptionModule.m_dImgScaleFactor)
' Imposto default per export
m_Controller.SetDefaultForDxfExport(OptionModule.m_nExportDxfFlag)
@@ -548,7 +553,13 @@ Public Class ProjectVM
' Esecuzione
OpenDoorFile(sFile, bNcGen, bExit, nProbing)
' Se richiesta uscita immediata
- If bExit Then Map.refMainWindowVM.CloseApplicationCmd()
+ If bExit Then
+ Map.refMainWindowVM.CloseApplicationCmd()
+ End If
+ ' Se applicate lavorazioni, vado in modalità Lavora
+ If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
+ Map.refTopCommandBarVM.SetMachiningMode()
+ End If
Return
End If
' Se file tol, gestione aggiornamento dei dati degli utensili
@@ -616,7 +627,7 @@ Public Class ProjectVM
Select Case nFileType
Case FT.NGE, FT.NFE
Return m_Controller.OpenProject(sFile, False)
- Case FT.DXF, FT.STL, FT._3MF, FT._3DM, FT.OBJ, FT.CNC, FT.CSF, FT.BTL, FT.BTLX, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML, FT.C3D
+ Case FT.DXF, FT.STL, FT._3MF, FT._3DM, FT.OFF, FT.PLY, FT.OBJ, FT.CNC, FT.CSF, FT.BTL, FT.BTLX, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML, FT.C3D
Return m_Controller.ImportProject(sFile, False)
Case FT.TSC, FT.LUA
Return m_Controller.Exec(sFile, False)
@@ -629,7 +640,6 @@ Public Class ProjectVM
' Formato descrizione porte
If Path.GetExtension(sFile).ToLower() = ".ddf" Then
nErr = ExecDoors(m_ProjectScene, sFile, bNcGen, bBatch, nProbing)
- 'CreateDoors(sFile, bNcGen, bBatch, nProbing)
Map.refProjectVM.EmitTitle()
Return True
End If
@@ -1114,8 +1124,8 @@ Public Class ProjectVM
Select Case m_SceneSelType
Case SceneSelTypeOpt.FIXTURE
Dim nFixtureId As Integer = EgtGetParent(EgtGetParent(nId))
- Dim sName As String = ""
- EgtGetName(EgtGetParent(nId), sName)
+ 'Dim sName As String = ""
+ 'EgtGetName(EgtGetParent(nId), sName)
If EgtVerifyFixture(nFixtureId) Then
m_SelType = DispositionUtility.SelType.FIXTURE
' Se già selezionato
@@ -1133,14 +1143,12 @@ Public Class ProjectVM
EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, ptCurr)
DispositionUtility.VtHookFinder(nFixtureId, ptCurr)
Exit While
- ElseIf sName.Contains(DispositionUtility.MOBILE) Then
- Dim sInfo As String = ""
- If EgtGetInfo(EgtGetParent(nId), "MDir", sInfo) Then
- m_SelType = DispositionUtility.SelType.BARS
- m_nIdToSel = EgtGetParent(nId)
- ' Drag possibile
- m_bDrag = True
- End If
+ ElseIf DispositionUtility.VerifyTableAxis( nFixtureId) Then
+ m_SelType = DispositionUtility.SelType.BARS
+ m_nIdToSel = nFixtureId
+ ' Drag possibile
+ m_bDrag = True
+ Exit While
End If
Case SceneSelTypeOpt.RAWPART, SceneSelTypeOpt.RAWPARTWITHFIXTURE
Dim nRawPartId As Integer = EgtGetParent(nId)
@@ -1202,7 +1210,6 @@ Public Class ProjectVM
vtMove.z = 0
' Muovo gli oggetti selezionati se consentito
DispositionUtility.MoveRawPartPartAndFixture(nMoveId, vtMove, m_SelType, ptCurr)
- 'EgtSaveFile("c:\Temp\ProveMovimentoVentose\Prova1.nge", NGE.BIN)
EgtDraw()
' Aggiorno il punto precedente
m_ptPrev = ptCurr
@@ -1234,7 +1241,7 @@ Public Class ProjectVM
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
Return
- ' altrimenti verifico il tipo del primo oggetto selezionato
+ ' altrimenti verifico il tipo del primo oggetto selezionato
Else
Dim nFirstSelId As Integer = EgtGetFirstSelectedObj()
' se è un riferimento resetto lo stato di selezione ed esco
@@ -1335,14 +1342,25 @@ Public Class ProjectVM
If Not EgtIsSelectedObj(nId) Then m_Controller.MouseSelectedObj(nId, bLast)
Else
m_Controller.MouseSelectedObj(nId, bLast)
+ ' Recupero primo layer selezionato
+ Dim nFirstSelId As Integer = EgtGetFirstSelectedObj()
+ ' Se viene selezionato un layer diverso deseleziono il layer precedente
+ If nFirstSelId <> nId Then
+ SetLastInteger(nFirstSelId)
+ Map.refProjectVM.ExecuteCommand(Controller.CMD.DESELECTPARTLAYEROBJ)
+ End If
' Selezione layer in albero
+ bSelObjOnScene = True
Map.refManageLayerExpanderVM.UpdateObjInObjTree(nId)
Map.refManageLayerExpanderVM.SelectIdInObjTree(nId)
Map.refManageLayerExpanderVM.UpdateObjTree()
+ Map.refProjectVM.ExecuteCommand(Controller.CMD.SETCURRPARTLAYER)
+
' Cancello geometria e info di eventuale precedente analisi
Analyze.ClearAnalyzeGroup()
Map.refStatusBarVM.NotifyStatusOutput("")
EgtDraw()
+ bSelObjOnScene = False
End If
End Sub
@@ -1574,6 +1592,8 @@ Public Class ProjectVM
nFlag = GetPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE)
ElseIf nType = FT.BTL Or nType = FT.BTLX Then
nFlag = GetPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIB_FL.NONE)
+ ElseIf nType = FT._3MF
+ nFlag = GetPrivateProfileInt(S_IMPORT, K_3MFFLAG, EI3_FL.NONE)
ElseIf nType = FT.OBJ Or nType = FT.IGES Or nType = FT.STEP_ Or nType = FT.ACIS Or
nType = FT.PARASOLID Or nType = FT.JT Or nType = FT.VRML Or nType = FT.C3D Then
nFlag = GetPrivateProfileInt(S_IMPORT, K_ADVFLAG, 0)
diff --git a/Special-Doors/MTableDbV.xaml b/Special-Doors/MTableDbV.xaml
index a72449e..de295de 100644
--- a/Special-Doors/MTableDbV.xaml
+++ b/Special-Doors/MTableDbV.xaml
@@ -139,72 +139,77 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -548,6 +553,18 @@
+
+
+
+
+
@@ -594,20 +611,25 @@
CommandParameter="{Binding Path=SelectedItem, ElementName=TablesListBox}"
IsEnabled="{Binding MoveRow_IsEnabled}"
Grid.Column="4"/>
+
+ Grid.Column="6"/>
+ Grid.Column="7"/>
+ Grid.Column="8"/>
+ Grid.Column="9"/>
diff --git a/Special-Doors/MTableDbV.xaml.vb b/Special-Doors/MTableDbV.xaml.vb
index 1f6f2bd..77fd8e4 100644
--- a/Special-Doors/MTableDbV.xaml.vb
+++ b/Special-Doors/MTableDbV.xaml.vb
@@ -1,5 +1,6 @@
Imports System.Windows.Controls.Primitives
Imports EgtWPFLib5
+Imports EgtUILib
Public Class MTableDbV
@@ -154,4 +155,31 @@ Public Class MTableDbV
WinPosFromWindowToIni(Me, S_DOORS, K_MTABLEWINPLACE)
End Sub
+
+ Public Sub DataGrid_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
+ If e.ChangedButton = MouseButton.Left Then
+ If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then
+ e.Handled = True
+ End If
+ If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control AndAlso TypeOf sender Is DataGrid AndAlso DirectCast(sender, DataGrid).SelectedItems.Count >= 2 Then
+ e.Handled = True
+ End If
+
+ End If
+ End Sub
+
+ Public Sub DataGrid_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs)
+ End Sub
+
+ Public Sub DataGrid_PreviewMouseMove(sender As Object, e As MouseEventArgs)
+ Dim Element As Object = e.OriginalSource
+ While Not IsNothing(Element) AndAlso Not TypeOf Element Is ScrollBar
+ Element = VisualTreeHelper.GetParent(Element)
+ End While
+ ' verifico che non sia ScrollBar, di modo che questa continui a funzionare, ma non possa selezionare piu' righe trascinando
+ If IsNothing(Element) OrElse Not TypeOf Element Is ScrollBar Then
+ e.Handled = True
+ End If
+ End Sub
+
End Class
diff --git a/Special-Doors/MTableDbVM.vb b/Special-Doors/MTableDbVM.vb
index 45fadfe..f0b07d2 100644
--- a/Special-Doors/MTableDbVM.vb
+++ b/Special-Doors/MTableDbVM.vb
@@ -1,6 +1,9 @@
Imports System.Collections.ObjectModel
+Imports System.Collections.Specialized
+Imports System.ComponentModel
Imports System.IO
Imports System.Text.RegularExpressions
+Imports System.Windows.Forms.LinkLabel
Imports EgtUILib
Imports EgtWPFLib5
@@ -155,6 +158,24 @@ Public Class MTableDbVM
End Set
End Property
+ Private m_Link_Visibility As Visibility = Visibility.Collapsed
+ Public ReadOnly Property Link_Visibility As Visibility
+ Get
+ Return m_Link_Visibility
+ End Get
+ End Property
+
+ Private m_Link_IsEnabled As Boolean
+ Public Property Link_IsEnabled As Boolean
+ Get
+ Return m_Link_IsEnabled
+ End Get
+ Set(value As Boolean)
+ m_Link_IsEnabled = value
+ NotifyPropertyChanged(NameOf(Link_IsEnabled))
+ End Set
+ End Property
+
#Region "Messages"
Public ReadOnly Property Title As String
@@ -358,6 +379,7 @@ Public Class MTableDbVM
Private m_cmdMoveRowDown As ICommand
Private m_cmdGroup As ICommand
Private m_cmdPosition As ICommand
+ Private m_cmdLink As ICommand
Private m_cmdCloseMTableWindow As ICommand
#Region "CONSTRUCTOR"
@@ -384,6 +406,9 @@ Public Class MTableDbVM
' Altrimenti recupero macchina corrente all'apertura della finestra per poterla ripristinare alla fine
EgtGetCurrMachineName(m_sPreviousActiveMachine)
End If
+ ' leggo abilitazione link
+ m_Link_Visibility = If(GetMainPrivateProfileInt(S_DOORS, K_OPTIMIZEMACHFORLINE, 0) = 1, Visibility.Visible, Visibility.Collapsed)
+ NotifyPropertyChanged(NameOf(Link_Visibility))
' Azzero indice per nome tabella di default
MTableListBoxItem.NewMTableIndex = 0
' Creo liste operazioni e proprietà
@@ -408,12 +433,24 @@ Public Class MTableDbVM
End If
m_TablesList(0).SelMachine = m_TablesList(0).ActiveMachinesList(0)
End If
+ For Each Table In TablesList
+ AddHandler Table.SelectedAssociations.CollectionChanged, AddressOf SelectedAssociations_CollectionChanged
+ Next
End Sub
#End Region
#Region "METHODS"
+ Private Sub SelectedAssociations_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
+ For Each Table In TablesList
+ If Table.IsSelected Then
+ AddRemoveRow_IsEnabled = Table.SelectedAssociations.Count = 1
+ Link_IsEnabled = Table.SelectedAssociations.Count = 2
+ End If
+ Next
+ End Sub
+
Private Sub UpdateTables()
m_TablesList.Clear()
' se trovo la cartella carico la lista di tabelle
@@ -1200,7 +1237,7 @@ Public Class MTableDbVM
Dim SelectedMTable As MTableListBoxItem = DirectCast(param, MTableListBoxItem)
If Not IsNothing(SelectedMTable) AndAlso Not IsNothing(SelectedMTable.SelectedAssociation) Then
Dim SelectedIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociation)
- Dim NewEmptyRow As New MTableAssociationGridBoxItem(False, String.Empty, 1, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, SelectedMTable.ActiveMachinesList, SelectedMTable.AssociationList)
+ Dim NewEmptyRow As MTableAssociationGridBoxItem = New MTableAssociationGridBoxItem(False, String.Empty, 1, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, 0, SelectedMTable.ActiveMachinesList, SelectedMTable.AssociationList)
SelectedMTable.AssociationList.Insert(SelectedIndex + 1, NewEmptyRow)
SelectedMTable.SelectedAssociation = NewEmptyRow
SelectedMTable.NotifyPropertyChanged(NameOf(SelectedMTable.SelectedAssociation))
@@ -1298,10 +1335,21 @@ Public Class MTableDbVM
' Left table Movement
Public Sub LeftTableMoveRowUp(SelectedMTable As MTableListBoxItem)
- Dim SelectedIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociation)
- If SelectedIndex >= 1 Then
- SelectedMTable.AssociationList.Move(SelectedIndex, SelectedIndex - 1)
+ If SelectedMTable.SelectedAssociations.Count < 2 Then
+ Dim SelectedIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociation)
+ If SelectedIndex >= 1 Then
+ SelectedMTable.AssociationList.Move(SelectedIndex, SelectedIndex - 1)
+ End If
+ ElseIf SelectedMTable.SelectedAssociations.Count > 2 Then
+ Return
+ Else
+ Dim MoveIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociations(0))
+ Dim DestinationIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociations(1))
+ If DestinationIndex >= 0 Then
+ SelectedMTable.AssociationList.Move(MoveIndex, If(MoveIndex > DestinationIndex, DestinationIndex, Math.Max(0, DestinationIndex - 1)))
+ End If
End If
+
End Sub
Public Sub RightTableMoveRowUp(SelectedMTable As MTableListBoxItem)
@@ -1551,9 +1599,19 @@ Public Class MTableDbVM
' Spostamento sulla tabella delle associazioni
Public Sub LeftTableMoveRowDown(SelectedMTable As MTableListBoxItem)
- Dim SelectedIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociation)
- If SelectedIndex < SelectedMTable.AssociationList.Count - 1 Then
- SelectedMTable.AssociationList.Move(SelectedIndex, SelectedIndex + 1)
+ If SelectedMTable.SelectedAssociations.Count < 2 Then
+ Dim SelectedIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociation)
+ If SelectedIndex < SelectedMTable.AssociationList.Count - 1 Then
+ SelectedMTable.AssociationList.Move(SelectedIndex, SelectedIndex + 1)
+ End If
+ ElseIf SelectedMTable.SelectedAssociations.Count > 2 Then
+ Return
+ Else
+ Dim MoveIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociations(0))
+ Dim DestinationIndex As Integer = SelectedMTable.AssociationList.IndexOf(SelectedMTable.SelectedAssociations(1))
+ If DestinationIndex < SelectedMTable.AssociationList.Count Then
+ SelectedMTable.AssociationList.Move(MoveIndex, If(MoveIndex > DestinationIndex, DestinationIndex + 1, DestinationIndex))
+ End If
End If
End Sub
@@ -1565,6 +1623,39 @@ Public Class MTableDbVM
#End Region ' MoveRowDownCommand
+#Region "Link"
+
+ '''
+ ''' Returns a command that do Exec.
+ '''
+ Public ReadOnly Property LinkCommand As ICommand
+ Get
+ If m_cmdLink Is Nothing Then
+ m_cmdLink = New Command(AddressOf Link)
+ End If
+ Return m_cmdLink
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Sub Link(param As Object)
+ Dim SelectedMTable As MTableListBoxItem = DirectCast(param, MTableListBoxItem)
+ If IsNothing(SelectedMTable) OrElse SelectedMTable.SelectedAssociations.Count <> 2 Then Return
+ 'If (SelectedMTable.SelectedAssociations(0).nLink = 0 AndAlso SelectedMTable.SelectedAssociations(1).nLink <> 0) OrElse (SelectedMTable.SelectedAssociations(0).nLink <> 0 AndAlso SelectedMTable.SelectedAssociations(1).nLink = 0) Then Return
+ If SelectedMTable.SelectedAssociations(0).nLink = 0 AndAlso SelectedMTable.SelectedAssociations(1).nLink = 0 Then
+ Dim nNewIndex As Integer = SelectedMTable.AssociationList.Max(Function(x) x.nLink) + 1
+ SelectedMTable.SelectedAssociations(0).SetLink(nNewIndex)
+ SelectedMTable.SelectedAssociations(1).SetLink(-nNewIndex)
+ ElseIf SelectedMTable.SelectedAssociations(0).nLink = Math.Abs(SelectedMTable.SelectedAssociations(1).nLink) OrElse SelectedMTable.SelectedAssociations(1).nLink = Math.Abs(SelectedMTable.SelectedAssociations(0).nLink) Then
+ SelectedMTable.SelectedAssociations(0).SetLink(0)
+ SelectedMTable.SelectedAssociations(1).SetLink(0)
+ End If
+ End Sub
+
+#End Region ' MoveRowDownCommand
+
#Region "GroupCommand"
'''
diff --git a/Special-Doors/MTableListBox.vb b/Special-Doors/MTableListBox.vb
index 7bdcb63..a37092c 100644
--- a/Special-Doors/MTableListBox.vb
+++ b/Special-Doors/MTableListBox.vb
@@ -1,6 +1,8 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtWPFLib5
+Imports EgtCAM5.MachineModel
+Imports System.Collections.Specialized
Public Class MTableListBoxItem
Inherits VMBase
@@ -145,10 +147,30 @@ Public Class MTableListBoxItem
Private m_SelectedAssociation As MTableAssociationGridBoxItem
Public Property SelectedAssociation As MTableAssociationGridBoxItem
Get
- Return m_SelectedAssociation
+ Return m_SelectedAssociations(0)
End Get
Set(value As MTableAssociationGridBoxItem)
- m_SelectedAssociation = value
+ Dim bFound As Boolean = False
+ For ItemIndex = m_SelectedAssociations.Count - 1 To 0 Step -1
+ If m_SelectedAssociations(ItemIndex) Is value Then
+ bFound = True
+ Else
+ m_SelectedAssociations.RemoveAt(ItemIndex)
+ End If
+ If Not bFound Then
+ m_SelectedAssociations.Add(value)
+ End If
+ Next
+ End Set
+ End Property
+
+ Private m_SelectedAssociations As New ObservableCollection(Of MTableAssociationGridBoxItem)
+ Public Property SelectedAssociations As ObservableCollection(Of MTableAssociationGridBoxItem)
+ Get
+ Return m_SelectedAssociations
+ End Get
+ Set(value As ObservableCollection(Of MTableAssociationGridBoxItem))
+ m_SelectedAssociations = value
End Set
End Property
@@ -166,6 +188,11 @@ Public Class MTableListBoxItem
Sub New(sTableName As String, sTableNamePath As String)
TableName = sTableName
m_TableNamePath = sTableNamePath
+ AddHandler m_SelectedAssociations.CollectionChanged, AddressOf SelectedAssociations_CollectionChanged
+ End Sub
+
+ Private Sub SelectedAssociations_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs)
+
End Sub
Private Function ReadMTableFile() As Boolean
@@ -173,7 +200,7 @@ Public Class MTableListBoxItem
SharedMachIndex += 1
ActiveMachinesList.Add(New MTableMachineListBoxItem(String.Empty, False, False, SharedMachIndex))
m_MachIdList.Add(SharedMachIndex)
- AssociationList.Add(New MTableAssociationGridBoxItem(False, String.Empty, Nothing, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, ActiveMachinesList, m_AssociationList))
+ AssociationList.Add(New MTableAssociationGridBoxItem(False, String.Empty, Nothing, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, 0, ActiveMachinesList, m_AssociationList))
Return True
End If
' resetto indici macchine impostati in tabella
@@ -819,7 +846,7 @@ Public Class MTableAssociationGridBoxItem
' Verifico se i nomi già presenti per Mach, MachUp e MachDw sono validi per la nuova macchina
If Not IsNothing(m_SelectedMachType) Then
m_RefMachItem = ManageOrderedMachining(Mach, nOldMachId, RefMachItem)
- If String.IsNullOrWhiteSpace(m_Mach) Then NotifyPropertyChanged(NameOf(Mach))
+ If String.IsNullOrWhiteSpace(m_Mach) Then NotifyPropertyChanged("Mach")
End If
If Not IsNothing(m_SelectedMachUpType) Then
m_RefMachUpItem = ManageOrderedMachining(MachUp, nOldMachId, RefMachUpItem)
@@ -1058,8 +1085,33 @@ Public Class MTableAssociationGridBoxItem
End Set
End Property
+ Private m_Link As Integer
+ Public Property Link As String
+ Get
+ Return m_Link.ToString()
+ End Get
+ Set(value As String)
+ Dim nValue As Integer = 0
+ If Integer.TryParse(value, nValue) Then
+ m_IsModified = True
+ m_Link = nValue
+ Else
+ NotifyPropertyChanged(NameOf(Link))
+ End If
+ End Set
+ End Property
+ Public ReadOnly Property nLink As Integer
+ Get
+ Return m_Link
+ End Get
+ End Property
+ Public Sub SetLink(value As Integer)
+ m_Link = value
+ NotifyPropertyChanged(NameOf(Link))
+ End Sub
+
Sub New(bOn As Boolean, sName As String, nMachId As Integer, nShift As Integer, sOper As String,
- RefMachItem As MTableMachiningGridBoxItem, sMach As String, RefMachUpItem As MTableMachiningGridBoxItem, sMachUp As String, RefMachDwItem As MTableMachiningGridBoxItem, sMachDw As String,
+ RefMachItem As MTableMachiningGridBoxItem, sMach As String, RefMachUpItem As MTableMachiningGridBoxItem, sMachUp As String, RefMachDwItem As MTableMachiningGridBoxItem, sMachDw As String, nLink As Integer,
ByRef ActiveMachinesList As ObservableCollection(Of MTableMachineListBoxItem), ByRef AssociationList As ObservableCollection(Of MTableAssociationGridBoxItem))
OnPar = bOn
@@ -1102,7 +1154,7 @@ Public Class MTableAssociationGridBoxItem
' Assegno l'operazione
Oper = sOper
' dall'MId recupero la macchina a cui si riferisce questa associazione e la imposto come corrente
- If not IsNothing(m_ActiveMachinesList(m_MachId - 1).SelectedMachine) Then
+ If Not IsNothing(m_ActiveMachinesList(m_MachId - 1).SelectedMachine) Then
EgtSetCurrMachine(m_ActiveMachinesList(m_MachId - 1).SelectedMachine.Name)
' Imposto MachType selezionato cercando il tipo delle lavorazioni
If EgtMdbSetCurrMachining(sMach) Then
@@ -1175,6 +1227,7 @@ Public Class MTableAssociationGridBoxItem
m_RefMachDwItem = RefMachDwItem
End If
End If
+ m_Link = nLink
m_IsModified = False
End Sub
@@ -1191,7 +1244,7 @@ Public Class MTableAssociationGridBoxItem
End If
Next
End If
- ' Se il nuovo valore è valido
+ ' Se il nuovo valore è valido
Else
' Se non esiste già il rispettivo item nella lista lavorazioni ordinata lo creo
If IsNothing(RefMachItem) Then
@@ -1207,7 +1260,7 @@ Public Class MTableAssociationGridBoxItem
m_ActiveMachinesList(MachIndex).MachiningList.Insert(0, RefMachItem)
End If
Next
- ' altrimenti lo aggiorno con la nuova lavorazione
+ ' altrimenti lo aggiorno con la nuova lavorazione
Else
RefMachItem.Machining = Mach
End If
diff --git a/Special-Doors/TableUtility.vb b/Special-Doors/TableUtility.vb
index 2b03f6f..0d3f25d 100644
--- a/Special-Doors/TableUtility.vb
+++ b/Special-Doors/TableUtility.vb
@@ -25,6 +25,7 @@ Module TableUtility
Private Const MACHDW As String = "MachDw"
Private Const MACHID As String = "MachId"
Private Const SHIFT As String = "Shift"
+ Private Const LINK As String = "Link"
Private Const PROPERTYTABLE As String = "PropertyTable"
Private Const OPER As String = "Oper"
Private Const GROUP As String = "Group"
@@ -92,6 +93,7 @@ Module TableUtility
Dim nMachId As Integer = 1
Dim nShift As Integer = 0
Dim sOper As String = String.Empty
+ Dim nLink As Integer = 0
If Not String.IsNullOrEmpty(sName) Then
Dim sOn As String = SearchKey(FileContent(LineIndex), ONCONST)
If Not String.IsNullOrEmpty(sOn) Then
@@ -165,7 +167,9 @@ Module TableUtility
End If
End If
Next
- Table.AssociationList.Add(New MTableAssociationGridBoxItem(bOn, sName, nMachId, nShift, sOper, MachItem, sMach, MachUpItem, sMachUp, MachDwItem, sMachDw, Table.ActiveMachinesList, Table.AssociationList))
+ Dim sLink As String = SearchKey(FileContent(LineIndex), LINK)
+ Integer.TryParse(sLink, nLink)
+ Table.AssociationList.Add(New MTableAssociationGridBoxItem(bOn, sName, nMachId, nShift, sOper, MachItem, sMach, MachUpItem, sMachUp, MachDwItem, sMachDw, nLink, Table.ActiveMachinesList, Table.AssociationList))
End If
End If
If bPropertyTable Then
@@ -236,7 +240,7 @@ Module TableUtility
End If
' se nessuna lavorazione, ne aggiungo una vuota
If Table.AssociationList.Count = 0 Then
- Table.AssociationList.Add(New MTableAssociationGridBoxItem(False, String.Empty, 0, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Table.ActiveMachinesList, Table.AssociationList))
+ Table.AssociationList.Add(New MTableAssociationGridBoxItem(False, String.Empty, 0, 0, String.Empty, Nothing, String.Empty, Nothing, String.Empty, Nothing, String.Empty, 0, Table.ActiveMachinesList, Table.AssociationList))
End If
Return True
End Function
@@ -470,7 +474,8 @@ Module TableUtility
", MachUp = '" & SelectedTable.AssociationList(Index).MachUp & "'", String.Empty) &
If(Not String.IsNullOrEmpty(SelectedTable.AssociationList(Index).MachDw), ", MachDwOrd = '" & SelectedTable.AssociationList(Index).RefMachDwItem.RWGroupId & "'" &
", MachDwJoin = '" & If(SelectedTable.AssociationList(Index).RefMachDwItem.Join, 1, 0) & "'" &
- ", MachDw = '" & SelectedTable.AssociationList(Index).MachDw & "'", String.Empty) & " }"
+ ", MachDw = '" & SelectedTable.AssociationList(Index).MachDw & "'", String.Empty) &
+ If(Not String.IsNullOrEmpty(SelectedTable.AssociationList(Index).Link), ", Link = '" & SelectedTable.AssociationList(Index).Link & "'", String.Empty) & " }"
If Index < SelectedTable.AssociationList.Count - 1 Then
CurrentLine &= " ,"
End If
diff --git a/StructureDataForMessenger.vb b/StructureDataForMessenger.vb
index 5d1869e..eb295de 100644
--- a/StructureDataForMessenger.vb
+++ b/StructureDataForMessenger.vb
@@ -1,4 +1,6 @@
Imports EgtUILib
+Imports EgtWPFLib5
+Imports EgtWPFLib5.MachiningTreeViewItem
Public Class PrepareInputBoxParam
Friend sTitle As String
@@ -62,4 +64,112 @@ Public Class NewMachOpParam
Me.SelMachOpId = SelMachOpId
End Sub
+End Class
+
+Public Class InfoItem
+ Inherits VMBase
+
+#Region "FIELDS & PROPERTIES"
+
+ Friend nId As Integer
+ '''
+ ''' Indice lista info note
+ '''
+ Public ReadOnly Property Id As Integer
+ Get
+ Return Id
+ End Get
+ End Property
+
+ Friend sKey As String
+ '''
+ ''' Chiave lista info note
+ '''
+ Public ReadOnly Property Key As String
+ Get
+ Return sKey
+ End Get
+ End Property
+
+ Friend sValour As String
+ '''
+ ''' Valore lista info note
+ '''
+ Public Property Valour As String
+ Get
+ Return sValour
+ End Get
+ Set(value As String)
+ sValour = value
+ NotifyPropertyChanged(NameOf(Valour))
+ End Set
+ End Property
+
+#End Region ' Fields & Properties
+
+ ' Comandi
+ Private m_cmdRemoveInfoItem As ICommand
+ Private m_cmdDoneInfo As ICommand
+
+#Region "CONSTRUCTORS"
+
+ Sub New(nId As Integer, sKey As String, sValue As String)
+ Me.nId = nId
+ Me.sKey = sKey
+ Me.sValour = sValue
+ End Sub
+
+#End Region ' Constructors
+
+#Region "COMMANDS"
+
+#Region "RemoveItemNoteCommand"
+
+ '''
+ ''' Comando per rimuovere l'informazione selezionata dalla combobox
+ '''
+ Public ReadOnly Property RemoveInfoItemCommand As ICommand
+ Get
+ If m_cmdRemoveInfoItem Is Nothing Then
+ m_cmdRemoveInfoItem = New Command(AddressOf RemoveInfoItem)
+ End If
+ Return m_cmdRemoveInfoItem
+ End Get
+ End Property
+
+ '''
+ ''' Rimuove l'informazione selezionata dalla combobox
+ '''
+ '''
+ Public Sub RemoveInfoItem(ByVal param As Object)
+ Map.refInputExpanderVM.RemoveItemInfo(Me)
+ End Sub
+
+#End Region ' RemoveItemNoteCommand
+
+#Region "DoneInfoCommand"
+
+ '''
+ ''' Comando per la conferma modifica o aggiunta nuova informazione
+ '''
+ Public ReadOnly Property DoneInfoCommand As ICommand
+ Get
+ If m_cmdDoneInfo Is Nothing Then
+ m_cmdDoneInfo = New Command(AddressOf DoneInfo)
+ End If
+ Return m_cmdDoneInfo
+ End Get
+ End Property
+
+ '''
+ ''' Conferma modifica o aggiunta nuova informazione
+ '''
+ Public Sub DoneInfo(ByVal param As Object)
+ Map.refInputExpanderVM.Done(Me)
+ End Sub
+
+#End Region ' DoneInfoCommand
+
+#End Region ' Commands
+
End Class
\ No newline at end of file
diff --git a/TopCommandBar/TopCommandBarVM.vb b/TopCommandBar/TopCommandBarVM.vb
index 25d24c8..bd45cdf 100644
--- a/TopCommandBar/TopCommandBarVM.vb
+++ b/TopCommandBar/TopCommandBarVM.vb
@@ -219,8 +219,12 @@ Public Class TopCommandBarVM
Dim bAllowEmpty As Boolean = (Keyboard.IsKeyDown(Key.LeftShift) OrElse Keyboard.IsKeyDown(Key.RightShift))
' Cerco di preimpostare come corrente la macchina opportuna
If Not bAllowEmpty AndAlso EgtGetSelectedObjCount() = 0 AndAlso EgtGetMachGroupCount() > 0 Then
+ Dim nMchGrpId As Integer = EgtGetCurrMachGroup()
+ If nMchGrpId = GDB_ID.NULL Then
+ nMchGrpId = EgtGetFirstMachGroup()
+ End If
Dim sMachineName As String = ""
- If EgtGetMachGroupMachineName(EgtGetLastMachGroup(), sMachineName) Then
+ if EgtGetMachGroupMachineName( nMchGrpId, sMachineName) Then
Map.refMachinePanelVM.SelectedMachine = Map.refMachinePanelVM.MachinesList.FirstOrDefault(Function(x) x.Name = sMachineName)
End If
End If
diff --git a/Utility/IniFile.vb b/Utility/IniFile.vb
index 0094a55..c8acdb5 100644
--- a/Utility/IniFile.vb
+++ b/Utility/IniFile.vb
@@ -33,6 +33,14 @@ Public Module IniFile
MACHPATH = 5
End Enum
+ Public Enum VMillSelTypeOpt As Integer
+ LOWER = -2
+ LOW = -1
+ STANDARD = 0
+ HIGH = 1
+ HIGHER = 2
+ End Enum
+
' MainWindow Page
Friend m_nInstance As Integer = 0
Friend m_nUserLevel As Integer = 1