diff --git a/CamAuto.vb b/CamAuto.vb index bc1ab4d..62bb531 100644 --- a/CamAuto.vb +++ b/CamAuto.vb @@ -72,7 +72,7 @@ Friend Module CamAuto Dim nOpeId As Integer = EgtGetLastOperation() While nOpeId <> GDB_ID.NULL Dim nPrevOpeId As Integer = EgtGetPrevOperation(nOpeId) - If EgtGetOperationType(nOpeId) = MCH_OY.DISP And EgtIsOperationEmpty(nOpeId) Then + If EgtGetOperationType(nOpeId) = MCH_OY.DISP AndAlso EgtIsOperationEmpty(nOpeId) Then EgtRemoveLastPhase() Else Exit While @@ -82,6 +82,21 @@ Friend Module CamAuto Return True End Function + Friend Function RemoveLastPhase() As Boolean + ' Non posso eliminare la prima fase + Dim nLastPhase As Integer = EgtGetPhaseCount() + If nLastPhase = 1 Then Return False + ' Sposto le lavorazioni in coda a quelle della fase precedente + Dim nDispId As Integer = EgtGetPhaseDisposition(nLastPhase) + Dim nMachId As Integer = EgtGetNextOperation(nDispId) + While nMachId <> GDB_ID.NULL + EgtChangeOperationPhase(nMachId, nLastPhase - 1) + nMachId = EgtGetNextOperation(nDispId) + End While + ' Rimuovo l'ultima fase + Return EgtRemoveLastPhase() + End Function + Friend Function UpdateAllMachiningsToolpaths() As Boolean EgtLuaCreateGlobTable("CAM") SetLuaStandardCamParams() diff --git a/ConstGen.vb b/ConstGen.vb index 47f67b8..226720d 100644 --- a/ConstGen.vb +++ b/ConstGen.vb @@ -76,6 +76,8 @@ Module ConstGen Public Const KEY_VAC_TYPE As String = "VacType" ' Nome gruppo layout in testa con ventose Public Const VACUUM_HEAD_LAYOUT As String = "LAYOUT" + ' Info in asse rotante ventosa per step discreti + Public Const KEY_ROTVAC_STEPS As String = "STEPS" ' Nome oggetto frame prima uscita di una testa Public Const HEAD_FIRST_EXIT As String = "_T1" diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 6467760..d0cd139 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -62,5 +62,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/SplitAuto.vb b/SplitAuto.vb index 03624ea..c8a3db6 100644 --- a/SplitAuto.vb +++ b/SplitAuto.vb @@ -440,22 +440,6 @@ Public Module SplitAuto Return False End Function - '----------------------------------------------------------------------------------------------- - Friend Function RemoveLastPhase() As Boolean - ' Non posso eliminare la prima fase - Dim nLastPhase As Integer = EgtGetPhaseCount() - If nLastPhase = 1 Then Return False - ' Sposto le lavorazioni in coda a quelle della fase precedente - Dim nDispId As Integer = EgtGetPhaseDisposition(nLastPhase) - Dim nMachId As Integer = EgtGetNextOperation(nDispId) - While nMachId <> GDB_ID.NULL - EgtChangeOperationPhase(nMachId, nLastPhase - 1) - nMachId = EgtGetNextOperation(nDispId) - End While - ' Rimuovo l'ultima fase - Return EgtRemoveLastPhase() - End Function - '----------------------------------------------------------------------------------------------- '----------------------------------------------------------------------------------------------- Private Function FindInterferences(ByRef MachSplitList As List(Of SplitMach)) As Boolean diff --git a/VacuumCups.vb b/VacuumCups.vb index 5474c5d..4fe6609 100644 --- a/VacuumCups.vb +++ b/VacuumCups.vb @@ -304,6 +304,23 @@ Module VacuumCups Return True End Function + Private Function GetVacRotAxisSteps(ByRef vAngRot As List(Of Double)) As Boolean + ' Recupero l'asse rotante della testa ventosa + Dim nRotAxId As Integer = EgtGetParent(EgtGetHeadId(VACUUM_HEAD)) + ' Verifico se contiene info con STEPS + Dim sSteps As String = "" + If Not EgtGetInfo(nRotAxId, KEY_ROTVAC_STEPS, sSteps) Then Return False + ' Leggo gli step previsti + Dim vStep() As String = sSteps.Split(",".ToCharArray) + For Each sStep As String In vStep + Dim dStep As Double = 0 + If StringToDouble(sStep, dStep) Then + vAngRot.Add(dStep) + End If + Next + Return True + End Function + Private Function TestVacuumCupSelection(sCups() As String, b3Raw As BBox3d, ptRawCen As Point3d, nOutlineId As Integer, nRawRegId As Integer, ByRef vtMove As Vector3d, ByRef ptRotCen As Point3d, ByRef dRotAngDeg As Double) As Double ' Se definizione mancante, scarto soluzione @@ -347,10 +364,20 @@ Module VacuumCups For nJ As Integer = 0 To sCups.Length() - 1 nCups(nJ) = EgtGetFirstNameInGroup(m_nVacId, sCups(nJ)) Next + ' Angoli di prova + Dim vAngRot As New List(Of Double) + ' Se asse rotante ventosa a step + If GetVacRotAxisSteps(vAngRot) Then + ' Annullo la rotazione di allineamento + dRotAngDeg = 0 + ' altrimenti in continuo + Else + ' Assegno più valori di ricerca e conservo angolo di allineamento + vAngRot.AddRange({0, +5, -5, +12.5, -12.5, +25, -25, +45, -45}) + End If ' Eseguo verifica delle ventose rispetto al grezzo Dim bVacOk As Boolean = False - Dim vAngRot() As Double = {0, +5, -5, +12.5, -12.5, +25, -25, +45, -45} - For i As Integer = 0 To vAngRot.Length() - 1 + For i As Integer = 0 To vAngRot.Count() - 1 If TestVacuumCups(nCups, nRawRegId, vtMove, ptRotCen, dRotAngDeg + vAngRot(i)) Then dRotAngDeg += vAngRot(i) bVacOk = True