From 0f32dde7db00e2e8ff02f1d17ef376315332b7a3 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Tue, 29 Nov 2016 18:46:51 +0000 Subject: [PATCH] EgtCAM5 : - Aggiunta voce SplitArcs nelle MachOptions. - Aggiunto modulo con parametri utili della finestra Options. - Piccola miglioria progetto selezione avanzata(scalo le linee sul piano di vista corrente). --- Constants/ConstIni.vb | 2 + Constants/ConstMsg.vb | 1 + EgtCAM5.vbproj | 1 + IniFile.vb | 10 --- MachOptionsWindow/MachOptionsView.xaml | 26 +++++-- MachOptionsWindow/MachOptionsViewModel.vb | 62 ++++++++++++++- MainWindow/MainWindowViewModel.vb | 8 +- OptionsWindow/OptionModule.vb | 75 +++++++++++++++++++ OptionsWindow/OptionsView.xaml | 21 +++++- OptionsWindow/OptionsViewModel.vb | 37 ++++++--- .../OperationExpanderViewModel.vb | 29 ++----- ProjectPage/ProjectViewModel.vb | 23 +++--- Utility.vb | 31 -------- 13 files changed, 229 insertions(+), 97 deletions(-) create mode 100644 OptionsWindow/OptionModule.vb diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index bd02501..35f089a 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -115,6 +115,8 @@ Module ConstIni Public Const K_SLIDERX As String = "SliderX" Public Const K_SLIDERVAL As String = "SliderVal" + Public Const S_OPTIONS As String = "Options" + Public Const K_NEWMACHININGISLASTONE As String = "NewMachiningIsLastOne" Public Const S_MRUFILES As String = "MruFiles" Public Const S_MRUSCRIPTS As String = "MruScripts" diff --git a/Constants/ConstMsg.vb b/Constants/ConstMsg.vb index 6b8b3f9..9810634 100644 --- a/Constants/ConstMsg.vb +++ b/Constants/ConstMsg.vb @@ -15,6 +15,7 @@ Public Const MSG_TOOLSERRORS As Integer = MSG_EGTCAM5 + 1100 Public Const MSG_MACHININGSDBPAGE As Integer = MSG_EGTCAM5 + 1200 Public Const MSG_MACHININGSERRORS As Integer = MSG_EGTCAM5 + 1350 + Public Const MSG_MACHININGOPTIONPAGE As Integer = MSG_EGTCAM5 + 1400 Public Const MSG_OPTIONPAGE As Integer = MSG_EGTCAM5 + 1500 Public Const MSG_DOORS As Integer = MSG_EGTCAM5 + 3000 Public Const MSG_DOORSERRORS As Integer = MSG_EGTCAM5 + 3100 diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj index d2d9c81..3dd58c1 100644 --- a/EgtCAM5.vbproj +++ b/EgtCAM5.vbproj @@ -144,6 +144,7 @@ + OptionsView.xaml diff --git a/IniFile.vb b/IniFile.vb index a5d41a2..a7e49bb 100644 --- a/IniFile.vb +++ b/IniFile.vb @@ -49,8 +49,6 @@ Public Module IniFile Friend m_bDrawShowGrid As Boolean Friend m_bMachiningShowGrid As Boolean = False Friend m_bShowGridFrame As Boolean - Friend m_LanguageList As New ObservableCollection(Of Language) - Friend m_SelectedLanguage As Language ' Project Page Friend m_ProjectSceneContext As Integer = 0 Friend m_bScriptRunning As Boolean = False @@ -82,14 +80,6 @@ Public Module IniFile Friend m_ToolsDbSceneContext As Integer = 0 ' Variabile che dice se sono abilitati i gruppi di lavorazione Friend m_bMachiningGroup As Boolean - ' Variabili che indicano per ogni tipo di lavorazione quale geometria è selezionabile - Friend m_SelGeomSawing As SceneSelModeOpt - Friend m_SelGeomDrilling As SceneSelModeOpt - Friend m_SelGeomMilling As SceneSelModeOpt - Friend m_SelGeomPocketing As SceneSelModeOpt - Friend m_SelGeomMortising As SceneSelModeOpt - Friend m_SelGeomSawRoughing As SceneSelModeOpt - Friend m_SelGeomSawFinishing As SceneSelModeOpt Public Function GetPrivateProfileInt(IpAppName As String, IpKeyName As String, nDefault As Integer) As Integer Return EgtUILib.GetPrivateProfileInt(IpAppName, IpKeyName, nDefault, m_sIniFile) diff --git a/MachOptionsWindow/MachOptionsView.xaml b/MachOptionsWindow/MachOptionsView.xaml index 94ec4db..0b7e929 100644 --- a/MachOptionsWindow/MachOptionsView.xaml +++ b/MachOptionsWindow/MachOptionsView.xaml @@ -10,6 +10,10 @@ IsMinimizable="False" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" CloseCommand="{Binding CloseMachOptionsCommand, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"> + + + + @@ -18,13 +22,25 @@ + + - - - - - + + + + + + + + + + + + + + diff --git a/MachOptionsWindow/MachOptionsViewModel.vb b/MachOptionsWindow/MachOptionsViewModel.vb index e500315..542e84a 100644 --- a/MachOptionsWindow/MachOptionsViewModel.vb +++ b/MachOptionsWindow/MachOptionsViewModel.vb @@ -21,11 +21,49 @@ Namespace EgtCAM5 End Set End Property + Private m_SplitArcsList As New List(Of MCH_SA)({MCH_SA.NEVER, MCH_SA.GEN_PLANE, MCH_SA.NO_XY_PLANE, MCH_SA.ALWAYS}) + Public ReadOnly Property SplitArcsList As List(Of MCH_SA) + Get + Return m_SplitArcsList + End Get + End Property + + Private m_SelectedSplitArcs As MCH_SA + Public Property SelectedSplitArcs As MCH_SA + Get + Return m_SelectedSplitArcs + End Get + Set(value As MCH_SA) + EgtMdbSetGeneralParam(MCH_GP.SPLITARCS, value) + EgtMdbSave() + m_SelectedSplitArcs = value + End Set + End Property + +#Region "Messages" + + Public ReadOnly Property SafeZMsg As String + Get + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 1) + End Get + End Property + Public ReadOnly Property SplitArcsMsg As String + Get + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 2) + End Get + End Property + +#End Region + Sub New() ' Leggo distanza di sicurezza Dim dVal As Double = 0 EgtMdbGetGeneralParam(MCH_GP.SAFEZ, dVal) m_dSafeZ = LenToString(dVal, 2) + ' Leggo tipo di spezzatura archi + Dim nVal As Integer = 0 + EgtMdbGetGeneralParam(MCH_GP.SPLITARCS, nVal) + m_SelectedSplitArcs = DirectCast(nVal, MCH_SA) End Sub #Region "COMMANDS" @@ -63,4 +101,26 @@ Namespace EgtCAM5 End Class -End Namespace \ No newline at end of file +End Namespace + +Public Class SplitArcTypeConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert + Select Case CInt(value) + Case MCH_SA.NEVER + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 3) + Case MCH_SA.GEN_PLANE + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 4) + Case MCH_SA.NO_XY_PLANE + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 5) + Case Else + Return EgtMsg(MSG_MACHININGOPTIONPAGE + 6) + End Select + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException + End Function + +End Class \ No newline at end of file diff --git a/MainWindow/MainWindowViewModel.vb b/MainWindow/MainWindowViewModel.vb index a9bb623..75a8e00 100644 --- a/MainWindow/MainWindowViewModel.vb +++ b/MainWindow/MainWindowViewModel.vb @@ -338,17 +338,19 @@ Namespace EgtCAM5 Dim nIndex As Integer = 1 Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex) While Not IsNothing(ReadLanguage) - IniFile.m_LanguageList.Add(ReadLanguage) + OptionModule.m_LanguageList.Add(ReadLanguage) nIndex += 1 ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex) End While + ' Inizializzo OptionModule + OptionModule.InitOptionModule() ' Leggo file messaggi Dim sMsgName As String = String.Empty GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName) Dim sMsgFilePath As String = sMsgDir & "\EgalTechIta.txt" - For Each Language In IniFile.m_LanguageList + For Each Language In OptionModule.m_LanguageList If Language.Name = sMsgName Then - IniFile.m_SelectedLanguage = Language + OptionModule.m_SelectedLanguage = Language sMsgFilePath = sMsgDir & "\" & Language.FilePath End If Next diff --git a/OptionsWindow/OptionModule.vb b/OptionsWindow/OptionModule.vb new file mode 100644 index 0000000..ed66d5a --- /dev/null +++ b/OptionsWindow/OptionModule.vb @@ -0,0 +1,75 @@ +Imports System.Collections.ObjectModel + +Public Module OptionModule + + ' Parametri che contengono lista delle lingue disponibili e lingua selezionata + Friend m_LanguageList As New ObservableCollection(Of Language) + Friend m_SelectedLanguage As Language + + ' Variabili che indicano per ogni tipo di lavorazione quale geometria è selezionabile + Friend m_SelGeomSawing As SceneSelModeOpt + Friend m_SelGeomDrilling As SceneSelModeOpt + Friend m_SelGeomMilling As SceneSelModeOpt + Friend m_SelGeomPocketing As SceneSelModeOpt + Friend m_SelGeomMortising As SceneSelModeOpt + Friend m_SelGeomSawRoughing As SceneSelModeOpt + Friend m_SelGeomSawFinishing As SceneSelModeOpt + + ' Variabile che indica se quando viene creata una nuova operazione di lavorazione deve essere aggiunta in fondo + ' alla fase o subito dopo la lavorazione selezionata + Friend m_bNewMachiningIsLastOne As Boolean + + ' inizializzazione lettura variabili ad inizio programma + Friend Sub InitOptionModule() + ' Inizializzo variabili che indicano per ogni tipo di lavorazione quale geometria è selezionabile + Dim Temp As Integer = 0 + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWING, -1) + m_SelGeomSawing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMDRILLING, -1) + m_SelGeomDrilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMILLING, -1) + m_SelGeomMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMPOCKETING, -1) + m_SelGeomPocketing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMORTISING, -1) + m_SelGeomMortising = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWROUGHING, -1) + m_SelGeomSawRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWFINISHING, -1) + m_SelGeomSawFinishing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) + ' Inizializzo variabile che indica posizione nuova operazione di lavorazione + m_bNewMachiningIsLastOne = If(GetPrivateProfileInt(S_OPTIONS, K_NEWMACHININGISLASTONE, 0) <> 0, True, False) + End Sub + + ' Classe che identifica una lingua del programma con nome e path del file dei messaggi + Public Class Language + + Private m_sName As String + Private m_sFilePath As String + + Public Property Name As String + Get + Return m_sName + End Get + Set(value As String) + m_sName = value + End Set + End Property + + Public Property FilePath As String + Get + Return m_sFilePath + End Get + Set(value As String) + m_sFilePath = value + End Set + End Property + + Sub New(sName As String, sFilePath As String) + Me.Name = sName + Me.FilePath = sFilePath + End Sub + + End Class + +End Module diff --git a/OptionsWindow/OptionsView.xaml b/OptionsWindow/OptionsView.xaml index e103985..e18a0ab 100644 --- a/OptionsWindow/OptionsView.xaml +++ b/OptionsWindow/OptionsView.xaml @@ -68,7 +68,26 @@ - + + + + + + + + + + + + + + + + + + diff --git a/OptionsWindow/OptionsViewModel.vb b/OptionsWindow/OptionsViewModel.vb index 70cb1c4..eadcf83 100644 --- a/OptionsWindow/OptionsViewModel.vb +++ b/OptionsWindow/OptionsViewModel.vb @@ -7,7 +7,7 @@ Namespace EgtCAM5 Public ReadOnly Property LanguageList As ObservableCollection(Of Language) Get - Return IniFile.m_LanguageList + Return OptionModule.m_LanguageList End Get End Property @@ -20,11 +20,11 @@ Namespace EgtCAM5 Public Property SelectedLanguage As Language Get - Return IniFile.m_SelectedLanguage + Return OptionModule.m_SelectedLanguage End Get Set(value As Language) - If value IsNot IniFile.m_SelectedLanguage Then - IniFile.m_SelectedLanguage = value + If value IsNot OptionModule.m_SelectedLanguage Then + OptionModule.m_SelectedLanguage = value WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name) End If End Set @@ -32,36 +32,51 @@ Namespace EgtCAM5 Public Property SelectedMillingGeomType As SceneSelModeOpt Get - Return IniFile.m_SelGeomMilling + Return OptionModule.m_SelGeomMilling End Get Set(value As SceneSelModeOpt) If WritePrivateProfileString(S_MACH, K_SELGEOMMILLING, CInt(value).ToString()) Then - IniFile.m_SelGeomMilling = value + OptionModule.m_SelGeomMilling = value End If End Set End Property Public Property SelectedDrillingGeomType As SceneSelModeOpt Get - Return IniFile.m_SelGeomDrilling + Return OptionModule.m_SelGeomDrilling End Get Set(value As SceneSelModeOpt) If WritePrivateProfileString(S_MACH, K_SELGEOMDRILLING, CInt(value).ToString()) Then - IniFile.m_SelGeomDrilling = value + OptionModule.m_SelGeomDrilling = value End If End Set End Property Public Property SelectedSawingGeomType As SceneSelModeOpt Get - Return IniFile.m_SelGeomSawing + Return OptionModule.m_SelGeomSawing End Get Set(value As SceneSelModeOpt) If WritePrivateProfileString(S_MACH, K_SELGEOMSAWING, CInt(value).ToString()) Then - IniFile.m_SelGeomSawing = value + OptionModule.m_SelGeomSawing = value End If End Set End Property - Private m_Title As String + Public Property NewMachiningIsLastOne As Boolean + Get + Return m_bNewMachiningIsLastOne + End Get + Set(value As Boolean) + m_bNewMachiningIsLastOne = value + WritePrivateProfileString(S_OPTIONS, K_NEWMACHININGISLASTONE, If(value, 1, 0).ToString) + End Set + End Property + + Public ReadOnly Property NewMachiningPosMsg As String + Get + Return EgtMsg(MSG_OPTIONPAGE + 7) + End Get + End Property + Public ReadOnly Property Title As String Get Return EgtMsg(MSG_MAINWINDOW + 5) diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb index fd54e7b..4a29b1e 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb @@ -143,19 +143,19 @@ Namespace EgtCAM5 ' Abilito la selezione dei giusti tipi di geometria Select Case OperationType Case MCH_OY.SAWING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomSawing) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawing) Case MCH_OY.DRILLING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomDrilling) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomDrilling) Case MCH_OY.MILLING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomMilling) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMilling) Case MCH_OY.POCKETING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomPocketing) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomPocketing) Case MCH_OY.MORTISING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomMortising) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMortising) Case MCH_OY.SAWROUGHING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomSawRoughing) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawRoughing) Case MCH_OY.SAWFINISHING - Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, IniFile.m_SelGeomSawFinishing) + Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawFinishing) End Select End If Else @@ -367,21 +367,6 @@ Namespace EgtCAM5 Private m_cmdUpdate As ICommand Sub New() - Dim Temp As Integer = 0 - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWING, -1) - m_SelGeomSawing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMDRILLING, -1) - m_SelGeomDrilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMILLING, -1) - m_SelGeomMilling = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMPOCKETING, -1) - m_SelGeomPocketing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMMORTISING, -1) - m_SelGeomMortising = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWROUGHING, -1) - m_SelGeomSawRoughing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) - Temp = GetPrivateProfileInt(S_MACH, K_SELGEOMSAWFINISHING, -1) - m_SelGeomSawFinishing = If(Temp < 0 Or Temp > 3, SceneSelModeOpt.PARTCURVESANDSURFACES, DirectCast(Temp, SceneSelModeOpt)) Me.ListIsExpanded = True Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer) LoadOperationList() diff --git a/ProjectPage/ProjectViewModel.vb b/ProjectPage/ProjectViewModel.vb index b741369..5864c18 100644 --- a/ProjectPage/ProjectViewModel.vb +++ b/ProjectPage/ProjectViewModel.vb @@ -1035,19 +1035,16 @@ Namespace EgtCAM5 Dim dCurrDist As Double Dim dMinDist As Double ' proietto le curve sul piano di vista - Dim vectorX As New Vector3d(0.5, -0.5, 0) - vectorX.Normalize() - Dim vectorY As New Vector3d(0.5, 0.5, 0.5) - vectorY.Normalize() - Dim vectorZ As New Vector3d(-0.5, -0.5, 0.5) - vectorZ.Normalize() - Dim frame As New Frame3d(Frame3d.GLOB) - frame.Rotate(New Point3d(0, 0, 0), Vector3d.X_AX, 45) - frame.Rotate(New Point3d(0, 0, 0), Vector3d.Z_AX, -45) - For Index = 0 To CurvesIdList.Count - 1 - Dim l = EgtScale(CurvesIdList(Index), frame, 1, 1, 0) - Next - 'Dim l = EgtScaleGroup(TempGroup, frame, 1, 1, 0) + Dim dAngVertDeg As Double + Dim dAngOrizDeg As Double + EgtGetGenericView(dAngVertDeg, dAngOrizDeg) + Dim vtZView As Vector3d = Vector3d.FromSpherical(1, dAngVertDeg, dAngOrizDeg) + Dim vtYView As Vector3d + EgtGetViewUp(vtYView) + Dim vtXView As Vector3d + vtXView = vtYView ^ vtZView + Dim frView As New Frame3d(Point3d.ORIG, vtXView, vtYView, vtZView) + EgtScaleGroup(TempGroup, frView, 1, 1, 0) ' ciclo sulle proiezioni Dim bFirst As Boolean = True For Index = 0 To CurvesIdList.Count - 1 diff --git a/Utility.vb b/Utility.vb index 02a8945..1aa8d44 100644 --- a/Utility.vb +++ b/Utility.vb @@ -122,35 +122,4 @@ Public Module Utility #End Region - Public Class Language - - Private m_sName As String - Private m_sFilePath As String - - Public Property Name As String - Get - Return m_sName - End Get - Set(value As String) - m_sName = value - End Set - End Property - - Public Property FilePath As String - Get - Return m_sFilePath - End Get - Set(value As String) - m_sFilePath = value - End Set - End Property - - Sub New(sName As String, sFilePath As String) - Me.Name = sName - Me.FilePath = sFilePath - End Sub - - End Class - - End Module