EgtCAM5 :

- Migliorie SetUp.
- Migliorie simulazione.
This commit is contained in:
Emmanuele Sassi
2017-01-27 18:33:56 +00:00
parent 7747916f24
commit dffe9de64e
15 changed files with 493 additions and 327 deletions
+136 -27
View File
@@ -211,6 +211,30 @@ Namespace EgtCAM5
Private Sub LoadMachinePositions()
' recupero il gruppo del setup
Dim nSetUpGroup As Integer = EgtGetCurrSetup()
' '' leggo l'attrezzaggio del progetto
''Dim sPosition As String = String.Empty
''Dim IniIndex As Integer = 1
' '' recupero stringa di ogni posizione
''While EgtGetInfo(nSetUpGroup, K_POS & IniIndex, sPosition)
'' ReadPositionString(IniIndex, sPosition)
'' IniIndex += 1
''End While
' '' altrimenti
''Dim bFound As Boolean = False
''For GroupIndex = 0 To m_PositionGroupList.Count - 1
'' If m_PositionGroupList(GroupIndex).PositionList.Count > 0 Then
'' bFound = True
'' Exit For
'' End If
''Next
''If Not bFound Then
' ne genero uno nuovo dalla configurazione nel file ini della macchina
Dim Index As Integer = 1
While CreateStdPosFromPosIndex(Index)
Index += 1
End While
''End If
' leggo l'attrezzaggio del progetto
Dim sPosition As String = String.Empty
Dim IniIndex As Integer = 1
@@ -219,21 +243,6 @@ Namespace EgtCAM5
ReadPositionString(IniIndex, sPosition)
IniIndex += 1
End While
' altrimenti
Dim bFound As Boolean = False
For GroupIndex = 0 To m_PositionGroupList.Count - 1
If m_PositionGroupList(GroupIndex).PositionList.Count > 0 Then
bFound = True
Exit For
End If
Next
If Not bFound Then
' ne genero uno nuovo dalla configurazione nel file ini della macchina
Dim Index As Integer = 1
While CreateStdPosFromPosIndex(Index)
Index += 1
End While
End If
End Sub
@@ -305,7 +314,7 @@ Namespace EgtCAM5
' se ci sono almeno due elementi sono sicuro che ci sia la H
If sItems.Count >= 2 Then
sHead = sItems(1)
m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
''m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata
If sItems.Count >= 3 Then
' separo le uscite divise dalla ,
@@ -341,14 +350,20 @@ Namespace EgtCAM5
' se lo trovo
If bFound Then
' cerco la relativa uscita
For ExitIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList.Count - 1
Dim CurrExitToolAss As ExitToolAssociation = m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList(ExitIndex)
If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then
' vi metto l'utensile e segno l'uscita come occupata
CurrExitToolAss.Tool = TempTool
CurrExitToolAss.IsOccupied = True
' lo metto anche come utensile originale
CurrExitToolAss.OrigTool = TempTool
For PositionIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList.Count - 1
Dim TempPosition As Position = m_PositionGroupList(nGroup - 1).PositionList(PositionIndex)
If TempPosition.TcPos = sTcPos Then
For ExitIndex = 0 To TempPosition.ExitToolAssociationList.Count - 1
Dim CurrExitToolAss As ExitToolAssociation = TempPosition.ExitToolAssociationList(ExitIndex)
If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then
' vi metto l'utensile e segno l'uscita come occupata
CurrExitToolAss.Tool = TempTool
CurrExitToolAss.IsOccupied = True
' lo metto anche come utensile originale
CurrExitToolAss.OrigTool = TempTool
Exit For
End If
Next
Exit For
End If
Next
@@ -363,12 +378,100 @@ Namespace EgtCAM5
End If
' non è presente la H, quindi la recupero dal modello delle posizioni nel file MachIni
Else
CreateStdPosFromPosIndex(nIndex)
''CreateStdPosFromPosIndex(nIndex)
End If
End If
End Sub
'' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto
'Private Sub ReadPositionString(nIndex As Integer, sPosition As String)
' Dim sTcPos As String = String.Empty
' Dim sHead As String = String.Empty
' Dim sExitList As New List(Of String)
' Dim sToolList As New List(Of String)
' ' la spezzo sui ;
' Dim sItems() As String = sPosition.Split(";".ToCharArray)
' ' se c'è almeno un elemento sono sicuro che ci sia la T
' If sItems.Count() >= 1 Then
' Dim nGroup As Integer = 0
' sTcPos = sItems(0)
' ' recupero il suo gruppo
' If Not GetGroupFromTcPos(sTcPos, nGroup) Then
' ' se non lo trovo lo metto nel primo
' nGroup = 1
' End If
' If Not VerifyIndexValidity(nGroup) Then
' ' se mi viene passato un indice non valido, lo metto nel primo
' nGroup = 1
' End If
' ' se ci sono almeno due elementi sono sicuro che ci sia la H
' If sItems.Count >= 2 Then
' sHead = sItems(1)
' m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
' ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata
' If sItems.Count >= 3 Then
' ' separo le uscite divise dalla ,
' Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray)
' sExitList.Clear()
' sToolList.Clear()
' ' creo le liste di uscite e utensili attrezzati ricavati
' For AssIndex = 0 To sExitToolAssList.Count() - 1
' Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray)
' If sExitToolAssItem.Count > 1 Then
' sExitList.Add(sExitToolAssItem(0))
' sToolList.Add(sExitToolAssItem(1))
' End If
' Next
' ' analizzo la lista di utensili attrezzati
' For ToolIndex = 0 To sToolList.Count - 1
' If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then
' Dim TempTool As ToolItem = Nothing
' Dim bFound As Boolean = False
' ' cerco l'utensile attrezzato nella lista utensili
' For FamilyListIndex = 0 To m_ToolsList.Count - 1
' For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1
' TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem)
' If TempTool.Uuid = sToolList(ToolIndex) Then
' ' lo salvo in una variabile temporanea e lo tolgo dalla lista
' m_ToolsList(FamilyListIndex).Items.Remove(m_ToolsList(FamilyListIndex).Items(ToolListIndex))
' bFound = True
' Exit For
' End If
' Next
' If bFound Then Exit For
' Next
' ' se lo trovo
' If bFound Then
' ' cerco la relativa uscita
' For ExitIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList.Count - 1
' Dim CurrExitToolAss As ExitToolAssociation = m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList(ExitIndex)
' If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then
' ' vi metto l'utensile e segno l'uscita come occupata
' CurrExitToolAss.Tool = TempTool
' CurrExitToolAss.IsOccupied = True
' ' lo metto anche come utensile originale
' CurrExitToolAss.OrigTool = TempTool
' Exit For
' End If
' Next
' ' altrimenti, se non l'ho trovato
' Else
' Dim sSearchedTool As String = String.Empty
' EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool)
' MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error)
' End If
' End If
' Next
' End If
' ' non è presente la H, quindi la recupero dal modello delle posizioni nel file MachIni
' Else
' CreateStdPosFromPosIndex(nIndex)
' End If
' End If
'End Sub
' Funzione che data una T restituisce il gruppo a cui appartiene
Private Function GetGroupFromTcPos(sTcPos As String, ByRef nGroup As Integer) As Boolean
Dim sGroup As String = String.Empty
@@ -571,6 +674,11 @@ Namespace EgtCAM5
' resetto lista utensili e posizioni
m_ToolsList.Clear()
m_PositionGroupList.Clear()
' genero una nuova lista delle posizioni dalla configurazione nel file ini della macchina
Dim Index As Integer = 1
While CreateStdPosFromPosIndex(Index)
Index += 1
End While
'ricarico lista utensili
LoadMachineTools()
' leggo l'attrezzaggio dal file scelto
@@ -665,7 +773,8 @@ Namespace EgtCAM5
End If
Next
Next
' aggiorno lo stato del bottone applica
IsEnabledBtns()
End Sub
#End Region ' AutomaticCommand
@@ -712,7 +821,7 @@ Namespace EgtCAM5
Next
End Sub
#End Region ' CloseSetUpCommand
#End Region ' CloseSetUpCommand
#Region "ToolDoubleClickCommand"