5edb9884c9
- aggiunta gestione spezzatura e movimento lastre.
1295 lines
45 KiB
VB.net
1295 lines
45 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class SplitModeVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Stato
|
|
Private m_nCurrPhase As Integer = 0
|
|
Private m_MachiningList As New List(Of SplitMach)
|
|
Private m_CurrInd As Integer = -1
|
|
Private m_bModified As Boolean = False
|
|
Private m_nNbrGrpId As Integer = GDB_ID.NULL
|
|
|
|
Private m_ItemList As New ObservableCollection(Of NameIdLsBxItem)
|
|
Public ReadOnly Property ItemList As ObservableCollection(Of NameIdLsBxItem)
|
|
Get
|
|
Return m_ItemList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelItem As NameIdLsBxItem
|
|
Public Property SelItem As NameIdLsBxItem
|
|
Get
|
|
Return m_SelItem
|
|
End Get
|
|
Set(value As NameIdLsBxItem)
|
|
m_SelItem = value
|
|
Dim nInd As Integer = m_SelItem.Ind
|
|
If nInd <> m_CurrInd Then
|
|
MarkMachining(m_CurrInd, False)
|
|
MarkMachining(nInd, True)
|
|
m_CurrInd = nInd
|
|
EgtDraw()
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SplitModeIsEnabled As Boolean
|
|
Public Property SplitModeIsEnabled As Boolean
|
|
Get
|
|
Return m_SplitModeIsEnabled
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_SplitModeIsEnabled = value
|
|
NotifyPropertyChanged("SplitModeIsEnabled")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_AllExtRedVisibility As Visibility
|
|
Public Property AllExtRedVisibility As Visibility
|
|
Get
|
|
Return m_AllExtRedVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_AllExtRedVisibility = value
|
|
NotifyPropertyChanged("AllExtRedVisibility")
|
|
End Set
|
|
End Property
|
|
|
|
#Region "Messages"
|
|
|
|
Public ReadOnly Property OnOffMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 1)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOnMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 2)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOffMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 3)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 4)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 5)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property CutEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 6)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OutCenStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 7)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOutStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 8)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllCenStartMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 9)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property OutCenEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 12)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllOutEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 13)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllCenEndMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 14)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllExtendMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 15)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property AllReduceMsg As String
|
|
Get
|
|
Return EgtMsg(MSG_SPLITPAGEUC + 16)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Messages
|
|
|
|
' Definizione comandi
|
|
Private m_cmdMoveUp As ICommand
|
|
Private m_cmdMoveDown As ICommand
|
|
Private m_cmdOnOff As ICommand
|
|
Private m_cmdAllOn As ICommand
|
|
Private m_cmdAllOff As ICommand
|
|
Private m_cmdCut As ICommand
|
|
Private m_cmdCutStart As ICommand
|
|
Private m_cmdCutEnd As ICommand
|
|
Private m_cmdOutCenStart As ICommand
|
|
Private m_cmdAllOutStart As ICommand
|
|
Private m_cmdAllCenStart As ICommand
|
|
Private m_cmdOutCenEnd As ICommand
|
|
Private m_cmdAllOutEnd As ICommand
|
|
Private m_cmdAllCenEnd As ICommand
|
|
Private m_cmdAllExtend As ICommand
|
|
Private m_cmdAllReduce As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in OmagOFFICEMap
|
|
OmagOFFICEMap.SetRefSplitModeVM(Me)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Function InitSplitRaw() As Boolean
|
|
' Nascondo eventuali pezzi in parcheggio
|
|
HideParkedParts()
|
|
' Nascondo eventuale contorno da foto
|
|
EstPhoto.ShowContour(False)
|
|
' Deseleziono pezzi
|
|
EgtDeselectAll()
|
|
EgtZoom(ZM.ALL)
|
|
' Se non sono in sola visualizzazione, faccio ordine automatico delle lavorazioni
|
|
If Not OmagOFFICEMap.refMachiningTabVM.IsShow Then
|
|
If SortAllMachinings() Then
|
|
EstCalc.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_DIS_NUMBER)
|
|
EgtSetStatus(m_nNbrGrpId, GDB_ST.SEL)
|
|
EgtSetLevel(m_nNbrGrpId, GDB_LV.TEMP)
|
|
' Recupero l'indice della fase corrente
|
|
m_nCurrPhase = EgtGetCurrPhase()
|
|
' Visualizzo solo anteprime di lavorazioni della fase
|
|
ShowOnePhaseMachiningPreview(m_nCurrPhase)
|
|
' Preparo la lista delle lavorazioni
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberMachining(nI)
|
|
Next
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Abilito impostazione modificato
|
|
EgtEnableModified()
|
|
' Nessun item corrente
|
|
m_CurrInd = -1
|
|
' Reset flag di modifica
|
|
m_bModified = False
|
|
' Visualizzazione bottoni
|
|
If OmagOFFICEMap.refMachiningTabVM.ByHand Then
|
|
AllExtRedVisibility = Visibility.Collapsed
|
|
End If
|
|
' Abilitazione bottoni
|
|
EnableButtons()
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function ExitSplitRaw(Optional bTrueExit As Boolean = True) As Boolean
|
|
' Rimuovo evidenziazione e numeri
|
|
RemoveMarkAndNumbers()
|
|
' Ripristino colori lavorazioni
|
|
EgtDisableModified()
|
|
For i As Integer = 0 To m_MachiningList.Count() - 1
|
|
ColorMachining(m_MachiningList(i), True)
|
|
Next
|
|
EgtEnableModified()
|
|
' 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, True)
|
|
End If
|
|
Next
|
|
' dichiaro ordine salvato
|
|
EstCalc.SetOrderMachiningFlag()
|
|
End If
|
|
' Affondamento ridotto
|
|
Dim dReducedDepth As Double = GetMainPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1)
|
|
' Restringo o rialzo lavorazioni abilitate ma con interferenza
|
|
Dim bModified As Boolean = False
|
|
For Each Mach As SplitMach 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 bTrueExit Then
|
|
' ritorno a fase 1
|
|
EgtSetCurrPhase(1)
|
|
' Ripristino visualizzazione preview lavorazioni
|
|
ShowAllPhasesMachiningPreview()
|
|
End If
|
|
If bModified Then
|
|
' Ridotte alcune lavorazioni per evitare interferenze
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90321), 3, StatusBarVM.MSG_TYPE.WARNING)
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Friend Function GetDisabledCutsCount() As Integer
|
|
' Determino il numero di tagli disabilitati
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If Not m_MachiningList(nI).m_bEnabled Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
Return nCount
|
|
End Function
|
|
|
|
Friend Function GetSplitCutsCount() As Integer
|
|
' Determino il numero di tagli passanti almeno da un lato
|
|
Dim nCount As Integer = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled And
|
|
(m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) Then
|
|
nCount += 1
|
|
End If
|
|
Next
|
|
Return nCount
|
|
End Function
|
|
|
|
Friend Sub GetSplitCuts(ByRef Cuts() As Integer)
|
|
' Determino l'elenco dei tagli passanti almeno da un lato
|
|
Dim MyCuts As New List(Of Integer)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled And
|
|
(m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) Then
|
|
MyCuts.Add(m_MachiningList(nI).m_nId)
|
|
End If
|
|
Next
|
|
Cuts = MyCuts.ToArray()
|
|
End Sub
|
|
|
|
Friend Sub GetEnabledCuts(ByRef Cuts() As Integer)
|
|
' Determino l'elenco dei tagli abilitati
|
|
Dim MyCuts As New List(Of Integer)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
MyCuts.Add(m_MachiningList(nI).m_nId)
|
|
End If
|
|
Next
|
|
Cuts = MyCuts.ToArray()
|
|
End Sub
|
|
|
|
Friend Sub ExecAuto()
|
|
' Con movimento manuale, non disponibile movimento automatico
|
|
If OmagOFFICEMap.refMachiningTabVM.ByHand Then Return
|
|
' Elimino evidenziazione e numerazione
|
|
RemoveMarkAndNumbers()
|
|
' Calcolo automatico
|
|
Dim bFinished As Boolean = False
|
|
Dim bOk As Boolean = SplitAuto.CalculateOnePhaseSplitAuto(bFinished)
|
|
If Not bOk Then
|
|
' Calcolo automatico non riuscito
|
|
OmagOFFICEMap.refStatusBarVM.SetOutputMessage(EgtMsg(90350), 3, StatusBarVM.MSG_TYPE.WARNING)
|
|
End If
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Friend Sub ChangeToModify()
|
|
' Elimino le fasi successive alla corrente
|
|
While EgtGetPhaseCount() > m_nCurrPhase
|
|
RemoveLastPhase()
|
|
End While
|
|
' Aggiorno le lavorazioni
|
|
If SortAllMachinings() Then
|
|
EstCalc.SetOrderMachiningFlag()
|
|
End If
|
|
' Visualizzo solo anteprime di lavorazioni della fase
|
|
ShowOnePhaseMachiningPreview(m_nCurrPhase)
|
|
' Nascondo gli eventuali percorsi di lavorazione
|
|
HideAllMachinings()
|
|
' Preparo la lista delle lavorazioni e le disabilito
|
|
CalculateSplitMachList(m_nCurrPhase, m_MachiningList)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
Next
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
EgtEmptyGroup(m_nNbrGrpId)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberMachining(nI)
|
|
Next
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Sub ShowMachiningList()
|
|
m_ItemList.Clear()
|
|
For i As Integer = 1 To m_MachiningList.Count()
|
|
Dim Mach As SplitMach = m_MachiningList(i - 1)
|
|
If Mach.m_nType = MCH_OY.SAWING Then ' Taglio
|
|
Dim sText As String = String.Empty
|
|
If Math.Abs(Mach.m_dSideAng) < EPS_ANG_SMALL Then
|
|
sText = EgtMsg(90791) & " " & i.ToString()
|
|
ElseIf Mach.m_dSideAng > 0 Then
|
|
sText = EgtMsg(90791) & " " & DoubleToString(Mach.m_dSideAng, 1) & "° " & i.ToString()
|
|
Else
|
|
sText = EgtMsg(90791) & " " & DoubleToString(Mach.m_dSideAng, 1) & "° " & i.ToString()
|
|
End If
|
|
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
|
|
End Sub
|
|
|
|
Private Sub EnableButtons()
|
|
' Per bottone PREV
|
|
OmagOFFICEMap.refMachiningTabVM.PrevIsEnabled = (m_nCurrPhase > 1)
|
|
' Per bottone NEXT
|
|
' Se abilitato manipolatore
|
|
If OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.MAN_MANIP) Or
|
|
OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.AUTO_MANIP) Then
|
|
' Se allontanamento perpendicolare
|
|
If OmagOFFICEMap.refMachiningTabVM.ByHand Then
|
|
' Ci deve essere almeno 1 taglio disabilitato e 1 e 1 solo passante
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = (GetDisabledCutsCount() > 0 And GetSplitCutsCount() = 1)
|
|
' Altrimenti
|
|
Else
|
|
' Ci deve essere almeno 1 taglio disabilitato e almeno 1 passante oppure fase successiva alla prima
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = GetDisabledCutsCount() > 0 And
|
|
(GetSplitCutsCount() > 0 Or m_nCurrPhase > 1)
|
|
End If
|
|
Else
|
|
OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = False
|
|
End If
|
|
' Se sto solo visualizzando
|
|
If m_nCurrPhase < EgtGetPhaseCount() Then OmagOFFICEMap.refMachiningTabVM.NextIsEnabled = True
|
|
' Per bottone MODIFY
|
|
OmagOFFICEMap.refMachiningTabVM.ModifyIsEnabled = OmagOFFICEMap.refMachiningTabVM.IsShow
|
|
' Per bottone AUTO
|
|
OmagOFFICEMap.refMachiningTabVM.AutoIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow And
|
|
((GetDisabledCutsCount() > 0 Or m_nCurrPhase = 1) And
|
|
Not OmagOFFICEMap.refMachiningTabVM.ByHand)
|
|
' Altri bottoni
|
|
SplitModeIsEnabled = Not OmagOFFICEMap.refMachiningTabVM.IsShow
|
|
End Sub
|
|
|
|
Private Function ModifyOtherLeadIn(nI As Integer, nLiOthType As Integer) As Boolean
|
|
' Modifico l'attacco delle lavorazioni inglobate
|
|
For Each nMchId As Integer In m_MachiningList(nI).m_vOthId
|
|
EgtSetCurrMachining(nMchId)
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, nLiOthType)
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ModifyOtherLeadOut(nI As Integer, nLoOthType As Integer) As Boolean
|
|
' Modifico l'uscita delle lavorazioni inglobate
|
|
For Each nMchId As Integer In m_MachiningList(nI).m_vOthId
|
|
EgtSetCurrMachining(nMchId)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, nLoOthType)
|
|
Next
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub NumberMachining(nI As Integer)
|
|
EgtDisableModified()
|
|
' 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)
|
|
EgtEnableModified()
|
|
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 ColorNumber(nI As Integer)
|
|
If nI < 0 Then Return
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
If 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
|
|
Else
|
|
If m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtResetColor(m_MachiningList(nI).m_nNbrId)
|
|
ElseIf Not m_MachiningList(nI).m_bEnabled Then
|
|
EgtSetColor(m_MachiningList(nI).m_nNbrId, COL_MCH_DIS_INTERF)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RemoveMarkAndNumbers()
|
|
EgtDisableModified()
|
|
' cancello evidenziazione
|
|
If m_CurrInd >= 0 Then
|
|
MarkMachining(m_CurrInd, False)
|
|
m_CurrInd = -1
|
|
End If
|
|
' cancello gruppo di numerazione e ripristino colori lavorazioni
|
|
EgtErase(m_nNbrGrpId)
|
|
For i As Integer = 0 To m_MachiningList.Count() - 1
|
|
ColorMachining(m_MachiningList(i), True)
|
|
Next
|
|
EgtEnableModified()
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "MoveCommands"
|
|
|
|
Public ReadOnly Property MoveUpCommand As ICommand
|
|
Get
|
|
If m_cmdMoveUp Is Nothing Then
|
|
m_cmdMoveUp = New Command(AddressOf MoveUp)
|
|
End If
|
|
Return m_cmdMoveUp
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub MoveUp(ByVal param As Object)
|
|
MoveItem(-1)
|
|
End Sub
|
|
|
|
Public ReadOnly Property MoveDownCommand As ICommand
|
|
Get
|
|
If m_cmdMoveDown Is Nothing Then
|
|
m_cmdMoveDown = New Command(AddressOf MoveDown)
|
|
End If
|
|
Return m_cmdMoveDown
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub MoveDown(ByVal param As Object)
|
|
MoveItem(+1)
|
|
End Sub
|
|
|
|
Public Sub MoveItem(direction As Integer)
|
|
' Checking selected item
|
|
If m_SelItem Is Nothing OrElse m_ItemList.IndexOf(m_SelItem) < 0 Then
|
|
Return
|
|
End If
|
|
' No selected item - nothing to do
|
|
' Calculate new index using move direction
|
|
Dim newIndex As Integer = m_ItemList.IndexOf(m_SelItem) + direction
|
|
|
|
' Checking bounds of the range
|
|
If newIndex < 0 OrElse newIndex >= m_ItemList.Count Then
|
|
Return
|
|
End If
|
|
' Index out of range - nothing to do
|
|
Dim selected As NameIdLsBxItem = m_SelItem
|
|
|
|
' Removing removable element
|
|
m_ItemList.Remove(selected)
|
|
' Insert it in new position
|
|
m_ItemList.Insert(newIndex, selected)
|
|
' Restore selection
|
|
SelItem = selected
|
|
NotifyPropertyChanged("SelItem")
|
|
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' MoveCommands
|
|
|
|
#Region "OnOffCommand"
|
|
|
|
Public ReadOnly Property OnOffCommand As ICommand
|
|
Get
|
|
If m_cmdOnOff Is Nothing Then
|
|
m_cmdOnOff = New Command(AddressOf OnOff)
|
|
End If
|
|
Return m_cmdOnOff
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OnOff(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
m_SelItem.bIsActive = False
|
|
Else
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
m_SelItem.bIsActive = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' OnOffCommand
|
|
|
|
#Region "AllOnCommand"
|
|
|
|
Public ReadOnly Property AllOnCommand As ICommand
|
|
Get
|
|
If m_cmdAllOn Is Nothing Then
|
|
m_cmdAllOn = New Command(AddressOf AllOn)
|
|
End If
|
|
Return m_cmdAllOn
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOn(ByVal param As Object)
|
|
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(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllOnCommand
|
|
|
|
#Region "AllOffCommand"
|
|
|
|
Public ReadOnly Property AllOffCommand As ICommand
|
|
Get
|
|
If m_cmdAllOff Is Nothing Then
|
|
m_cmdAllOff = New Command(AddressOf AllOff)
|
|
End If
|
|
Return m_cmdAllOff
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOff(ByVal param As Object)
|
|
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(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllOffCommand
|
|
|
|
#Region "CutCommands"
|
|
|
|
Public ReadOnly Property CutCommand As ICommand
|
|
Get
|
|
If m_cmdCut Is Nothing Then
|
|
m_cmdCut = New Command(AddressOf Cut)
|
|
End If
|
|
Return m_cmdCut
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Cut(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
' Provo ad entrambi gli estremi
|
|
Dim bModif As Boolean = AdjustBothCuts(nI)
|
|
' Provo all'inizio
|
|
If Not bModif Then bModif = AdjustStartCut(nI)
|
|
' Provo alla fine
|
|
If Not bModif Then bModif = AdjustEndCut(nI)
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiorno abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Public ReadOnly Property CutStartCommand As ICommand
|
|
Get
|
|
If m_cmdCutStart Is Nothing Then
|
|
m_cmdCutStart = New Command(AddressOf CutStart)
|
|
End If
|
|
Return m_cmdCutStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CutStart(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
' Eseguo
|
|
If AdjustStartCut(nI) Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiorno abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Public ReadOnly Property CutEndCommand As ICommand
|
|
Get
|
|
If m_cmdCutEnd Is Nothing Then
|
|
m_cmdCutEnd = New Command(AddressOf CutEnd)
|
|
End If
|
|
Return m_cmdCutEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub CutEnd(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
' Eseguo
|
|
If AdjustEndCut(nI) Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiorno abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Function AdjustBothCuts(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che entrambi gli estremi siano allungabili
|
|
If Not (m_MachiningList(nI).m_bCanStartAll And m_MachiningList(nI).m_bCanEndAll) Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If (m_MachiningList(nI).m_bStartAll Or m_MachiningList(nI).m_bEndAll) And Not bAllForced Then
|
|
' accorcio
|
|
If nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
End If
|
|
If nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = False
|
|
m_MachiningList(nI).m_bEndAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
End If
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = True
|
|
m_MachiningList(nI).m_bEndAll = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AdjustStartCut(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che l'estremo iniziale sia allungabile
|
|
If Not m_MachiningList(nI).m_bCanStartAll Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If m_MachiningList(nI).m_bStartAll And Not bAllForced Then
|
|
' accorcio
|
|
If nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
m_MachiningList(nI).m_bStartAll = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AdjustEndCut(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
' Verifico che l'estremo finale sia allungabile
|
|
If Not m_MachiningList(nI).m_bCanEndAll Then Return False
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If m_MachiningList(nI).m_bEndAll And Not bAllForced Then
|
|
' accorcio
|
|
If nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
End If
|
|
m_MachiningList(nI).m_bEndAll = False
|
|
ElseIf m_MachiningList(nI).m_bEnabled And Not bAccForced Then
|
|
' allungo
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
Else
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
End If
|
|
m_MachiningList(nI).m_bEndAll = True
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' CutCommands
|
|
|
|
#Region "OutCenStartCommand"
|
|
|
|
Public ReadOnly Property OutCenStartCommand As ICommand
|
|
Get
|
|
If m_cmdOutCenStart Is Nothing Then
|
|
m_cmdOutCenStart = New Command(AddressOf OutCenStart)
|
|
End If
|
|
Return m_cmdOutCenStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OutCenStart(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
ElseIf nLiPrev = MCH_SAW_LI.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' OutCenStartCommand
|
|
|
|
#Region "AllOutStartCommand"
|
|
|
|
Public ReadOnly Property AllOutStartCommand As ICommand
|
|
Get
|
|
If m_cmdAllOutStart Is Nothing Then
|
|
m_cmdAllOutStart = New Command(AddressOf AllOutStart)
|
|
End If
|
|
Return m_cmdAllOutStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOutStart(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllOutStartCommand
|
|
|
|
#Region "AllCenStartCommand"
|
|
|
|
Public ReadOnly Property AllCenStartCommand As ICommand
|
|
Get
|
|
If m_cmdAllCenStart Is Nothing Then
|
|
m_cmdAllCenStart = New Command(AddressOf AllCenStart)
|
|
End If
|
|
Return m_cmdAllCenStart
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllCenStart(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLiPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
If nLiPrev = MCH_SAW_LI.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLiPrev = MCH_SAW_LI.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, MCH_SAW_LI.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadIn(nI, MCH_SAW_LI.CENT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllCenStartCommand
|
|
|
|
#Region "OutCenEndCommand"
|
|
|
|
Public ReadOnly Property OutCenEndCommand As ICommand
|
|
Get
|
|
If m_cmdOutCenEnd Is Nothing Then
|
|
m_cmdOutCenEnd = New Command(AddressOf OutCenEnd)
|
|
End If
|
|
Return m_cmdOutCenEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub OutCenEnd(ByVal param As Object)
|
|
If IsNothing(m_SelItem) Then Return
|
|
Dim nI As Integer = m_SelItem.Ind
|
|
If m_MachiningList(nI).m_sLay = NAME_OUTLOOP Then
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
ElseIf nLoPrev = MCH_SAW_LO.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' OutCenEndCommand
|
|
|
|
#Region "AllOutEndCommand"
|
|
|
|
Public ReadOnly Property AllOutEndCommand As ICommand
|
|
Get
|
|
If m_cmdAllOutEnd Is Nothing Then
|
|
m_cmdAllOutEnd = New Command(AddressOf AllOutEnd)
|
|
End If
|
|
Return m_cmdAllOutEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllOutEnd(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_CENT Then
|
|
' allungo
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_OUT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.OUT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllOutEndCommand
|
|
|
|
#Region "AllCenEndCommand"
|
|
|
|
Public ReadOnly Property AllCenEndCommand As ICommand
|
|
Get
|
|
If m_cmdAllCenEnd Is Nothing Then
|
|
m_cmdAllCenEnd = New Command(AddressOf AllCenEnd)
|
|
End If
|
|
Return m_cmdAllCenEnd
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllCenEnd(ByVal param As Object)
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
EgtSetCurrMachining(m_MachiningList(nI).m_nId)
|
|
Dim nLoPrev As Integer
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
If nLoPrev = MCH_SAW_LO.OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
' ri-verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ElseIf nLoPrev = MCH_SAW_LO.EXT_OUT Then
|
|
' accorcio
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, MCH_SAW_LO.EXT_CENT)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ModifyOtherLeadOut(nI, MCH_SAW_LO.CENT)
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumber(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
#End Region ' AllCenEndCommand
|
|
|
|
#Region "AllExtendCommand"
|
|
|
|
Public ReadOnly Property AllExtendCommand As ICommand
|
|
Get
|
|
If m_cmdAllExtend Is Nothing Then
|
|
m_cmdAllExtend = New Command(AddressOf AllExtend)
|
|
End If
|
|
Return m_cmdAllExtend
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllExtend(ByVal param As Object)
|
|
Dim bModif As Boolean = False
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' Provo ad entrambi gli estremi
|
|
Dim bOneModif As Boolean = AdjustBothCuts(nI, True, False)
|
|
' Provo all'inizio
|
|
If Not bOneModif Then bOneModif = AdjustStartCut(nI, True, False)
|
|
' Provo alla fine
|
|
If Not bOneModif Then bOneModif = AdjustEndCut(nI, True, False)
|
|
' Aggiorno flag globale
|
|
If bOneModif Then bModif = True
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllExtendCommand
|
|
|
|
#Region "AllReduceCommand"
|
|
|
|
Public ReadOnly Property AllReduceCommand As ICommand
|
|
Get
|
|
If m_cmdAllReduce Is Nothing Then
|
|
m_cmdAllReduce = New Command(AddressOf AllReduce)
|
|
End If
|
|
Return m_cmdAllReduce
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AllReduce(ByVal param As Object)
|
|
Dim bModif As Boolean = False
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' Provo ad entrambi gli estremi
|
|
Dim bOneModif As Boolean = AdjustBothCuts(nI, False, True)
|
|
' Provo all'inizio
|
|
If Not bOneModif Then bOneModif = AdjustStartCut(nI, False, True)
|
|
' Provo alla fine
|
|
If Not bOneModif Then bOneModif = AdjustEndCut(nI, False, True)
|
|
' Aggiorno flag globale
|
|
If bOneModif Then bModif = True
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
#End Region ' AllReduceCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
|
|
'-----------------------------------------------------------------------------------------------
|
|
Public Class NameIdLsBxItem
|
|
Inherits VMBase
|
|
|
|
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
|
|
|
|
End Class
|
|
|
|
End Class
|