77ee302fa7
- notevoli migliorie a spezzatura manuale.
620 lines
24 KiB
VB.net
620 lines
24 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports EgtUILib
|
|
|
|
Public Class SplitPageUC
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
|
|
|
Private m_nCurrPhase As Integer = 0
|
|
Private m_MachiningList As New List(Of Machining)
|
|
Private m_ItemList As New ObservableCollection(Of NameIdLsBxItem)
|
|
Private m_CurrInd As Integer = -1
|
|
Private m_bModified As Boolean = False
|
|
Private m_nNbrGrpId As Integer = GDB_ID.NULL
|
|
Private m_bToNext As Boolean = False
|
|
|
|
Private Sub SplitPageUC_Initialized(sender As Object, e As EventArgs)
|
|
' Collego lista di oggetti a ListBox
|
|
MachiningLsBx.ItemsSource = m_ItemList
|
|
' Assegno testi
|
|
OnOffBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 1) ' On/Off
|
|
AllOnBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 2) ' Tutti On
|
|
AllOffBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 3) ' Tutti Off
|
|
CutBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 4) ' Allunga/Accorcia
|
|
CutStartBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 5) ' Inizio Allunga/Accorcia
|
|
CutEndBtn.Content = EgtMsg(MSG_SPLITPAGEUC + 6) ' Fine Allunga/Accorcia
|
|
End Sub
|
|
|
|
Private Sub SplitPageUC_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
|
' Se non c'è ordine delle lavorazioni, ne faccio uno automatico
|
|
If Not m_MainWindow.m_CurrentProjectPageUC.GetOrderMachiningFlag() Then
|
|
Dim bOk As Boolean = SortAllMachinings()
|
|
If bOk Then
|
|
m_MainWindow.m_CurrentProjectPageUC.SetOrderMachiningFlag()
|
|
End If
|
|
End If
|
|
' Disabilito impostazione modificato
|
|
EgtDisableModified()
|
|
' Creo gruppo per numeri identificativi di lavorazione (colore default grigio)
|
|
m_nNbrGrpId = EgtCreateGroup(GDB_ID.ROOT)
|
|
EgtSetColor(m_nNbrGrpId, COL_MCH_DISABLED)
|
|
EgtSetStatus(m_nNbrGrpId, GDB_ST.SEL)
|
|
EgtSetLevel(m_nNbrGrpId, GDB_LV.TEMP)
|
|
' Recupero l'indice della fase corrente
|
|
m_nCurrPhase = EgtGetCurrPhase()
|
|
' Preparo la lista delle lavorazioni
|
|
m_MachiningList.Clear()
|
|
Dim nOperId As Integer = EgtGetFirstOperation()
|
|
While nOperId <> GDB_ID.NULL
|
|
' verifico sia una lavorazione valida della fase corrente
|
|
If IsValidMachining(nOperId) And EgtGetOperationPhase(nOperId) = m_nCurrPhase Then
|
|
Dim Mach As New Machining
|
|
' identificativo
|
|
Mach.m_nId = nOperId
|
|
' eventuali lavorazioni inglobate
|
|
Dim sInfo As String = String.Empty
|
|
If EgtGetInfo(nOperId, INFO_MCH_OTHMID, sInfo) Then
|
|
Dim sItems() As String = sInfo.Split(",".ToCharArray)
|
|
For Each sId In sItems
|
|
Mach.m_vOthId.Add(CInt(sId))
|
|
Next
|
|
End If
|
|
' tipo
|
|
Mach.m_nType = EgtGetOperationType(nOperId)
|
|
' layer di origine
|
|
EgtGetInfo(nOperId, "Lay", Mach.m_sLay)
|
|
' verifica interferenza
|
|
If Mach.m_sLay = "OutLoop" Then
|
|
EgtVerifyMachining(nOperId, Mach.m_nInterf)
|
|
For Each nId As Integer In Mach.m_vOthId
|
|
Dim nRes As Integer = FMI_TYPE.LI Or FMI_TYPE.RM Or FMI_TYPE.LO
|
|
EgtVerifyMachining(nId, nRes)
|
|
Mach.m_nInterf = Mach.m_nInterf Or nRes
|
|
Next
|
|
Else
|
|
Mach.m_nInterf = FMI_TYPE.NONE
|
|
End If
|
|
' verifica se trasformabile in un taglio di separazione
|
|
If Mach.m_sLay = "OutLoop" And Mach.m_nInterf = FMI_TYPE.NONE Then
|
|
Dim nRes As Integer = EgtVerifyCutAsSplitting(nOperId)
|
|
Mach.m_bCanAllStart = (nRes And CAR_RES.LI_OK) <> 0
|
|
Mach.m_bCanAllEnd = (nRes And CAR_RES.LO_OK) <> 0
|
|
Else
|
|
Mach.m_bCanAllStart = False
|
|
Mach.m_bCanAllEnd = False
|
|
End If
|
|
' se trasformabile in taglio di separazione, verifico se lo è
|
|
If Mach.m_bCanAllStart Or Mach.m_bCanAllEnd Then
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim nLiType As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiType)
|
|
Dim nLoType As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoType)
|
|
Mach.m_bAllStart = (nLiType = MCH_SAW_LI.EXT_CENT)
|
|
Mach.m_bAllEnd = (nLoType = MCH_SAW_LO.EXT)
|
|
Else
|
|
Mach.m_bAllStart = False
|
|
Mach.m_bAllEnd = False
|
|
End If
|
|
' abilitazione
|
|
Mach.m_bEnabled = Not EgtExistsInfo(nOperId, INFO_MCH_USER_OFF)
|
|
' inserisco in lista
|
|
m_MachiningList.Add(Mach)
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList.Count() - 1)
|
|
' assegno numerazione
|
|
NumberMachining(m_MachiningList.Count() - 1)
|
|
End If
|
|
nOperId = EgtGetNextOperation(nOperId)
|
|
End While
|
|
' Preparo la lista degli Item
|
|
m_ItemList.Clear()
|
|
For i As Integer = 1 To m_MachiningList.Count()
|
|
Dim Mach As Machining = m_MachiningList(i - 1)
|
|
If Mach.m_nType = MCH_OY.SAWING Then ' Taglio
|
|
Dim sText As String = EgtMsg(90791) & i.ToString()
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled))
|
|
ElseIf Mach.m_nType = MCH_OY.DRILLING Then ' Foratura
|
|
Dim sText As String = EgtMsg(90792) & i.ToString()
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled))
|
|
ElseIf Mach.m_nType = MCH_OY.MILLING Then ' Fresatura
|
|
Dim sText As String = EgtMsg(90793) & i.ToString()
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled))
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Abilito impostazione modificato
|
|
EgtEnableModified()
|
|
' Nessun item corrente
|
|
m_CurrInd = -1
|
|
' Reset flag di modifica
|
|
m_bModified = False
|
|
' Reset flag tipo uscita
|
|
m_bToNext = False
|
|
End Sub
|
|
|
|
Private Sub MachiningLsBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles MachiningLsBx.SelectionChanged
|
|
Dim SelItem As NameIdLsBxItem = MachiningLsBx.SelectedItem
|
|
If IsNothing(SelItem) Then Return
|
|
Dim nInd As Integer = SelItem.Ind
|
|
If nInd <> m_CurrInd Then
|
|
MarkMachining(m_CurrInd, False)
|
|
MarkMachining(nInd, True)
|
|
m_CurrInd = nInd
|
|
EgtDraw()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click
|
|
MoveItem(-1)
|
|
End Sub
|
|
|
|
Private Sub MoveDownBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveDownBtn.Click
|
|
MoveItem(1)
|
|
End Sub
|
|
|
|
Private Sub MoveItem(direction As Integer)
|
|
' Checking selected item
|
|
If MachiningLsBx.SelectedItem Is Nothing OrElse MachiningLsBx.SelectedIndex < 0 OrElse MachiningLsBx.SelectedItems.Count > 1 Then
|
|
Return
|
|
End If
|
|
' No selected item - nothing to do
|
|
' Calculate new index using move direction
|
|
Dim newIndex As Integer = MachiningLsBx.SelectedIndex + direction
|
|
|
|
' Checking bounds of the range
|
|
If newIndex < 0 OrElse newIndex >= MachiningLsBx.Items.Count Then
|
|
Return
|
|
End If
|
|
' Index out of range - nothing to do
|
|
Dim selected As Object = MachiningLsBx.SelectedItem
|
|
|
|
' Removing removable element
|
|
m_ItemList.Remove(selected)
|
|
' Insert it in new position
|
|
m_ItemList.Insert(newIndex, selected)
|
|
' Restore selection
|
|
MachiningLsBx.SelectedItem = selected
|
|
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub OnOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles OnOffBtn.Click
|
|
Dim SelItem As NameIdLsBxItem = MachiningLsBx.SelectedItem
|
|
If IsNothing(SelItem) Then
|
|
Return
|
|
End If
|
|
Dim nI As Integer = SelItem.Ind
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
SelItem.bIsActive = False
|
|
Else
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
SelItem.bIsActive = True
|
|
End If
|
|
ColorMachining(nI)
|
|
ColorNumber(nI)
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub AllOnBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOnBtn.Click
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If Not m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
m_ItemList(nI).bIsActive = True
|
|
ColorMachining(nI)
|
|
ColorNumber(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub AllOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOffBtn.Click
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
m_ItemList(nI).bIsActive = False
|
|
ColorMachining(nI)
|
|
ColorNumber(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub CutBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutBtn.Click
|
|
Dim SelItem As NameIdLsBxItem = MachiningLsBx.SelectedItem
|
|
If IsNothing(SelItem) Then
|
|
Return
|
|
End If
|
|
Dim nI As Integer = SelItem.Ind
|
|
If m_MachiningList(nI).m_bCanAllStart And m_MachiningList(nI).m_bCanAllEnd Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
If m_MachiningList(nI).m_bAllStart Or m_MachiningList(nI).m_bAllEnd Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllStart = False
|
|
m_MachiningList(nI).m_bAllEnd = False
|
|
Else
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllStart = True
|
|
m_MachiningList(nI).m_bAllEnd = True
|
|
End If
|
|
EgtDraw()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CutStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutStartBtn.Click
|
|
Dim SelItem As NameIdLsBxItem = MachiningLsBx.SelectedItem
|
|
If IsNothing(SelItem) Then
|
|
Return
|
|
End If
|
|
Dim nI As Integer = SelItem.Ind
|
|
If m_MachiningList(nI).m_bCanAllStart Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
If m_MachiningList(nI).m_bAllStart Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllStart = False
|
|
Else
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllStart = True
|
|
End If
|
|
EgtDraw()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CutEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutEndBtn.Click
|
|
Dim SelItem As NameIdLsBxItem = MachiningLsBx.SelectedItem
|
|
If IsNothing(SelItem) Then
|
|
Return
|
|
End If
|
|
Dim nI As Integer = SelItem.Ind
|
|
If m_MachiningList(nI).m_bCanAllEnd Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
If m_MachiningList(nI).m_bAllEnd Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllEnd = False
|
|
Else
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bAllEnd = True
|
|
End If
|
|
EgtDraw()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub SplitPageUC_Unloaded(sender As Object, e As EventArgs) Handles Me.Unloaded
|
|
ExitSplit()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Friend Sub ExitSplit()
|
|
If Not m_bToNext Then
|
|
' ritorno a fase 1
|
|
EgtSetCurrPhase(1)
|
|
End If
|
|
' cancello evidenziazione
|
|
If m_CurrInd >= 0 Then
|
|
MarkMachining(m_CurrInd, False)
|
|
m_CurrInd = -1
|
|
EgtDraw()
|
|
End If
|
|
' cancello gruppo di numerazione e ripristino colori lavorazioni
|
|
EgtDisableModified()
|
|
EgtErase(m_nNbrGrpId)
|
|
For i As Integer = 1 To m_MachiningList.Count()
|
|
ColorMachining(i - 1, True)
|
|
Next
|
|
EgtEnableModified()
|
|
' Affondamento ridotto
|
|
Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, m_MainWindow.GetMachIniFile())
|
|
' Restringo o rialzo lavorazioni abilitate ma con interferenza
|
|
Dim bModified As Boolean = False
|
|
For Each Mach As Machining In m_MachiningList
|
|
If Mach.m_bEnabled And Mach.m_nInterf <> FMI_TYPE.NONE Then
|
|
If AdjustMachining(Mach.m_nId, Mach.m_nInterf, dReducedDepth) Then
|
|
bModified = True
|
|
End If
|
|
End If
|
|
Next
|
|
If bModified Then
|
|
m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
End If
|
|
' se modificato salvo ordine e stato delle lavorazioni
|
|
If m_bModified Then
|
|
' Al primo posto deve rimanere la disposizione della fase
|
|
Dim nFirstOperId As Integer = EgtGetPhaseDisposition(m_nCurrPhase)
|
|
For i = m_ItemList.Count() - 1 To 0 Step -1
|
|
Dim nI As Integer = m_ItemList(i).Ind
|
|
Dim nMchId As Integer = m_MachiningList(nI).m_nId
|
|
EgtRelocate(nMchId, nFirstOperId, GDB_POS.AFTER)
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
EgtSetOperationMode(m_MachiningList(nI).m_nId, True)
|
|
EgtRemoveInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_OFF)
|
|
Else
|
|
EgtSetOperationMode(m_MachiningList(nI).m_nId, False)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_OFF, 1)
|
|
End If
|
|
Next
|
|
' dichiaro ordine salvato
|
|
m_MainWindow.m_CurrentProjectPageUC.SetOrderMachiningFlag()
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub GetEnabledCuts(ByRef Cuts() As Integer)
|
|
' Determino il numero di tagli abilitati
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
' Creo l'array con gli indici
|
|
Dim MyCuts(nCount - 1) As Integer
|
|
Dim nInd As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
MyCuts(nInd) = m_MachiningList(nI).m_nId
|
|
nInd += 1
|
|
End If
|
|
Next
|
|
' Lo restituisco
|
|
Cuts = MyCuts
|
|
End Sub
|
|
|
|
Friend Sub GetSplitCuts(ByRef Cuts() As Integer)
|
|
' Determino il numero di tagli di separazione
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bAllStart Or m_MachiningList(nI).m_bAllEnd Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
' Creo l'array con gli indici
|
|
Dim MyCuts(nCount - 1) As Integer
|
|
Dim nInd As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bAllStart Or m_MachiningList(nI).m_bAllEnd Then
|
|
MyCuts(nInd) = m_MachiningList(nI).m_nId
|
|
nInd += 1
|
|
End If
|
|
Next
|
|
' Lo restituisco
|
|
Cuts = MyCuts
|
|
End Sub
|
|
|
|
Private Sub NumberMachining(nI As Integer)
|
|
' Ingombro complessivo della lavorazione
|
|
Dim ptMin, ptMax As Point3d
|
|
If Not BoxFromMachining(nI, ptMin, ptMax) Then Return
|
|
' Metto il numero nel centro
|
|
Dim ptCen As Point3d = ptMin + 0.5 * (ptMax - ptMin)
|
|
ptCen.z = ptMax.z + 1
|
|
Dim dRadXY = Point3d.DistXY(ptMin, ptMax)
|
|
Dim dHtxt As Double = 75
|
|
Dim dRat As Double = 1
|
|
If dRadXY < 200 Then
|
|
dHtxt = 50
|
|
dRat = 0.75
|
|
ElseIf dRadXY < 25 Then
|
|
dHtxt = 25
|
|
dRat = 0.5
|
|
End If
|
|
Dim nNbrId As Integer = EgtCreateTextAdv(m_nNbrGrpId, ptCen, 0, (nI + 1).ToString(), "",
|
|
300, False, dHtxt, dRat, 0, INS_POS.MC)
|
|
m_MachiningList(nI).m_nNbrId = nNbrId
|
|
ColorNumber(nI)
|
|
EgtSetInfo(nNbrId, "MId", m_MachiningList(nI).m_nId)
|
|
' Aggiungo a lavorazione info con identificativo del numero e viceversa
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, "NbrId", nNbrId)
|
|
End Sub
|
|
|
|
Private Function BoxFromMachining(nI As Integer, ByRef ptMin As Point3d, ByRef ptMax As Point3d) As Boolean
|
|
If nI < 0 Then Return False
|
|
' Lavorazione principale
|
|
If Not BoxFromSingleMachining(m_MachiningList(nI).m_nId, ptMin, ptMax) Then
|
|
Return False
|
|
End If
|
|
' Eventuali lavorazioni inglobate
|
|
For Each nId As Integer In m_MachiningList(nI).m_vOthId
|
|
Dim ptMchMin, ptMchMax As Point3d
|
|
If BoxFromSingleMachining(nId, ptMchMin, ptMchMax) Then
|
|
ptMin.x = Math.Min(ptMin.x, ptMchMin.x)
|
|
ptMin.y = Math.Min(ptMin.y, ptMchMin.y)
|
|
ptMin.z = Math.Min(ptMin.z, ptMchMin.z)
|
|
ptMax.x = Math.Max(ptMax.x, ptMchMax.x)
|
|
ptMax.y = Math.Max(ptMax.y, ptMchMax.y)
|
|
ptMax.z = Math.Max(ptMax.z, ptMchMax.z)
|
|
End If
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Function BoxFromSingleMachining(nOperId As Integer, ByRef ptMin As Point3d, ByRef ptMax As Point3d) As Boolean
|
|
' Recupero il preview della lavorazione
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Return EgtGetBBoxGlob(nPvId, GDB_BB.STANDARD, ptMin, ptMax)
|
|
End Function
|
|
|
|
Private Sub MarkMachining(nI As Integer, bMark As Boolean)
|
|
If nI < 0 Then Return
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
' Evidenzio la lavorazione principale
|
|
MarkSingleMachining(nOperId, bMark)
|
|
' Evidenzio l'eventuale numero della lavorazione
|
|
MarkNumber(nI, bMark)
|
|
' Marco anche le lavorazioni inglobate
|
|
For Each nId As Integer In m_MachiningList(nI).m_vOthId
|
|
MarkSingleMachining(nId, bMark)
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub MarkSingleMachining(nOperId As Integer, bMark As Boolean)
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId) Then
|
|
If bMark Then
|
|
EgtSetMark(nPvId)
|
|
Else
|
|
EgtResetMark(nPvId)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MarkNumber(nI As Integer, bMark As Boolean)
|
|
If nI < 0 Then Return
|
|
Dim nNbrId As Integer = m_MachiningList(nI).m_nNbrId
|
|
If bMark Then
|
|
EgtSetMark(nNbrId)
|
|
Else
|
|
EgtResetMark(nNbrId)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ColorMachining(nI As Integer, Optional bReset As Boolean = False)
|
|
If nI < 0 Then Return
|
|
' Assegno stato
|
|
'Dim bEnabled As Boolean = If(bReset, True, m_MachiningList(nI).m_bEnabled)
|
|
Dim bEnabled As Boolean = m_MachiningList(nI).m_bEnabled
|
|
Dim nInterf As Integer = If(bReset, FMI_TYPE.NONE, m_MachiningList(nI).m_nInterf)
|
|
' Colore della lavorazione principale
|
|
ColorSingleMachining(m_MachiningList(nI).m_nId, bEnabled, nInterf)
|
|
' Colore delle lavorazioni inglobate
|
|
For Each nId As Integer In m_MachiningList(nI).m_vOthId
|
|
ColorSingleMachining(nId, bEnabled, nInterf)
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub ColorSingleMachining(nOperId As Integer, bEnabled As Boolean, nInterf As Integer)
|
|
' Recupero il preview della lavorazione
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
' Cambio il colore
|
|
Dim nGrpId As Integer = EgtGetFirstGroupInGroup(nPvId)
|
|
While nGrpId <> GDB_ID.NULL
|
|
Dim nCutId As Integer = EgtGetFirstNameInGroup(nGrpId, NAME_PV_CUT)
|
|
Dim nPrcId As Integer = EgtGetFirstNameInGroup(nGrpId, NAME_PV_PRECUT)
|
|
Dim nPocId As Integer = EgtGetFirstNameInGroup(nGrpId, NAME_PV_POSTCUT)
|
|
If Not bEnabled Then
|
|
EgtSetColor(nCutId, COL_MCH_DISABLED)
|
|
EgtSetColor(nPrcId, COL_MCH_DISABLED)
|
|
EgtSetColor(nPocId, COL_MCH_DISABLED)
|
|
Else
|
|
EgtSetColor(nCutId, COL_MCH_CUT)
|
|
Dim bFreeStart As Boolean = (nInterf And FMI_TYPE.LI) <> FMI_TYPE.LI
|
|
EgtSetColor(nPrcId, If(bFreeStart, COL_MCH_FREE, COL_MCH_INTERF))
|
|
Dim bFreeEnd As Boolean = (nInterf And FMI_TYPE.LO) <> FMI_TYPE.LO
|
|
EgtSetColor(nPocId, If(bFreeEnd, COL_MCH_FREE, COL_MCH_INTERF))
|
|
End If
|
|
nGrpId = EgtGetNextGroup(nGrpId)
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub ColorNumber(nI As Integer)
|
|
If nI < 0 Then Return
|
|
If Not m_MachiningList(nI).m_bEnabled Then
|
|
EgtResetColor(m_MachiningList(nI).m_nNbrId)
|
|
ElseIf m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtSetColor(m_MachiningList(nI).m_nNbrId, COL_MCH_FREE)
|
|
Else
|
|
EgtSetColor(m_MachiningList(nI).m_nNbrId, COL_MCH_INTERF)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub NextBtn_Click(sender As Object, e As RoutedEventArgs) Handles NextBtn.Click
|
|
m_bToNext = True
|
|
m_MainWindow.m_CadCutPageUC.CadCutPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC.m_SplitPage)
|
|
m_MainWindow.m_CadCutPageUC.CadCutPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC.m_MoveRawPartPage)
|
|
m_MainWindow.m_CadCutPageUC.m_MovePartPage = CadCutPageUC.MovePartsPages.MoveRawPart
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class NameIdLsBxItem
|
|
Implements INotifyPropertyChanged
|
|
|
|
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
|
|
|
|
Private m_nInd As Integer
|
|
Private m_sName As String
|
|
Private m_bIsActive As Boolean
|
|
|
|
Public Property Ind As Integer
|
|
Get
|
|
Return m_nInd
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nInd = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Name As String
|
|
Get
|
|
Return m_sName
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sName Then
|
|
m_sName = value
|
|
NotifyPropertyChanged("Name")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Public Property bIsActive As Boolean
|
|
Get
|
|
Return m_bIsActive
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_bIsActive Then
|
|
m_bIsActive = value
|
|
NotifyPropertyChanged("bIsActive")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Name As String, Ind As Integer, bIsActive As Boolean)
|
|
Me.m_sName = Name
|
|
Me.m_nInd = Ind
|
|
Me.m_bIsActive = bIsActive
|
|
End Sub
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class Machining
|
|
Public m_nId As Integer
|
|
Public m_vOthId As New List(Of Integer)
|
|
Public m_nType As Integer
|
|
Public m_sLay As String
|
|
Public m_nNbrId As Integer
|
|
Public m_nInterf As Integer
|
|
Public m_bCanAllStart As Boolean
|
|
Public m_bCanAllEnd As Boolean
|
|
Public m_bAllStart As Boolean
|
|
Public m_bAllEnd As Boolean
|
|
Public m_bEnabled As Boolean
|
|
End Class |