88ff42a8c6
- aggiunta gestione lavorazione di taglio anche con lama manuale (ovviamente non si cambia lama).
3262 lines
142 KiB
VB.net
3262 lines
142 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.ComponentModel
|
|
Imports System.Reflection
|
|
Imports System.Security.Cryptography
|
|
Imports EgtUILib
|
|
|
|
Public Class SplitPageUC
|
|
|
|
' Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
|
Private WithEvents m_CurrProjPage As CurrentProjectPageUC
|
|
|
|
' Creazione converter da String a ImageSource
|
|
Private ImageConverter As New ImageSourceConverter
|
|
|
|
' Flag di pagina attiva
|
|
Private m_bActive As Boolean = False
|
|
' Tipo movimento dei grezzi (manuale o con testa ventosa)
|
|
Private m_bByHand As Boolean = True
|
|
' Abilitazione movimento finale pezzi su tavola ausiliaria
|
|
Friend m_bEnableOnAuxTab As Boolean = False
|
|
' Stato
|
|
Private m_nCurrPhase As Integer = 0
|
|
Private m_MachiningList As New List(Of SplitMach)
|
|
|
|
' numero di lavorazioni di tipo lama
|
|
Private m_nCountSawing As Integer = 0
|
|
' numero di lavprazioni di tipo waterjet
|
|
Private m_nCountWaterjetting As Integer = 0
|
|
' altri tipi di lavorazioni (Foro/Fresa)
|
|
Private m_nCountOtherMachining As Integer = 0
|
|
' verifico che le lavorazioni selezionate siano omogenee (con lo stesso utensile)
|
|
Private m_bAreHomogeneous As Boolean = False
|
|
|
|
' Id tagli WJ per generazione ponticelli tra due percorsi
|
|
Private m_nIdSelectedPartWJ_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedSideWJ_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedWaterJet_Srt As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedPartWJ_End As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedSideWJ_End As Integer = GDB_ID.NULL
|
|
Private m_nIdSelectedWaterJet_End As Integer = GDB_ID.NULL
|
|
' Id gruppo Bridges (Nuovo da versione 30/08/2022)
|
|
Private m_nIdBridgesGroup As Integer = GDB_ID.NULL
|
|
Private m_nIdBridge As Integer = GDB_ID.NULL
|
|
Private m_ptSrtBridge As New Point3d
|
|
Private m_ptEndBridge As New Point3d
|
|
|
|
Private m_ItemList As New ObservableCollection(Of NameIdLsBxItem)
|
|
'Private m_CurrInd As Integer = -1
|
|
'Private m_CurrItems As New List(Of NameIdLsBxItem)
|
|
Private m_CurrFirstInd As Integer = -1
|
|
Private m_CurrLastInd As Integer = -1
|
|
Friend m_bShow As Boolean = False
|
|
Private m_bModified As Boolean = False
|
|
Private m_nNbrGrpId As Integer = GDB_ID.NULL
|
|
Private m_bToNext As Boolean = False
|
|
Private m_bToPrev As Boolean = False
|
|
Friend m_bOnAuxTab As Boolean = False
|
|
' Drag
|
|
Private m_nDragInd As Integer = -1
|
|
Private m_nDragType As Integer = 0 '0=niente, 1=attacco, 2=uscita
|
|
Private m_ptDragPrev As Point3d
|
|
Private m_bDragging As Boolean = False
|
|
' Selected cut
|
|
Private m_nSelected As Integer = GDB_ID.NULL
|
|
' Abilita la mofica Inizio fine per i tagli interni sugli angoli
|
|
Private m_StartEndModifyOnIntCorner As Boolean = False
|
|
|
|
Private m_IsCtrlKeyDown As Boolean = False
|
|
Private m_IsShiftKeyDown As Boolean = False
|
|
|
|
Private Sub SplitPageUC_Initialized(sender As Object, e As EventArgs)
|
|
PrevBtn.IsEnabled = False
|
|
' Collego lista di oggetti a ListBox
|
|
MachiningLsBx.ItemsSource = m_ItemList
|
|
' Assegno testi
|
|
OnOffBtn.ToolTip = EgtMsg(90341) ' On/Off
|
|
AllOnBtn.ToolTip = EgtMsg(90342) ' Tutti On
|
|
AllOffBtn.ToolTip = EgtMsg(90343) ' Tutti Off
|
|
CutBtn.ToolTip = EgtMsg(90344) ' Allunga/Accorcia
|
|
CutStartBtn.ToolTip = EgtMsg(90345) ' Inizio Allunga/Accorcia
|
|
CutEndBtn.ToolTip = EgtMsg(90346) ' Fine Allunga/Accorcia
|
|
OutCenStartBtn.ToolTip = EgtMsg(90347) ' Inizio Centro/Fuori
|
|
OutCenEndBtn.ToolTip = EgtMsg(90352) ' Fine Centro/Fuori
|
|
ModifStartBtn.ToolTip = EgtMsg(90373) ' Inizio Modif.
|
|
ModifEndBtn.ToolTip = EgtMsg(90374) ' Fine Modif.
|
|
InvertBtn.ToolTip = EgtMsg(90376) ' Inverti
|
|
PauseBtn.ToolTip = EgtMsg(90371) ' Pausa On/Off
|
|
AllOutStartBtn.ToolTip = EgtMsg(90348) ' Inizi Tutti Fuori
|
|
AllCenStartBtn.ToolTip = EgtMsg(90349) ' Inizi Tutti Centro
|
|
AllOutEndBtn.ToolTip = EgtMsg(90353) ' Fine Tutti Fuori
|
|
AllCenEndBtn.ToolTip = EgtMsg(90354) ' Fine Tutti Centro
|
|
AllExtendBtn.ToolTip = EgtMsg(90355) ' Allunga Tutti
|
|
AllReduceBtn.ToolTip = EgtMsg(90356) ' Accorc. Tutti
|
|
ModifyBtn.Content = EgtMsg(90357) ' Modifica
|
|
AutoBtn.Content = EgtMsg(90358) ' Auto
|
|
RestartBtn.Content = EgtMsg(90359) ' Restart
|
|
BridgesWJBtn.ToolTip = EgtMsg(91214) ' Bridges
|
|
BridgesDeleteWJBtn.ToolTip = EgtMsg(91215) ' Remove bridges
|
|
End Sub
|
|
|
|
Private Sub SplitPageUC_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
|
m_bActive = True
|
|
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
' Leggo tipo movimento grezzi
|
|
m_bByHand = (EgtGetHeadId(VACUUM_HEAD) = GDB_ID.NULL Or
|
|
Not m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.AUTO_MANIP) Or
|
|
(GetPrivateProfileInt(S_RAWMOVE, K_PERPENDICULAR, 0, m_MainWindow.GetIniFile()) <> 0))
|
|
' Se movimento con ventosa, verifico se lama troppo grande
|
|
If Not m_bByHand And Not m_MainWindow.m_CurrentMachine.IsVacuumMovePossible() Then
|
|
m_bByHand = True
|
|
m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90351)) ' Lama troppo grande per utilizzo ventosa
|
|
End If
|
|
' Verifico se abilitato spostamento finale pezzi e se macchina lo consente
|
|
m_bEnableOnAuxTab = Not m_bByHand AndAlso
|
|
m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.MOVE_PARTS) AndAlso
|
|
EgtGetTableId(AUX_TAB) <> GDB_ID.NULL
|
|
' verifico se è abilitata la possibiltà di allungare i lati interni
|
|
m_StartEndModifyOnIntCorner = (GetPrivateProfileInt(S_NEST, K_STARTENDMODIFYONINTCORNER, 0, m_MainWindow.GetMachIniFile()) <> 0)
|
|
' Nascondo eventuali pezzi in parcheggio
|
|
HideParkedParts()
|
|
' Nascondo eventuale contorno da foto
|
|
m_MainWindow.m_CurrentProjectPageUC.ShowContour(False)
|
|
' Deseleziono pezzi
|
|
EgtDeselectAll()
|
|
EgtZoom(ZM.ALL)
|
|
' Elimino eventuali pretagli su uscite
|
|
RemoveAllExitPreCuts()
|
|
' Se non sono in sola visualizzazione, faccio ordine automatico delle lavorazioni
|
|
If Not m_bShow Then
|
|
If m_MainWindow.m_CurrentMachine.WaterJettingActive Then ResetAllMachinings()
|
|
If SortAllMachinings() Then m_MainWindow.m_CurrentProjectPageUC.SetOrderMachiningFlag()
|
|
If m_MainWindow.m_CurrentMachine.WaterJettingActive Then
|
|
Dim bModif As Boolean = TestAllMachiningsForStrict()
|
|
If bModif Then m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
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)
|
|
' azzero i contatori delle lavorazioni
|
|
m_nCountSawing = 0
|
|
m_nCountWaterjetting = 0
|
|
m_nCountOtherMachining = 0
|
|
' Aggiorno visualizzazione delle lavorazioni
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(nI))
|
|
' assegno numerazione
|
|
NumberDirectionMachining(nI)
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Abilito impostazione modificato
|
|
EgtEnableModified()
|
|
' Nessun item corrente
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -1
|
|
' Reset flag di modifica
|
|
m_bModified = False
|
|
' Reset flag tipo uscita
|
|
m_bToNext = False
|
|
m_bToPrev = False
|
|
' Abilitazione bottoni
|
|
EnableButtons()
|
|
' Se sola visualizzazione, segnalazione di eventuale fase di restart
|
|
If m_bShow Then
|
|
Dim nPhaseRestart As Integer = m_MainWindow.m_CurrentProjectPageUC.GetProjectNcRestart()
|
|
If nPhaseRestart = m_nCurrPhase Then
|
|
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(EgtMsg(90359) & " (" & m_nCurrPhase.ToString() & ")") ' Restart
|
|
Else
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
End If
|
|
End If
|
|
' leggo lo stato del bottone per la visualizzazione delle etichette
|
|
LayNbArrTgBtn.IsChecked = (GetPrivateProfileInt(S_GENERAL, K_SHOWNBARROW, 1, m_MainWindow.GetIniFile()) <> 0)
|
|
SetLayNbArrTgBtn_Click()
|
|
End Sub
|
|
|
|
' preparo la lista delle lavorazioni da mostrare in interfaccia
|
|
Public 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()
|
|
If Mach.m_sLay = NAME_ONPATH Then AddTopText(sText)
|
|
If Mach.m_bFinalCut Then AddFinalText(sText)
|
|
Else
|
|
sText = EgtMsg(90791) & " " & i.ToString() & " " & DoubleToString(Mach.m_dSideAng, 2) & "°"
|
|
End If
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
AddItemToList(i, Mach, sText, MCH_OY.SAWING)
|
|
ElseIf Mach.m_nType = MCH_OY.DRILLING Then ' Foratura
|
|
Dim sText As String = EgtMsg(90792) & " " & i.ToString()
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
AddItemToList(i, Mach, sText, MCH_OY.DRILLING)
|
|
ElseIf Mach.m_nType = MCH_OY.MILLING Then ' Fresatura
|
|
Dim sText As String = EgtMsg(90793) & " " & i.ToString()
|
|
If Mach.m_sLay = NAME_ONPATH Then AddTopText(sText)
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
AddItemToList(i, Mach, sText, MCH_OY.MILLING)
|
|
ElseIf Mach.m_nType = MCH_OY.POCKETING Then ' Svuotatura
|
|
Dim sText As String = EgtMsg(90796) & " " & i.ToString()
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
AddItemToList(i, Mach, sText, MCH_OY.POCKETING)
|
|
ElseIf Mach.m_nType = MCH_OY.WATERJETTING Then ' Waterjet
|
|
Dim sText As String = EgtMsg(90797) & " " & i.ToString()
|
|
If Math.Abs(Mach.m_dSideAng) > EPS_ANG_SMALL Then sText &= " " & DoubleToString(Mach.m_dSideAng, 2) & "°"
|
|
If Mach.m_bPause Then AddPauseText(sText)
|
|
AddItemToList(i, Mach, sText, MCH_OY.WATERJETTING)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub AddItemToList(i As Integer, Mach As SplitMach, sText As String, nMach As Integer)
|
|
Dim sTCPos As String = ""
|
|
' Visualizzo la posizione utensile solo se configurata
|
|
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
|
Dim sMachining As String = "", sTool As String = ""
|
|
GetMachiningAndTool(Mach.m_nId, sMachining, sTool)
|
|
' Verifico che sia montata su un portautensile
|
|
EgtTdbSetCurrTool(sTool)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
|
|
End If
|
|
' Se TCPos non trovato
|
|
If String.IsNullOrEmpty(sTCPos) Then
|
|
' Imposto come lavorazione corrente
|
|
EgtSetCurrMachining(Mach.m_nId)
|
|
' 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
|
|
Dim sawColor As Color3d = Utility.GetColorPV()
|
|
Dim tmpSawColor As System.Windows.Media.Color = System.Windows.Media.Color.FromRgb(sawColor.R, sawColor.G, sawColor.B)
|
|
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, nMach, sTCPos, New SolidColorBrush(tmpSawColor)))
|
|
End If
|
|
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"
|
|
|
|
Private Sub OnMyMouseDownSceneBridges(sender As Object, e As System.Windows.Forms.MouseEventArgs,
|
|
ByVal IsFirst As Boolean,
|
|
ByRef m_nIdSelectedSideWJ As Integer,
|
|
ByRef m_nIdSelectedWaterJet As Integer,
|
|
ByRef nIdParentPart As Integer)
|
|
|
|
' Acquisisco punto da disegno
|
|
Dim CurrPoint As New Point3d
|
|
EgtUnProjectPoint(e.Location, CurrPoint)
|
|
|
|
' Verifico se selezionato indicativo di pezzo
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSelMy As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
|
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdMy <> GDB_ID.NULL
|
|
Dim sLayer As String = String.Empty
|
|
' layer di origine
|
|
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
|
' recupero il nome del Layer
|
|
EgtGetName(nIdParent, sLayer)
|
|
' solo se il nome del layer è quello associato ad un lato esterno allora procedo con l'evidenziazione
|
|
If sLayer = NAME_OUTLOOP Or sLayer = NAME_INLOOP Then
|
|
If (EgtGetType(nIdMy) = GDB_TY.CRV_ARC OrElse EgtGetType(nIdMy) = GDB_TY.CRV_COMPO OrElse EgtGetType(nIdMy) = GDB_TY.CRV_LINE) AndAlso VerifySideIsAcceptable(nIdMy) Then
|
|
If m_nIdSelectedSideWJ <> GDB_ID.NULL Or m_nIdSelectedSideWJ = nIdMy Then
|
|
EgtDeselectObj(m_nIdSelectedSideWJ)
|
|
End If
|
|
' recupero il gruppo della lavorazione associata
|
|
nIdParentPart = EgtGetParent(nIdParent)
|
|
' se non esiste almeno 1 Preview di tipo WaterJet
|
|
If IsWaterJetting(nIdMy) Then
|
|
' NON RECUPERO LA PREVIEW DELLA LAVORAZIONE : m_nIdSelectedWaterJet
|
|
m_nIdSelectedSideWJ = nIdMy
|
|
' recupero il punto più vicino alla curva passata
|
|
If IsFirst Then
|
|
EgtNearPoint(nIdMy, CurrPoint, GDB_RT.GLOB, m_ptSrtBridge)
|
|
Else
|
|
' prima di confermare verifico che non ci siano interferenze
|
|
EgtNearPoint(nIdMy, CurrPoint, GDB_RT.GLOB, m_ptEndBridge)
|
|
EgtModifyCurveEndPoint(m_nIdBridge, m_ptEndBridge, GDB_RT.GLOB)
|
|
If VerifyInterference(m_nIdBridge) Then
|
|
m_CurrProjPage.ClearMessage()
|
|
EgtSetInfo(m_nIdBridge, INFO_BRIDGE_PARTSTART, m_nIdSelectedPartWJ_Srt)
|
|
EgtSetInfo(m_nIdBridge, INFO_BRIDGE_ENTSTART, m_nIdSelectedSideWJ_Srt)
|
|
EgtSetInfo(m_nIdBridge, INFO_BRIDGE_PARTEND, m_nIdSelectedPartWJ_End)
|
|
EgtSetInfo(m_nIdBridge, INFO_BRIDGE_ENTEND, m_nIdSelectedSideWJ_End)
|
|
EgtSetInfo(m_nIdBridge, INFO_BRIDGE_PHASE, EgtGetCurrPhase())
|
|
' Ricalcolo tutte le lavorazioni
|
|
Dim nWarn As Integer = 0
|
|
ResetAllMachinings(nWarn)
|
|
Else
|
|
' attendo la selezione di un punto valido
|
|
m_nIdSelectedSideWJ = GDB_ID.NULL
|
|
nIdParentPart = GDB_ID.NULL
|
|
m_CurrProjPage.ClearMessage()
|
|
m_CurrProjPage.SetWarningMessage(EgtMsg(91216)) ' Bridge intersects part
|
|
Return
|
|
End If
|
|
End If
|
|
' salvo il valore del PreView evidenziato
|
|
EgtSetMark(nIdParentPart)
|
|
' EgtSetMark(nIdWJ)
|
|
EgtSelectObj(nIdMy)
|
|
EgtDraw()
|
|
Exit While
|
|
End If
|
|
End If
|
|
End If
|
|
nIdMy = EgtGetNextObjInSelWin()
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseDownSceneBridgesDelete(sender As Object, e As System.Windows.Forms.MouseEventArgs)
|
|
' Acquisisco punto da disegno
|
|
Dim CurrPoint As New Point3d
|
|
EgtUnProjectPoint(e.Location, CurrPoint)
|
|
|
|
' Verifico se selezionato indicativo di pezzo
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSelMy As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSelMy)
|
|
Dim nIdMy As Integer = EgtGetFirstObjInSelWin()
|
|
While nIdMy <> GDB_ID.NULL
|
|
Dim sGroupName As String = String.Empty
|
|
Dim sSelName As String = String.Empty
|
|
' gruppo di appartenenza
|
|
Dim nIdParent As Integer = EgtGetParent(nIdMy)
|
|
' recupero il nome del gruppo di appartenenza
|
|
EgtGetName(nIdParent, sGroupName)
|
|
' recupero il nome dell'oggetto selezionato
|
|
EgtGetName(nIdMy, sSelName)
|
|
If sGroupName.Contains(BRIDGES) AndAlso sSelName.Contains(BRIDGELINE) Then
|
|
EgtErase(nIdMy)
|
|
EgtDraw()
|
|
' Ricalcolo tutte le lavorazioni
|
|
Dim nWarn As Integer = 0
|
|
ResetAllMachinings(nWarn)
|
|
Return
|
|
End If
|
|
nIdMy = EgtGetNextObjInSelWin()
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseMoveSceneBridges(ptCurr As Point3d)
|
|
ptCurr.z = m_ptSrtBridge.z
|
|
' rappresento il egmento
|
|
If m_nIdBridge = GDB_ID.NULL Then
|
|
m_nIdBridge = EgtCreateLine(m_nIdBridgesGroup, m_ptSrtBridge, ptCurr, GDB_RT.GLOB)
|
|
' assegno un nome alla linea
|
|
EgtSetName(m_nIdBridge, BRIDGELINE)
|
|
End If
|
|
EgtModifyCurveEndPoint(m_nIdBridge, ptCurr, GDB_RT.GLOB)
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Function VerifyInterference(nIdBridge As Integer) As Boolean
|
|
' prima di procedere alla verifica accorcio il segmento (solo per sicurezza) 10 * EPS_SMALL
|
|
Dim dLen As Double
|
|
If EgtCurveLength(nIdBridge, dLen) AndAlso dLen > 21 AndAlso Not EgtCurveIsClosed(nIdBridge) Then
|
|
EgtTrimCurveEndAtLen(nIdBridge, dLen - 10 * EPS_SMALL)
|
|
EgtTrimCurveStartAtLen(nIdBridge, 10 * EPS_SMALL)
|
|
End If
|
|
Dim nIdPart As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId)
|
|
While nIdPart <> GDB_ID.NULL
|
|
Dim nIdRegion As Integer = EgtGetFirstNameInGroup(nIdPart, "Region")
|
|
Dim nIdSurf As Integer = EgtGetFirstInGroup(nIdRegion)
|
|
While nIdSurf <> GDB_ID.NULL
|
|
If EgtGetType(nIdSurf) = GDB_TY.SRF_FRGN Then
|
|
' se la linea bridge interseca la superficie allora restitusco false
|
|
If EgtCurveWithRegionClassify(nIdBridge, nIdSurf) <> CREGC.OUT Then
|
|
EgtExtendCurveStartByLen(nIdBridge, 10 * EPS_SMALL)
|
|
Return False
|
|
Else
|
|
Exit While
|
|
End If
|
|
Else
|
|
nIdSurf = EgtGetNext( nIdSurf)
|
|
End If
|
|
End While
|
|
nIdPart = EgtGetNextPartInRawPart(nIdPart)
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Function VerifySideIsAcceptable(nMyId As Integer) As Boolean
|
|
Dim dVal As Double = 0
|
|
' verifico che l'entità selezionata non contenga questi parametri
|
|
If EgtGetInfo(nMyId, INFO_SIDE_ANGLE2, dVal) Then
|
|
If dVal <> 0 Then
|
|
Return False
|
|
End If
|
|
End If
|
|
If EgtGetInfo(nMyId, INFO_SIDE_ANGLE, dVal) Then
|
|
If dVal <> 0 Then
|
|
Return False
|
|
End If
|
|
End If
|
|
' ' Non bastano i controlli sopra...?
|
|
' If EgtGetInfo(nMyId, INFO_ORIG_SIDE_ANGLE, dVal) Then
|
|
' If dVal <> 0 Then
|
|
' Return False
|
|
' End If
|
|
' End If
|
|
' altrimenti l'entità è accettabile
|
|
Return True
|
|
End Function
|
|
|
|
' verifico che il lato selezionato appartenga ad una lavorazione di tipo Waterjet
|
|
Private Function IsWaterJetting(nMyId As Integer) As Boolean
|
|
' verifico che sul lato indicato sia impostato un taglio di tipo WaterJet
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
nMchId = m_MachiningList(nInd).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(m_MachiningList(nInd).m_nId)
|
|
If nMachiningType = MCH_MY.WATERJETTING Then
|
|
EgtSetCurrMachining(nMchId)
|
|
Dim nIndex As Integer = 0
|
|
Dim nIdSide As Integer = GDB_ID.NULL
|
|
Dim nSub As Integer = GDB_ID.NULL
|
|
While EgtGetMachiningGeometry(nIndex, nIdSide, nSub)
|
|
If nIdSide = nMyId Then
|
|
Return True
|
|
End If
|
|
nIndex += 1
|
|
End While
|
|
End If
|
|
Next
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub RefreshMachList()
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
' cancello tutti gli indici di lavorazione presenti nel disegno
|
|
Dim nNbrId As Integer = GDB_ID.NULL
|
|
EgtErase(m_MachiningList(nI).m_nNbrId)
|
|
EgtRemoveInfo(m_MachiningList(nI).m_nId, "NbrId")
|
|
Next
|
|
' 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 nuova numerazione
|
|
NumberDirectionMachining(nI)
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
Next
|
|
' aggiorno grafica
|
|
ShowMachiningList()
|
|
' Nessun item corrente
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -1
|
|
' aggiorno la visualizzazione
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub DeselectWJBridgesPart()
|
|
' se in fase di definzione di un ponticello lo elimino
|
|
If m_nIdSelectedSideWJ_Srt <> GDB_ID.NULL And m_nIdSelectedSideWJ_End = GDB_ID.NULL And m_nIdBridge <> GDB_ID.NULL Then
|
|
EgtErase(EgtGetParent(m_nIdBridge))
|
|
End If
|
|
m_nIdBridge = GDB_ID.NULL
|
|
EgtResetMark(m_nIdSelectedPartWJ_Srt)
|
|
m_nIdSelectedPartWJ_Srt = GDB_ID.NULL
|
|
EgtDeselectObj(m_nIdSelectedSideWJ_Srt)
|
|
m_nIdSelectedSideWJ_Srt = GDB_ID.NULL
|
|
m_nIdSelectedWaterJet_Srt = GDB_ID.NULL
|
|
EgtResetMark(m_nIdSelectedPartWJ_End)
|
|
m_nIdSelectedPartWJ_End = GDB_ID.NULL
|
|
EgtDeselectObj(m_nIdSelectedSideWJ_End)
|
|
m_nIdSelectedSideWJ_End = GDB_ID.NULL
|
|
m_nIdSelectedWaterJet_End = GDB_ID.NULL
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
#End Region ' Bridge
|
|
|
|
Private Sub OnMyMouseDownScene_DoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene_DoubleClick
|
|
OnOffCut()
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse m_bShow Then Return
|
|
|
|
If e.Button = Windows.Forms.MouseButtons.Right Then
|
|
Dim nCurrCtx As Integer = EgtGetCurrentContext()
|
|
Dim nSel1 As Integer = GDB_ID.NULL
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel1)
|
|
Dim nId1 As Integer = EgtGetFirstObjInSelWin()
|
|
While nId1 <> GDB_ID.NULL
|
|
' Verifico sia un attacco o uscita di taglio con lama
|
|
Dim nType As Integer = 0
|
|
Dim sName As String = ""
|
|
EgtGetName(nId1, sName)
|
|
nPvId = EgtGetParent(EgtGetParent(nId1))
|
|
nMchId = GDB_ID.NULL
|
|
If String.Compare(sName, NAME_PV_PRECUT) = 0 Or String.Compare(sName, NAME_PV_POSTCUT) = 0 Or String.Compare(sName, NAME_PV_CUT) = 0 Then
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
Exit While
|
|
End If
|
|
End If
|
|
nId1 = EgtGetNextObjInSelWin()
|
|
End While
|
|
|
|
If nMchId = GDB_ID.NULL Then
|
|
GetCurrSelection()
|
|
Return
|
|
End If
|
|
|
|
ChangeMachining(nMchId)
|
|
GetCurrSelection()
|
|
Return
|
|
End If
|
|
|
|
' Si può selezionare solo con il tasto sinistro e se stato NULL
|
|
If e.Button <> Windows.Forms.MouseButtons.Left Or
|
|
Not m_CurrProjPage.CurrentProjectScene.IsStatusNull() Then
|
|
Return
|
|
End If
|
|
|
|
' definizione dei ponticelli
|
|
If BridgesWJBtn.IsChecked Then
|
|
If m_nIdSelectedPartWJ_Srt = GDB_ID.NULL Then
|
|
OnMyMouseDownSceneBridges(sender, e, True, m_nIdSelectedSideWJ_Srt, m_nIdSelectedWaterJet_Srt, m_nIdSelectedPartWJ_Srt)
|
|
Else
|
|
OnMyMouseDownSceneBridges(sender, e, False, m_nIdSelectedSideWJ_End, m_nIdSelectedWaterJet_End, m_nIdSelectedPartWJ_End)
|
|
' aggiorno la visualizzazione delle lavorazioni e la lista
|
|
RefreshMachList()
|
|
End If
|
|
' se entrambi i pezzi sono stati definiti allora procedo alla deselezione
|
|
If m_nIdSelectedPartWJ_Srt <> GDB_ID.NULL And m_nIdSelectedPartWJ_End <> GDB_ID.NULL Then
|
|
DeselectWJBridgesPart()
|
|
End If
|
|
GetCurrSelection()
|
|
Return
|
|
End If
|
|
|
|
' eliminazione dei ponticelli
|
|
If BridgesDeleteWJBtn.IsChecked Then
|
|
OnMyMouseDownSceneBridgesDelete(sender, e)
|
|
' aggiorno la visualizzazione delle lavorazioni e la lista
|
|
RefreshMachList()
|
|
GetCurrSelection()
|
|
Return
|
|
End If
|
|
|
|
' Reset drag
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
' Reset selection interface
|
|
m_nSelected = GDB_ID.NULL
|
|
' Verifico se selezionato estremo di taglio con lama
|
|
EgtSetObjFilterForSelWin(False, True, False, False, False)
|
|
Dim nSel As Integer
|
|
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
|
|
Dim nId As Integer = EgtGetFirstObjInSelWin()
|
|
While nId <> GDB_ID.NULL
|
|
' Verifico sia un attacco o uscita di taglio con lama
|
|
Dim nType As Integer = 0
|
|
Dim sName As String = ""
|
|
EgtGetName(nId, sName)
|
|
If String.Compare(sName, NAME_PV_PRECUT) = 0 Then
|
|
nType = 1
|
|
ElseIf String.Compare(sName, NAME_PV_POSTCUT) = 0 Then
|
|
nType = 2
|
|
ElseIf String.Compare(sName, NAME_PV_CUT) = 0 Then
|
|
nType = 3
|
|
End If
|
|
If nType = 1 Or nType = 2 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nInd).m_nId = nMchId Then
|
|
m_nDragInd = nInd
|
|
m_nDragType = nType
|
|
End If
|
|
For nJ As Integer = 0 To m_MachiningList(nInd).m_vOthId.Count() - 1
|
|
If m_MachiningList(nInd).m_vOthId(nJ) = nMchId Then
|
|
m_nDragInd = nInd
|
|
m_nDragType = nType
|
|
Exit For
|
|
End If
|
|
Next
|
|
If m_nDragInd >= 0 Then
|
|
' Assegno l'id dell'elemnto selezionato
|
|
m_nSelected = m_nDragInd
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
If m_nDragInd >= 0 Then
|
|
' Assegno l'id dell'elemnto selezionato
|
|
m_nSelected = m_nDragInd
|
|
Exit While
|
|
End If
|
|
ElseIf nType = 3 Then
|
|
Dim nPvId As Integer = EgtGetParent(EgtGetParent(nId))
|
|
Dim nMchId As Integer = GDB_ID.NULL
|
|
If EgtGetInfo(nPvId, "MId", nMchId) Then
|
|
For nInd As Integer = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(nInd).m_nId = nMchId Then
|
|
m_nSelected = nInd
|
|
End If
|
|
For nJ As Integer = 0 To m_MachiningList(nInd).m_vOthId.Count() - 1
|
|
If m_MachiningList(nInd).m_vOthId(nJ) = nMchId Then
|
|
m_nSelected = nInd
|
|
Exit For
|
|
End If
|
|
Next
|
|
If m_nSelected >= 0 Then Exit For
|
|
Next
|
|
End If
|
|
If m_nSelected >= 0 Then Exit While
|
|
End If
|
|
nId = EgtGetNextObjInSelWin()
|
|
End While
|
|
' Sistemazioni per drag
|
|
If m_nSelected >= 0 AndAlso EgtUnProjectPoint(e.Location, m_ptDragPrev) Then
|
|
MachiningLsBx.SelectedIndex = m_nSelected
|
|
Else
|
|
m_nDragInd = -1
|
|
m_nDragType = 0
|
|
m_nSelected = GDB_ID.NULL
|
|
If Not IsNothing(MachiningLsBx.SelectedItem) Then
|
|
MarkMachining(MachiningLsBx.SelectedItem.Ind, False)
|
|
EgtDraw()
|
|
End If
|
|
MachiningLsBx.SelectedIndex = -1
|
|
End If
|
|
GetCurrSelection()
|
|
End Sub
|
|
|
|
Private Sub ChangeMachining(nMchId As Integer)
|
|
' Cambiamenti possibili solo se taglio di lama
|
|
If EgtGetOperationType( nMchId) <> MCH_OY.SAWING Then Return
|
|
' Imposto la lavorazione corrente
|
|
EgtSetCurrMachining(nMchId)
|
|
Dim EntId As Integer = GDB_ID.NULL
|
|
Dim SubEntId As Integer = GDB_ID.NULL
|
|
If Not EgtGetMachiningGeometry(0, EntId, SubEntId) Then Return
|
|
' verifico se la lavorazione selezionata ha un angolo di inclinazione
|
|
Dim dSideAng As Double = 0.0
|
|
EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAng)
|
|
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
|
|
Dim sSawing As String = ""
|
|
EgtGetInfo(EntId, sDefMach, sSawing)
|
|
|
|
' Apro pagina di selezione della lavorazione
|
|
Dim m_ChangeToolPage = New ChangeToolWD(m_MainWindow)
|
|
' Imposto nome lavorazione corrente
|
|
m_ChangeToolPage.CurrSawing = sSawing
|
|
' apro la finestra per la selezione delle lavorazioni
|
|
m_ChangeToolPage.ShowDialog()
|
|
|
|
' se seleziono "Ok" allora cambio la lavorazione
|
|
If m_ChangeToolPage.DialogResult Then
|
|
' 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
|
|
For Index = 0 To m_MachiningList.Count() - 1
|
|
If m_MachiningList(Index).m_nId = nMchId Then Exit For
|
|
Next
|
|
' Smarco ed elimino la numerazione e la freccia
|
|
MarkMachining( Index, False)
|
|
EgtErase(m_MachiningList(Index).m_nArrId)
|
|
EgtErase(m_MachiningList(Index).m_nNbrId)
|
|
' Aggiorno la lavorazione
|
|
Dim nNewMchId As Integer = GDB_ID.NULL
|
|
CamAuto.UpdateSawing(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.UpdateSawing(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
|
|
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
|
|
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)
|
|
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()
|
|
End If
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
Public Function GetMachiningAndTool(ByVal nMchId As Integer, ByRef sMachining As String, ByRef sToolName As String) As Boolean
|
|
' Imposto la lavorazione come corrente
|
|
EgtSetCurrMachining(nMchId)
|
|
' Verifico abbia geometria associata
|
|
Dim EntId As Integer = GDB_ID.NULL
|
|
Dim SubEntId As Integer = GDB_ID.NULL
|
|
If Not EgtGetMachiningGeometry(0, EntId, SubEntId) Then Return False
|
|
' Recupero il nome della lavorazione di libreria da cui deriva
|
|
If Not EgtGetMachiningParam( MCH_MP.NAME, sMachining) Then Return False
|
|
' Recupero il nome dell'utensile
|
|
Dim sToolUuid As String = ""
|
|
If Not EgtGetMachiningParam( MCH_MP.TUUID, sToolUuid) Then Return False
|
|
If Not EgtTdbGetToolFromUUID( sToolUuid, sToolName) Then Return False
|
|
' Tutto ok
|
|
Return True
|
|
End Function
|
|
|
|
' Dato l'id della lavorazione nel grezzo colora il taglio del colore assegnato
|
|
Public Sub ColorsCut(nOperId As Integer, EgtCol As Color3d)
|
|
' Recupero la lavorazione
|
|
Dim nPVRawId As Integer = EgtGetFirstNameInGroup(nOperId, "PV")
|
|
Dim nPVPartId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(nPVRawId, "PvId", nPVPartId)
|
|
Dim nId2 As Integer = EgtGetFirstInGroup(EgtGetFirstInGroup(nPVPartId))
|
|
Dim sName As String = ""
|
|
EgtGetName(nId2, sName)
|
|
While nId2 <> GDB_ID.NULL
|
|
If String.Compare(sName, NAME_PV_CUT) = 0 Then
|
|
EgtSetColor(nId2, EgtCol)
|
|
Exit While
|
|
End If
|
|
nId2 = EgtGetNext(nId2)
|
|
End While
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseMoveScene
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse m_bShow Then Return
|
|
' Ricavo il punto corrente in coordinate mondo
|
|
Dim ptCurr As Point3d
|
|
EgtUnProjectPoint(e.Location, ptCurr)
|
|
|
|
' definizione dei ponticelli
|
|
If BridgesWJBtn.IsChecked Then
|
|
If m_nIdSelectedPartWJ_Srt <> GDB_ID.NULL Then
|
|
OnMyMouseMoveSceneBridges(ptCurr)
|
|
End If
|
|
Return
|
|
End If
|
|
|
|
' Se drag non abilitato o in corso
|
|
If m_nDragInd = -1L Or m_bDragging Then Return
|
|
m_bDragging = True
|
|
Dim nOperId As Integer = m_MachiningList(m_nDragInd).m_nId
|
|
|
|
' Ricavo il vettore di movimento e la variazione di lunghezza
|
|
Dim vtMove As Vector3d = ptCurr - m_ptDragPrev
|
|
Dim dDelta = vtMove * m_MachiningList(m_nDragInd).m_vtDir
|
|
If m_nDragType = 1 Then
|
|
Dim dOrigUsal As Double = 0
|
|
Dim dUsal As Double
|
|
' ----------------------- REPEAT -----------------------
|
|
Do
|
|
If Not m_MachiningList(m_nDragInd).m_bCanStartAll Then Exit Do
|
|
dDelta = -dDelta
|
|
' Leggo il valore salvato nella geometria
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
dUsal = dOrigUsal + dDelta
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(m_nDragInd).m_dStartFreeLen < FREELEN_INF Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, m_MainWindow.GetMachIniFile()), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUsal = Math.Min(dUsal, m_MachiningList(m_nDragInd).m_dStartFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
|
|
If dAddLen - dOrigUsal < -10 * EPS_SMALL Then
|
|
m_bDragging = False
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
Loop Until UpdateMachiningPreview(m_MachiningList(m_nDragInd).m_nId, True)
|
|
' ----------------------- REPEAT (solo se il segmento scompare) -----------------------
|
|
Else
|
|
Dim dOrigUeal As Double = 0
|
|
Dim dUeal As Double
|
|
dDelta = -dDelta
|
|
Do
|
|
If Not m_MachiningList(m_nDragInd).m_bCanEndAll Then Exit Do
|
|
dDelta = -dDelta
|
|
' Leggo il valore salvato nella geometria
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
dUeal = dOrigUeal + dDelta
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(m_nDragInd).m_dEndFreeLen < FREELEN_INF Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, m_MainWindow.GetMachIniFile()), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUeal = Math.Min(dUeal, m_MachiningList(m_nDragInd).m_dEndFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
|
|
If dAddLen - dOrigUeal < -10 * EPS_SMALL Then
|
|
m_bDragging = False
|
|
Return
|
|
End If
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
Loop Until UpdateMachiningPreview(m_MachiningList(m_nDragInd).m_nId, True)
|
|
End If
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(m_nDragInd).m_nId, m_MachiningList(m_nDragInd).m_nInterf)
|
|
ColorMachining(m_MachiningList(m_nDragInd))
|
|
ColorNumberArrow(m_nDragInd)
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
m_bModified = True
|
|
' Aggiorno punto e stato di drag
|
|
m_ptDragPrev = ptCurr
|
|
m_bDragging = False
|
|
End Sub
|
|
|
|
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseUpScene
|
|
' Verifico di essere il gestore attivo e non in modalità sola visualizzazione
|
|
If Not m_bActive OrElse m_bShow Then Return
|
|
' Se drag in corso
|
|
If m_nDragInd >= 0 Then
|
|
m_nDragInd = -1
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub AddPauseText(ByRef sName As String)
|
|
sName &= " " & EgtMsg(90372) ' Pausa
|
|
End Sub
|
|
|
|
Private Sub AddTopText(ByRef sName As String)
|
|
sName &= EgtMsg(91217) ' Top
|
|
End Sub
|
|
|
|
Private Sub AddFinalText(ByRef sName As String)
|
|
sName = "Final " & sName
|
|
End Sub
|
|
|
|
Private Sub RemovePauseText(ByRef sName As String)
|
|
sName = sName.Replace(EgtMsg(90372), "") ' Pausa
|
|
sName = sName.TrimEnd()
|
|
End Sub
|
|
|
|
Private Sub MachiningLsBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles MachiningLsBx.SelectionChanged
|
|
' se non attiva la modifica allora esco
|
|
If m_bShow Then
|
|
MachiningLsBx.SelectedIndex = -1
|
|
Return
|
|
End If
|
|
If MachiningLsBx.SelectedItems.Count = 0 Then Return
|
|
If MachiningLsBx.SelectedItems.Count = 1 Then m_bAreHomogeneous = True
|
|
' creo lista ordinata dei selezionati
|
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
|
For Each Item As NameIdLsBxItem In MachiningLsBx.SelectedItems
|
|
ItemList.Add(Item)
|
|
Next
|
|
|
|
' verifico che le lavorazioni siano dello stesso tipo
|
|
VerifyHomogenousMachining(ItemList)
|
|
|
|
ItemList.Sort(Function(x, y) Comparer(Of Integer).Default.Compare(m_ItemList.IndexOf(x), m_ItemList.IndexOf(y)))
|
|
|
|
If VerifyContinuity(ItemList) Then
|
|
MoveUpBtn.IsEnabled = True
|
|
MoveDownBtn.IsEnabled = True
|
|
Else
|
|
MoveUpBtn.IsEnabled = False
|
|
MoveDownBtn.IsEnabled = False
|
|
End If
|
|
' Recupero la selezione dei tagli correnti
|
|
GetCurrSelection()
|
|
' resetto marcatura lavorazioni
|
|
If m_CurrFirstInd > -1 Then
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
MarkMachining(m_ItemList(Index).Ind, False)
|
|
Next
|
|
End If
|
|
' resetto indici
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -1
|
|
' marco lavorazioni selezionate
|
|
For Each Item As NameIdLsBxItem In ItemList
|
|
MarkMachining(Item.Ind, True)
|
|
Next
|
|
m_CurrFirstInd = m_ItemList.IndexOf(ItemList(0))
|
|
m_CurrLastInd = m_ItemList.IndexOf(ItemList(ItemList.Count - 1))
|
|
' Aggiorno lo stato dei bottoni
|
|
UpdateEnableMoveBtn()
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub MachiningLsBx_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles MachiningLsBx.MouseDoubleClick
|
|
' se disabilitata la modifica allora esco
|
|
If m_bShow Then Return
|
|
If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return
|
|
OnOffCut()
|
|
End Sub
|
|
|
|
Private Sub MachiningLsBx_MouseRightButtonDown(sender As Object, e As MouseEventArgs) Handles MachiningLsBx.PreviewMouseRightButtonDown
|
|
' se disabilitata la modifica allora esco
|
|
If m_bShow Then Return
|
|
If m_IsCtrlKeyDown Or m_IsShiftKeyDown Then Return
|
|
Dim Index As Integer = MachiningLsBx.SelectedIndex
|
|
If Index = -1 Then Return
|
|
ChangeMachining(m_MachiningList(Index).m_nId)
|
|
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 LayNbArrTgBtn_Click() Handles LayNbArrTgBtn.Click
|
|
SetLayNbArrTgBtn_Click()
|
|
WritePrivateProfileString(S_GENERAL, K_SHOWNBARROW, If(LayNbArrTgBtn.IsChecked, "1", "0"), m_MainWindow.GetIniFile())
|
|
End Sub
|
|
|
|
Private Sub SetLayNbArrTgBtn_Click()
|
|
If LayNbArrTgBtn.IsChecked Then
|
|
StatusOffNumbArrow(GDB_ST.ON_)
|
|
LayNbArrTgBtn.ToolTip = EgtMsg(91218) ' Hide
|
|
Dim Img As ImageSource = ImageConverter.ConvertFromString("pack://application:,,,/Resources/NewIcons/LightArrowOn.png")
|
|
LayNbArrImg.Source = Img
|
|
Else
|
|
StatusOffNumbArrow(GDB_ST.OFF)
|
|
LayNbArrTgBtn.ToolTip = EgtMsg(91219) ' Show
|
|
Dim Img As ImageSource = ImageConverter.ConvertFromString("pack://application:,,,/Resources/NewIcons/LightArrowOff.png")
|
|
LayNbArrImg.Source = Img
|
|
End If
|
|
End Sub
|
|
|
|
' Uno spostamento è possibile solo se la pozione di arrivo è un taglio dello stesso tipo (FinalCut)
|
|
Private Sub UpdateEnableMoveBtn()
|
|
If Not MoveUpBtn.IsEnabled And Not MoveDownBtn.IsEnabled Then Return
|
|
|
|
' MOVE UP (-1)
|
|
If m_CurrFirstInd > 0 Then
|
|
Dim OldItem As SplitMach = m_MachiningList(m_CurrFirstInd - 1)
|
|
Dim NewItem As SplitMach = m_MachiningList(m_CurrLastInd)
|
|
MoveUpBtn.IsEnabled = Not (OldItem.m_bFinalCut Or NewItem.m_bFinalCut) Or (OldItem.m_bFinalCut And NewItem.m_bFinalCut)
|
|
End If
|
|
|
|
' MOVE DOWN (1)
|
|
If m_CurrLastInd < m_MachiningList.Count - 1 Then
|
|
Dim OldItem = m_MachiningList(m_CurrLastInd + 1)
|
|
Dim NewItem = m_MachiningList(m_CurrFirstInd)
|
|
MoveDownBtn.IsEnabled = Not (OldItem.m_bFinalCut Or NewItem.m_bFinalCut) Or (OldItem.m_bFinalCut And NewItem.m_bFinalCut)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MoveItem(direction As Integer)
|
|
' Checking selected item
|
|
If m_CurrFirstInd = -1 OrElse MachiningLsBx.SelectedIndex < 0 Then
|
|
Return
|
|
End If
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
|
|
' Se la direzione è giù
|
|
If direction = 1 And m_CurrLastInd < m_ItemList.Count - 1 Then
|
|
' sposto il successivo prima di tutti i selezionati
|
|
m_ItemList.Move(m_CurrLastInd + 1, m_CurrFirstInd)
|
|
MoveMachining(m_CurrLastInd + 1, m_CurrFirstInd)
|
|
' aggiorno gli indici degli elementi coinvolti nello spostamento (selezionati e non)
|
|
For index As Integer = m_CurrLastInd + 1 To m_CurrFirstInd Step -1
|
|
m_ItemList(index).Ind = index
|
|
Next
|
|
m_CurrFirstInd += 1
|
|
m_CurrLastInd += 1
|
|
ElseIf direction = -1 And m_CurrFirstInd > 0 Then
|
|
' sposto il precedente dopo tutti i selezionati
|
|
m_ItemList.Move(m_CurrFirstInd - 1, m_CurrLastInd)
|
|
MoveMachining(m_CurrFirstInd - 1, m_CurrLastInd)
|
|
' aggiorno gli indici degli elementi coinvolti nello spostamento (selezionati e non)
|
|
For index As Integer = m_CurrFirstInd - 1 To m_CurrLastInd
|
|
m_ItemList(index).Ind = index
|
|
Next
|
|
m_CurrFirstInd -= 1
|
|
m_CurrLastInd -= 1
|
|
End If
|
|
' Aggiorno lo stato dei bottoni
|
|
UpdateEnableMoveBtn()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub MoveMachining(oldIndex As Integer, newIndex As Integer)
|
|
Dim item As SplitMach = m_MachiningList(oldIndex)
|
|
m_MachiningList.RemoveAt(oldIndex)
|
|
m_MachiningList.Insert(newIndex, item)
|
|
End Sub
|
|
|
|
Private Sub OnOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles OnOffBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
m_ItemList(Index).bIsActive = False
|
|
Else
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
m_ItemList(Index).bIsActive = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
|
|
' recupero l'elenco degli elementi selezionati
|
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
|
For Each Item As NameIdLsBxItem In MachiningLsBx.SelectedItems
|
|
ItemList.Add(Item)
|
|
Next
|
|
|
|
VerifyHomogenousMachining(ItemList)
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
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(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
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(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Sub CutBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).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
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Sub CutEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutEndBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Eseguo
|
|
If AdjustEndCut(nI) Then
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Sub CutStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles CutStartBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Eseguo
|
|
If AdjustStartCut(nI) Then
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
' Aggiono abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
'' DA FARE: quando seleziono Esc devo togliere deselezionare tutte le enità!
|
|
'Private Sub OnKeyDownScene(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
|
' If e.Key = Key.Escape Then
|
|
' ' se sono in fase di creazione di un ponticello interrompo
|
|
' DeselectWJBridgesPart()
|
|
' EgtDeselectAll()
|
|
' RemoveMarkAndNumbers()
|
|
' End If
|
|
'End Sub
|
|
|
|
Private Sub MachiningLsBx_KeyDown(sender As Object, e As KeyEventArgs) Handles MachiningLsBx.KeyDown
|
|
If e.Key = Key.LeftCtrl Or e.Key = Key.RightCtrl Then
|
|
m_IsCtrlKeyDown = True
|
|
End If
|
|
If e.Key = Key.LeftShift Or e.Key = Key.RightShift Then
|
|
m_IsShiftKeyDown = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MachiningLsBx_KeyUp(sender As Object, e As KeyEventArgs) Handles MachiningLsBx.KeyUp
|
|
If e.Key = Key.LeftCtrl Or e.Key = Key.RightCtrl Then
|
|
m_IsCtrlKeyDown = False
|
|
End If
|
|
If e.Key = Key.LeftShift Or e.Key = Key.RightShift Then
|
|
m_IsShiftKeyDown = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BridgeBtn_Click(sender As Object, e As RoutedEventArgs) Handles BridgesWJBtn.Click
|
|
' eventualmente spengo il comando per eliminare i ponticelli
|
|
If BridgesDeleteWJBtn.IsChecked Then
|
|
BridgesDeleteWJBtn.IsChecked = False
|
|
End If
|
|
' se deseleziono resetto tutte le variabili
|
|
If Not BridgesWJBtn.IsChecked Then
|
|
' se sono in fase di creazione di un ponticello interrompo
|
|
DeselectWJBridgesPart()
|
|
Return
|
|
End If
|
|
' recuoero il gruppo di lavorazione corrente
|
|
Dim nIdCurrMachGroup As Integer = EgtGetCurrMachGroup()
|
|
' creo il gruppo per i ponticelli
|
|
Dim sNameGroup As String = BRIDGES
|
|
Dim nId As Integer = EgtGetFirstNameInGroup(nIdCurrMachGroup, sNameGroup)
|
|
If nId <> GDB_ID.NULL Then
|
|
m_nIdBridgesGroup = nId
|
|
End If
|
|
' se non lo trovo allora lo creo
|
|
If nId = GDB_ID.NULL Then
|
|
m_nIdBridgesGroup = EgtCreateGroup(nIdCurrMachGroup)
|
|
EgtSetName(m_nIdBridgesGroup, BRIDGES)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BridgeDeleteBtn_Click(Sender As Object, e As RoutedEventArgs) Handles BridgesDeleteWJBtn.Click
|
|
' eventualmente spengo il comando per inserire i ponticelli
|
|
If BridgesWJBtn.IsChecked Then
|
|
BridgesWJBtn.IsChecked = False
|
|
End If
|
|
|
|
If Not BridgesDeleteWJBtn.IsChecked Then
|
|
DeselectWJBridgesPart()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub QualityWJBtn_Click(Sender As Object, e As RoutedEventArgs) Handles QualityWJBtn.Click
|
|
Dim bFirstWJ As Boolean = True
|
|
Dim sQuality As String = String.Empty
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
' se altrimenti getto d'acqua
|
|
If nMachiningType = MCH_MY.WATERJETTING Then
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstWJ Then
|
|
EgtSetCurrMachining(nOperId)
|
|
' Dialogo richiesta valore
|
|
Dim ValWnd As New EditValueWD(m_MainWindow, m_MainWindow.m_CurrentMachine.Qualities, "Quality")
|
|
If EgtGetInfo(nOperId, "Quality", sQuality) Then
|
|
ValWnd.SetItemComboBox(sQuality)
|
|
Else
|
|
ValWnd.SetItemComboBox(m_MainWindow.m_CurrentMachine.sCurrWaterJettingQuality)
|
|
End If
|
|
If Not ValWnd.ShowDialog() Then Return
|
|
sQuality = ValWnd.GetItemComboBox
|
|
' comunico che ho letto il primo dato
|
|
bFirstWJ = False
|
|
End If
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetInfo(nOperId, "Quality", sQuality)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
' verifico interferenza
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
' Dato l'indice della lavorazione restituisce l'indice della lavorazione TwinCut
|
|
Private Function GetIndexTwinCut(nIndex As Integer, Optional OnlyFinalCut As Boolean = True) As Integer
|
|
Dim nIndexTwinCut As Integer = -1
|
|
If m_MachiningList(nIndex).m_bFinalCut Or Not OnlyFinalCut Then
|
|
Dim nIdTwinCut As Integer = -1
|
|
EgtGetInfo(m_MachiningList(nIndex).m_nId, "IdTwinCut", nIdTwinCut)
|
|
nIndexTwinCut = m_MachiningList.FindIndex(Function(x) x.m_nId = nIdTwinCut)
|
|
End If
|
|
Return nIndexTwinCut
|
|
End Function
|
|
|
|
Private Function AdjustBothCuts(nI As Integer,
|
|
Optional bAllForced As Boolean = False,
|
|
Optional bAccForced As Boolean = False) As Boolean
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
' Verifico che entrambi gli estremi siano allungabili
|
|
If Not ((m_MachiningList(nI).m_bCanStartAll And m_MachiningList(nI).m_bCanEndAll) Or nIndexTwinCut > -1) 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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
|
|
' 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(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
|
|
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(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
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
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
' Verifico che l'estremo iniziale sia allungabile
|
|
If Not (m_MachiningList(nI).m_bCanStartAll Or nIndexTwinCut > -1) 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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
' 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(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLiPrev)
|
|
' 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(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
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
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
' Verifico che l'estremo finale sia allungabile
|
|
If Not (m_MachiningList(nI).m_bCanEndAll Or nIndexTwinCut > -1) 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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
' 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
|
|
UpdateMachiningPreview(m_MachiningList(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
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
|
|
|
|
' ver_2.7h3
|
|
If nIndexTwinCut > -1 And nIndexTwinCut < m_MachiningList.Count Then
|
|
' Eseguo allungamento o riporto allo standard
|
|
EgtSetCurrMachining(m_MachiningList(nIndexTwinCut).m_nId)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLoPrev)
|
|
' 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
|
|
UpdateMachiningPreview(m_MachiningList(nIndexTwinCut).m_nId, True)
|
|
End If
|
|
|
|
End If
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
ColorMachining(m_MachiningList(nI))
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub OutCenStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles OutCenStartBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
Dim CurrIndex As Integer = Index
|
|
If Not m_ItemList(CurrIndex).IsSelected Then Continue For
|
|
|
|
For nCount As Integer = 1 To 2
|
|
Dim nI As Integer = m_ItemList(CurrIndex).Ind
|
|
' se non è loop esterno non posso modificare
|
|
If m_MachiningList(nI).m_sLay <> NAME_OUTLOOP Then
|
|
Exit For
|
|
End If
|
|
' se ho forzato il tipo di ingresso da CamAuto qui non posso modificarlo!
|
|
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
|
EgtOutLog("L'ingresso di taglio associato all'entita' " & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
|
Exit For
|
|
End If
|
|
' Eseguo
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
' Se primo ciclo, cerco eventuale taglio associato
|
|
If nCount = 1 Then
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then
|
|
CurrIndex = nIndexTwinCut
|
|
Else
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub AllOutStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOutStartBtn.Click
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub AllCenStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllCenStartBtn.Click
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
|
|
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
|
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
|
EgtOutLog("L'ingresso di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
|
Else
|
|
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
|
|
End If
|
|
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub OutCenEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles OutCenEndBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
Dim CurrIndex As Integer = Index
|
|
If Not m_ItemList(CurrIndex).IsSelected Then Continue For
|
|
|
|
For nCount As Integer = 1 To 2
|
|
Dim nI As Integer = m_ItemList(CurrIndex).Ind
|
|
' se non è loop esterno non posso modificare
|
|
If m_MachiningList(nI).m_sLay <> NAME_OUTLOOP Then
|
|
Exit For
|
|
End If
|
|
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
|
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
|
EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
|
Exit For
|
|
End If
|
|
' Eseguo
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
' Se primo ciclo, cerco eventuale taglio associato
|
|
If nCount = 1 Then
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then
|
|
CurrIndex = nIndexTwinCut
|
|
Else
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub AllOutEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllOutEndBtn.Click
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub AllCenEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllCenEndBtn.Click
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
|
|
' se ho forzato il tipo di ingresso da CamAuto qui non posso moficarlo!
|
|
If m_MachiningList(nI).m_bMngLeadInOnIntCorner Then
|
|
EgtOutLog("L'uscita di taglio associato all'entita'_" & m_MachiningList(nI).m_nEntId & " non puo' essere modificato per problemi di ingombro lama")
|
|
Else
|
|
|
|
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))
|
|
ColorNumberArrow(nI)
|
|
|
|
End If
|
|
|
|
Next
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
End Sub
|
|
|
|
Private Sub AllExtendBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllExtendBtn.Click
|
|
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
|
|
|
|
Private Sub AllReduceBtn_Click(sender As Object, e As RoutedEventArgs) Handles AllReduceBtn.Click
|
|
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
|
|
|
|
Private Sub ModifStartBtn_Click(sender As Object, e As RoutedEventArgs) Handles ModifStartBtn.Click
|
|
Dim bLen As Boolean = True
|
|
' abilito la finestra per inserire i valori solo per il primo elemento della lista (di default tutti gli altri oggetti assumono lo stesso valore)
|
|
Dim bFirstInd As Boolean = True
|
|
Dim bFirstMill As Boolean = True
|
|
Dim bFirstWJ As Boolean = True
|
|
' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING
|
|
Dim dUsal As Double = 0
|
|
' elenco delle variabili : MCH_MY.WATERJETTING
|
|
Dim dWJAddLen As Double = 0
|
|
Dim bWJLiHole As Boolean = True
|
|
Dim nWJTangDist As Double = 0
|
|
Dim nWJPerpDist As Double = 0
|
|
Dim nWJLeadInType As Integer = 0
|
|
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
Dim CurrIndex As Integer = Index
|
|
If Not m_ItemList(CurrIndex).IsSelected Then Continue For
|
|
|
|
Dim nI As Integer = m_ItemList(CurrIndex).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
|
|
' Se taglio con lama
|
|
If nMachiningType = MCH_MY.SAWING Then
|
|
|
|
For nCount As Integer = 1 To 2
|
|
' Riassegno i valori dell'indice corrente
|
|
nI = m_ItemList(CurrIndex).Ind
|
|
nOperId = m_MachiningList(nI).m_nId
|
|
' se non è retta o ...
|
|
If Not (m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dPrevAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then
|
|
Exit For
|
|
End If
|
|
|
|
' leggo il valore salvato nella geometria
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstInd Then
|
|
' Dialogo richiesta valore
|
|
Dim ValWnd As New EditValueWD(m_MainWindow, "SAW: " & EgtMsg(90375)) ' Allungamento
|
|
ValWnd.SetVal(dOrigUsal, bLen)
|
|
If Not ValWnd.ShowDialog() Then Return
|
|
' carico il valore letto dal testierino virtuale
|
|
dUsal = ValWnd.GetVal(bLen)
|
|
' comunico che ho letto il primo dato
|
|
bFirstInd = False
|
|
End If
|
|
' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' recupero allungamento corrente
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
' non eseguo modifica se su angolo interno
|
|
If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUsal < -10 * EPS_SMALL) Then
|
|
Exit For
|
|
End If
|
|
' Eseguo
|
|
Dim bRepeat As Boolean = False
|
|
Do
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(nI).m_dStartFreeLen < FREELEN_INF Then
|
|
' se abilitati i controlli sugli allungamenti dei lati interni
|
|
If Not m_StartEndModifyOnIntCorner Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, m_MainWindow.GetMachIniFile()), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUsal = Math.Min(dUsal, m_MachiningList(nI).m_dStartFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
If bRepeat Then
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
dUsal = dOrigUsal
|
|
End If
|
|
Loop While bRepeat
|
|
|
|
' controllo ammissibilità allungamento
|
|
Dim nInterf As Integer = FMI_TYPE.NONE
|
|
If EgtVerifyMachining(m_MachiningList(nI).m_nId, nInterf) AndAlso nInterf = FMI_TYPE.LI Then
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
dUsal = dOrigUsal
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
End If
|
|
|
|
' verifica finale interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
' Se primo ciclo, cerco eventuale taglio associato
|
|
If nCount = 1 Then
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then
|
|
CurrIndex = nIndexTwinCut
|
|
Else
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
' se altrimenti fresatura sopra
|
|
ElseIf nMachiningType = MCH_MY.MILLING And m_MachiningList(nI).m_sLay = NAME_ONPATH Then
|
|
|
|
' leggo il valore salvato nella geometria
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
If bFirstMill Then
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' Dialogo richiesta valore
|
|
Dim ValWnd As New EditValueWD(m_MainWindow, "MILL: " & EgtMsg(90375)) ' Allungamento
|
|
ValWnd.SetVal(dOrigUsal, bLen)
|
|
If Not ValWnd.ShowDialog() Then
|
|
' Esco da tutto
|
|
Return
|
|
End If
|
|
' carico il valore letto dal testierino virtuale
|
|
dUsal = ValWnd.GetVal(bLen)
|
|
' comunico che ho letto il primo dato
|
|
bFirstMill = False
|
|
End If
|
|
' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dAddLen)
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dAddLen + dUsal - dOrigUsal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_SAL, dUsal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bGenModif = True
|
|
|
|
' se altrimenti getto d'acqua
|
|
ElseIf nMachiningType = MCH_MY.WATERJETTING Then
|
|
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstWJ Then
|
|
' Recupero i valori attuali della lavorazione
|
|
Dim bOriginalIsLeadIn As Boolean = True
|
|
Dim dOriginalAddLen As Double = 0
|
|
Dim bOriginalLiHole As Boolean = True
|
|
Dim nOriginalTangDist As Double = 0
|
|
Dim nOriginalPerpDist As Double = 0
|
|
Dim nOriginalLeadInType As Integer = 0
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dOriginalAddLen)
|
|
EgtGetMachiningParam(MCH_MP.LIHOLE, bOriginalLiHole)
|
|
EgtGetMachiningParam(MCH_MP.LITANG, nOriginalTangDist)
|
|
EgtGetMachiningParam(MCH_MP.LIPERP, nOriginalPerpDist)
|
|
EgtGetMachiningParam(MCH_MP.LEADINTYPE, nOriginalLeadInType)
|
|
' Dialogo richiesta valori
|
|
Dim ModifStartWnd As New ModifStartEndWD(m_MainWindow, "WJ: " & EgtMsg(90373), bOriginalIsLeadIn, nOperId) ' Inizio Modif.
|
|
ModifStartWnd.SetElongation(dOriginalAddLen)
|
|
ModifStartWnd.SetHole(bOriginalLiHole)
|
|
ModifStartWnd.SetLiTangDist(nOriginalTangDist)
|
|
ModifStartWnd.SetLiPerpDist(nOriginalPerpDist)
|
|
ModifStartWnd.SetLeadInType(nOriginalLeadInType)
|
|
If Not ModifStartWnd.ShowDialog() Then
|
|
' esco da tutto
|
|
Return
|
|
End If
|
|
' carico il valore letto dal testierino virtuale
|
|
dWJAddLen = ModifStartWnd.GetElongation()
|
|
bWJLiHole = ModifStartWnd.GetHole()
|
|
nWJTangDist = ModifStartWnd.GetLiTangDist()
|
|
nWJPerpDist = ModifStartWnd.GetLiPerpDist()
|
|
nWJLeadInType = ModifStartWnd.GetLeadInType().Id
|
|
' comunico che ho letto il primo dato
|
|
bFirstWJ = False
|
|
End If
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetMachiningParam(MCH_MP.LIHOLE, bWJLiHole)
|
|
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dWJAddLen)
|
|
EgtSetMachiningParam(MCH_MP.LEADINTYPE, nWJLeadInType)
|
|
EgtSetMachiningParam(MCH_MP.LITANG, nWJTangDist)
|
|
EgtSetMachiningParam(MCH_MP.LIPERP, nWJPerpDist)
|
|
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ModifEndBtn_Click(sender As Object, e As RoutedEventArgs) Handles ModifEndBtn.Click
|
|
Dim bLen As Boolean = True
|
|
' abilito la finestra per inserire i valori solo per il primo elemento della lista (di default tutti gli altri oggetti assumono lo stesso valore)
|
|
Dim bFirstInd As Boolean = True
|
|
Dim bFirstMill As Boolean = True
|
|
Dim bFirstWJ As Boolean = True
|
|
' elenco delle variabili : MCH_MY.SAWING/MCH_MY.MILLING
|
|
Dim dUeal As Double = 0
|
|
' elenco delle variabili : MCH_MY.WATERJETTING
|
|
Dim dWJAddLen As Double = 0
|
|
Dim WJLeadOutType As Integer = 0
|
|
Dim nWJTangDist As Double = 0
|
|
Dim nWJPerpDist As Double = 0
|
|
|
|
' Recupero la lavorazione corrente
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
Dim CurrIndex As Integer = Index
|
|
If Not m_ItemList(Index).IsSelected Then Continue For
|
|
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
Dim nMachiningType As Integer = EgtGetOperationType(nOperId)
|
|
|
|
' Se taglio con lama
|
|
If nMachiningType = MCH_MY.SAWING Then
|
|
|
|
For nCount As Integer = 1 To 2
|
|
' Riassegno i valori dell'indice corrente
|
|
nI = m_ItemList(CurrIndex).Ind
|
|
nOperId = m_MachiningList(nI).m_nId
|
|
' se non è retta o ...
|
|
If Not (m_MachiningList(nI).m_bIsLine Or m_MachiningList(nI).m_dNextAng > FL_ARC_ANG_MIN Or m_MachiningList(nI).m_sLay = NAME_ONPATH) Then
|
|
Exit For
|
|
End If
|
|
|
|
' leggo il valore salvato nella geometria
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstInd Then
|
|
' Dialogo richiesta valore
|
|
Dim ValWnd As New EditValueWD(m_MainWindow, "SAW: " & EgtMsg(90375)) ' Allungamento
|
|
ValWnd.SetVal(dOrigUeal, bLen)
|
|
If Not ValWnd.ShowDialog() Then Return
|
|
dUeal = ValWnd.GetVal(bLen)
|
|
bFirstInd = False
|
|
End If
|
|
' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' recupero allungamento corrente
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
If Not m_StartEndModifyOnIntCorner And (dAddLen - dOrigUeal < -10 * EPS_SMALL) Then
|
|
Exit For
|
|
End If
|
|
' Eseguo
|
|
Dim bRepeat As Boolean = False
|
|
Do
|
|
' Se c'è limite alla lunghezza libera
|
|
If m_MachiningList(nI).m_dEndFreeLen < FREELEN_INF Then
|
|
' se abilitati i controlli sugli allungamenti dei lati interni
|
|
If Not m_StartEndModifyOnIntCorner Then
|
|
' Recupero sicurezza in corner interno
|
|
Dim dCornerSafety As Double = Math.Max(GetPrivateProfileDouble(S_MACH_NEST, K_MACH_SAFE_LEN_INTCORNER, 1, m_MainWindow.GetMachIniFile()), 10 * EPS_SMALL)
|
|
' Recupero lunghezza baffo del taglio
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
Dim dDT As Double = 0
|
|
EgtGetInfo(EgtGetFirstGroupInGroup(nPvId), "DT", dDT)
|
|
dUeal = Math.Min(dUeal, m_MachiningList(nI).m_dEndFreeLen - dDT - dCornerSafety)
|
|
End If
|
|
End If
|
|
' Modifica della lavorazione
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bRepeat = Not UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
If bRepeat Then
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
dUeal = dOrigUeal
|
|
End If
|
|
Loop While bRepeat
|
|
|
|
' controllo ammissibilità allungamento
|
|
Dim nInterf As Integer = FMI_TYPE.NONE
|
|
If EgtVerifyMachining(m_MachiningList(nI).m_nId, nInterf) AndAlso nInterf = FMI_TYPE.LO Then
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
dUeal = dOrigUeal
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
End If
|
|
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
|
|
' Se primo ciclo, cerco eventuale taglio associato
|
|
If nCount = 1 Then
|
|
Dim nIndexTwinCut As Integer = GetIndexTwinCut(nI, False)
|
|
If nIndexTwinCut > -1 AndAlso Not m_ItemList(nIndexTwinCut).IsSelected Then
|
|
CurrIndex = nIndexTwinCut
|
|
Else
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
' se altrimenti fresatura sopra
|
|
ElseIf nMachiningType = MCH_MY.MILLING And m_MachiningList(nI).m_sLay = NAME_ONPATH Then
|
|
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(nOperId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
' ------------------ INIZIO PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
If bFirstMill Then
|
|
' Dialogo richiesta valore
|
|
Dim ValWnd As New EditValueWD(m_MainWindow, "MILL: " & EgtMsg(90375)) ' Allungamento
|
|
ValWnd.SetVal(dOrigUeal, bLen)
|
|
If Not ValWnd.ShowDialog() Then Return
|
|
dUeal = ValWnd.GetVal(bLen)
|
|
bFirstMill = False
|
|
End If
|
|
' ------------------ FINE PREPARAZIONE TASTIERINO VIRTUALE ------------------
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
Dim dAddLen As Double = 0
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dAddLen + dUeal - dOrigUeal)
|
|
EgtSetInfo(nOperId, INFO_MCH_USER_EAL, dUeal)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
bGenModif = True
|
|
|
|
' se altrimenti getto d'acqua
|
|
ElseIf nMachiningType = MCH_MY.WATERJETTING Then
|
|
|
|
If bFirstWJ Then
|
|
' Recupero i valori attuali della lavorazione
|
|
Dim dAddLen As Double = 0
|
|
Dim LeadOutType As Integer = 0
|
|
Dim nTangDist As Double = 0
|
|
Dim nPerpDist As Double = 0
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dAddLen)
|
|
EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, LeadOutType)
|
|
EgtGetMachiningParam(MCH_MP.LOTANG, nTangDist)
|
|
EgtGetMachiningParam(MCH_MP.LOPERP, nPerpDist)
|
|
' Dialogo richiesta valore
|
|
Dim ModifStartWnd As New ModifStartEndWD(m_MainWindow, "WJ: " & EgtMsg(90374), False, nOperId) ' Fine Modif.
|
|
ModifStartWnd.SetElongation(dAddLen)
|
|
ModifStartWnd.SetLeadOutType(LeadOutType)
|
|
ModifStartWnd.SetLoTangDist(nTangDist)
|
|
ModifStartWnd.SetLoPerpDist(nPerpDist)
|
|
If Not ModifStartWnd.ShowDialog() Then Return
|
|
dWJAddLen = ModifStartWnd.GetElongation()
|
|
WJLeadOutType = ModifStartWnd.GetLeadOutType().Id
|
|
nWJTangDist = ModifStartWnd.GetLoTangDist()
|
|
nWJPerpDist = ModifStartWnd.GetLoPerpDist()
|
|
bFirstWJ = False
|
|
End If
|
|
|
|
' Modifica della lavorazione
|
|
EgtSetCurrMachining(nOperId)
|
|
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dWJAddLen)
|
|
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, WJLeadOutType)
|
|
EgtSetMachiningParam(MCH_MP.LOTANG, nWJTangDist)
|
|
EgtSetMachiningParam(MCH_MP.LOPERP, nWJPerpDist)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
|
|
' verifico interferenza
|
|
EgtVerifyMachining(m_MachiningList(nI).m_nId, m_MachiningList(nI).m_nInterf)
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
bGenModif = True
|
|
End If
|
|
Next
|
|
' Se modificato qualcosa
|
|
If bGenModif Then
|
|
EgtDraw()
|
|
m_bModified = True
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub InvertBtn_Click(sender As Object, e As RoutedEventArgs) Handles InvertBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
' Se taglio di lama verticale
|
|
If m_MachiningList(nI).m_nType = MCH_OY.SAWING And Math.Abs(m_MachiningList(nI).m_dSideAng) < 0.1 Then
|
|
' Se abilitata inversione automatica e quindi non invertito
|
|
If m_MachiningList(nI).m_bEnableInvert Then
|
|
' Inverto e disabilito inversione automatica
|
|
If CamAuto.InvertVerticalCut(m_MachiningList(nI).m_nId) Then
|
|
m_MachiningList(nI).m_bInvert = True
|
|
m_MachiningList(nI).m_vtDir = -m_MachiningList(nI).m_vtDir
|
|
m_MachiningList(nI).m_bEnableInvert = False
|
|
SwapStartEndData(nI)
|
|
ResetEnableInvert(m_MachiningList(nI).m_nEntId)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtSetStatus(m_MachiningList(nI).m_nArrId, GDB_ST.ON_)
|
|
EgtSetMark(m_MachiningList(nI).m_nArrId)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
EgtDraw()
|
|
End If
|
|
' se altrimenti disabilitata inversione automatica e invertito
|
|
ElseIf m_MachiningList(nI).m_bInvert Then
|
|
' Tolgo inversione e lascio disabilitazione inv. autom.
|
|
If CamAuto.InvertVerticalCut(m_MachiningList(nI).m_nId) Then
|
|
m_MachiningList(nI).m_bInvert = False
|
|
m_MachiningList(nI).m_vtDir = -m_MachiningList(nI).m_vtDir
|
|
SwapStartEndData(nI)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtSetStatus(m_MachiningList(nI).m_nArrId, GDB_ST.ON_)
|
|
EgtSetMark(m_MachiningList(nI).m_nArrId)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
EgtDraw()
|
|
End If
|
|
' altrimenti disabilitata inversione automatica e non invertito
|
|
Else
|
|
' Abilito inversione automatica e lascio non invertito
|
|
m_MachiningList(nI).m_bEnableInvert = True
|
|
SetEnableInvert(m_MachiningList(nI).m_nEntId)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtSetStatus(m_MachiningList(nI).m_nArrId, GDB_ST.ON_)
|
|
EgtSetMark(m_MachiningList(nI).m_nArrId)
|
|
EgtDraw()
|
|
End If
|
|
' se taglio waterjet
|
|
ElseIf m_MachiningList(nI).m_nType = MCH_OY.WATERJETTING Then
|
|
' Inverto sempre (non va gestita abilitazione inversione)
|
|
If CamAuto.InvertWaterjet(m_MachiningList(nI).m_nId) Then
|
|
m_MachiningList(nI).m_bInvert = Not m_MachiningList(nI).m_bInvert
|
|
m_MachiningList(nI).m_vtDir = -m_MachiningList(nI).m_vtDir
|
|
SwapStartEndData(nI)
|
|
EgtErase(m_MachiningList(nI).m_nArrId)
|
|
NumberDirectionMachining(nI, False)
|
|
EgtSetStatus(m_MachiningList(nI).m_nArrId, GDB_ST.ON_)
|
|
EgtSetMark(m_MachiningList(nI).m_nArrId)
|
|
UpdateMachiningPreview(m_MachiningList(nI).m_nId, True)
|
|
EgtDraw()
|
|
End If
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub PauseBtn_Click(sender As Object, e As RoutedEventArgs) Handles PauseBtn.Click
|
|
If m_CurrFirstInd = -1 Then Return
|
|
Dim bGenModif As Boolean = False
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
Dim nI As Integer = m_ItemList(Index).Ind
|
|
Dim nOperId As Integer = m_MachiningList(nI).m_nId
|
|
If GetPause(nOperId) Then
|
|
ResetPause(nOperId)
|
|
m_MachiningList(nI).m_bPause = False
|
|
RemovePauseText(m_ItemList(Index).Name)
|
|
Else
|
|
SetPause(nOperId)
|
|
m_MachiningList(nI).m_bPause = True
|
|
AddPauseText(m_ItemList(Index).Name)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub PrevBtn_Click(sender As Object, e As RoutedEventArgs) Handles PrevBtn.Click
|
|
' Dichiaro solo visualizzazione
|
|
m_bShow = True
|
|
'' Esco
|
|
'ExitSplit(False)
|
|
' Torno alla fase precedente
|
|
Dim nCurrPhase As Integer = EgtGetCurrPhase()
|
|
' se questa è la prima fase, non possono tornare più indietro di così
|
|
If nCurrPhase = 1 Then
|
|
Return
|
|
End If
|
|
EgtSetCurrPhase(nCurrPhase - 1)
|
|
m_bToPrev = True
|
|
' Reimposto la precedente
|
|
'SplitPageUC_Loaded(Nothing, Nothing)
|
|
' torno alla disposizione della fase corrente
|
|
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_CadCutMode = CadCutPageUC.CadCutModes.MoveRawPart
|
|
End Sub
|
|
|
|
Private Sub NextBtn_Click(sender As Object, e As RoutedEventArgs) Handles NextBtn.Click
|
|
' ------- VISUALIZZAZIONE (navigazione tra le fasi) -------
|
|
If m_bShow Then
|
|
Dim CurrDisposition As Integer = EgtGetPhaseDisposition(m_nCurrPhase)
|
|
' recupero l'operazione successiva
|
|
Dim NextDisposition As Integer = EgtGetNextOperation(CurrDisposition)
|
|
If Not IsNothing(m_MainWindow.m_CadCutPageUC.m_MoveRawPartPage) Then
|
|
' verifico che l'operazione sia una disposizione, altrimenti cerco
|
|
NextDisposition = m_MainWindow.m_CadCutPageUC.m_MoveRawPartPage.GetNextDisposition(NextDisposition)
|
|
m_bOnAuxTab = m_MainWindow.m_CadCutPageUC.m_MoveRawPartPage.IsDispUnloadOnAuxTab(NextDisposition)
|
|
End If
|
|
End If
|
|
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_CadCutMode = CadCutPageUC.CadCutModes.MoveRawPart
|
|
End Sub
|
|
|
|
Private Sub AutoBtn_Click(sender As Object, e As RoutedEventArgs) Handles AutoBtn.Click
|
|
' Con movimento manuale, non disponibile movimento automatico
|
|
If m_bByHand Then Return
|
|
' Elimino evidenziazione e numerazione
|
|
RemoveMarkAndNumbers()
|
|
' Calcolo automatico
|
|
Dim bFinished As Boolean = False
|
|
Dim bOk As Boolean = CalculateOnePhaseSplitAuto(bFinished)
|
|
If Not bOk Then
|
|
m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90350)) 'Calcolo automatico non riuscito
|
|
End If
|
|
m_bModified = True
|
|
' Ricarico
|
|
SplitPageUC_Loaded(Nothing, Nothing)
|
|
End Sub
|
|
|
|
Private Sub RestartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RestartBtn.Click
|
|
' Se fase corrente è la prima, imposto partenza normale
|
|
If m_nCurrPhase = 1 Then
|
|
m_MainWindow.m_CurrentProjectPageUC.ResetProjectNcRestart()
|
|
' Altrimenti, imposto la ripartenza dalla fase corrente
|
|
Else
|
|
m_MainWindow.m_CurrentProjectPageUC.SetProjectNcRestart(m_nCurrPhase)
|
|
m_MainWindow.m_CurrentProjectPageUC.SetInfoMessage(EgtMsg(90359) & " (" & m_nCurrPhase.ToString() & ")") ' Restart
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ModifyBtn_Click(sender As Object, e As RoutedEventArgs) Handles ModifyBtn.Click
|
|
' Dichiaro non più solo visualizzazione
|
|
m_bShow = False
|
|
' Rimuovo eventuale restart
|
|
m_MainWindow.m_CurrentProjectPageUC.ResetProjectNcRestart()
|
|
' Elimino le fasi successive alla corrente
|
|
While EgtGetPhaseCount() > m_nCurrPhase
|
|
RemoveLastPhase()
|
|
End While
|
|
' Aggiorno le lavorazioni (solo per waterjet sono ricalcolate e riordinate)
|
|
If m_MainWindow.m_CurrentMachine.WaterJettingActive Then
|
|
ResetAllMachinings()
|
|
SortAllMachinings()
|
|
For Each ItemSplitMach As NameIdLsBxItem In m_ItemList
|
|
ItemSplitMach.bIsActive = True
|
|
Next
|
|
End If
|
|
m_MainWindow.m_CurrentProjectPageUC.SetOrderMachiningFlag()
|
|
If m_MainWindow.m_CurrentMachine.WaterJettingActive Then
|
|
Dim bModif As Boolean = TestAllMachiningsForStrict()
|
|
If bModif Then m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
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)
|
|
m_nCountSawing = 0
|
|
m_nCountWaterjetting = 0
|
|
m_nCountOtherMachining = 0
|
|
For nI As Integer = 0 To m_MachiningList.Count() - 1
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
' conto il numero di tipi di lavorazioni
|
|
CountMachiningType(m_MachiningList(nI), m_nCountSawing, m_nCountWaterjetting, m_nCountOtherMachining)
|
|
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
|
|
NumberDirectionMachining(nI)
|
|
Next
|
|
|
|
' -------------------- Recupero le lavorazioni indicate come attive -- INIZIO --------------------
|
|
Dim ActiveMachLst As New List(Of Integer)
|
|
For Each ItemSplitMach As NameIdLsBxItem In m_ItemList
|
|
If ItemSplitMach.bIsActive Then ActiveMachLst.Add(ItemSplitMach.Ind)
|
|
Next
|
|
' -------------------- Recupero le lavorazioni indicate come attive -- FINE --------------------
|
|
|
|
' Preparo la lista degli Item
|
|
ShowMachiningList()
|
|
|
|
' -------------------- Riattivo le lavorazioni precedenti -- INIZIO --------------------
|
|
For Each Item As SplitMach In m_MachiningList
|
|
' spengo tutte le lavorazioni disponibili
|
|
EgtSetInfo(Item.m_nId, INFO_MCH_USER_OFF, True)
|
|
Next
|
|
' riattivo solo quelle indicate come attive
|
|
For nIndex As Integer = 0 To ActiveMachLst.Count - 1
|
|
For Each ItemSplitMach As NameIdLsBxItem In m_ItemList
|
|
If ItemSplitMach.Ind = ActiveMachLst(nIndex) Then
|
|
EgtRemoveInfo(m_MachiningList(ItemSplitMach.Ind).m_nId, INFO_MCH_USER_OFF)
|
|
m_MachiningList(ItemSplitMach.Ind).m_bEnabled = True
|
|
ItemSplitMach.bIsActive = True
|
|
' sistemo colore
|
|
ColorMachining(m_MachiningList(ItemSplitMach.Ind))
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
' -------------------- Riattivo le lavorazioni precedenti -- FINE --------------------
|
|
|
|
' Aggiorno visualizzazione
|
|
EgtDraw()
|
|
' Aggiorno abilitazione bottoni
|
|
EnableButtons()
|
|
End Sub
|
|
|
|
Private Sub SplitPageUC_Unloaded(sender As Object, e As EventArgs) Handles Me.Unloaded
|
|
m_bActive = False
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
ExitSplit(Not m_bToNext And Not m_bToPrev)
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Friend Sub ExitSplit(Optional bTrueExit As Boolean = True)
|
|
DeselectWJBridgesPart()
|
|
BridgesWJBtn.IsChecked = False
|
|
BridgesDeleteWJBtn.IsChecked = False
|
|
|
|
' 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
|
|
SaveOrderMachinig(m_nCurrPhase)
|
|
End If
|
|
' 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 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
|
|
m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub SaveOrderMachinig(CurrPhase As Integer)
|
|
' Al primo posto deve rimanere la disposizione della fase
|
|
Dim nFirstOperId As Integer = EgtGetPhaseDisposition(CurrPhase)
|
|
For i As Integer = 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
|
|
m_MainWindow.m_CurrentProjectPageUC.SetOrderMachiningFlag()
|
|
End Sub
|
|
|
|
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 And
|
|
(m_MachiningList(nI).m_sLay = NAME_OUTLOOP Or m_MachiningList(nI).m_sLay = NAME_INLOOP) Then
|
|
MyCuts.Add(m_MachiningList(nI).m_nId)
|
|
End If
|
|
Next
|
|
Cuts = MyCuts.ToArray()
|
|
End Sub
|
|
|
|
Private Sub EnableButtons()
|
|
' Per bottone PREV
|
|
PrevBtn.IsEnabled = (m_nCurrPhase > 1)
|
|
' Per bottone NEXT
|
|
' Se abilitato manipolatore e non è con waterjet
|
|
If (m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.MAN_MANIP) Or
|
|
m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.AUTO_MANIP)) And
|
|
Not m_MainWindow.m_CurrentMachine.bWaterJetting Then
|
|
' Se in modifica
|
|
If Not m_bShow Then
|
|
' Se allontanamento perpendicolare
|
|
If m_bByHand Then
|
|
m_bOnAuxTab = False
|
|
' Ci deve essere almeno 1 taglio disabilitato e 1 e 1 solo passante
|
|
NextBtn.IsEnabled = (GetDisabledCutsCount() > 0 And GetSplitCutsCount() = 1)
|
|
' Altrimenti
|
|
Else
|
|
' movimento standard sulla tavola (almeno un taglio disabilitato allora False)
|
|
Dim bStdTab As Boolean = (GetDisabledCutsCount() > 0)
|
|
' movimento su tavola di scarico
|
|
m_bOnAuxTab = Not bStdTab AndAlso (m_nCurrPhase = EgtGetPhaseCount() And m_bEnableOnAuxTab)
|
|
' movimento finale sulla tavola
|
|
Dim bFinalMoveTab As Boolean = m_MainWindow.m_CurrentMachine.bRawFinalMove
|
|
' Deve essere permesso almeno un tipo di movimento
|
|
NextBtn.IsEnabled = bStdTab Or m_bOnAuxTab Or bFinalMoveTab
|
|
End If
|
|
' altrimenti sto solo visualizzando
|
|
Else
|
|
' movimento su tavola di scarico
|
|
m_bOnAuxTab = (m_nCurrPhase = EgtGetPhaseCount() - 1 And m_bEnableOnAuxTab And EgtGetOperationType(EgtGetLastOperation()) = MCH_OY.DISP)
|
|
' Non deve essere l'ultima fase
|
|
NextBtn.IsEnabled = (m_nCurrPhase < EgtGetPhaseCount())
|
|
End If
|
|
Else
|
|
NextBtn.IsEnabled = False
|
|
End If
|
|
' Per bottone MODIFY
|
|
ModifyBtn.IsEnabled = m_bShow
|
|
' Per bottone AUTO
|
|
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))
|
|
' Per bottone RESTART
|
|
RestartBtn.Visibility = If(m_bShow, Windows.Visibility.Visible, Windows.Visibility.Hidden)
|
|
RestartBtn.IsEnabled = (m_bShow And m_MainWindow.m_CurrentMachine.bEnableRestart)
|
|
' Altri bottoni
|
|
MoveUpBtn.IsEnabled = Not m_bShow
|
|
MoveDownBtn.IsEnabled = Not m_bShow
|
|
OnOffBtn.IsEnabled = Not m_bShow
|
|
AllOnBtn.IsEnabled = Not m_bShow
|
|
AllOffBtn.IsEnabled = Not m_bShow
|
|
CutBtn.IsEnabled = Not m_bShow
|
|
CutStartBtn.IsEnabled = Not m_bShow
|
|
CutEndBtn.IsEnabled = Not m_bShow
|
|
OutCenStartBtn.IsEnabled = Not m_bShow
|
|
AllOutStartBtn.IsEnabled = Not m_bShow
|
|
AllCenStartBtn.IsEnabled = Not m_bShow
|
|
OutCenEndBtn.IsEnabled = Not m_bShow
|
|
AllOutEndBtn.IsEnabled = Not m_bShow
|
|
AllCenEndBtn.IsEnabled = Not m_bShow
|
|
AllExtendBtn.IsEnabled = Not m_bShow
|
|
AllReduceBtn.IsEnabled = Not m_bShow
|
|
ModifStartBtn.IsEnabled = Not m_bShow
|
|
ModifEndBtn.IsEnabled = Not m_bShow
|
|
InvertBtn.IsEnabled = Not m_bShow
|
|
PauseBtn.IsEnabled = (Not m_bShow And m_MainWindow.m_CurrentMachine.bEnablePause)
|
|
BridgesWJBtn.IsEnabled = Not m_bShow
|
|
BridgesDeleteWJBtn.IsEnabled = Not m_bShow
|
|
QualityWJBtn.IsEnabled = Not m_bShow
|
|
|
|
' nascondo i comandi che non devono essere visualizzati in funzione delle lavorazioni attive
|
|
If m_nCountSawing = 0 And (m_nCountWaterjetting > 0 Or m_nCountOtherMachining) Then
|
|
VisibilityButtonFromMachinig(MCH_OY.WATERJETTING)
|
|
Else
|
|
VisibilityButtonFromMachinig(MCH_OY.SAWING)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub OnOffCut()
|
|
If MachiningLsBx.SelectedItems.Count = 1 Then
|
|
Dim x As NameIdLsBxItem = DirectCast(MachiningLsBx.SelectedItems(0), NameIdLsBxItem)
|
|
Dim nI As Integer = x.Ind
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
m_MachiningList(nI).m_bEnabled = False
|
|
x.bIsActive = False
|
|
Else
|
|
m_MachiningList(nI).m_bEnabled = True
|
|
x.bIsActive = True
|
|
End If
|
|
ColorMachining(m_MachiningList(nI))
|
|
ColorNumberArrow(nI)
|
|
EgtDraw()
|
|
' Imposto flag di modifica
|
|
m_bModified = True
|
|
' recupero l'elenco degli elementi selezionati
|
|
Dim ItemList As New List(Of NameIdLsBxItem)
|
|
For Each Item As NameIdLsBxItem In MachiningLsBx.SelectedItems
|
|
ItemList.Add(Item)
|
|
Next
|
|
VerifyHomogenousMachining(ItemList)
|
|
' Abilitazione bottone Next
|
|
EnableButtons()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub VerifyHomogenousMachining(ItemList As List(Of NameIdLsBxItem))
|
|
If IsNothing(ItemList) OrElse ItemList.Count = 0 Then
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
Return
|
|
End If
|
|
Dim nSawing As Integer = 0
|
|
Dim nWaterjetting As Integer = 0
|
|
Dim nOtherMachining As Integer = 0
|
|
' conto il numero di tipi di lavprazioni
|
|
For Each Item As NameIdLsBxItem In ItemList
|
|
If Item.Type = MCH_OY.SAWING Then
|
|
nSawing += 1
|
|
ElseIf Item.Type = MCH_OY.WATERJETTING Then
|
|
nWaterjetting += 1
|
|
Else
|
|
nOtherMachining += 1
|
|
End If
|
|
Next
|
|
' verifico se le lavorazioni sono omeogenee
|
|
If nSawing > 0 And (nWaterjetting > 0 Or nOtherMachining > 0) Then
|
|
m_bAreHomogeneous = False
|
|
VisibilityButtonFromMachinig(MCH_OY.SAWING)
|
|
ElseIf nSawing = 0 And nOtherMachining > 0 And nWaterjetting > 0 Then
|
|
m_bAreHomogeneous = False
|
|
VisibilityButtonFromMachinig(MCH_OY.WATERJETTING)
|
|
Else
|
|
VisibilityButtonFromMachinig(ItemList(0).Type)
|
|
m_bAreHomogeneous = True
|
|
End If
|
|
' eventualmente stampo messaggio
|
|
If Not m_bAreHomogeneous Then
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
m_MainWindow.m_CurrentProjectPageUC.SetWarningMessage(EgtMsg(91220)) ' Lavorazioni non omogenee
|
|
Else
|
|
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
|
|
End If
|
|
End Sub
|
|
|
|
Private Function VerifyContinuity(ItemList As List(Of NameIdLsBxItem)) As Boolean
|
|
If ItemList.Count < 2 Then Return True
|
|
Dim bContigus As Boolean = False
|
|
For Index As Integer = 0 To ItemList.Count - 2
|
|
If ItemList(Index).Ind = ItemList(Index + 1).Ind + 1 Or ItemList(Index).Ind = ItemList(Index + 1).Ind - 1 Then
|
|
bContigus = True
|
|
Else
|
|
bContigus = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
Return bContigus
|
|
End Function
|
|
|
|
Private Sub GetCurrSelection()
|
|
For Each Item As NameIdLsBxItem In m_ItemList
|
|
Item.IsSelected = False
|
|
Next
|
|
' recupero il numero di elementi selezionati
|
|
Dim nCount As Integer = MachiningLsBx.SelectedItems.Count
|
|
For Index As Integer = 0 To nCount - 1
|
|
Dim Local_ItemTemplate As NameIdLsBxItem = MachiningLsBx.SelectedItems(Index)
|
|
For Each Item As NameIdLsBxItem In m_ItemList
|
|
If Item.Ind = Local_ItemTemplate.Ind Then
|
|
Item.IsSelected = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub VisibilityButtonFromMachinig(ByVal Type As Integer)
|
|
If Type <> MCH_OY.SAWING Then
|
|
|
|
CutBtn.Visibility = Visibility.Hidden
|
|
CutStartBtn.Visibility = Visibility.Hidden
|
|
CutEndBtn.Visibility = Visibility.Hidden
|
|
|
|
OutCenStartBtn.Visibility = Visibility.Hidden
|
|
OutCenEndBtn.Visibility = Visibility.Hidden
|
|
InvertBtn.Visibility = Visibility.Hidden
|
|
PauseBtn.Visibility = Visibility.Hidden
|
|
AllOutStartBtn.Visibility = Visibility.Hidden
|
|
AllCenStartBtn.Visibility = Visibility.Hidden
|
|
AllOutEndBtn.Visibility = Visibility.Hidden
|
|
AllCenEndBtn.Visibility = Visibility.Hidden
|
|
AllExtendBtn.Visibility = Visibility.Hidden
|
|
AllReduceBtn.Visibility = Visibility.Hidden
|
|
Else
|
|
CutBtn.Visibility = Visibility.Visible
|
|
CutStartBtn.Visibility = Visibility.Visible
|
|
CutEndBtn.Visibility = Visibility.Visible
|
|
|
|
OutCenStartBtn.Visibility = Visibility.Visible
|
|
OutCenEndBtn.Visibility = Visibility.Visible
|
|
InvertBtn.Visibility = Visibility.Visible
|
|
PauseBtn.Visibility = Visibility.Visible
|
|
AllOutStartBtn.Visibility = Visibility.Visible
|
|
AllCenStartBtn.Visibility = Visibility.Visible
|
|
AllOutEndBtn.Visibility = Visibility.Visible
|
|
AllCenEndBtn.Visibility = Visibility.Visible
|
|
AllExtendBtn.Visibility = Visibility.Visible
|
|
AllReduceBtn.Visibility = Visibility.Visible
|
|
End If
|
|
|
|
' gestione bottone per generazione ponticelli
|
|
If Type = MCH_OY.WATERJETTING Then
|
|
InvertBtn.Visibility = Visibility.Visible
|
|
' siccome la stessa posizione è occupata da due comandi sovrapposti
|
|
If CutStartBtn.Visibility = Visibility.Hidden Then
|
|
BridgesWJBtn.Visibility = Visibility.Visible
|
|
BridgesDeleteWJBtn.Visibility = Visibility.Visible
|
|
QualityWJBtn.Visibility = Visibility.Visible
|
|
Else
|
|
BridgesWJBtn.Visibility = Visibility.Hidden
|
|
BridgesDeleteWJBtn.Visibility = Visibility.Hidden
|
|
QualityWJBtn.Visibility = Visibility.Hidden
|
|
End If
|
|
Else
|
|
BridgesWJBtn.Visibility = Visibility.Hidden
|
|
BridgesDeleteWJBtn.Visibility = Visibility.Hidden
|
|
QualityWJBtn.Visibility = Visibility.Hidden
|
|
End If
|
|
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 NumberDirectionMachining(nI As Integer, Optional bNumber As Boolean = True)
|
|
EgtDisableModified()
|
|
' Determino se seconda lavorazione
|
|
Dim sName As String = String.Empty
|
|
EgtGetName(m_MachiningList(nI).m_nId, sName)
|
|
Dim b2ndLav As Boolean = sName.Contains("_") Or sName.Contains("Drip")
|
|
' Ingombro complessivo della lavorazione
|
|
Dim ptMin, ptMax As Point3d
|
|
If Not BoxFromMachining(nI, ptMin, ptMax) Then Return
|
|
' Metto il numero nel centro
|
|
Dim dRadXY = Point3d.DistXY(ptMin, ptMax)
|
|
Dim dHtxt As Double = 50
|
|
Dim dRat As Double = 0.75
|
|
If dRadXY < 200 Then
|
|
dHtxt = 40
|
|
dRat = 0.6
|
|
ElseIf dRadXY < 25 Then
|
|
dHtxt = 25
|
|
dRat = 0.5
|
|
End If
|
|
Dim vtXY As Vector3d = ptMax - ptMin
|
|
vtXY.Normalize()
|
|
Dim ptCen As Point3d = Point3d.Media(ptMin, ptMax) + vtXY * If(Not b2ndLav, -0.8, 0.8) * dHtxt
|
|
ptCen.z = ptMax.z + 1
|
|
|
|
' ricavo la posizione del punto (se waterjet separata)
|
|
If m_MachiningList(nI).m_nType = MCH_OY.WATERJETTING Or m_MachiningList(nI).m_nType = MCH_OY.MILLING Then
|
|
Dim ptMid As Point3d
|
|
Dim vVers As Vector3d
|
|
MidPointOfCurve(m_MachiningList(nI).m_nId, ptMid, vVers)
|
|
ptCen = ptMid ' + vVers * If(Not b2ndLav, -0.8, 0.8) * dHtxt
|
|
End If
|
|
|
|
If bNumber Then
|
|
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
|
|
' Aggiungo a numero info con identificativo della lavorazione e viceversa
|
|
EgtSetInfo(nNbrId, "MId", m_MachiningList(nI).m_nId)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, "NbrId", nNbrId)
|
|
If Not LayNbArrTgBtn.IsChecked Then
|
|
EgtSetStatus(nNbrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nNbrId, GDB_ST.ON_)
|
|
End If
|
|
End If
|
|
' Se taglio con lama, metto la direzione accanto al numero
|
|
If m_MachiningList(nI).m_nType = MCH_OY.SAWING Then
|
|
Dim ptStart As New Point3d(ptCen + m_MachiningList(nI).m_vtDir * dHtxt)
|
|
Dim vtDir As New Vector3d(m_MachiningList(nI).m_vtDir)
|
|
Dim bTwin As Boolean = (Not m_MachiningList(nI).m_bEnableInvert OrElse Math.Abs(m_MachiningList(nI).m_dSideAng) > 0.1)
|
|
Dim nArrId As Integer = AddMachiningDirection(ptStart, vtDir, dHtxt, bTwin)
|
|
m_MachiningList(nI).m_nArrId = nArrId
|
|
' Aggiungo a freccia info con identificativo della lavorazione e viceversa
|
|
EgtSetInfo(nArrId, "MId", m_MachiningList(nI).m_nId)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, "ArrId", nArrId)
|
|
If Not LayNbArrTgBtn.IsChecked Then
|
|
EgtSetStatus(nArrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nArrId, GDB_ST.ON_)
|
|
End If
|
|
Else
|
|
m_MachiningList(nI).m_nArrId = GDB_ID.NULL
|
|
End If
|
|
' Assegno colore a numero e freccia
|
|
ColorNumberArrow(nI)
|
|
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 Function MidPointOfCurve(nOperId As Integer, ByRef ptMid As Point3d, ByRef vVers As Vector3d) As Boolean
|
|
Dim nPvId As Integer = GDB_ID.NULL
|
|
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
|
' creo un layer ausiliario per creare la curva composita
|
|
Dim AuxLayer As Integer = EgtCreateGroup(nPvId)
|
|
' imposto la lavorazione corrente
|
|
EgtSetCurrMachining(nOperId)
|
|
' recupero tutte le entità della lavorazione corrente
|
|
Dim nInd As Integer = 0
|
|
Dim nIdCurr As Integer
|
|
Dim nSub As Integer
|
|
Dim CurveCompoList As New List(Of Integer)
|
|
While EgtGetMachiningGeometry(nInd, nIdCurr, nSub)
|
|
CurveCompoList.Add(nIdCurr)
|
|
nInd += 1
|
|
End While
|
|
Dim PtNearStart As Point3d
|
|
Dim nIdCutPath As Integer = EgtCreateCurveCompoByChain(AuxLayer, CurveCompoList.ToArray, PtNearStart, False)
|
|
Dim dLength As Double = 0
|
|
EgtCurveLength(nIdCutPath, dLength)
|
|
Dim dParam As Double = 0
|
|
EgtCurveParamAtLength(nIdCutPath, dLength / 2, dParam)
|
|
EgtAtParamPoint(nIdCutPath, dParam, GDB_RT.GLOB, ptMid)
|
|
EgtAtParamVector(nIdCutPath, dParam, -1, vVers)
|
|
vVers.Normalize()
|
|
vVers.Rotate(Vector3d.Z_AX, 90)
|
|
EgtErase(AuxLayer)
|
|
Return True
|
|
End Function
|
|
|
|
Private Function AddMachiningDirection(ptStart As Point3d, vtDir As Vector3d, dLen As Double, bTwin As Boolean) As Integer
|
|
Dim dArrX As Double = dLen * Math.Cos(30 * Math.PI / 180)
|
|
Dim dArrY As Double = dLen * Math.Sin(30 * Math.PI / 180)
|
|
Dim nTmpId As Integer = EgtCreateLine(m_nNbrGrpId, Point3d.ORIG() + dArrY * Vector3d.Y_AX(), Point3d.ORIG() + dArrX * Vector3d.X_AX())
|
|
Dim nCrvId As Integer = EgtCreateCurveCompo(m_nNbrGrpId, nTmpId, True)
|
|
EgtAddCurveCompoLine(nCrvId, Point3d.ORIG() - dArrY * Vector3d.Y_AX())
|
|
If bTwin Then
|
|
EgtAddCurveCompoLine(nCrvId, Point3d.ORIG() + 2 * dArrX * Vector3d.X_AX())
|
|
EgtCloseCurveCompo(nCrvId)
|
|
End If
|
|
Dim frLoc As New Frame3d(ptStart, vtDir, Vector3d.Z_AX() ^ vtDir, Vector3d.Z_AX())
|
|
EgtTransform(nCrvId, frLoc)
|
|
Return nCrvId
|
|
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
|
|
MarkNumberArrow(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 MarkNumberArrow(nI As Integer, bMark As Boolean)
|
|
If nI < 0 Then Return
|
|
Dim nNbrId As Integer = m_MachiningList(nI).m_nNbrId
|
|
Dim nArrId As Integer = m_MachiningList(nI).m_nArrId
|
|
If bMark Then
|
|
EgtSetMark(nNbrId)
|
|
EgtSetMark(nArrId)
|
|
Else
|
|
EgtResetMark(nNbrId)
|
|
EgtResetMark(nArrId)
|
|
End If
|
|
If Not LayNbArrTgBtn.IsChecked And Not bMark Then
|
|
EgtSetStatus(nNbrId, GDB_ST.OFF)
|
|
EgtSetStatus(nArrId, GDB_ST.OFF)
|
|
Else
|
|
EgtSetStatus(nNbrId, GDB_ST.ON_)
|
|
EgtSetStatus(nArrId, GDB_ST.ON_)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub StatusOffNumbArrow(Status As GDB_ST)
|
|
For Each Item As SplitMach In m_MachiningList
|
|
Dim nOperId As Integer = Item.m_nId
|
|
Dim nNbrId As Integer = Item.m_nNbrId
|
|
Dim nArrId As Integer = Item.m_nArrId
|
|
Dim nInd As Integer = m_MachiningList.IndexOf(Item)
|
|
If nInd >= 0 AndAlso nInd < m_ItemList.Count AndAlso Not m_ItemList(nInd).IsSelected Then
|
|
EgtSetStatus(nNbrId, Status)
|
|
EgtSetStatus(nArrId, Status)
|
|
End If
|
|
Next
|
|
EgtDraw()
|
|
End Sub
|
|
|
|
Private Sub ColorNumberArrow(nI As Integer)
|
|
If nI < 0 Then Return
|
|
Dim nNbrId As Integer = m_MachiningList(nI).m_nNbrId
|
|
Dim nArrId As Integer = m_MachiningList(nI).m_nArrId
|
|
If m_MachiningList(nI).m_bEnabled Then
|
|
If m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtSetColor(nNbrId, COL_MCH_FREE)
|
|
EgtSetColor(nArrId, COL_MCH_FREE)
|
|
Else
|
|
EgtSetColor(nNbrId, COL_MCH_INTERF)
|
|
EgtSetColor(nArrId, COL_MCH_INTERF)
|
|
End If
|
|
Else
|
|
If m_MachiningList(nI).m_nInterf = FMI_TYPE.NONE Then
|
|
EgtResetColor(nNbrId)
|
|
EgtResetColor(nArrId)
|
|
ElseIf Not m_MachiningList(nI).m_bEnabled Then
|
|
EgtSetColor(nNbrId, COL_MCH_DIS_INTERF)
|
|
EgtSetColor(nArrId, COL_MCH_DIS_INTERF)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub RemoveMarkAndNumbers()
|
|
EgtDisableModified()
|
|
' cancello evidenziazione
|
|
If m_CurrFirstInd >= 0 Then
|
|
For Index As Integer = m_CurrFirstInd To m_CurrLastInd
|
|
If Not m_ItemList(Index).IsSelected Then
|
|
Continue For
|
|
End If
|
|
MarkMachining(m_ItemList(Index).Ind, False)
|
|
Next
|
|
m_CurrFirstInd = -1
|
|
m_CurrLastInd = -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
|
|
|
|
Private Sub SwapStartEndData(nI As Integer)
|
|
' Swap angoli precedente e successivo
|
|
Dim dAng As Double = m_MachiningList(nI).m_dPrevAng
|
|
m_MachiningList(nI).m_dPrevAng = m_MachiningList(nI).m_dNextAng
|
|
m_MachiningList(nI).m_dNextAng = dAng
|
|
' Swap lunghezze libere
|
|
Dim dFreeLen As Double = m_MachiningList(nI).m_dStartFreeLen
|
|
m_MachiningList(nI).m_dStartFreeLen = m_MachiningList(nI).m_dEndFreeLen
|
|
m_MachiningList(nI).m_dEndFreeLen = dFreeLen
|
|
' Swap stato di allungamento
|
|
Dim bAll As Boolean = m_MachiningList(nI).m_bStartAll
|
|
m_MachiningList(nI).m_bStartAll = m_MachiningList(nI).m_bEndAll
|
|
m_MachiningList(nI).m_bEndAll = bAll
|
|
' Swap possibilità di allungamento
|
|
Dim bCanAll As Boolean = m_MachiningList(nI).m_bCanStartAll
|
|
m_MachiningList(nI).m_bCanStartAll = m_MachiningList(nI).m_bCanEndAll
|
|
m_MachiningList(nI).m_bCanEndAll = bCanAll
|
|
' Swap stato interferenza
|
|
If (m_MachiningList(nI).m_nInterf And FMI_TYPE.LI) <> 0 And (m_MachiningList(nI).m_nInterf And FMI_TYPE.LO) = 0 Then
|
|
m_MachiningList(nI).m_nInterf -= FMI_TYPE.LI
|
|
m_MachiningList(nI).m_nInterf += FMI_TYPE.LO
|
|
ElseIf (m_MachiningList(nI).m_nInterf And FMI_TYPE.LI) = 0 And (m_MachiningList(nI).m_nInterf And FMI_TYPE.LO) <> 0 Then
|
|
m_MachiningList(nI).m_nInterf += FMI_TYPE.LI
|
|
m_MachiningList(nI).m_nInterf -= FMI_TYPE.LO
|
|
End If
|
|
' Swap Allungamento Utente
|
|
Dim dOrigUsal As Double = 0
|
|
EgtGetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_SAL, dOrigUsal)
|
|
Dim dOrigUeal As Double = 0
|
|
EgtGetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_EAL, dOrigUeal)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_SAL, dOrigUeal)
|
|
EgtSetInfo(m_MachiningList(nI).m_nId, INFO_MCH_USER_EAL, dOrigUsal)
|
|
End Sub
|
|
|
|
'-----------------------------------------------------------------------------------------------
|
|
Private 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
|
|
Private m_nType As Integer
|
|
' Posizione porta utensile (parametro non obbligatorio)
|
|
Private m_sTCPos As String = ""
|
|
Private m_cSawColor As SolidColorBrush
|
|
Private m_bMachiningTCPosVisibility As Visibility = Visibility.Hidden
|
|
|
|
Private m_IsSelected 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 TCPos As String
|
|
Get
|
|
Return m_sTCPos
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_sTCPos Then
|
|
m_sTCPos = value
|
|
NotifyPropertyChanged("TCPos")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
'!!!!!!!!!!!!!!!!!!!!
|
|
Public Property SawColor As SolidColorBrush
|
|
Get
|
|
Return m_cSawColor
|
|
End Get
|
|
Set(value As SolidColorBrush)
|
|
m_cSawColor = value
|
|
NotifyPropertyChanged("SawColor")
|
|
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
|
|
|
|
Public Property Type As Integer
|
|
Get
|
|
Return m_nType
|
|
End Get
|
|
Set(value As Integer)
|
|
m_nType = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property IsSelected As Boolean
|
|
Get
|
|
Return m_IsSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_IsSelected = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MachiningTCPosVisibility As Visibility
|
|
Get
|
|
Return m_bMachiningTCPosVisibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
If value <> m_bMachiningTCPosVisibility Then
|
|
m_bMachiningTCPosVisibility = value
|
|
NotifyPropertyChanged("MachiningTCPosVisibility")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Name As String, Ind As Integer, bIsActive As Boolean, nType As Integer)
|
|
Me.m_sName = Name
|
|
Me.m_nInd = Ind
|
|
Me.m_bIsActive = bIsActive
|
|
Me.m_nType = nType
|
|
Me.m_bMachiningTCPosVisibility = Visibility.Hidden
|
|
End Sub
|
|
|
|
Sub New(Name As String, Ind As Integer, bIsActive As Boolean, nType As Integer, sTCPos As String, cSawColor As SolidColorBrush)
|
|
Me.m_sName = Name
|
|
Me.m_nInd = Ind
|
|
Me.m_bIsActive = bIsActive
|
|
Me.m_nType = nType
|
|
Me.m_sTCPos = sTCPos
|
|
Me.m_cSawColor = cSawColor
|
|
Me.m_bMachiningTCPosVisibility = Visibility.Visible
|
|
End Sub
|
|
|
|
Public Sub NotifyPropertyChanged(propName As String)
|
|
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
End Class
|