EgtCAM5 :
- aggiunto check Active nel Db utensili. - aggiunta creazione SetUp di default in base agli utensili Active nel Db. - aggiunta prima gestione movimento barre di ventose e ventose magnetiche.
This commit is contained in:
+146
-26
@@ -69,6 +69,7 @@ Public Class ToolTreeViewItem
|
||||
Friend Shared m_delRemoveTool As Action(Of ToolTreeViewItem)
|
||||
Friend Shared m_delErrorOnTool As Action(Of Boolean)
|
||||
Friend Shared m_delIsEnabledBtns As Action(Of Boolean, Boolean, Boolean)
|
||||
Friend Shared m_delGetSelectedTool As Func(Of ToolTreeViewItem)
|
||||
|
||||
#Region "Tool Property"
|
||||
|
||||
@@ -125,6 +126,9 @@ Public Class ToolTreeViewItem
|
||||
End Select
|
||||
End If
|
||||
End If
|
||||
' ricarico utensile per avere valore Active e ricaricarlo
|
||||
EgtTdbSetCurrTool(Me.Name)
|
||||
NotifyPropertyChanged("Active")
|
||||
NotifyPropertyChanged("IsSelected")
|
||||
End If
|
||||
End Set
|
||||
@@ -179,6 +183,8 @@ Public Class ToolTreeViewItem
|
||||
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, DbExit)
|
||||
Int32.TryParse(value, nValue)
|
||||
m_IsModifiedSelectedExit = If(nValue <> DbExit, True, False)
|
||||
' se modificato disattivo l'utensile
|
||||
If m_IsModifiedSelectedExit Then EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
|
||||
If Not GetValidationError("SelectedExit") Then
|
||||
m_delErrorOnTool(True)
|
||||
m_delIsEnabledBtns(False, False, True)
|
||||
@@ -821,6 +827,8 @@ Public Class ToolTreeViewItem
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.HEAD, DbHead)
|
||||
m_IsModifiedSelectedHead = If(value.HName <> DbHead, True, False)
|
||||
' se modificato disattivo l'utensile
|
||||
If m_IsModifiedSelectedHead Then EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
|
||||
If Not m_SuspendToolDrawUpdate Then
|
||||
UpdateSceneToolDraw()
|
||||
End If
|
||||
@@ -971,6 +979,11 @@ Public Class ToolTreeViewItem
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, DbTcPos)
|
||||
m_IsModifiedSelectedTcPos = If(value <> DbTcPos, True, False)
|
||||
' se modificato disattivo l'utensile
|
||||
If m_IsModifiedSelectedTcPos Then
|
||||
Dim z = EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, False)
|
||||
NotifyPropertyChanged("Active")
|
||||
End If
|
||||
m_delIsEnabledBtns(IsValid And Not IsModified, IsValid, True)
|
||||
NotifyPropertyChanged("SelectedTcPos")
|
||||
End If
|
||||
@@ -987,6 +1000,49 @@ Public Class ToolTreeViewItem
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private m_PreviousCurrentTool As String = String.Empty
|
||||
Public Property Active As Boolean
|
||||
Get
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' salvo utensile corrente precedente
|
||||
EgtTdbGetCurrToolParam(MCH_TP.NAME, m_PreviousCurrentTool)
|
||||
Dim bChangeTool As Boolean = m_PreviousCurrentTool <> Me.Name
|
||||
If bChangeTool Then EgtTdbSetCurrTool(Me.Name)
|
||||
Dim bActive As Boolean = False
|
||||
EgtTdbGetCurrToolParam(MCH_TP.ACTIVE, bActive)
|
||||
' ripristino utensile corrente
|
||||
If bChangeTool Then EgtTdbSetCurrTool(m_PreviousCurrentTool)
|
||||
Return bActive
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' salvo utensile corrente precedente
|
||||
Dim t = EgtTdbGetCurrToolParam(MCH_TP.NAME, m_PreviousCurrentTool)
|
||||
' verifico se l'utensile selezionato è modificato
|
||||
Dim SelTool As ToolTreeViewItem = m_delGetSelectedTool()
|
||||
If Not IsNothing(SelTool) AndAlso SelTool.IsModified Then
|
||||
' chiedo di salvare
|
||||
If MessageBox.Show(String.Format(EgtMsg(6144), Me.Name), EgtMsg(6143), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' se attivato, verifico che non sia in conflitto con altri utensili
|
||||
If value Then
|
||||
' verifico se c'è un utensile con la stessa posizione
|
||||
If Not VerifyAllPositions() Then
|
||||
MessageBox.Show(EgtMsg(6145), EgtMsg(6126), MessageBoxButton.OK, MessageBoxImage.Exclamation)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
' lo scrivo nel Db
|
||||
EgtTdbSetCurrTool(Me.Name)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.ACTIVE, value)
|
||||
Dim y = EgtTdbSaveCurrTool()
|
||||
NotifyPropertyChanged("Active")
|
||||
' ripristino utensile corrente
|
||||
Dim X = EgtTdbSetCurrTool(m_PreviousCurrentTool)
|
||||
End Set
|
||||
End Property
|
||||
#End Region ' Tool Property
|
||||
|
||||
' Definizione comandi
|
||||
@@ -1194,6 +1250,70 @@ Public Class ToolTreeViewItem
|
||||
EgtTdbSetCurrToolParam(MCH_TP.NAME, NamePar)
|
||||
End Sub
|
||||
|
||||
' funzione che verifica se c'è attivo un utensile sulla stessa posizione
|
||||
Private Function VerifyAllPositions() As Boolean
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' carico posizione, testa e uscita dell'utensile che si attiva
|
||||
EgtTdbSetCurrTool(Me.Name)
|
||||
Dim sCheckedTcPos As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sCheckedTcPos)
|
||||
Dim sCheckedHead As String = String.Empty
|
||||
EgtTdbGetCurrToolParam(MCH_TP.HEAD, sCheckedHead)
|
||||
Dim nCheckedExit As Integer = 0
|
||||
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nCheckedExit)
|
||||
' verifico su tutti gli utensili disponibili
|
||||
Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies()
|
||||
For Each ToolsFamily In ActiveToolsFamilies
|
||||
Dim nType As Integer = 0
|
||||
Dim ToolName As String = String.Empty
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then
|
||||
If ToolName <> Me.Name Then
|
||||
EgtTdbSetCurrTool(ToolName)
|
||||
If Not VerifyPosition(sCheckedTcPos, sCheckedHead, nCheckedExit) Then Return False
|
||||
End If
|
||||
While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType)
|
||||
If ToolName <> Me.Name Then
|
||||
EgtTdbSetCurrTool(ToolName)
|
||||
If Not VerifyPosition(sCheckedTcPos, sCheckedHead, nCheckedExit) Then Return False
|
||||
End If
|
||||
End While
|
||||
End If
|
||||
Next
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function VerifyPosition(sCheckedTcPos As String, sCheckedHead As String, nCheckedExit As Integer) As Boolean
|
||||
' verifico se attivo
|
||||
Dim DbActive As Boolean = False
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
If Not EgtTdbGetCurrToolParam(MCH_TP.ACTIVE, DbActive) Then DbActive = False
|
||||
' se non è attivo non lo considero e restituisco vero
|
||||
If Not DbActive Then Return True
|
||||
' recupero posizione
|
||||
Dim DbTcPos As String = String.Empty
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, DbTcPos)
|
||||
' se la posizione è uguale controllo la testa
|
||||
If sCheckedTcPos = DbTcPos Then
|
||||
Dim DbHead As String = String.Empty
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.HEAD, DbHead)
|
||||
' se la testa è uguale, controllo l'uscita
|
||||
If sCheckedHead = DbHead Then
|
||||
Dim DbExit As Integer = 0
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, DbExit)
|
||||
' se l'uscita è uguale la posizione è già occupata
|
||||
If nCheckedExit = DbExit Then Return False
|
||||
Else
|
||||
' se la testa è diversa vuol dire che la posizione è già occupata
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
|
||||
#End Region ' Methods
|
||||
|
||||
#Region "ToolSceneUpdate"
|
||||
@@ -1228,33 +1348,33 @@ Public Class ToolTreeViewItem
|
||||
|
||||
Private Function CreateToolDraw() As Boolean
|
||||
' Calcolo parametri per disegno
|
||||
Dim sHeadName As String = If( Not IsNothing( SelectedHead), SelectedHead.HName, "")
|
||||
Dim nExit As Integer = 0 : If Not IsNothing( SelectedExit) Then StringToInt( SelectedExit, nExit)
|
||||
Dim sHeadName As String = If(Not IsNothing(SelectedHead), SelectedHead.HName, "")
|
||||
Dim nExit As Integer = 0 : If Not IsNothing(SelectedExit) Then StringToInt(SelectedExit, nExit)
|
||||
Dim nType As Integer = Type
|
||||
Dim dTotLen As Double = 0 : StringToLen(TotLen, dTotLen)
|
||||
Dim dLen As Double = 0 : StringToLen(Len, dLen)
|
||||
Dim dTotDiam As Double = 0 : StringToLen(TotDiam, dTotDiam)
|
||||
Dim dDiam As Double = 0 : StringToLen(Diam, dDiam)
|
||||
Dim dThick As Double = 0 : StringToLen(Thick, dThick)
|
||||
Dim dMaxMat As Double = 0 : StringToLen(MaxMat, dMaxMat)
|
||||
Dim dSideAng As Double = 0 : StringToDouble(SideAng, dSideAng)
|
||||
Dim dCornRad As Double = 0 : StringToLen(CornRad, dCornRad)
|
||||
Dim dTotLen As Double = 0 : StringToLen(TotLen, dTotLen)
|
||||
Dim dLen As Double = 0 : StringToLen(Len, dLen)
|
||||
Dim dTotDiam As Double = 0 : StringToLen(TotDiam, dTotDiam)
|
||||
Dim dDiam As Double = 0 : StringToLen(Diam, dDiam)
|
||||
Dim dThick As Double = 0 : StringToLen(Thick, dThick)
|
||||
Dim dMaxMat As Double = 0 : StringToLen(MaxMat, dMaxMat)
|
||||
Dim dSideAng As Double = 0 : StringToDouble(SideAng, dSideAng)
|
||||
Dim dCornRad As Double = 0 : StringToLen(CornRad, dCornRad)
|
||||
Dim sDraw As String = Draw
|
||||
|
||||
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' Salvo parametri originali dell'utensile corrente
|
||||
Dim sHeadNameOri As string = "" : EgtTdbGetCurrToolParam(MCH_TP.HEAD, sHeadNameOri)
|
||||
Dim nExitOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nExitOri)
|
||||
Dim nTypeOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.TYPE, nTypeOri)
|
||||
Dim dTotLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, dTotLenOri)
|
||||
Dim dLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.LEN, dLenOri)
|
||||
Dim dTotDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, dTotDiamOri)
|
||||
Dim dDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.DIAM, dDiamOri)
|
||||
Dim dThickOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.THICK, dThickOri)
|
||||
Dim dMaxMatOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, dMaxMatOri)
|
||||
Dim dSideAngOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, dSideAngOri)
|
||||
Dim dCornRadOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, dCornRadOri)
|
||||
Dim sDrawOri As String = "" : EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawOri)
|
||||
Dim sHeadNameOri As String = "" : EgtTdbGetCurrToolParam(MCH_TP.HEAD, sHeadNameOri)
|
||||
Dim nExitOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nExitOri)
|
||||
Dim nTypeOri As Integer = 0 : EgtTdbGetCurrToolParam(MCH_TP.TYPE, nTypeOri)
|
||||
Dim dTotLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, dTotLenOri)
|
||||
Dim dLenOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.LEN, dLenOri)
|
||||
Dim dTotDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, dTotDiamOri)
|
||||
Dim dDiamOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.DIAM, dDiamOri)
|
||||
Dim dThickOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.THICK, dThickOri)
|
||||
Dim dMaxMatOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, dMaxMatOri)
|
||||
Dim dSideAngOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, dSideAngOri)
|
||||
Dim dCornRadOri As Double = 0 : EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, dCornRadOri)
|
||||
Dim sDrawOri As String = "" : EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawOri)
|
||||
' Imposto parametri correnti all'utensile corrente
|
||||
EgtTdbSetCurrToolParam(MCH_TP.HEAD, sHeadName)
|
||||
EgtTdbSetCurrToolParam(MCH_TP.EXIT_, nExit)
|
||||
@@ -1270,7 +1390,7 @@ Public Class ToolTreeViewItem
|
||||
EgtTdbSetCurrToolParam(MCH_TP.DRAW, sDraw)
|
||||
|
||||
' Creo il disegno
|
||||
m_nDrawingError = EgtTdbCurrToolDraw( IniFile.m_ProjectSceneContext, IniFile.m_ToolsDbSceneContext)
|
||||
m_nDrawingError = EgtTdbCurrToolDraw(IniFile.m_ProjectSceneContext, IniFile.m_ToolsDbSceneContext)
|
||||
|
||||
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
||||
' Ripristino i valori originali dell'utensile corrente
|
||||
@@ -1716,9 +1836,9 @@ Public Class ToolTreeViewItem
|
||||
m_DrawError = EgtMsg(MSG_TOOLSERRORS + 40) ' Il Massimo Materiale deve essere più grande del Raggio Corner
|
||||
ElseIf m_nDrawingError = 22 Then
|
||||
m_DrawError = EgtMsg(MSG_TOOLSERRORS + 34) ' La Lunghezza Totale deve essere maggiore di Lunghezza + Spessore
|
||||
ElseIf m_nDrawingError = 997 then
|
||||
ElseIf m_nDrawingError = 997 Then
|
||||
m_DrawError = EgtMsg(MSG_TOOLSERRORS + 3) ' Il file non esiste o non è Nge
|
||||
ElseIf m_nDrawingError = 998 then
|
||||
ElseIf m_nDrawingError = 998 Then
|
||||
m_DrawError = EgtMsg(MSG_TOOLSERRORS + 4) ' Non esiste il ToolMaker per questo tipo di utensile
|
||||
ElseIf m_nDrawingError <> 0 Then
|
||||
m_DrawError = EgtMsg(MSG_TOOLSERRORS + 5) ' Impossibile creare l'utensile con questi parametri
|
||||
|
||||
Reference in New Issue
Block a user