OmagCUT :

- aggiunta gestione lavorazione di taglio anche con lama manuale (ovviamente non si cambia lama).
This commit is contained in:
Dario Sassi
2026-04-30 16:25:43 +02:00
parent daeaec3b6b
commit 88ff42a8c6
4 changed files with 172 additions and 148 deletions
+94 -110
View File
@@ -4,7 +4,7 @@ Imports EgtUILib
Public Class ChangeToolWD Public Class ChangeToolWD
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private m_SetUpMachiningList As New ObservableCollection(Of ItemMachining) Private m_MachiningList As New ObservableCollection(Of ItemMachining)
Sub New(Owner As Window) Sub New(Owner As Window)
Me.Owner = Owner Me.Owner = Owner
@@ -73,8 +73,8 @@ Public Class ChangeToolWD
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2 Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
' Definizione del collegamento tra ItemList e ListBox1 ' Definizione del collegamento tra ItemList e ListBox1
SetUpToolListBox.ItemsSource = m_SetUpMachiningList SetUpToolListBox.ItemsSource = m_MachiningList
' 90378=Seleziona lavorazione ' Seleziona lavorazione
FilePathTxBl.Text = EgtMsg(90378) FilePathTxBl.Text = EgtMsg(90378)
End Sub End Sub
@@ -85,8 +85,8 @@ Public Class ChangeToolWD
' carico elenco degli utensili impostati attualmente in macchina (anche il laser!) ' carico elenco degli utensili impostati attualmente in macchina (anche il laser!)
LoadSetUpMachining() LoadSetUpMachining()
' ricerco la lavorazione corrente ' ricerco la lavorazione corrente
Dim Item As ItemMachining = m_SetUpMachiningList.FirstOrDefault(Function(x) x.Machining = m_CurrSawing) Dim Item As ItemMachining = m_MachiningList.FirstOrDefault(Function(x) x.Machining = m_CurrSawing)
Dim Index As Integer = m_SetUpMachiningList.IndexOf(Item) Dim Index As Integer = m_MachiningList.IndexOf(Item)
If Index < 0 Then If Index < 0 Then
' Imposto lavorazione di default ' Imposto lavorazione di default
EgtMdbSetCurrMachining(m_CurrSawing) EgtMdbSetCurrMachining(m_CurrSawing)
@@ -97,8 +97,8 @@ Public Class ChangeToolWD
Index = 0 Index = 0
End If End If
' se presente seleziono il primo elemento ' se presente seleziono il primo elemento
If m_SetUpMachiningList.Count > 0 Then If m_MachiningList.Count > 0 Then
SetUpToolListBox.SelectedItem = m_SetUpMachiningList(Index) SetUpToolListBox.SelectedItem = m_MachiningList(Index)
OkBtn.IsEnabled = True OkBtn.IsEnabled = True
Else Else
OkBtn.IsEnabled = False OkBtn.IsEnabled = False
@@ -109,61 +109,55 @@ Public Class ChangeToolWD
' Creo le liste da mostrare nella lista ' Creo le liste da mostrare nella lista
Private Function LoadSetUpMachining() As Boolean Private Function LoadSetUpMachining() As Boolean
Dim sNameTool As String = String.Empty ' Pulisco la lista delle lavorazioni di lama
Dim nType As Integer = 0 m_MachiningList.Clear()
Dim sHeadTool As String = String.Empty
Dim nExitTool As Integer = 0
' Imposto il contesto corrente ' Imposto il contesto corrente
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx()) EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
' Recupero la lista di tutte le lavorazioni di lama ' Recupero la lista di tutte le lavorazioni di lama
Dim local_Sawing As TreeViewItem.CathegoryItem = GetAllSawing() Dim SawingList As List(Of String) = GetAllSawing()
' Se non ci sono lavorazioni di lama allora esco ' Se non ci sono lavorazioni di lama allora esco
If IsNothing(local_Sawing) Then Return False If SawingList.Count() = 0 Then Return False
' Carico le lavorazioni di lama compatibili
' Ripulisco la lista degli utensili CreateSawingList(SawingList)
m_SetUpMachiningList.Clear()
CreateSawingList(local_Sawing)
Return True Return True
End Function End Function
' Creo la lista delle delle lavorazioni di lama da proporre ' Creo la lista delle delle lavorazioni di lama da proporre
Private Sub CreateSawingList(SawingFam As TreeViewItem.CathegoryItem) Private Sub CreateSawingList(SawingList As List(Of String))
' Recupero le info della lama montata di default ' Recupero le info della lama montata di default
GetDiamAndThickDefaultSaw() GetDiamAndThickDefaultSaw()
' Verifico se lama fissa ' Verifico se lama fissa
Dim bFixedSaw As Boolean = Not CamAuto.CanChangeSaw() Dim bFixedSaw As Boolean = Not CamAuto.CanChangeSaw()
' recupero la prima lavorazione ' recupero la prima lavorazione
For Each Item As TreeViewItem.CustomItem In SawingFam.Items For Each sSawingName As String In SawingList
Dim sNameTool As String = String.Empty Dim sToolName As String = ""
' Imposto la lavorazione corrente ' Imposto la lavorazione corrente
EgtMdbSetCurrMachining(Item.Name) EgtMdbSetCurrMachining(sSawingName)
' Recupero il nome dell'utensile della lavorazione ' Recupero il nome dell'utensile della lavorazione
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sNameTool) EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sToolName)
If Not String.IsNullOrEmpty(sNameTool) And VerifyCurrSawTolerance(sNameTool) Then If String.IsNullOrWhiteSpace( sToolName) Then Continue For
' Recupero la posizione ' Se lama fissa
EgtTdbSetCurrTool(sNameTool) If bFixedSaw Then
Dim sTCPos As String = String.Empty ' Sono ammesse solo altre lavorazioni con la stessa lama
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos) If sToolName = m_DefaultSaw_Name AndAlso VerifyCurrMachiningMaterial() Then
' Se lama fissa sono ammesse solo altre lavorazioni con la stessa ' recupero eventuale posizione
If bFixedSaw Then EgtTdbSetCurrTool(sToolName)
If sNameTool = m_DefaultSaw_Name AndAlso VerifyCurrMachiningMaterial() Then Dim sTCPos As String = ""
m_SetUpMachiningList.Add(New ItemMachining(Item.Name, sNameTool, sTCPos, Utility.GetColorPV())) EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
End If ' inserisco in lista
' altrimenti cerco le lame compatibili nel TC automatico m_MachiningList.Add(New ItemMachining(sSawingName, sToolName, sTCPos, New Color3d(0, 0, 0, 100)))
ElseIf Not String.IsNullOrEmpty(sTCPos) Then
For Each ToolPosition As ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
If ToolPosition.sTool <> String.Empty Then
If sNameTool = ToolPosition.sTool Then
' Verifico il materiale e lo spessore
If VerifyCurrMachiningMaterial() Then
m_SetUpMachiningList.Add(New ItemMachining(Item.Name, sNameTool, sTCPos, Utility.GetColorPV()))
End If
Exit For
End If
End If
Next
End If End If
' altrimenti (ammessa solo se da TC)
Else
' Verifico compatibilità nelle dimensioni lama e nei materiali ammessi dalla lavorazione
If Not( VerifyCurrSawTolerance(sToolName) AndAlso VerifyCurrMachiningMaterial()) Then Continue For
' Cerco la lama nel TC
For Each ToolPosition As ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
If sToolName = ToolPosition.sTool Then
m_MachiningList.Add(New ItemMachining(sSawingName, sToolName, ToolPosition.sName, Utility.GetColorPV()))
Exit For
End If
Next
End If End If
Next Next
' reimposto la lavorazione di lama e la lama impostate in macchina ' reimposto la lavorazione di lama e la lama impostate in macchina
@@ -171,49 +165,39 @@ Public Class ChangeToolWD
EgtMdbSetCurrMachining(m_MainWindow.m_CurrentMachine.sCurrSawing) EgtMdbSetCurrMachining(m_MainWindow.m_CurrentMachine.sCurrSawing)
End Sub End Sub
' verifico l'utensile corrente (impostato nella funzione chiamante) se può lavorare il grezzo corrente ' Verifico se la lavorazione impostata nella chiamante e quindi corrente può lavorare il grezzo corrente
Private Function VerifyCurrMachiningMaterial() As Boolean Private Function VerifyCurrMachiningMaterial() As Boolean
Dim m_MaterialsList As New ObservableCollection(Of MachiningMaterial) ' Stringa identificativa del materiale corrente
For Each Material As Material In m_MainWindow.m_CurrentMachine.Materials Dim sCurrMatId As String = m_MainWindow.m_CurrentMachine.CurrMat.nId.ToString()
If m_MainWindow.m_CurrentMachine.bWaterJet And m_MainWindow.m_CurrentMachine.bFromDBWaterJet Then If m_MainWindow.m_CurrentMachine.bWaterJet And m_MainWindow.m_CurrentMachine.bFromDBWaterJet Then
m_MaterialsList.Add(New MachiningMaterial(Material.nId, Material.sName, Material.SubId)) sCurrMatId &= "." & m_MainWindow.m_CurrentMachine.CurrMat.SubId.ToString()
Else End If
m_MaterialsList.Add(New MachiningMaterial(Material.nId, Material.sName)) ' Recupero elenco materiali della lavorazione
Dim sSysNotes As String = ""
EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, sSysNotes)
If String.IsNullOrWhiteSpace( sSysNotes) Then Return False
' Cerco un materiale compatibile con il corrente
Dim sItems() As String = sSysNotes.Split(";".ToCharArray)
For Ind As Integer = 0 To sItems.Count() - 1
' Divido il materiale nei suoi parametri
Dim sParams() = sItems(Ind).Split(",".ToCharArray)
' Se è il materiale del grezzo corrente
If sParams.Count() >= 3 AndAlso Trim(sParams(0)) = sCurrMatId Then
' Verifico rientri nello spessore ammesso
Dim dMinTh As Double = 0
Dim dMaxTh As Double = 0
StringToDouble(sParams(1), dMinTh)
StringToDouble(sParams(2), dMaxTh)
If dMinTh < dMaxTh - 10 * EPS_SMALL And
m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight >= dMinTh And
m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight <= dMaxTh Then
Return True
Else
Return False
End If
End If End If
Next Next
' Non ho trovato niente
Dim ToolString As String = String.Empty
EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, ToolString)
If ToolString <> String.Empty Then
Dim sItems() = ToolString.Split(";".ToCharArray)
Dim Index As Integer = 0
For Each Material As MachiningMaterial In m_MaterialsList
Dim Param() As String = sItems(Index).Split(",".ToCharArray)
Dim SubParam() As String = Param(0).Split(".".ToCharArray)
Dim nParId As Integer = 0
Dim nSubParId As Integer = 0
If m_MainWindow.m_CurrentMachine.bWaterJet And m_MainWindow.m_CurrentMachine.bFromDBWaterJet Then
If StringToInt(SubParam(0), nParId) AndAlso nParId = m_MainWindow.m_CurrentMachine.CurrMat.nId AndAlso SubParam.Count > 1 AndAlso
StringToInt(SubParam(1), nSubParId) AndAlso nSubParId = Material.nSubId Then
StringToDouble(Param(1), Material.dMinThickness)
StringToDouble(Param(2), Material.dMaxThickness)
Material.VerifyIfActive()
Else
Material.VerifyIfActive()
End If
Else
If StringToInt(Param(0), nParId) AndAlso nParId = m_MainWindow.m_CurrentMachine.CurrMat.nId Then
StringToDouble(Param(1), Material.dMinThickness)
StringToDouble(Param(2), Material.dMaxThickness)
Material.VerifyIfActive()
If m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight > Material.dMinThickness And m_MainWindow.m_CurrentProjectPageUC.m_dRawHeight < Material.dMaxThickness Then
Return True
End If
End If
End If
Index += 1
Next
End If
Return False Return False
End Function End Function
@@ -233,35 +217,35 @@ Public Class ChangeToolWD
If Delta_Diam < 0.25 * m_DefaultSaw_Diam And Delta_Thick < EPS_SMALL Then If Delta_Diam < 0.25 * m_DefaultSaw_Diam And Delta_Thick < EPS_SMALL Then
Return True Return True
Else Else
EgtOutLog(String.Format("New saw {0} can not repalce the current {1}; Delta_Diam={2}, |Delta_Thick|={3} ", sNameTool, m_DefaultSaw_Name, Delta_Diam, Delta_Thick)) EgtOutLog(String.Format("New saw {0} can not replace the current {1}; Delta_Diam={2}, |Delta_Thick|={3} ", sNameTool, m_DefaultSaw_Name, Delta_Diam, Delta_Thick))
End If End If
Else Else
EgtOutLog("Impossible to find in tooldb SAW: " & sNameTool) EgtOutLog("Impossible to find in toolDB saw: " & sNameTool)
End If End If
Else Else
If String.IsNullOrEmpty(m_DefaultSaw_Name) Then If String.IsNullOrEmpty(m_DefaultSaw_Name) Then
EgtOutLog("There is no currsaw setted in machine!") EgtOutLog("There is no machine CurrSaw!")
Else Else
EgtOutLog("Impossible to find in tooldb currsaw setted in machine: " & m_DefaultSaw_Name) EgtOutLog("Impossible to find in toolDB machine CurrSaw: " & m_DefaultSaw_Name)
End If End If
End If End If
Return False Return False
End Function End Function
' Restituisce tutto l'elenco delle lavorazioni disponibili in macchina ' Restituisce tutto l'elenco delle lavorazioni di taglio di lama disponibili in macchina
Private Function GetAllSawing() As TreeViewItem.CathegoryItem Private Function GetAllSawing() As List(Of String)
Dim sFName As String = EgtMsg(90771) ' Uscita Dim sFName As String = EgtMsg(90771) ' Uscita
Dim nFType As Integer = MCH_MY.SAWING
If Not m_MainWindow.m_CurrentMachine.bSawing Then Return Nothing If Not m_MainWindow.m_CurrentMachine.bSawing Then Return Nothing
' Inserisco categoria ed eventuali elementi ' Inserisco categoria ed eventuali elementi
Dim MachiningCathegory As New TreeViewItem.CathegoryItem(sFName, nFType) Dim SawingList As New List(Of String)
Dim nFType As Integer = MCH_MY.SAWING
Dim MachiningName As String = String.Empty Dim MachiningName As String = String.Empty
Dim bFound As Boolean = EgtMdbGetFirstMachining(nFType, MachiningName) Dim bFound As Boolean = EgtMdbGetFirstMachining(nFType, MachiningName)
While bFound While bFound
MachiningCathegory.Items.Add(New TreeViewItem.CustomItem(MachiningName, nFType)) SawingList.Add( MachiningName)
bFound = EgtMdbGetNextMachining(nFType, MachiningName) bFound = EgtMdbGetNextMachining(nFType, MachiningName)
End While End While
Return MachiningCathegory Return SawingList
End Function End Function
#End Region ' Set up machinining #End Region ' Set up machinining
@@ -272,12 +256,12 @@ Public Class ChangeToolWD
' Recupero item selezionato ' Recupero item selezionato
If SetUpToolListBox.SelectedItems.Count() = 0 Then If SetUpToolListBox.SelectedItems.Count() = 0 Then
Return Return
Else
m_NewSawing = m_MachiningList(SetUpToolListBox.SelectedIndex).Machining
m_EgtColor = m_MachiningList(SetUpToolListBox.SelectedIndex).FootprintToolColor
m_TCPos = m_MachiningList(SetUpToolListBox.SelectedIndex).ToolPos
OkBtn.IsEnabled = True
End If End If
m_NewSawing = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).Machining
m_EgtColor = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).PrintFootToolColor
m_TCPos = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).ToolPos
' A seconda del tipo
OkBtn.IsEnabled = True
End Sub End Sub
Private Sub SetUpToolListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles SetUpToolListBox.SelectionChanged Private Sub SetUpToolListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles SetUpToolListBox.SelectionChanged
@@ -287,9 +271,9 @@ Public Class ChangeToolWD
If SetUpToolListBox.SelectedItems.Count() = 0 Then If SetUpToolListBox.SelectedItems.Count() = 0 Then
Return Return
Else Else
m_NewSawing = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).Machining m_NewSawing = m_MachiningList(SetUpToolListBox.SelectedIndex).Machining
m_EgtColor = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).PrintFootToolColor m_EgtColor = m_MachiningList(SetUpToolListBox.SelectedIndex).FootprintToolColor
m_TCPos = m_SetUpMachiningList(SetUpToolListBox.SelectedIndex).ToolPos m_TCPos = m_MachiningList(SetUpToolListBox.SelectedIndex).ToolPos
OkBtn.IsEnabled = True OkBtn.IsEnabled = True
End If End If
End Sub End Sub
@@ -307,7 +291,7 @@ Public Class ItemMachining
Private m_Machining As String = String.Empty Private m_Machining As String = String.Empty
Private m_ToolExit As Integer = 1 Private m_ToolExit As Integer = 1
Private m_ToolType As Integer = -1 Private m_ToolType As Integer = -1
Private m_PrintFootToolColor As New Color3d(0, 255, 0, 100) Private m_FootprintToolColor As New Color3d(0, 255, 0, 100)
Private m_cSawColor As SolidColorBrush Private m_cSawColor As SolidColorBrush
' Posizione porta utensile ' Posizione porta utensile
@@ -358,12 +342,12 @@ Public Class ItemMachining
End Set End Set
End Property End Property
Public Property PrintFootToolColor As Color3d Public Property FootprintToolColor As Color3d
Get Get
Return m_PrintFootToolColor Return m_FootprintToolColor
End Get End Get
Set(value As Color3d) Set(value As Color3d)
m_PrintFootToolColor = value m_FootprintToolColor = value
End Set End Set
End Property End Property
@@ -380,8 +364,8 @@ Public Class ItemMachining
m_Machining = sMachining m_Machining = sMachining
m_ToolPos = sToolPos m_ToolPos = sToolPos
m_ToolName = sToolName m_ToolName = sToolName
m_PrintFootToolColor = cColor m_FootprintToolColor = cColor
m_cSawColor = New SolidColorBrush(Color.FromRgb(m_PrintFootToolColor.R, m_PrintFootToolColor.G, m_PrintFootToolColor.B)) m_cSawColor = New SolidColorBrush(Color.FromRgb(m_FootprintToolColor.R, m_FootprintToolColor.G, m_FootprintToolColor.B))
End Sub End Sub
End Class End Class
+56 -17
View File
@@ -232,10 +232,10 @@ Public Class SplitPageUC
End Sub End Sub
Private Sub AddItemToList(i As Integer, Mach As SplitMach, sText As String, nMach As Integer) Private Sub AddItemToList(i As Integer, Mach As SplitMach, sText As String, nMach As Integer)
Dim sTCPos As String = String.Empty Dim sTCPos As String = ""
' Visualizzo la posizione utensile solo se configurata ' Visualizzo la posizione utensile solo se configurata
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
Dim sMachining As String = String.Empty, sTool As String = String.Empty Dim sMachining As String = "", sTool As String = ""
GetMachiningAndTool(Mach.m_nId, sMachining, sTool) GetMachiningAndTool(Mach.m_nId, sMachining, sTool)
' Verifico che sia montata su un portautensile ' Verifico che sia montata su un portautensile
EgtTdbSetCurrTool(sTool) EgtTdbSetCurrTool(sTool)
@@ -243,9 +243,16 @@ Public Class SplitPageUC
End If End If
' Se TCPos non trovato ' Se TCPos non trovato
If String.IsNullOrEmpty(sTCPos) Then If String.IsNullOrEmpty(sTCPos) Then
' Inserisco solo nome lavorazione ' Imposto come lavorazione corrente
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, nMach)) EgtSetCurrMachining(Mach.m_nId)
' altrimenti esiste utensile ' Se c'è lavorazione forzata, assegno colore nero
If VerifyForcedCurrMachine() Then
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, nMach, "", New SolidColorBrush(Color.FromRgb(0, 0, 0))))
' altrimenti solo nome
Else
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, nMach))
End If
' altrimenti assegno TcPos e colore
Else Else
Dim sawColor As Color3d = Utility.GetColorPV() Dim sawColor As Color3d = Utility.GetColorPV()
Dim tmpSawColor As System.Windows.Media.Color = System.Windows.Media.Color.FromRgb(sawColor.R, sawColor.G, sawColor.B) Dim tmpSawColor As System.Windows.Media.Color = System.Windows.Media.Color.FromRgb(sawColor.R, sawColor.G, sawColor.B)
@@ -253,6 +260,22 @@ Public Class SplitPageUC
End If End If
End Sub End Sub
Private Function VerifyForcedCurrMachine() As Boolean
' Se non c'è geometria, non può essere forzata
Dim EntId As Integer = GDB_ID.NULL
Dim SubEntId As Integer = GDB_ID.NULL
If Not EgtGetMachiningGeometry(0, EntId, SubEntId) Then Return False
' Se c'è Info standard è forzata
If EgtExistsInfo(EntId, DEF_MACHINING) Then Return True
' Se c'è Info per inclinato verifico se nome lavorazione non è standard
Dim sMchTilted As String = ""
If EgtGetInfo(EntId, DEF_MACHINING_TILTED, sMchTilted) AndAlso
(Not m_MainWindow.m_CurrentMachine.bApplySawingTilted OrElse
sMchTilted <> m_MainWindow.m_CurrentMachine.sCurrSawingTilted) Then Return True
' In tutti gli altri casi non è forzata
Return False
End Function
#Region "BRIDGE" #Region "BRIDGE"
Private Sub OnMyMouseDownSceneBridges(sender As Object, e As System.Windows.Forms.MouseEventArgs, Private Sub OnMyMouseDownSceneBridges(sender As Object, e As System.Windows.Forms.MouseEventArgs,
@@ -501,7 +524,7 @@ Public Class SplitPageUC
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione ' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
If Not m_bActive OrElse m_bShow Then Return If Not m_bActive OrElse m_bShow Then Return
If e.Button = Windows.Forms.MouseButtons.Right And m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then If e.Button = Windows.Forms.MouseButtons.Right Then
Dim nCurrCtx As Integer = EgtGetCurrentContext() Dim nCurrCtx As Integer = EgtGetCurrentContext()
Dim nSel1 As Integer = GDB_ID.NULL Dim nSel1 As Integer = GDB_ID.NULL
Dim nPvId As Integer = GDB_ID.NULL Dim nPvId As Integer = GDB_ID.NULL
@@ -656,16 +679,17 @@ Public Class SplitPageUC
' Cambiamenti possibili solo se taglio di lama ' Cambiamenti possibili solo se taglio di lama
If EgtGetOperationType( nMchId) <> MCH_OY.SAWING Then Return If EgtGetOperationType( nMchId) <> MCH_OY.SAWING Then Return
' Imposto la lavorazione corrente ' Imposto la lavorazione corrente
Dim sSawing As String = String.Empty EgtSetCurrMachining(nMchId)
Dim EntId As Integer = GDB_ID.NULL Dim EntId As Integer = GDB_ID.NULL
Dim SubEntId As Integer = GDB_ID.NULL Dim SubEntId As Integer = GDB_ID.NULL
EgtSetCurrMachining(nMchId)
If Not EgtGetMachiningGeometry(0, EntId, SubEntId) Then Return If Not EgtGetMachiningGeometry(0, EntId, SubEntId) Then Return
' verifico se la lavorazione selezionata ha un angolo di inclinazione ' verifico se la lavorazione selezionata ha un angolo di inclinazione
Dim dSideAng As Double = 0.0 Dim dSideAng As Double = 0.0
EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAng) EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAng)
Dim sDefMach As String = If(Math.Abs(dSideAng) < EPS_ANG_SMALL, DEF_MACHINING, DEF_MACHINING_TILTED) Dim bVertical As Boolean = ( Math.Abs(dSideAng) < EPS_ANG_SMALL)
Dim sDefMach As String = If(bVertical, DEF_MACHINING, DEF_MACHINING_TILTED)
' Recupero il nome della lavorazione ' Recupero il nome della lavorazione
Dim sSawing As String = ""
EgtGetInfo(EntId, sDefMach, sSawing) EgtGetInfo(EntId, sDefMach, sSawing)
' Apro pagina di selezione della lavorazione ' Apro pagina di selezione della lavorazione
@@ -677,7 +701,19 @@ Public Class SplitPageUC
' se seleziono "Ok" allora cambio la lavorazione ' se seleziono "Ok" allora cambio la lavorazione
If m_ChangeToolPage.DialogResult Then If m_ChangeToolPage.DialogResult Then
EgtSetInfo(EntId, sDefMach, m_ChangeToolPage.NewSawing) ' se taglio verticale o non c'è lavorazione dedicata per inclinato
If bVertical Or Not m_MainWindow.m_CurrentMachine.bApplySawingTilted Then
' se ripristino default, tolgo info
If m_ChangeToolPage.NewSawing = m_MainWindow.m_CurrentMachine.sCurrSawing Then
EgtRemoveInfo(EntId, sDefMach)
' altrimenti la aggiorno
Else
EgtSetInfo(EntId, sDefMach, m_ChangeToolPage.NewSawing)
End If
' altrimenti inclinato con lavorazione dedicata
Else
EgtSetInfo(EntId, sDefMach, m_ChangeToolPage.NewSawing)
End If
Dim Index As Integer = 0 Dim Index As Integer = 0
For Index = 0 To m_MachiningList.Count() - 1 For Index = 0 To m_MachiningList.Count() - 1
If m_MachiningList(Index).m_nId = nMchId Then Exit For If m_MachiningList(Index).m_nId = nMchId Then Exit For
@@ -716,7 +752,12 @@ Public Class SplitPageUC
Dim EgtCol As Color3d = m_ChangeToolPage.EgtColor Dim EgtCol As Color3d = m_ChangeToolPage.EgtColor
Dim tmpSawColor As System.Windows.Media.Color = System.Windows.Media.Color.FromRgb(EgtCol.R, EgtCol.G, EgtCol.B) Dim tmpSawColor As System.Windows.Media.Color = System.Windows.Media.Color.FromRgb(EgtCol.R, EgtCol.G, EgtCol.B)
m_ItemList(Index).SawColor = New SolidColorBrush(tmpSawColor) m_ItemList(Index).SawColor = New SolidColorBrush(tmpSawColor)
m_ItemList(Index).MachiningTCPosVisibility = Visibility.Visible If m_MainWindow.m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW AndAlso
Not VerifyForcedCurrMachine() Then
m_ItemList(Index).MachiningTCPosVisibility = Visibility.Hidden
else
m_ItemList(Index).MachiningTCPosVisibility = Visibility.Visible
End If
EgtDraw() EgtDraw()
End If End If
m_bModified = True m_bModified = True
@@ -948,9 +989,7 @@ Public Class SplitPageUC
If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return
Dim Index As Integer = MachiningLsBx.SelectedIndex Dim Index As Integer = MachiningLsBx.SelectedIndex
If Index = -1 Then Return If Index = -1 Then Return
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then ChangeMachining(m_MachiningList(Index).m_nId)
ChangeMachining(m_MachiningList(Index).m_nId)
End If
End Sub End Sub
Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click
@@ -2606,10 +2645,10 @@ Public Class SplitPageUC
ModifyBtn.IsEnabled = m_bShow ModifyBtn.IsEnabled = m_bShow
' Per bottone AUTO ' Per bottone AUTO
AutoBtn.Visibility = If(m_bShow, Windows.Visibility.Hidden, Windows.Visibility.Visible) AutoBtn.Visibility = If(m_bShow, Windows.Visibility.Hidden, Windows.Visibility.Visible)
AutoBtn.IsEnabled = Not m_bShow And ((GetDisabledCutsCount() > 0 Or m_nCurrPhase = 1) And Not m_bByHand) AutoBtn.IsEnabled = (Not m_bShow And ((GetDisabledCutsCount() > 0 Or m_nCurrPhase = 1) And Not m_bByHand))
' Per bottone RESTART ' Per bottone RESTART
RestartBtn.Visibility = If(m_bShow, Windows.Visibility.Visible, Windows.Visibility.Hidden) RestartBtn.Visibility = If(m_bShow, Windows.Visibility.Visible, Windows.Visibility.Hidden)
RestartBtn.IsEnabled = m_bShow And m_MainWindow.m_CurrentMachine.bEnableRestart RestartBtn.IsEnabled = (m_bShow And m_MainWindow.m_CurrentMachine.bEnableRestart)
' Altri bottoni ' Altri bottoni
MoveUpBtn.IsEnabled = Not m_bShow MoveUpBtn.IsEnabled = Not m_bShow
MoveDownBtn.IsEnabled = Not m_bShow MoveDownBtn.IsEnabled = Not m_bShow
@@ -2630,7 +2669,7 @@ Public Class SplitPageUC
ModifStartBtn.IsEnabled = Not m_bShow ModifStartBtn.IsEnabled = Not m_bShow
ModifEndBtn.IsEnabled = Not m_bShow ModifEndBtn.IsEnabled = Not m_bShow
InvertBtn.IsEnabled = Not m_bShow InvertBtn.IsEnabled = Not m_bShow
PauseBtn.IsEnabled = Not m_bShow And m_MainWindow.m_CurrentMachine.bEnablePause PauseBtn.IsEnabled = (Not m_bShow And m_MainWindow.m_CurrentMachine.bEnablePause)
BridgesWJBtn.IsEnabled = Not m_bShow BridgesWJBtn.IsEnabled = Not m_bShow
BridgesDeleteWJBtn.IsEnabled = Not m_bShow BridgesDeleteWJBtn.IsEnabled = Not m_bShow
QualityWJBtn.IsEnabled = Not m_bShow QualityWJBtn.IsEnabled = Not m_bShow
+1 -1
View File
@@ -227,7 +227,7 @@ Module SideAngle
EgtSetInfo(EntId, INFO_ORIG_SIDE_ANGLE, dAng) EgtSetInfo(EntId, INFO_ORIG_SIDE_ANGLE, dAng)
EgtSetInfo(EntId, INFO_HEEL, dHeel) EgtSetInfo(EntId, INFO_HEEL, dHeel)
Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted Dim sSawingTilted As String = m_MainWindow.m_CurrentMachine.sCurrSawingTilted
If Not String.IsNullOrEmpty(sSawingTilted) Then If Not String.IsNullOrWhiteSpace(sSawingTilted) Then
EgtSetInfo(EntId, DEF_MACHINING_TILTED, sSawingTilted) EgtSetInfo(EntId, DEF_MACHINING_TILTED, sSawingTilted)
End If End If
End If End If
+21 -20
View File
@@ -555,9 +555,7 @@ Public Class CurrentProjectPageUC
' carica ultimo progetto ' carica ultimo progetto
Friend Function LoadProject(ByVal sPath As String, Optional ByVal bUpdateIndex As Boolean = True) As Boolean Friend Function LoadProject(ByVal sPath As String, Optional ByVal bUpdateIndex As Boolean = True) As Boolean
' Se richiesto, imposto nuovo indice di progetto ' Se richiesto, imposto nuovo indice di progetto
If bUpdateIndex Then If bUpdateIndex Then SetNextProjectIndex()
SetNextProjectIndex()
End If
' Carico il file del progetto ' Carico il file del progetto
EgtOutLog("LoadProject : " & sPath & " (" & m_nCurrProj.ToString() & ")") EgtOutLog("LoadProject : " & sPath & " (" & m_nCurrProj.ToString() & ")")
If Not LoadFile(sPath) Then If Not LoadFile(sPath) Then
@@ -574,39 +572,42 @@ Public Class CurrentProjectPageUC
UpdateHeightTxBx() UpdateHeightTxBx()
' aggiorno materiale ' aggiorno materiale
m_MainWindow.m_CurrentMachine.SetCurrMatByName(GetProjectMaterial()) m_MainWindow.m_CurrentMachine.SetCurrMatByName(GetProjectMaterial())
' recupero Id del gruppo "OmagCUT"
Dim nProjMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
' aggiorno altezza sovaratavola ' aggiorno altezza sovaratavola
If GetPrivateProfileInt(S_GENERAL, K_ADD_TAB_BY_PROJ, 0, m_sIniFile) = 1 Then If GetPrivateProfileInt(S_GENERAL, K_ADD_TAB_BY_PROJ, 0, m_sIniFile) = 1 Then
' leggo il valore OrigiAdditionalTable ' leggo il valore OrigAdditionalTable
Dim dValue As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable Dim dValue As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
Dim sKey As String = K_ADDITIONALTABLE
Select Case GetCurrentTable() Select Case GetCurrentTable()
Case 4
sKey = K_TAB4_ADDITIONALTABLE
Case 3 Case 3
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), K_TAB3_ADDITIONALTABLE, dValue) sKey = K_TAB3_ADDITIONALTABLE
Case 2 Case 2
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), K_TAB2_ADDITIONALTABLE, dValue) sKey = K_TAB2_ADDITIONALTABLE
Case Else
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), K_ADDITIONALTABLE, dValue)
End Select End Select
EgtGetInfo(nProjMarkId, sKey, dValue)
m_MainWindow.m_CurrentMachine.dAdditionalTable = dValue m_MainWindow.m_CurrentMachine.dAdditionalTable = dValue
End If End If
' forzo visualizzazione eventuali dati su aree ' Forzo visualizzazione eventuali dati su aree
SetAreasStatus(True) SetAreasStatus(True)
' Recupero info C Home ' Recupero info C_Home corrente
Dim dCHomeCurrMach As Double Dim dCHomeCurrMach As Double
Dim dCHomeCurrproj As Double
EgtGetAxisHomePos("C", dCHomeCurrMach) EgtGetAxisHomePos("C", dCHomeCurrMach)
' Verifico che esista l'info del progetto ' Verifico C_Home del progetto
If EgtExistsInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME) Then Dim dCHomeCurrproj As Double
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, dCHomeCurrproj) If EgtGetInfo(nProjMarkId, INFO_CAXESHOME, dCHomeCurrproj) Then
' Se la macchina indicata ha C Home differente allora comunico un errore del progetto ' Recupero tipo di ventose usate
If Math.Abs(dCHomeCurrproj - dCHomeCurrMach) > EPS_ANG_SMALL Then Dim nVacType As Integer = 0
EgtGetInfo(EgtGetHeadId("H4"), KEY_VAC_TYPE, nVacType)
' Se ventose di lato alla testa e C_Home diverso, registro un problema
If nVacType = 2 And Math.Abs(dCHomeCurrproj - dCHomeCurrMach) > EPS_ANG_SMALL Then
EgtOutLog(" WARNING -> C axes home project is different from current machine, delta ang C home:" & DoubleToString(dCHomeCurrproj - dCHomeCurrMach, 2)) EgtOutLog(" WARNING -> C axes home project is different from current machine, delta ang C home:" & DoubleToString(dCHomeCurrproj - dCHomeCurrMach, 2))
End If End If
Else Else
EgtSetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, DoubleToString(dCHomeCurrMach, 0)) EgtSetInfo(nProjMarkId, INFO_CAXESHOME, DoubleToString(dCHomeCurrMach, 0))
End If End If
'SelParkIndWD.UpdateViewOnParkInd(False)
' Dichiaro progetto non modificato ' Dichiaro progetto non modificato
EgtResetModified() EgtResetModified()
Return True Return True