EgtCAM5 1.6x7 :
- migliorie all'attrezzaggio.
This commit is contained in:
@@ -200,10 +200,6 @@ Namespace EgtCAM5
|
||||
Next
|
||||
If Not bFound Then
|
||||
' ne genero uno nuovo dalla configurazione nel file ini della macchina
|
||||
Dim sTcPos As String = String.Empty
|
||||
Dim sHead As String = String.Empty
|
||||
Dim sGroup As String = String.Empty
|
||||
Dim nErr As Double = 0
|
||||
Dim Index As Integer = 1
|
||||
While CreateStdPosFromPosIndex(Index)
|
||||
Index += 1
|
||||
@@ -217,21 +213,20 @@ Namespace EgtCAM5
|
||||
Dim sTcPos As String = String.Empty
|
||||
Dim sHead As String = String.Empty
|
||||
Dim sGroup As String = String.Empty
|
||||
Dim nErr As Double = 0
|
||||
EgtLuaSetGlobNumVar("STU.INDEX", Index)
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaSetGlobIntVar("STU.INDEX", Index)
|
||||
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
|
||||
' Leggo variabili
|
||||
EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos)
|
||||
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
|
||||
EgtLuaGetGlobStringVar("STU.GROUP", sGroup)
|
||||
EgtLuaGetGlobNumVar("STU.ERR", nErr)
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
' se l'indice del gruppo è valido
|
||||
Dim nGroup As Integer = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0)
|
||||
If VerifyIndexValidity(CInt(nGroup)) Then
|
||||
m_PositionGroupList(CInt(nGroup) - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
|
||||
If VerifyIndexValidity(nGroup) Then
|
||||
m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead)))
|
||||
End If
|
||||
If nErr = 0 Then Return True
|
||||
Return False
|
||||
Return (nErr = 0)
|
||||
End Function
|
||||
|
||||
' Funzione che verifica che l'indice del gruppo sia valido, esista, e nel caso non esistesse aggiunge i gruppi necessari
|
||||
@@ -304,9 +299,9 @@ Namespace EgtCAM5
|
||||
' 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
|
||||
If m_ToolsList(FamilyListIndex).Items(ToolListIndex).Name = sToolList(ToolIndex) Then
|
||||
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
|
||||
TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem)
|
||||
m_ToolsList(FamilyListIndex).Items.Remove(m_ToolsList(FamilyListIndex).Items(ToolListIndex))
|
||||
bFound = True
|
||||
Exit For
|
||||
@@ -337,12 +332,12 @@ Namespace EgtCAM5
|
||||
' 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
|
||||
Dim nErr As Double = 0
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos)
|
||||
EgtLuaCallFunction("STU.GetGroupFromTcPos")
|
||||
' Leggo variabili
|
||||
EgtLuaGetGlobStringVar("STU.GROUP", sGroup)
|
||||
EgtLuaGetGlobNumVar("STU.ERR", nErr)
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
If nErr = 0 Then
|
||||
nGroup = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0)
|
||||
Return True
|
||||
@@ -353,15 +348,15 @@ Namespace EgtCAM5
|
||||
|
||||
Private Function GetPositionFromTcPos(sTcPos As String, ByRef nPosIndex As Integer) As Boolean
|
||||
Dim sPosition As String = String.Empty
|
||||
Dim nErr As Double = 0
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos)
|
||||
EgtLuaCallFunction("STU.GetPosFromTcPos")
|
||||
' Leggo variabili
|
||||
EgtLuaGetGlobStringVar("STU.POS", sPosition)
|
||||
EgtLuaGetGlobNumVar("STU.ERR", nErr)
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
If nErr = 0 Then
|
||||
nPosIndex = If(Integer.TryParse(sPosition.Replace("Pos", ""), nPosIndex), nPosIndex, -1)
|
||||
Return If(nPosIndex >= 0, True, False)
|
||||
Return (nPosIndex >= 0)
|
||||
End If
|
||||
nPosIndex = -1
|
||||
Return False
|
||||
@@ -391,20 +386,22 @@ Namespace EgtCAM5
|
||||
Dim nSetUpGroup As Integer = EgtGetCurrSetup()
|
||||
For GroupIndex = 0 To m_PositionGroupList.Count - 1
|
||||
For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1
|
||||
Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex)
|
||||
Dim sPosition As String = String.Empty
|
||||
sPosition = m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos
|
||||
sPosition = CurrPosition.TcPos
|
||||
Dim sExitToolAssociation As String = String.Empty
|
||||
For AssIndex = 0 To m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1
|
||||
sExitToolAssociation &= If(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).IsOccupied, _
|
||||
m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).ExitPar & "/" & _
|
||||
m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
|
||||
For AssIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1
|
||||
sExitToolAssociation &= If(CurrPosition.ExitToolAssociationList(AssIndex).IsOccupied,
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).ExitPar & "/" &
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).Tool.Uuid & "/" &
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
|
||||
Next
|
||||
sExitToolAssociation = sExitToolAssociation.Trim(","c)
|
||||
If Not String.IsNullOrEmpty(sExitToolAssociation) Then
|
||||
sPosition &= ";" & m_PositionGroupList(GroupIndex).PositionList(PositionIndex).Head & ";" & sExitToolAssociation
|
||||
sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation
|
||||
End If
|
||||
Dim nPosition As Integer
|
||||
If GetPositionFromTcPos(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos, nPosition) Then
|
||||
If GetPositionFromTcPos(CurrPosition.TcPos, nPosition) Then
|
||||
EgtSetInfo(nSetUpGroup, K_POS & nPosition, sPosition)
|
||||
End If
|
||||
Next
|
||||
@@ -450,17 +447,19 @@ Namespace EgtCAM5
|
||||
|
||||
For GroupIndex = 0 To m_PositionGroupList.Count - 1
|
||||
For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1
|
||||
Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex)
|
||||
Dim sPosition As String = String.Empty
|
||||
sPosition = m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos
|
||||
sPosition = CurrPosition.TcPos
|
||||
Dim sExitToolAssociation As String = String.Empty
|
||||
For AssIndex = 0 To m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1
|
||||
sExitToolAssociation &= If(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).IsOccupied, _
|
||||
m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).ExitPar & "/" & _
|
||||
m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
|
||||
For AssIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1
|
||||
sExitToolAssociation &= If(CurrPosition.ExitToolAssociationList(AssIndex).IsOccupied,
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).ExitPar & "/" &
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).Tool.Uuid & "/" &
|
||||
CurrPosition.ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty)
|
||||
Next
|
||||
sExitToolAssociation = sExitToolAssociation.Trim(","c)
|
||||
If Not String.IsNullOrEmpty(sExitToolAssociation) Then
|
||||
sPosition &= ";" & m_PositionGroupList(GroupIndex).PositionList(PositionIndex).Head & ";" & sExitToolAssociation
|
||||
sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation
|
||||
End If
|
||||
Dim nPosition As Integer
|
||||
If GetPositionFromTcPos(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos, nPosition) Then
|
||||
@@ -647,10 +646,10 @@ Public Class Position
|
||||
' Leggo variabili
|
||||
Dim sHead As String = String.Empty
|
||||
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
|
||||
Dim nExit As Double = 0
|
||||
EgtLuaGetGlobNumVar("STU.EXIT", nExit)
|
||||
Dim nErr As Double = 0
|
||||
EgtLuaGetGlobNumVar("STU.ERR", nErr)
|
||||
Dim nExit As Integer = 0
|
||||
EgtLuaGetGlobIntVar("STU.EXIT", nExit)
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
If nErr <> 0 Then
|
||||
' disattivo tutte le uscite tranne quelle attrezzate
|
||||
For ExitIndex = 0 To ExitToolAssociationList.Count - 1
|
||||
@@ -707,7 +706,7 @@ Public Class Position
|
||||
' altrimenti, se le teste coincidono
|
||||
ElseIf sHead = Head Then
|
||||
' se l'uscita restituita è libera la attivo e disattivo tutte le altre non occupate
|
||||
If Not ExitToolAssociationList(CInt(nExit) - 1).IsOccupied Then
|
||||
If Not ExitToolAssociationList(nExit - 1).IsOccupied Then
|
||||
For ExitIndex = 0 To ExitToolAssociationList.Count - 1
|
||||
If ExitIndex = nExit - 1 Then
|
||||
ExitToolAssociationList(ExitIndex).IsEnabledPos = True
|
||||
@@ -723,7 +722,7 @@ Public Class Position
|
||||
For ExitIndex = 0 To ExitToolAssociationList.Count - 1
|
||||
If ExitToolAssociationList(ExitIndex).IsOccupied Then
|
||||
ExitToolAssociationList(ExitIndex).IsEnabledPos = True
|
||||
If ExitIndex = CInt(nExit) - 1 Then
|
||||
If ExitIndex = nExit - 1 Then
|
||||
ExitToolAssociationList(ExitIndex).IsValidPos = True
|
||||
Else
|
||||
ExitToolAssociationList(ExitIndex).IsValidPos = False
|
||||
@@ -905,20 +904,16 @@ Public Class ExitToolAssociation
|
||||
End If
|
||||
Dim SelTool As ToolItem = DirectCast(param, ToolItem)
|
||||
' verifico se devo cambiare la testa
|
||||
|
||||
|
||||
|
||||
|
||||
EgtLuaSetGlobStringVar("STU.TUUID", SelTool.Uuid)
|
||||
EgtLuaSetGlobStringVar("STU.TCPOS", m_MyPos.TcPos)
|
||||
EgtLuaCallFunction("STU.GetValidHeadExitForPos")
|
||||
' Leggo variabili
|
||||
Dim sHead As String = String.Empty
|
||||
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
|
||||
Dim nExit As Double = 0
|
||||
EgtLuaGetGlobNumVar("STU.EXIT", nExit)
|
||||
Dim nErr As Double = 0
|
||||
EgtLuaGetGlobNumVar("STU.ERR", nErr)
|
||||
Dim nExit As Integer = 0
|
||||
EgtLuaGetGlobIntVar("STU.EXIT", nExit)
|
||||
Dim nErr As Integer = 999
|
||||
EgtLuaGetGlobIntVar("STU.ERR", nErr)
|
||||
If nErr <> 0 Then
|
||||
Dim sToolName As String = String.Empty
|
||||
EgtTdbGetToolFromUUID(SelTool.Uuid, sToolName)
|
||||
@@ -926,12 +921,12 @@ Public Class ExitToolAssociation
|
||||
Return
|
||||
End If
|
||||
' se la testa restituita coincide con quella della posizione
|
||||
If Not m_MyPos.Head = sHead Then
|
||||
If m_MyPos.Head <> sHead Then
|
||||
m_MyPos.Head = sHead
|
||||
For ExitIndex = m_MyPos.ExitToolAssociationList.Count To EgtGetHeadExitCount(sHead)
|
||||
For ExitIndex = m_MyPos.ExitToolAssociationList.Count + 1 To EgtGetHeadExitCount(sHead)
|
||||
m_MyPos.ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString, m_MyPos))
|
||||
Next
|
||||
For ExitIndex = EgtGetHeadExitCount(sHead) To m_MyPos.ExitToolAssociationList.Count
|
||||
For ExitIndex = EgtGetHeadExitCount(sHead) + 1 To m_MyPos.ExitToolAssociationList.Count
|
||||
m_MyPos.ExitToolAssociationList.RemoveAt(ExitIndex - 1)
|
||||
Next
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user