diff --git a/EgtStoneLib/CamAuto.vb b/EgtStoneLib/CamAuto.vb index 93f7ad9..10ef109 100644 --- a/EgtStoneLib/CamAuto.vb +++ b/EgtStoneLib/CamAuto.vb @@ -547,6 +547,32 @@ Friend Module CamAuto Return True End Function + Friend Function GetTableCount() As Integer + If EgtGetTableId(MAIN_TAB) = GDB_ID.NULL Then Return 0 + If EgtGetTableId(SECOND_TAB) = GDB_ID.NULL Then Return 1 + If EgtGetTableId(THIRD_TAB) = GDB_ID.NULL Then Return 2 + Return 3 + End Function + + Friend Function GetTableName(nInd As Integer) As String + If nInd = 1 Then Return MAIN_TAB + If nInd = 2 Then Return SECOND_TAB + If nInd = 3 Then Return THIRD_TAB + Return "" + End Function + + Friend Function GetCurrentTable() As Integer + Dim sTabName As String = MAIN_TAB + EgtGetTableName(sTabName) + If sTabName = THIRD_TAB Then + Return 3 + ElseIf sTabName = SECOND_TAB Then + Return 2 + Else + Return 1 + End If + End Function + Friend Function GetCurrentRaw() As Integer ' Recupero il grezzo (primo con fase 1) Dim nRawId As Integer = EgtGetFirstRawPart() diff --git a/EgtStoneLib/ConstMach.vb b/EgtStoneLib/ConstMach.vb index 3cd1b3e..5feda6b 100644 --- a/EgtStoneLib/ConstMach.vb +++ b/EgtStoneLib/ConstMach.vb @@ -36,6 +36,7 @@ Module ConstMach Public Const MACH_GROUP As String = "Mach01" Public Const MAIN_TAB As String = "MainTab" Public Const SECOND_TAB As String = "2ndTab" + Public Const THIRD_TAB As String = "3rdTab" Public Const PHOTO_GRP As String = "Photos" Public Const PHOTO_NAME As String = "Raw" Public Const BASE_MACH_GROUP As String = "Mach_" diff --git a/EgtStoneLib/ConstMachIni.vb b/EgtStoneLib/ConstMachIni.vb index f6fd818..8142335 100644 --- a/EgtStoneLib/ConstMachIni.vb +++ b/EgtStoneLib/ConstMachIni.vb @@ -63,10 +63,14 @@ Public Const S_TABLE As String = "Table" Public Const K_ADDITIONALTABLE As String = "AdditionalTable" + Public Const K_TAB2_ADDITIONALTABLE As String = "Tab2AdditionalTable" + Public Const K_TAB3_ADDITIONALTABLE As String = "Tab3AdditionalTable" Public Const S_PHOTO As String = "Photo" Public Const K_PHOTO_OFFSETX As String = "OffsetX" Public Const K_PHOTO_OFFSETY As String = "OffsetY" + Public Const K_PHOTO_TAB2_OFFSETX As String = "Tab2OffsetX" + Public Const K_PHOTO_TAB2_OFFSETY As String = "Tab2OffsetY" Public Const S_TOOLS As String = "Tools" Public Const K_DRILLBIT As String = "Drillbit" diff --git a/EgtStoneLib/CurrentMachine.vb b/EgtStoneLib/CurrentMachine.vb index 296d820..b84d75e 100644 --- a/EgtStoneLib/CurrentMachine.vb +++ b/EgtStoneLib/CurrentMachine.vb @@ -101,10 +101,14 @@ Public Module CurrentMachine ' Spessore sottopezzo Private m_dAdditionalTable As Double = 0 + Private m_dTab2AdditionalTable As Double = 0 + Private m_dTab3AdditionalTable As Double = 0 ' Offset aggiuntivi per fotografia Private m_dPhotoOffsetX As Double = 0 Private m_dPhotoOffsetY As Double = 0 + Private m_dTab2PhotoOffsetX As Double = 0 + Private m_dTab2PhotoOffsetY As Double = 0 ' Flag home finale per tagli diretti Private m_bDirectCutsFinalHome As Boolean = True @@ -526,9 +530,6 @@ Public Module CurrentMachine If EstCalc.SetCurrSawing(value) Then m_sCurrSawing = value End If - 'If WritePrivateProfileString(S_MACH_MACH, K_CURRSAWING, value, sMachIniFile) Then - ' m_sCurrSawing = value - 'End If End Set End Property @@ -540,9 +541,6 @@ Public Module CurrentMachine If EstCalc.SetCurrDrilling(value) Then m_sCurrDrilling = value End If - 'If WritePrivateProfileString(S_MACH_MACH, K_CURRDRILLING, value, sMachIniFile) Then - ' m_sCurrDrilling = value - 'End If End Set End Property @@ -554,9 +552,6 @@ Public Module CurrentMachine If EstCalc.SetCurrMilling(value) Then m_sCurrMilling = value End If - 'If WritePrivateProfileString(S_MACH_MACH, K_CURRMILLING, value, sMachIniFile) Then - ' m_sCurrMilling = value - 'End If End Set End Property @@ -606,22 +601,53 @@ Public Module CurrentMachine Public Property dAdditionalTable As Double Get - Return m_dAdditionalTable + Select Case GetCurrentTable() + Case 3 + Return m_dTab3AdditionalTable + Case 2 + Return m_dTab2AdditionalTable + Case Else + Return m_dAdditionalTable + End Select End Get Set(value As Double) - If Math.Abs(value - m_dAdditionalTable) > EPS_SMALL And - WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, DoubleToString(value, 3), sMachIniFile) Then - ' Aggiorno il valore corrente - m_dAdditionalTable = value - ' Aggiorno il progetto corrente - AdjustAdditionalTable() - End If + Select Case GetCurrentTable() + Case 3 + If Math.Abs(value - m_dTab3AdditionalTable) > EPS_SMALL And + WritePrivateProfileString(S_TABLE, K_TAB3_ADDITIONALTABLE, DoubleToString(value, 3), sMachIniFile) Then + ' Aggiorno il valore corrente + m_dTab3AdditionalTable = value + ' Aggiorno il progetto corrente + AdjustAdditionalTable() + End If + Case 2 + If Math.Abs(value - m_dTab2AdditionalTable) > EPS_SMALL And + WritePrivateProfileString(S_TABLE, K_TAB2_ADDITIONALTABLE, DoubleToString(value, 3), sMachIniFile) Then + ' Aggiorno il valore corrente + m_dTab2AdditionalTable = value + ' Aggiorno il progetto corrente + AdjustAdditionalTable() + End If + Case Else + If Math.Abs(value - m_dAdditionalTable) > EPS_SMALL And + WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, DoubleToString(value, 3), sMachIniFile) Then + ' Aggiorno il valore corrente + m_dAdditionalTable = value + ' Aggiorno il progetto corrente + AdjustAdditionalTable() + End If + End Select End Set End Property Friend ReadOnly Property PhotoOffset As Vector3d Get - Return New Vector3d(m_dPhotoOffsetX, m_dPhotoOffsetY, 0) + Select Case GetCurrentTable() + Case 2 + Return New Vector3d(m_dTab2PhotoOffsetX, m_dTab2PhotoOffsetY, 0) + Case Else + Return New Vector3d(m_dPhotoOffsetX, m_dPhotoOffsetY, 0) + End Select End Get End Property @@ -956,10 +982,14 @@ Public Module CurrentMachine ' Leggo altezza sopratavola m_dAdditionalTable = GetPrivateProfileDouble(S_TABLE, K_ADDITIONALTABLE, 0, sMachIniFile) + m_dTab2AdditionalTable = GetPrivateProfileDouble(S_TABLE, K_TAB2_ADDITIONALTABLE, 0, sMachIniFile) + m_dTab3AdditionalTable = GetPrivateProfileDouble(S_TABLE, K_TAB3_ADDITIONALTABLE, 0, sMachIniFile) ' Leggo offset aggiuntivo a fotografia m_dPhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_OFFSETX, 0, sMachIniFile) m_dPhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_OFFSETY, 0, sMachIniFile) + m_dTab2PhotoOffsetX = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB2_OFFSETX, 0, sMachIniFile) + m_dTab2PhotoOffsetY = GetPrivateProfileDouble(S_PHOTO, K_PHOTO_TAB2_OFFSETY, 0, sMachIniFile) ' Leggo flag per posizione home alla fine dei tagli diretti m_bDirectCutsFinalHome = (GetPrivateProfileInt(S_MACH_DIRECTCUTS, K_FINALHOME, 1, sMachIniFile) <> 0) diff --git a/EgtStoneLib/EstCalc.vb b/EgtStoneLib/EstCalc.vb index f2493e1..3c652c2 100644 --- a/EgtStoneLib/EstCalc.vb +++ b/EgtStoneLib/EstCalc.vb @@ -182,7 +182,7 @@ Module EstCalc Public Function AdjustAdditionalTable() As Boolean ' Recupero altezza sottotavola corrente - Dim nFixtId As Integer = EgtGetFirstNameInGroup(EgtGetFirstMachGroup(), MACH_FIXT_GROUP) + Dim nFixtId As Integer = EgtGetFirstNameInGroup(EgtGetCurrMachGroup(), MACH_FIXT_GROUP) Dim nAddTabId As Integer = EgtGetFirstNameInGroup(nFixtId, MACH_ADD_TABLE) Dim dCurrAddTab As Double = 0 If nAddTabId <> GDB_ID.NULL And Not EgtGetInfo(nAddTabId, KEY_ADD_TABLE, dCurrAddTab) Then @@ -209,7 +209,7 @@ Module EstCalc Public Function AddAdditionalTable() As Boolean ' Gruppo dei sottopezzi - Dim nFixtId As Integer = EgtGetFirstNameInGroup(EgtGetFirstMachGroup(), MACH_FIXT_GROUP) + Dim nFixtId As Integer = EgtGetFirstNameInGroup(EgtGetCurrMachGroup(), MACH_FIXT_GROUP) ' Elimino eventuale vecchia tavola dal gruppo dei bloccaggi EgtErase(EgtGetFirstNameInGroup(nFixtId, MACH_ADD_TABLE)) ' Altezza eventuale tavola aggiuntiva diff --git a/EgtStoneLib/VacuumCups.vb b/EgtStoneLib/VacuumCups.vb index 6707d47..3b476bf 100644 --- a/EgtStoneLib/VacuumCups.vb +++ b/EgtStoneLib/VacuumCups.vb @@ -475,7 +475,7 @@ Module VacuumCups Return nInd End Function - Friend Function AddRawMoveData(nRawId As Integer, ByRef rmList As List(Of RawMoveData)) As Integer + Private Function AddRawMoveData(nRawId As Integer, ByRef rmList As List(Of RawMoveData)) As Integer ' Cerco in lista record con dati del grezzo indicato Dim nInd As Integer = -1 For i As Integer = 0 To rmList.Count() - 1 @@ -484,8 +484,16 @@ Module VacuumCups Exit For End If Next + ' Se trovato + If nInd <> -1 Then + ' Se con movimenti trascurabili e non alla fine, lo sposto alla fine + If rmList(nInd).m_vtRawMove.IsSmall() AndAlso Math.Abs(rmList(nInd).m_dRawAngRotDeg) < EPS_ANG_SMALL AndAlso nInd <> rmList.Count() - 1 Then + rmList.Add(rmList(nInd)) + rmList.RemoveAt(nInd) + nInd = rmList.Count() - 1 + End If ' Se non trovato, lo accodo - If nInd = -1 Then + Else rmList.Add(New RawMoveData(nRawId)) nInd = rmList.Count() - 1 End If diff --git a/MachOptionWindow/MachOptionWindowVM.vb b/MachOptionWindow/MachOptionWindowVM.vb index e50f525..7b05cec 100644 --- a/MachOptionWindow/MachOptionWindowVM.vb +++ b/MachOptionWindow/MachOptionWindowVM.vb @@ -213,6 +213,7 @@ Public Class MachOptionWindowVM Dim dAdditionalTable As Double = 0 If StringToLen(value, dAdditionalTable) Then CurrentMachine.dAdditionalTable = dAdditionalTable + EgtDraw() End If End Set End Property diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index b942712..e974bf1 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -30,7 +30,7 @@ Imports System.Windows #End If - + 'In order to begin building localizable applications, set @@ -69,5 +69,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/MyMachGroupPanel/MyMachGroupPanelVM.vb b/MyMachGroupPanel/MyMachGroupPanelVM.vb index afc39ce..dce8ead 100644 --- a/MyMachGroupPanel/MyMachGroupPanelVM.vb +++ b/MyMachGroupPanel/MyMachGroupPanelVM.vb @@ -61,12 +61,25 @@ Public Class MyMachGroupPanelVM ' NB: Anche se ho già aggiunto il nuovo gruppo di lavorazione, non l'ho ancora reso corrente (viene fatto dopo), quindi ' non posso usare CurrentMachine perchè è ancora impostata quella precedente!!! Public Overrides Function OnPostNewMachGroup() As Boolean - ' !!! GESTIRE MACCHINE CON DUE TAVOLE !!! - EgtSetTable("MainTab") - ' leggo nome attrezzaggio di default - Dim sDefaultSetUpName As String = String.Empty + ' Salvo macchina del gruppo come nuovo default Dim sCurrMachName As String = String.Empty EgtGetCurrMachineName(sCurrMachName) + WriteMainPrivateProfileString(S_MACH, K_CURRMACH, sCurrMachName) + ' Ricarico la macchina corrente + InitCurrentMachine(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot, sCurrMachName, + OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.PROCUCTION_LINE), + OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_MILL), True) + ' Se macchina con più tavole, chiedo quale usare + Dim nTabInd As Integer = 1 + Dim nTabCnt As Integer = CamAuto.GetTableCount() + If nTabCnt > 1 And nTabCnt <= 3 Then + Dim dlg As New SelectTableWindowV(Application.Current.MainWindow, New SelectTableWindowVM(nTabCnt)) + dlg.ShowDialog() + nTabInd = dlg.m_SelTable + End If + EgtSetTable(GetTableName(nTabInd)) + ' leggo nome attrezzaggio di default + Dim sDefaultSetUpName As String = String.Empty Dim sMachineIniPath As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini" EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, sMachineIniPath) ' se è attiva l'opzione, rendo corrente l'attrezzaggio di default @@ -76,12 +89,8 @@ Public Class MyMachGroupPanelVM MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, MessageBoxButton.OK, MessageBoxImage.Exclamation) End If End If - ' Salvo macchina del gruppo come nuovo default - WriteMainPrivateProfileString(S_MACH, K_CURRMACH, sCurrMachName) - ' Ricarico la macchina corrente - InitCurrentMachine(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot, sCurrMachName, - OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.PROCUCTION_LINE), - OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.ENABLE_MILL), True) + ' Aggiungo eventuale sovratavola + EstCalc.AddAdditionalTable() ' Aggiorno grezzo iniziale EstCalc.UpdateRawPart() ' Imposto materiale corrente diff --git a/OmagOFFICE.vbproj b/OmagOFFICE.vbproj index 1d167b4..a890a3b 100644 --- a/OmagOFFICE.vbproj +++ b/OmagOFFICE.vbproj @@ -246,6 +246,10 @@ SceneHostV.xaml + + SelectTableWindowV.xaml + + ShowPanelV.xaml @@ -387,6 +391,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/SelectTableWindow/SelectTableWindowV.xaml b/SelectTableWindow/SelectTableWindowV.xaml new file mode 100644 index 0000000..4ef9b0f --- /dev/null +++ b/SelectTableWindow/SelectTableWindowV.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/SelectTableWindow/SelectTableWindowV.xaml.vb b/SelectTableWindow/SelectTableWindowV.xaml.vb new file mode 100644 index 0000000..2772deb --- /dev/null +++ b/SelectTableWindow/SelectTableWindowV.xaml.vb @@ -0,0 +1,20 @@ +Public Class SelectTableWindowV + + Private WithEvents m_SelectTableWindowVM As SelectTableWindowVM + Public m_SelTable As Integer + + Sub New(Owner As Window, SelectTableWindowVM As SelectTableWindowVM) + MyBase.New(Owner) + ' This call is required by the designer. + InitializeComponent() + Me.DataContext = SelectTableWindowVM + ' Assegno al riferimento locale al VM il VM preso dal DataContext + m_SelectTableWindowVM = SelectTableWindowVM + End Sub + + Private Sub CloseWindow(DialogResult As Integer) Handles m_SelectTableWindowVM.m_CloseWindow + m_SelTable = DialogResult + Me.DialogResult = True + End Sub + +End Class diff --git a/SelectTableWindow/SelectTableWindowVM.vb b/SelectTableWindow/SelectTableWindowVM.vb new file mode 100644 index 0000000..f72c1c4 --- /dev/null +++ b/SelectTableWindow/SelectTableWindowVM.vb @@ -0,0 +1,81 @@ +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class SelectTableWindowVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + Public Enum TableNumOpt As Integer + TWO = 2 + THREE = 3 + End Enum + + Friend Event m_CloseWindow(DialogResult As Integer) + + Private m_Table3_Visibility As Visibility + Public Property Table3_Visibility As Visibility + Get + Return m_Table3_Visibility + End Get + Set(value As Visibility) + m_Table3_Visibility = value + End Set + End Property + +#Region "Messages" + + Public ReadOnly Property Title As String + Get + Return EgtMsg(91123) 'Tavola + End Get + End Property + + Public ReadOnly Property WndMsg As String + Get + Return EgtMsg(91111) 'Tavola da usare ? + End Get + End Property + +#End Region + + ' Definizione comandi + Private m_cmdTable As ICommand + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New(nTableNum As TableNumOpt) + If nTableNum = TableNumOpt.TWO Then + m_Table3_Visibility = Visibility.Collapsed + Else + m_Table3_Visibility = Visibility.Visible + End If + NotifyPropertyChanged("Table3_Visibility") + End Sub + +#End Region ' CONSTRUCTOR + +#Region "COMMANDS" + +#Region "Table" + + Public ReadOnly Property Table_Command As ICommand + Get + If m_cmdTable Is Nothing Then + m_cmdTable = New Command(AddressOf Table) + End If + Return m_cmdTable + End Get + End Property + + Public Sub Table(ByVal param As Object) + RaiseEvent m_CloseWindow(CInt(param)) + End Sub + +#End Region ' DrawCommand + +#End Region ' COMMANDS + +End Class