OmagCUT :
- modifiche e correzioni per cambio lama in pagina Split.
This commit is contained in:
@@ -68,7 +68,7 @@ Public Class ChangeToolWD
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OpenFile_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
Private Sub ChangeToolWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
' Posizione finestra
|
||||
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
|
||||
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
|
||||
@@ -78,7 +78,7 @@ Public Class ChangeToolWD
|
||||
FilePathTxBl.Text = EgtMsg(90378)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenFile_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
||||
Private Sub ChangeToolWD_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
||||
If String.IsNullOrEmpty(m_CurrSawing) Then
|
||||
m_CurrSawing = m_MainWindow.m_CurrentMachine.sCurrSawing
|
||||
End If
|
||||
@@ -116,7 +116,7 @@ Public Class ChangeToolWD
|
||||
' Imposto il contesto corrente
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
' Recupero la lista di tutte le lavorazioni di lama
|
||||
Dim local_Sawing As TreeViewItem.CathegoryItem = GetAllSwaing()
|
||||
Dim local_Sawing As TreeViewItem.CathegoryItem = GetAllSawing()
|
||||
' Se non ci sono lavorazioni di lama allora esco
|
||||
If IsNothing(local_Sawing) Then Return False
|
||||
|
||||
@@ -138,17 +138,17 @@ Public Class ChangeToolWD
|
||||
EgtMdbSetCurrMachining(Item.Name)
|
||||
' Recupero il nome dell'utensile della lavorazione
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sNameTool)
|
||||
If Not String.IsNullOrEmpty(sNameTool) And VerifyCurrSawTollerance(sNameTool) Then
|
||||
If Not String.IsNullOrEmpty(sNameTool) And VerifyCurrSawTolerance(sNameTool) Then
|
||||
' Verifico che sia montata su un portautensile
|
||||
EgtTdbSetCurrTool(sNameTool)
|
||||
Dim sTCPos As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
|
||||
If Not String.IsNullOrEmpty(sTCPos) Then
|
||||
' Cerco nel porta utensili automaitico
|
||||
' Cerco nel porta utensili automatico
|
||||
For Each ToolPosition As ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
|
||||
If ToolPosition.sTool <> String.Empty Then
|
||||
If sNameTool = ToolPosition.sTool Then
|
||||
' Verifico che il materiale e lo spessore
|
||||
' Verifico il materiale e lo spessore
|
||||
If VerifyCurrMachiningMaterial() Then
|
||||
m_SetUpMachiningList.Add(New ItemMachining(Item.Name, sNameTool, sTCPos, Utility.GetColorPV()))
|
||||
End If
|
||||
@@ -211,7 +211,7 @@ Public Class ChangeToolWD
|
||||
End Function
|
||||
|
||||
' verifico l'utensile corrente (impostato nella funzione chiamante) se ha le stesse dimensioni della lama di default
|
||||
Private Function VerifyCurrSawTollerance(sNameTool As String) As Boolean
|
||||
Private Function VerifyCurrSawTolerance(sNameTool As String) As Boolean
|
||||
If m_DefaultSaw_Exists Then
|
||||
If EgtTdbSetCurrTool(sNameTool) Then
|
||||
' Diametro nuova lama
|
||||
@@ -220,10 +220,10 @@ Public Class ChangeToolWD
|
||||
' Spessore lama
|
||||
Dim NewThick As Double = 0
|
||||
EgtTdbGetCurrToolParam(MCH_TP.THICK, NewThick)
|
||||
' Verifico che la nuova lama possa essere applicata: diametro minore, uguale spessore
|
||||
' Verifico che la nuova lama possa essere applicata: diametro max 1.25*prec, uguale spessore
|
||||
Dim Delta_Diam As Double = NewDiam - m_DefaultSaw_Diam
|
||||
Dim Delta_Thick As Double = Math.Abs(NewThick - m_DefaultSaw_Thick)
|
||||
If Delta_Diam < EPS_SMALL And Delta_Thick < EPS_SMALL Then
|
||||
If Delta_Diam < 0.25 * m_DefaultSaw_Diam And Delta_Thick < EPS_SMALL Then
|
||||
Return True
|
||||
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))
|
||||
@@ -242,19 +242,18 @@ Public Class ChangeToolWD
|
||||
End Function
|
||||
|
||||
' Restituisce tutto l'elenco delle lavorazioni disponibili in macchina
|
||||
Private Function GetAllSwaing() As TreeViewItem.CathegoryItem
|
||||
Private Function GetAllSawing() As TreeViewItem.CathegoryItem
|
||||
Dim sFName As String = EgtMsg(90771) ' Uscita
|
||||
Dim nFType As Integer = MCH_MY.SAWING
|
||||
If Not m_MainWindow.m_CurrentMachine.bSawing Then Return Nothing
|
||||
' Inserisco categoria ed eventuali elementi
|
||||
Dim MachiningCathegory As New TreeViewItem.CathegoryItem(sFName, nFType)
|
||||
Dim MachiningName As String = String.Empty
|
||||
If EgtMdbGetFirstMachining(nFType, MachiningName) Then
|
||||
Dim bFound As Boolean = EgtMdbGetFirstMachining(nFType, MachiningName)
|
||||
While bFound
|
||||
MachiningCathegory.Items.Add(New TreeViewItem.CustomItem(MachiningName, nFType))
|
||||
While EgtMdbGetNextMachining(nFType, MachiningName)
|
||||
MachiningCathegory.Items.Add(New TreeViewItem.CustomItem(MachiningName, nFType))
|
||||
End While
|
||||
End If
|
||||
bFound = EgtMdbGetNextMachining(nFType, MachiningName)
|
||||
End While
|
||||
Return MachiningCathegory
|
||||
End Function
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ Public Module SplitAuto
|
||||
' verifico sia una lavorazione valida della fase corrente
|
||||
If IsValidMachining(nOperId) And EgtGetOperationPhase(nOperId) = nCurrPhase Then
|
||||
Dim Mach As New SplitMach
|
||||
If CreateMach(Mach, nOperId) Then MachSplitList.Add(Mach)
|
||||
If CreateMach(nOperId, Mach) Then MachSplitList.Add(Mach)
|
||||
End If
|
||||
nOperId = EgtGetNextOperation(nOperId)
|
||||
End While
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function CreateMach(ByRef Mach As SplitMach, nOperId As Integer) As Boolean
|
||||
Friend Function CreateMach(nOperId As Integer, ByRef Mach As SplitMach) As Boolean
|
||||
Dim bOk As Boolean = True
|
||||
' se appartiene ad un grezzo attivo la inserisco in lista
|
||||
If IsMachiningInActiveRaw(nOperId) Then
|
||||
|
||||
+28
-13
@@ -651,6 +651,8 @@ Public Class SplitPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub ChangeMachinig(nMchId As Integer)
|
||||
' Cambiamenti possibili solo se taglio di lama
|
||||
If EgtGetOperationType( nMchId) <> MCH_OY.SAWING Then Return
|
||||
' Imposto la lavorazione corrente
|
||||
Dim sSawing As String = String.Empty
|
||||
Dim EntId As Integer = GDB_ID.NULL
|
||||
@@ -660,10 +662,7 @@ Public Class SplitPageUC
|
||||
' verifico se la lavorazione selezionata ha un angolo di inclinazione
|
||||
Dim dSideAng As Double = 0.0
|
||||
EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAng)
|
||||
Dim sDefMach As String = DEF_MACHINING
|
||||
If Math.Abs(dSideAng) > 0 Then
|
||||
sDefMach = DEF_MACHINING_TILTED
|
||||
End If
|
||||
Dim sDefMach As String = If(Math.Abs(dSideAng) < EPS_ANG_SMALL, DEF_MACHINING, DEF_MACHINING_TILTED)
|
||||
' Recupero il nome della lavorazione
|
||||
EgtGetInfo(EntId, sDefMach, sSawing)
|
||||
|
||||
@@ -674,27 +673,42 @@ Public Class SplitPageUC
|
||||
' apro la finestra per la selezione delle lavorazioni
|
||||
m_ChangeToolPage.ShowDialog()
|
||||
|
||||
' se seleziono "Ok" allora resetto tutte le lavorazioni del progetto
|
||||
' se seleziono "Ok" allora cambio la lavorazione
|
||||
If m_ChangeToolPage.DialogResult Then
|
||||
EgtSetInfo(EntId, sDefMach, m_ChangeToolPage.NewSawing)
|
||||
Dim Index As Integer = 0
|
||||
For Index = 0 To m_MachiningList.Count() - 1
|
||||
If m_MachiningList(Index).m_nId = nMchId Then
|
||||
Exit For
|
||||
End If
|
||||
If m_MachiningList(Index).m_nId = nMchId Then Exit For
|
||||
Next
|
||||
Dim nNewMchId As Integer = -1
|
||||
CamAuto.AddSawMachining(nMchId, nNewMchId)
|
||||
' Elimino la numerazione e la freccia
|
||||
' Smarco ed elimino la numerazione e la freccia
|
||||
MarkMachining( Index, False)
|
||||
EgtErase(m_MachiningList(Index).m_nArrId)
|
||||
EgtErase(m_MachiningList(Index).m_nNbrId)
|
||||
Dim Mach As New SplitMach
|
||||
' Aggiorno la lavorazione
|
||||
Dim nNewMchId As Integer = GDB_ID.NULL
|
||||
CamAuto.AddSawMachining(nMchId, nNewMchId)
|
||||
' Aggiorno anche le lavorazioni dipendenti disabilitate
|
||||
Dim sOthMid As String = ""
|
||||
For Each nOthMId As Integer In m_MachiningList(Index).m_vOthId
|
||||
EgtSetCurrMachining(nOthMId)
|
||||
If EgtGetMachiningGeometry(0, EntId, SubEntId) Then
|
||||
EgtSetInfo(EntId, sDefMach, m_ChangeToolPage.NewSawing)
|
||||
Dim nNewOthMchId As Integer = GDB_ID.NULL
|
||||
CamAuto.AddSawMachining(nOthMId, nNewOthMchId)
|
||||
EgtSetOperationMode(nNewOthMchId, False)
|
||||
sOthMid &= If( String.IsNullOrEmpty( sOthMid), "", ",") & nNewOthMchId.ToString()
|
||||
End If
|
||||
Next
|
||||
EgtSetInfo(nNewMchId, INFO_MCH_OTHMID, sOthMId)
|
||||
' Sostituisco la vecchia lavorazione con la nuova
|
||||
If SplitAuto.CreateMach(Mach, nNewMchId) Then
|
||||
Dim Mach As New SplitMach
|
||||
If SplitAuto.CreateMach(nNewMchId, Mach) Then
|
||||
' Assegno la lavorazione alla lista
|
||||
m_MachiningList(Index) = Mach
|
||||
' Riassegno la numerazione
|
||||
NumberDirectionMachining(Index)
|
||||
EgtSetStatus(m_MachiningList(Index).m_nArrId, GDB_ST.ON_)
|
||||
EgtSetStatus(m_MachiningList(Index).m_nNbrId, GDB_ST.ON_)
|
||||
m_ItemList(Index).TCPos = m_ChangeToolPage.TCPos
|
||||
' Recupero il colore della lavorazione
|
||||
Dim EgtCol As Color3d = m_ChangeToolPage.EgtColor
|
||||
@@ -703,6 +717,7 @@ Public Class SplitPageUC
|
||||
m_ItemList(Index).MachiningTCPosVisibility = Visibility.Visible
|
||||
EgtDraw()
|
||||
End If
|
||||
m_bModified = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user