From 993e7e86a24949501fde1ff411c514ed93af2479 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 10 Jun 2025 18:38:46 +0200 Subject: [PATCH] EgtCAM5 2.7f2 : - modifiche per aggiunta utensile di tipo Probe e lavorazione Probing. --- Constants/ConstIni.vb | 1 + Constants/ConstMachIni.vb | 2 + EgtCAM5.vbproj | 7 + My Project/AssemblyInfo.vb | 4 +- .../MachiningTreeExpanderVM.vb | 2 + .../FiveAxisMachinigParameterExpanderV.xaml | 2 +- ...FiveAxisMachinigParameterExpanderV.xaml.vb | 2 +- .../MachiningParameterExpanderVM.vb | 9 +- .../ProbingParameterExpanderV.xaml | 270 ++++++++++++++++++ .../ProbingParameterExpanderV.xaml.vb | 83 ++++++ .../OperationParametersExpanderVM.vb | 2 + OptionsWindow/OptionModule.vb | 3 + OptionsWindow/OptionWindowV.xaml | 11 +- OptionsWindow/OptionWindowVM.vb | 17 ++ Utility/MachineModel.vb | 6 + 15 files changed, 414 insertions(+), 7 deletions(-) create mode 100644 OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/ProbingParameterExpanderV.xaml create mode 100644 OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/ProbingParameterExpanderV.xaml.vb diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 66d01a0..be8a10b 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -189,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_SELGEOMPROBING As String = "SelGeomProbing" Public Const K_SELVMILLQUALITY As String = "VMillQuality" Public Const K_MACHININGGROUP As String = "MachiningGroup" Public Const K_SHOWONLYTABLE As String = "ShowOnlyTable" diff --git a/Constants/ConstMachIni.vb b/Constants/ConstMachIni.vb index df26bff..c37620d 100644 --- a/Constants/ConstMachIni.vb +++ b/Constants/ConstMachIni.vb @@ -4,6 +4,7 @@ Public Const K_EXTENSION As String = "Extension" Public Const S_TOOLS As String = "Tools" + Public Const K_PROBE As String = "Probe" Public Const K_DRILLBIT As String = "Drillbit" Public Const K_SAWBLADE As String = "Sawblade" Public Const K_MILL As String = "Mill" @@ -21,6 +22,7 @@ Public Const S_TOOLHOLDER As String = "ToolHolder" Public Const S_MACHININGS As String = "Machinings" + Public Const K_PROBING As String = "Probing" Public Const K_SAWING As String = "Sawing" Public Const K_DRILLING As String = "Drilling" Public Const K_MILLING As String = "Milling" diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj index d45e2e6..6e8b265 100644 --- a/EgtCAM5.vbproj +++ b/EgtCAM5.vbproj @@ -173,6 +173,9 @@ EstimationsExpanderV.xaml + + ProbingParameterExpanderV.xaml + FiveAxisMachinigParameterExpanderV.xaml @@ -475,6 +478,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index d9f143e..55063f4 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -70,6 +70,6 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb index 2dfa088..6241136 100644 --- a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb @@ -152,6 +152,8 @@ Public Class MachiningTreeExpanderVM Return EgtMsg(MSG_MACHININGSDBPAGE + 12) Case MCH_MY.FIVEAXISMILLING Return EgtMsg(31213) + Case MCH_MY.PROBING + Return EgtMsg(31220) Case Else Return "Mach" End Select diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/FiveAxisMachinigParameterExpanderV.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/FiveAxisMachinigParameterExpanderV.xaml index 74e43e5..650ef44 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/FiveAxisMachinigParameterExpanderV.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/FiveAxisMachinigParameterExpanderV.xaml @@ -1,4 +1,4 @@ - + + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/ProbingParameterExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/ProbingParameterExpanderV.xaml.vb new file mode 100644 index 0000000..fd885e5 --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/ProbingParameterExpanderV.xaml.vb @@ -0,0 +1,83 @@ +Imports EgtWPFLib5.EgtFloating + +Public Class ProbingParameterExpanderV + + Private m_RightTrayV As RightTrayV + Private EgtFloatingPanel As EgtFloatingPanel + + Private m_bFirst As Boolean = True + + Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded + If m_bFirst Then + m_RightTrayV = FindAncestor(Of RightTrayV)(Me) + EgtFloatingPanel = FindAncestor(Of EgtFloatingPanel)(Me) + AddHandler m_RightTrayV.SizeChanged, AddressOf RightTrayV_SizeChanged + PanelHeight = EgtFloatingPanel.DesiredSize.Height + Me.AutomaticCloseExpanderStackPanelHeight = AutomaticCloseExpanderStackPanel.ActualHeight + m_bFirst = False + End If + CalculateOperationParametersStackPanelMaxHeight() + End Sub + + Dim m_bSizeChanging As Boolean = False + + Private Sub RightTrayV_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs) + If m_bSizeChanging Then Return + m_bSizeChanging = True + CalculateOperationParametersStackPanelMaxHeight() + m_bSizeChanging = False + End Sub + + Dim PanelHeight As Double = 0 + Dim AutomaticCloseExpanderStackPanelHeight As Double = 0 + + ' ricalcola spazio utilizzabile quando modificata dimensione finestra e quindi dimensione della tray + Private Sub CalculateOperationParametersStackPanelMaxHeight() + Dim AutomaticCloseExpanderStackPanelHeight As Double = 0 + Dim OpenedExpanderList As New List(Of Boolean) + For Index = 0 To AutomaticCloseExpanderStackPanel.Children.Count - 1 + If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then + Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander) + If IndexedExpander.IsExpanded Then + OpenedExpanderList.Add(True) + IndexedExpander.IsExpanded = False + Dim CurrExpanderContent As FrameworkElement = DirectCast(IndexedExpander.Content, FrameworkElement) + CurrExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity)) + AutomaticCloseExpanderStackPanelHeight -= CurrExpanderContent.DesiredSize.Height + ' Sottraggo anche i padding + AutomaticCloseExpanderStackPanelHeight -= (IndexedExpander.Padding.Top + IndexedExpander.Padding.Bottom) + Else + OpenedExpanderList.Add(False) + End If + Else + OpenedExpanderList.Add(False) + End If + Next + Dim RemainingHeight As Double = m_RightTrayV.ActualHeight - PanelHeight + AutomaticCloseExpanderStackPanel.MaxHeight = Me.AutomaticCloseExpanderStackPanelHeight + RemainingHeight + For Index = AutomaticCloseExpanderStackPanel.Children.Count - 1 To 0 Step -1 + If TypeOf AutomaticCloseExpanderStackPanel.Children(Index) Is Expander Then + Dim IndexedExpander As Expander = DirectCast(AutomaticCloseExpanderStackPanel.Children(Index), Expander) + If OpenedExpanderList(Index) Then + IndexedExpander.IsExpanded = True + End If + End If + Next + End Sub + + ' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject + Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T + Dim target As DependencyObject = dependencyObject + Do + target = LogicalTreeHelper.GetParent(target) + Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T) + If IsNothing(target) Then + target = dependencyObject + Do + target = VisualTreeHelper.GetParent(target) + Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T) + End If + Return TryCast(target, T) + End Function + +End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb index 7b2baf5..2aa1cf0 100644 --- a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb @@ -177,6 +177,8 @@ Public Class OperationParametersExpanderVM Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomWaterJetting Case MCH_OY.FIVEAXISMILLING Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomFiveAxMilling + Case MCH_OY.PROBING + Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomProbing End Select ' Imposto visualizzazione utensile Map.refMachiningParameterExpanderVM.SetViewTool( True) diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb index 2c6b128..4ec783a 100644 --- a/OptionsWindow/OptionModule.vb +++ b/OptionsWindow/OptionModule.vb @@ -59,6 +59,7 @@ Friend Module OptionModule Friend m_SelGeomSurfRoughing As SceneSelModeOpt Friend m_SelGeomWaterJetting As SceneSelModeOpt Friend m_SelGeomFiveAxMilling As SceneSelModeOpt + Friend m_SelGeomProbing 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 @@ -154,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_SELGEOMPROBING, -1) + m_SelGeomProbing = 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 diff --git a/OptionsWindow/OptionWindowV.xaml b/OptionsWindow/OptionWindowV.xaml index 904deb9..3436598 100644 --- a/OptionsWindow/OptionWindowV.xaml +++ b/OptionsWindow/OptionWindowV.xaml @@ -9,7 +9,7 @@ WindowStyle="None" ResizeMode="NoResize" TitleBarHeight="30" IsResizable="False" IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" MinWidth="400" MinHeight="382" - Width="400" Height="575" + Width="400" Height="600" CloseCommand="{Binding CloseOptionsCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> @@ -249,6 +249,15 @@ Header="{Binding MachiningSelGeomMsg}" Margin="5,5,5,0"> + + + + + + + + diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb index 5e659bc..d8c617b 100644 --- a/OptionsWindow/OptionWindowVM.vb +++ b/OptionsWindow/OptionWindowVM.vb @@ -214,6 +214,17 @@ Public Class OptionWindowVM End Set End Property + Public Property SelectedProbingGeomType As SceneSelModeOpt + Get + Return OptionModule.m_SelGeomProbing + End Get + Set(value As SceneSelModeOpt) + If WritePrivateProfileString(S_MACH, K_SELGEOMPROBING, CInt(value).ToString()) Then + OptionModule.m_SelGeomProbing = value + End If + End Set + End Property + Public Property SelectedVMillTypeType As VMillSelTypeOpt Get Return OptionModule.m_SelVMillQuality @@ -1134,6 +1145,12 @@ Public Class OptionWindowVM Return EgtMsg(31212) End Get End Property + + Public ReadOnly Property GeomTypeProbingMsg As String + Get + Return EgtMsg(31220) + End Get + End Property Public ReadOnly Property VMillQualityMsg As String Get diff --git a/Utility/MachineModel.vb b/Utility/MachineModel.vb index 8ebcb1e..f951924 100644 --- a/Utility/MachineModel.vb +++ b/Utility/MachineModel.vb @@ -11,6 +11,9 @@ Public Module MachineModel ''' Friend Function ReadActiveMachiningsFamilies() As MachiningsType() Dim ActiveMachiningsFamiliesList As New List(Of MachiningsType) + If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_PROBING, 0, m_sCurrMachIniFilePath) <> 0 Then + ActiveMachiningsFamiliesList.Add(New MachiningsType With {.TypeId = MCH_MY.PROBING, .TypeName = EgtMsg(31220)}) + End If If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_DRILLING, 0, m_sCurrMachIniFilePath) <> 0 Then ActiveMachiningsFamiliesList.Add(New MachiningsType With {.TypeId = MCH_MY.DRILLING, .TypeName = EgtMsg(MSG_MACHININGSDBPAGE + 1)}) End If @@ -163,6 +166,9 @@ Public Module MachineModel ''' Friend Function ReadActiveToolsFamilies() As ToolsFamily() Dim ActiveToolsFamiliesList As New List(Of ToolsFamily) + If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_PROBE, 0, m_sCurrMachIniFilePath) <> 0 Then + ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.PROBE, EgtMsg(31011))) ' Tastatore + End If If EgtUILib.GetPrivateProfileInt(S_TOOLS, K_DRILLBIT, 0, m_sCurrMachIniFilePath) <> 0 Then ActiveToolsFamiliesList.Add(New ToolsFamily(MCH_TF.DRILLBIT, EgtMsg(MSG_TOOLSDBPAGE + 1))) End If