|
|
|
@@ -28,6 +28,8 @@ Public Class MoveRawPartPage
|
|
|
|
|
Private m_RawMoveDataList As New List(Of RawMoveData) ' dati di movimento
|
|
|
|
|
Private m_bRawWithCups As Boolean = False ' flag per pezzo corrente con ventose
|
|
|
|
|
|
|
|
|
|
Private m_CurrRawOnVacuum As Integer = GDB_ID.NULL
|
|
|
|
|
|
|
|
|
|
Private Sub MoveRawPartPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
|
|
|
|
' Assegno testi
|
|
|
|
|
RemovePartBtn.Content = EgtMsg(MSG_MOVERAWPAGEUC + 1) 'Rimuovi
|
|
|
|
@@ -230,11 +232,33 @@ Public Class MoveRawPartPage
|
|
|
|
|
If nParentId = nRawGroupId Then
|
|
|
|
|
Dim nStat As Integer = GDB_ST.ON_
|
|
|
|
|
EgtGetStatus(nId, nStat)
|
|
|
|
|
' Se il pezzo corrente è selezionato allora lo disattivo -> deposito del pezzo
|
|
|
|
|
If nStat = GDB_ST.SEL Then
|
|
|
|
|
EgtSetStatus(nId, GDB_ST.ON_)
|
|
|
|
|
' Se con ventose, le nascondo
|
|
|
|
|
If Not m_bByHand Then EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
|
|
|
|
|
' prima di rilasciare il pezzo verifico che non vada in collisione con altri pezzi sulla tavola
|
|
|
|
|
If VerifyCollisionWithOtherRawPart(nId) Then
|
|
|
|
|
' mantengo la selezione del pezzo
|
|
|
|
|
EgtSetStatus(nId, GDB_ST.SEL)
|
|
|
|
|
m_CurrProjPage.SetErrorMessage("Collisione pezzi")
|
|
|
|
|
Else
|
|
|
|
|
' Se con ventose, le nascondo
|
|
|
|
|
If Not m_bByHand Then EgtSetStatus(GetVacuumId(), GDB_ST.OFF)
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
|
|
' verifico che il pezzo precedente possa essere depositato correttamente
|
|
|
|
|
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
|
|
|
|
|
' mantengo la selezione del pezzo
|
|
|
|
|
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
|
|
|
|
|
m_CurrProjPage.SetErrorMessage("Collisione pezzi")
|
|
|
|
|
EgtDraw()
|
|
|
|
|
' esco dal ciclo, prima devo depositare correttamente il pezzo
|
|
|
|
|
Exit While
|
|
|
|
|
End If
|
|
|
|
|
' salvo l'indice del pezzo correntemente attaccato alle ventose
|
|
|
|
|
m_CurrRawOnVacuum = nId
|
|
|
|
|
|
|
|
|
|
' Deseleziono tutto e abilito la selezione del pezzo corrente
|
|
|
|
|
EgtDeselectAll()
|
|
|
|
|
EgtSetStatus(nId, GDB_ST.SEL)
|
|
|
|
|
' Se con ventose, le posiziono sul grezzo
|
|
|
|
@@ -271,7 +295,6 @@ Public Class MoveRawPartPage
|
|
|
|
|
' Messaggio di avvertimento
|
|
|
|
|
m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2)) 'Pezzo troppo piccolo : non si può muovere
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
@@ -280,8 +303,50 @@ Public Class MoveRawPartPage
|
|
|
|
|
End If
|
|
|
|
|
nId = EgtGetNextObjInSelWin()
|
|
|
|
|
End While
|
|
|
|
|
|
|
|
|
|
' clicco su un oggetto che non è un grezzo -> verifico che il pezzo precedente possa essere depositato correttamente
|
|
|
|
|
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
|
|
|
|
|
' mantengo la selezione del pezzo
|
|
|
|
|
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
|
|
|
|
|
m_CurrProjPage.SetErrorMessage("Collisione pezzi")
|
|
|
|
|
EgtDraw()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
' Veririfica che il grezzo non entri in colliosione con altri pezzi
|
|
|
|
|
Private Function VerifyCollisionWithOtherRawPart(nIdOnVacumm As Integer) As Boolean
|
|
|
|
|
If nIdOnVacumm = GDB_ID.NULL Then Return False
|
|
|
|
|
' Creo gruppo temporaneo in cui generare le superfici per la veririfica di collisione
|
|
|
|
|
Dim m_nTempId As Integer = EgtCreateGroup(GDB_ID.ROOT)
|
|
|
|
|
If m_nTempId = GDB_ID.NULL Then Return False
|
|
|
|
|
EgtSetName(m_nTempId, "RawTemp")
|
|
|
|
|
Dim nIdActualRawOutLine As Integer = EgtGetFirstNameInGroup(nIdOnVacumm, "RawOutline")
|
|
|
|
|
Dim ActualRawFlatRegion As Integer = EgtCreateSurfFlatRegion(m_nTempId, nIdActualRawOutLine)
|
|
|
|
|
Dim nCurrPhase As Integer = EgtGetCurrPhase()
|
|
|
|
|
Dim nRawGroupId = EgtGetParent(EgtGetFirstRawPart())
|
|
|
|
|
Dim nIdRaw As Integer = EgtGetFirstRawPart()
|
|
|
|
|
' ciclo su tutti i grezzi per veririficare eventuali collisioni
|
|
|
|
|
While nIdRaw <> GDB_ID.NULL
|
|
|
|
|
' verifico la fase del grezzo
|
|
|
|
|
If EgtVerifyRawPartCurrPhase(nIdRaw) And nIdOnVacumm <> nIdRaw Then
|
|
|
|
|
' recupero il contorno del pezzo
|
|
|
|
|
Dim nIdRawOutLine As Integer = EgtGetFirstNameInGroup(nIdRaw, "RawOutline")
|
|
|
|
|
Dim nIdRawFlatRegion As Integer = EgtCreateSurfFlatRegion(m_nTempId, nIdRawOutLine)
|
|
|
|
|
If EgtSurfFrIntersect(nIdRawFlatRegion, ActualRawFlatRegion) Then
|
|
|
|
|
If EgtExistsObj(nIdRawFlatRegion) Then
|
|
|
|
|
EgtErase(m_nTempId)
|
|
|
|
|
' esiste una intersezione delle superfici
|
|
|
|
|
Return True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
nIdRaw = EgtGetNextRawPart(nIdRaw)
|
|
|
|
|
End While
|
|
|
|
|
EgtErase(m_nTempId)
|
|
|
|
|
Return False
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
#Region "Move Up/Down/Left/Right"
|
|
|
|
|
|
|
|
|
|
Private Sub UpBtn_Click(sender As Object, e As RoutedEventArgs) Handles UpBtn.Click
|
|
|
|
@@ -487,6 +552,8 @@ Public Class MoveRawPartPage
|
|
|
|
|
Return bOk
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
#Region "Rotate CounterClockWise/ClockWise"
|
|
|
|
|
|
|
|
|
|
Private Sub RotateCounterClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateCounterClockwiseBtn.Click
|
|
|
|
|
' Solo movimento con ventose
|
|
|
|
|
If m_bByHand Then Return
|
|
|
|
@@ -555,6 +622,9 @@ Public Class MoveRawPartPage
|
|
|
|
|
EgtDraw()
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
#End Region ' Rotate CounterClockWise/ClockWise
|
|
|
|
|
|
|
|
|
|
' verifica che la rotazione da raggiungere sia nei limiti delle corse
|
|
|
|
|
Private Function VerifyReleasdAngleIsValid(ByRef dAngDeg As Double, ByVal ptCenter As Point3d) As Boolean
|
|
|
|
|
Dim bOk As Boolean = True
|
|
|
|
|
' determino il punto finale dello spostamento
|
|
|
|
@@ -827,6 +897,17 @@ Public Class MoveRawPartPage
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub PrevBtn_Click(sender As Object, e As RoutedEventArgs) Handles PrevBtn.Click
|
|
|
|
|
' verifico che il pezzo sia depositabile
|
|
|
|
|
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
|
|
|
|
|
' mantengo la selezione del pezzo
|
|
|
|
|
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
|
|
|
|
|
m_CurrProjPage.SetErrorMessage("Collisione pezzi")
|
|
|
|
|
EgtDraw()
|
|
|
|
|
' non cambio pagina
|
|
|
|
|
Return
|
|
|
|
|
End If
|
|
|
|
|
' resetto l'inidice del pezzo da mnovimentare
|
|
|
|
|
m_CurrRawOnVacuum = GDB_ID.NULL
|
|
|
|
|
' Deseleziono tutto
|
|
|
|
|
EgtDeselectAll()
|
|
|
|
|
' Torno alla fase precedente
|
|
|
|
@@ -838,6 +919,17 @@ Public Class MoveRawPartPage
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub NextBtn_Click(sender As Object, e As RoutedEventArgs) Handles NextBtn.Click
|
|
|
|
|
' verifico che il pezzo sia depositabile
|
|
|
|
|
If VerifyCollisionWithOtherRawPart(m_CurrRawOnVacuum) Then
|
|
|
|
|
' mantengo la selezione del pezzo
|
|
|
|
|
EgtSetStatus(m_CurrRawOnVacuum, GDB_ST.SEL)
|
|
|
|
|
m_CurrProjPage.SetErrorMessage("Collisione pezzi")
|
|
|
|
|
EgtDraw()
|
|
|
|
|
' non cambio pagina
|
|
|
|
|
Return
|
|
|
|
|
End If
|
|
|
|
|
' resetto l'inidice del pezzo da mnovimentare
|
|
|
|
|
m_CurrRawOnVacuum = GDB_ID.NULL
|
|
|
|
|
' Deseleziono tutto
|
|
|
|
|
EgtDeselectAll()
|
|
|
|
|
' Passo alla pagina delle spezzature
|
|
|
|
|