OmagCUT :
- modifiche e correzioni per colori associati a lame e loro lavorazioni.
This commit is contained in:
+14
-15
@@ -241,18 +241,20 @@ Public Module SplitAuto
|
||||
Dim bEnabled As Boolean = MachSplit.m_bEnabled
|
||||
Dim nInterf As Integer = If(bReset, FMI_TYPE.NONE, MachSplit.m_nInterf)
|
||||
' Colore della lavorazione principale
|
||||
ColorSingleMachining(MachSplit.m_nId, MachSplit.m_sLay, MachSplit.m_dSideAng, bEnabled, nInterf)
|
||||
ColorSingleMachining(MachSplit.m_nId, MachSplit.m_nType, MachSplit.m_sLay, MachSplit.m_dSideAng, bEnabled, nInterf)
|
||||
' Colore delle lavorazioni inglobate
|
||||
For Each nId As Integer In MachSplit.m_vOthId
|
||||
ColorSingleMachining(nId, MachSplit.m_sLay, MachSplit.m_dSideAng, bEnabled, nInterf)
|
||||
ColorSingleMachining(nId, MachSplit.m_nType, MachSplit.m_sLay, MachSplit.m_dSideAng, bEnabled, nInterf)
|
||||
Next
|
||||
EgtEnableModified()
|
||||
End Sub
|
||||
|
||||
Private Sub ColorSingleMachining(nOperId As Integer, sLay As String, dSideAng As Double, bEnabled As Boolean, nInterf As Integer)
|
||||
Private Sub ColorSingleMachining(nOperId As Integer, nOperType As Integer, sLay As String, dSideAng As Double, bEnabled As Boolean, nInterf As Integer)
|
||||
' Verifico se è un taglio da sopra o da sotto
|
||||
Dim bOnMach As Boolean = (sLay = NAME_ONPATH Or (sLay = NAME_INLOOP AndAlso EgtExistsInfo(nOperId, INFO_FILOTOP)))
|
||||
Dim bDrip As Boolean = (sLay = NAME_DRIPCUT Or sLay = NAME_UNDERDRILL)
|
||||
' Verifico se macchina con cambio utensile per lama
|
||||
Dim bSawTc As Boolean = ( m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW)
|
||||
' Recupero il preview della lavorazione
|
||||
Dim nPvId As Integer = GDB_ID.NULL
|
||||
EgtGetInfo(EgtGetFirstNameInGroup(nOperId, NAME_PREVIEW), INFO_PV_ONPART_ID, nPvId)
|
||||
@@ -287,20 +289,17 @@ Public Module SplitAuto
|
||||
colCut = COL_MCH_ONCUT()
|
||||
ElseIf bDrip Then
|
||||
colCut = COL_MCH_DRIPCUT()
|
||||
ElseIf Math.Abs(dSideAng) > EPS_ANG_SMALL Then
|
||||
ElseIf nOperType = MCH_OY.SAWING AndAlso bSawTc Then
|
||||
Dim sSawing As String = String.Empty, sSaw As String = String.Empty
|
||||
m_MainWindow.m_CadCutPageUC.m_SplitPage.GetMachiningAndTool(nOperId, sSawing, sSaw)
|
||||
' Setto l'utensile corrente
|
||||
EgtTdbSetCurrTool(sSaw)
|
||||
' recupero il colore della lavorazione direttamente dall'utensile
|
||||
colCut = Utility.GetColorPV()
|
||||
ElseIf nOperType = MCH_OY.SAWING AndAlso Math.Abs(dSideAng) > EPS_ANG_SMALL Then
|
||||
colCut = COL_MCH_CUT_ANG()
|
||||
Else
|
||||
' Se macchina con cambio utensile di lama
|
||||
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
||||
Dim sSawing As String = String.Empty, sSaw As String = String.Empty
|
||||
m_MainWindow.m_CadCutPageUC.m_SplitPage.GetCurrSawingAndSaw(nOperId, sSawing, sSaw)
|
||||
' Setto l'utensile corrente
|
||||
EgtTdbSetCurrTool(sSaw)
|
||||
' recupero il colore della lavorazione direttamente dall'utensile
|
||||
colCut = Utility.GetColorPV()
|
||||
Else
|
||||
colCut = COL_MCH_CUT()
|
||||
End If
|
||||
colCut = COL_MCH_CUT()
|
||||
End If
|
||||
|
||||
For Each nId In vCutId
|
||||
|
||||
+18
-22
@@ -237,18 +237,18 @@ Public Class SplitPageUC
|
||||
Dim sTCPos As String = String.Empty
|
||||
' Visualizzo la posizione utensile solo se configurata
|
||||
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then
|
||||
Dim sSawing As String = String.Empty, sSaw As String = String.Empty
|
||||
GetCurrSawingAndSaw(Mach.m_nId, sSawing, sSaw)
|
||||
Dim sMachining As String = String.Empty, sTool As String = String.Empty
|
||||
GetMachiningAndTool(Mach.m_nId, sMachining, sTool)
|
||||
' Verifico che sia montata su un portautensile
|
||||
EgtTdbSetCurrTool(sSaw)
|
||||
EgtTdbSetCurrTool(sTool)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sTCPos)
|
||||
End If
|
||||
' Se TCPos non trovato
|
||||
If String.IsNullOrEmpty(sTCPos) Then
|
||||
' Inserisco solo nome lavorazione
|
||||
m_ItemList.Add(New NameIdLsBxItem(sText, i - 1, Mach.m_bEnabled, nMach))
|
||||
' altrimenti esiste utensile
|
||||
Else
|
||||
' altrimenti se esiste una lama impostata nell'if sopra
|
||||
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)))
|
||||
@@ -706,26 +706,22 @@ Public Class SplitPageUC
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub GetCurrSawingAndSaw(ByVal nMchId As Integer, ByRef sSawing As String, ByRef sNameTool As String)
|
||||
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
|
||||
EgtSetCurrMachining(nMchId)
|
||||
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 sDefMach As String = DEF_MACHINING
|
||||
If Math.Abs(dSideAng) > EPS_ANG_SMALL Then
|
||||
sDefMach = DEF_MACHINING_TILTED
|
||||
End If
|
||||
' Eventualmente recupero il nome della lavorazione
|
||||
EgtGetInfo(EntId, sDefMach, sSawing)
|
||||
If String.IsNullOrEmpty(sSawing) Then sSawing = m_MainWindow.m_CurrentMachine.sCurrSawing
|
||||
' Imposto la lavorazione corrente
|
||||
EgtMdbSetCurrMachining(sSawing)
|
||||
' Recupero il nome dell'utensile della lavorazione
|
||||
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, sNameTool)
|
||||
End Sub
|
||||
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)
|
||||
|
||||
@@ -24,6 +24,7 @@ Public Class ToolsDbPageUC
|
||||
Private m_nToolType As Integer = MCH_TY.NONE
|
||||
Private m_sToolName As String = String.Empty
|
||||
Private m_sEndLife As String = String.Empty
|
||||
Private m_bShowColor As Boolean = False
|
||||
|
||||
' Array che contengono i tipi di Coolant
|
||||
Dim ToolCoolant() As String
|
||||
@@ -573,6 +574,12 @@ Public Class ToolsDbPageUC
|
||||
Dim ChooseColor As New ChooseColor(m_MainWindow)
|
||||
If ChooseColor.ShowDialog() Then
|
||||
ColorBtn.Background = m_MainWindow.m_brCurrentColor
|
||||
Dim nOldCtx As String = EgtGetCurrentContext()
|
||||
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
|
||||
EgtTdbSetCurrToolValInNotes(MCH_TP.SYSNOTES, "COLOR", ColorToString(ColorBtn.Background.ToString()))
|
||||
EgtSetCurrentContext(nOldCtx)
|
||||
CreateToolDraw()
|
||||
EgtZoom(ZM.ALL)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -772,16 +779,21 @@ Public Class ToolsDbPageUC
|
||||
EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, ToolString)
|
||||
UserNotesTxBx.Text = ToolString
|
||||
End If
|
||||
' Inizializzo colore di default
|
||||
Dim EgtCol As Color3d = Utility.GetColorPV()
|
||||
ColorBtn.Background = New SolidColorBrush(Color.FromRgb(EgtCol.R, EgtCol.G, EgtCol.B))
|
||||
' Determino se richiesta gestione colore
|
||||
m_bShowColor = (m_nToolType = MCH_TY.SAW_STD And m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW)
|
||||
' Se necessario, inizializzo colore di default
|
||||
If m_bShowColor Then
|
||||
Dim EgtCol As Color3d = Utility.GetColorPV()
|
||||
ColorBtn.Background = New SolidColorBrush(Color.FromRgb(EgtCol.R, EgtCol.G, EgtCol.B))
|
||||
End If
|
||||
' Eventualmente verifico se inserito nel setup
|
||||
VerifyToolInSetUp(m_sToolName, TCPosTxBx.Text)
|
||||
End Sub
|
||||
|
||||
Private Sub VerifyToolInSetUp(sNameTool As String, sTCPos As String)
|
||||
' Se configurato cambio utensile lama
|
||||
' Se non c'è cambio utensile per lama, esco subito
|
||||
If m_MainWindow.m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW Then Return
|
||||
' Cerco la posizione di attrezzaggio della lama
|
||||
Dim bFound As Boolean = False
|
||||
Dim sCurrTCPos As String = String.Empty
|
||||
For Each ToolPosition As ToolChangerPos In m_MainWindow.m_CurrentMachine.ToolChanger
|
||||
@@ -793,7 +805,7 @@ Public Class ToolsDbPageUC
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
' Se non trovata
|
||||
If Not bFound Then
|
||||
TCPosTxBl.Foreground = Brushes.Red
|
||||
If String.IsNullOrEmpty(sTCPos) Then
|
||||
@@ -871,7 +883,11 @@ Public Class ToolsDbPageUC
|
||||
If Not SetSpecials() Then
|
||||
EgtTdbSetCurrToolParam(MCH_TP.USERNOTES, UserNotesTxBx.Text)
|
||||
End If
|
||||
EgtTdbSetCurrToolValInNotes(MCH_TP.SYSNOTES, "COLOR", ColorToString(ColorBtn.Background.ToString()))
|
||||
If m_bShowColor Then
|
||||
EgtTdbSetCurrToolValInNotes(MCH_TP.SYSNOTES, "COLOR", ColorToString(ColorBtn.Background.ToString()))
|
||||
Else
|
||||
EgtTdbRemoveCurrToolValInNotes(MCH_TP.SYSNOTES, "COLOR")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ColorToString(color As String) As String
|
||||
@@ -945,9 +961,8 @@ Public Class ToolsDbPageUC
|
||||
SupplierTxBx.Visibility = If(bShowSpecials, Windows.Visibility.Visible, Windows.Visibility.Hidden)
|
||||
EndLifeTxBl.Visibility = If(bShowSpecials, Windows.Visibility.Visible, Windows.Visibility.Hidden)
|
||||
EndLifeChBx.Visibility = If(bShowSpecials, Windows.Visibility.Visible, Windows.Visibility.Hidden)
|
||||
|
||||
ColorTxBl.Visibility = If(m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW, Visibility.Visible, Visibility.Hidden)
|
||||
ColorBtn.Visibility = If(m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.TOOLCHANGERWITHSAW, Visibility.Visible, Visibility.Hidden)
|
||||
ColorTxBl.Visibility = If(m_bShowColor, Visibility.Visible, Visibility.Hidden)
|
||||
ColorBtn.Visibility = If(m_bShowColor, Visibility.Visible, Visibility.Hidden)
|
||||
End Sub
|
||||
|
||||
Private Sub HideToolParams()
|
||||
@@ -975,7 +990,6 @@ Public Class ToolsDbPageUC
|
||||
SupplierTxBx.Visibility = Windows.Visibility.Hidden
|
||||
EndLifeTxBl.Visibility = Windows.Visibility.Hidden
|
||||
EndLifeChBx.Visibility = Windows.Visibility.Hidden
|
||||
|
||||
ColorTxBl.Visibility = Visibility.Hidden
|
||||
ColorBtn.Visibility = Visibility.Hidden
|
||||
End Sub
|
||||
@@ -1013,8 +1027,6 @@ Public Class ToolsDbPageUC
|
||||
' Aggiorno visualizzazione
|
||||
EgtSetCurrentContext(ToolScene.GetCtx())
|
||||
EgtSetView(VT.TOP, False)
|
||||
'EgtSetGenericView(150, -150)
|
||||
'EgtSetView(VT.ISO_SE, False)
|
||||
EgtZoom(ZM.ALL)
|
||||
End Sub
|
||||
|
||||
|
||||
+10
-13
@@ -322,24 +322,21 @@ Module Utility
|
||||
Return True
|
||||
End Function
|
||||
|
||||
' Restituisce il colore dell'utensile correntemente settato, se non trova l'utesile o il colore ritorna il default (0,255,0)
|
||||
' Restituisce il colore dell'utensile correntemente settato, se non trova l'utensile o il colore ritorna il default (0,255,0)
|
||||
Friend Function GetColorPV() As Color3d
|
||||
Dim ToolString As String = String.Empty
|
||||
' Recupero il campo COLOR dalle note di sistema
|
||||
Dim ToolColor As String = String.Empty
|
||||
'EgtTdbGetCurrToolParam(MCH_MP.SYSNOTES, ToolString)
|
||||
EgtTdbGetCurrToolParam(MCH_TP.SYSNOTES, ToolString)
|
||||
EgtTdbGetCurrToolValInNotes(MCH_TP.SYSNOTES, "COLOR", ToolColor)
|
||||
' Recupero i tre valori interi RGB
|
||||
Dim sItems As String() = ToolColor.Split(","c)
|
||||
' Verifico che siano almeno 3 campi
|
||||
If sItems.Count < 3 Then
|
||||
Return New Color3d(0, 255, 0, 100)
|
||||
Dim nRed, nGreen, nBlue As Integer
|
||||
If sItems.Count>= 3 AndAlso
|
||||
Integer.TryParse( sItems(0), nRed) AndAlso
|
||||
Integer.TryParse( sItems(1), nGreen) AndAlso
|
||||
Integer.TryParse( sItems(2), nBlue) Then
|
||||
Return New Color3d(nRed, nGreen, nBlue, 100)
|
||||
Else
|
||||
' Verifico che tutti i campi siano numerici
|
||||
If IsNumeric(sItems(0)) And IsNumeric(sItems(1)) And IsNumeric(sItems(2)) Then
|
||||
Return New Color3d(CInt(sItems(0)), CInt(sItems(1)), CInt(sItems(2)), 100)
|
||||
Else
|
||||
Return New Color3d(0, 255, 0, 100)
|
||||
End If
|
||||
Return New Color3d(0, 255, 0, 100)
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user