diff --git a/ConstIni.vb b/ConstIni.vb
index 52c97ad..476bb5a 100644
--- a/ConstIni.vb
+++ b/ConstIni.vb
@@ -126,6 +126,7 @@ Module ConstIni
Public Const S_RAWMOVE As String = "RawMove"
Public Const K_RAWSTEP As String = "Step"
+ Public Const K_RAWROTATION As String = "Rotation"
Public Const K_PERPENDICULAR As String = "Perpendicular"
Public Const S_CAMERA As String = "Camera"
diff --git a/ConstMachIni.vb b/ConstMachIni.vb
index b649aa6..fed5694 100644
--- a/ConstMachIni.vb
+++ b/ConstMachIni.vb
@@ -107,6 +107,9 @@
Public Const K_MACH_NEST_ALIGNED As String = "Aligned"
Public Const K_MACH_WASHING As String = "Washing"
+ Public Const S_MACH_RAWMOVE As String = "RawMove"
+ Public Const K_MACH_RM_ROTATE As String = "Rotate"
+
Public Const S_TOOLCHANGER As String = "ToolChanger"
Public Const K_NUMBER As String = "Number"
Public Const K_POS As String = "Pos"
diff --git a/CurrentMachine.vb b/CurrentMachine.vb
index 7053e52..b87aeb6 100644
--- a/CurrentMachine.vb
+++ b/CurrentMachine.vb
@@ -46,6 +46,9 @@ Public Class CurrentMachine
' Massimo diametro lama per tastatura grezzo
Private m_dMaxSawDiamForProbe As Double = 630
+ ' Possibilità di ruotare i grezzi durante separa e muovi
+ Private m_bRawSplMovRotate As Boolean = False
+
' Flag che indicano stato tipologia utensili (attivo/non attivo)
Private m_bSaw As Boolean = False
Private m_bDrill As Boolean = False
@@ -230,6 +233,13 @@ Public Class CurrentMachine
End Get
End Property
+
+ Friend ReadOnly Property bRawSplMovRotate As Boolean
+ Get
+ Return m_bRawSplMovRotate
+ End Get
+ End Property
+
Friend Property dSafeZ As Double
Get
If EgtMdbGetGeneralParam(MCH_GP.SAFEZ, m_dSafeZ) Then
@@ -678,6 +688,8 @@ Public Class CurrentMachine
' Leggo limiti diametro lama per altre operazioni
m_dMaxSawDiamForVac = GetPrivateProfileDouble(S_TOOLS, K_MAXSAWDIAMFORVAC, 630, sMachIniFile)
m_dMaxSawDiamForProbe = GetPrivateProfileDouble(S_TOOLS, K_MAXSAWDIAMFORPROBE, 630, sMachIniFile)
+ ' Leggo flag abilitazione rotazione grezzi durante spezza e muovi
+ m_bRawSplMovRotate = (GetPrivateProfileInt(S_MACH_RAWMOVE, K_MACH_RM_ROTATE, 0, sMachIniFile) <> 0)
' Leggo flag presenza tipologie lavorazioni
' lama
m_bSawing = (GetPrivateProfileInt(S_MACHININGS, K_SAWING, 0, sMachIniFile) > 0)
diff --git a/MoveRawPartPage.xaml b/MoveRawPartPage.xaml
index ad4ab7c..0a0ef2c 100644
--- a/MoveRawPartPage.xaml
+++ b/MoveRawPartPage.xaml
@@ -96,6 +96,30 @@
VerticalAlignment="Center" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MoveRawPartPage.xaml.vb b/MoveRawPartPage.xaml.vb
index c2f0185..f6aedaf 100644
--- a/MoveRawPartPage.xaml.vb
+++ b/MoveRawPartPage.xaml.vb
@@ -13,6 +13,7 @@ Public Class MoveRawPartPage
Private m_bPrev As Boolean = False
' Dati movimento
Private m_dStep As Double = 0
+ Private m_dRotation As Double = 0
' Tipo movimento dei grezzi (manuale o con testa ventosa)
Private m_bByHand As Boolean = True
' Gestione movimento manuale perpendicolare
@@ -65,6 +66,8 @@ Public Class MoveRawPartPage
' Carico i parametri di movimento
m_dStep = GetPrivateProfileDouble(S_RAWMOVE, K_RAWSTEP, 50, m_MainWindow.GetIniFile())
StepMoveTxBx.Text = LenToString(m_dStep, 3)
+ m_dRotation = GetPrivateProfileDouble(S_RAWMOVE, K_RAWROTATION, 30, m_MainWindow.GetIniFile())
+ RotationAngleTxBx.Text = DoubleToString(m_dRotation, 3)
' Se movimento manuale perpendicolare
If m_bByHand Then
' Se esiste taglio passante determino direzione di movimento
@@ -117,10 +120,16 @@ Public Class MoveRawPartPage
If m_bByHand Then
LeftBtn.Visibility = Windows.Visibility.Hidden
RightBtn.Visibility = Windows.Visibility.Hidden
+ RotateClockwiseBtn.Visibility = Windows.Visibility.Hidden
+ RotateCounterClockwiseBtn.Visibility = Windows.Visibility.Hidden
+ RotationAngle.Visibility = Windows.Visibility.Hidden
' Altrimenti per movimento con ventose
Else
LeftBtn.Visibility = Windows.Visibility.Visible
RightBtn.Visibility = Windows.Visibility.Visible
+ RotateClockwiseBtn.Visibility = If(m_MainWindow.m_CurrentMachine.bRawSplMovRotate, Windows.Visibility.Visible, Windows.Visibility.Hidden)
+ RotateCounterClockwiseBtn.Visibility = If(m_MainWindow.m_CurrentMachine.bRawSplMovRotate, Windows.Visibility.Visible, Windows.Visibility.Hidden)
+ RotationAngle.Visibility = If(m_MainWindow.m_CurrentMachine.bRawSplMovRotate, Windows.Visibility.Visible, Windows.Visibility.Hidden)
End If
RemovePartBtn.Visibility = Windows.Visibility.Visible
' Abilitazione bottone modifica
@@ -300,6 +309,50 @@ Public Class MoveRawPartPage
EgtDraw()
End Sub
+ Private Sub RotateCounterClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateCounterClockwiseBtn.Click
+ ' Solo movimento con ventose
+ If m_bByHand Then Return
+ Dim nRawId As Integer = EgtGetFirstSelectedObj()
+ While nRawId <> GDB_ID.NULL
+ If m_bRawWithCups Then
+ Dim dAng As Double = m_dRotation
+ If EgtRotateRawPart(nRawId, Vector3d.Z_AX(), dAng) Then
+ ' Recupero il centro del grezzo
+ Dim ptRawCen As Point3d
+ GetRawCenter(nRawId, ptRawCen)
+ EgtRotate(GetVacuumId(), ptRawCen, Vector3d.Z_AX(), dAng, GDB_RT.GLOB)
+ AddRawMoveData(nRawId, dAng, m_RawMoveDataList)
+ End If
+ Else
+ m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2)) 'Pezzo troppo piccolo : non si può muovere
+ End If
+ nRawId = EgtGetNextSelectedObj()
+ End While
+ EgtDraw()
+ End Sub
+
+ Private Sub RotateClockwiseBtn_Click(sender As Object, e As RoutedEventArgs) Handles RotateClockwiseBtn.Click
+ ' Solo movimento con ventose
+ If m_bByHand Then Return
+ Dim nRawId As Integer = EgtGetFirstSelectedObj()
+ While nRawId <> GDB_ID.NULL
+ If m_bRawWithCups Then
+ Dim dAng As Double = -m_dRotation
+ If EgtRotateRawPart(nRawId, Vector3d.Z_AX(), dAng) Then
+ ' Recupero il centro del grezzo
+ Dim ptRawCen As Point3d
+ GetRawCenter(nRawId, ptRawCen)
+ EgtRotate(GetVacuumId(), ptRawCen, Vector3d.Z_AX(), dAng, GDB_RT.GLOB)
+ AddRawMoveData(nRawId, dAng, m_RawMoveDataList)
+ End If
+ Else
+ m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_MOVERAWPAGEUC + 2)) 'Pezzo troppo piccolo : non si può muovere
+ End If
+ nRawId = EgtGetNextSelectedObj()
+ End While
+ EgtDraw()
+ End Sub
+
Private Sub RemovePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemovePartBtn.Click
Dim nRawId As Integer = EgtGetFirstSelectedObj()
While nRawId <> GDB_ID.NULL
@@ -326,6 +379,13 @@ Public Class MoveRawPartPage
End If
End Sub
+ Private Sub RotationAngleTxBx_EgtClosed(sender As Object, e As EventArgs) Handles RotationAngleTxBx.EgtClosed
+ Dim dRotation As Double
+ If StringToDouble(RotationAngleTxBx.Text, dRotation) Then
+ m_dRotation = Math.Max(dRotation, 2 * EPS_ANG_SMALL)
+ End If
+ End Sub
+
Private Sub PrevBtn_Click(sender As Object, e As RoutedEventArgs) Handles PrevBtn.Click
' Deseleziono tutto
EgtDeselectAll()
@@ -387,6 +447,9 @@ Public Class MoveRawPartPage
RightBtn.IsEnabled = Not m_SplitPage.m_bShow
DownBtn.IsEnabled = Not m_SplitPage.m_bShow
StepMoveTxBx.IsEnabled = Not m_SplitPage.m_bShow
+ RotateClockwiseBtn.IsEnabled = Not m_SplitPage.m_bShow
+ RotateCounterClockwiseBtn.IsEnabled = Not m_SplitPage.m_bShow
+ RotationAngle.IsEnabled = Not m_SplitPage.m_bShow
RemovePartBtn.IsEnabled = Not m_SplitPage.m_bShow
End Sub
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index cc7a5c4..0553e11 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -60,5 +60,5 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/RawPartPageUC.xaml.vb b/RawPartPageUC.xaml.vb
index f6a26b0..e9e9ad5 100644
--- a/RawPartPageUC.xaml.vb
+++ b/RawPartPageUC.xaml.vb
@@ -584,6 +584,9 @@ Public Class RawPartPageUC
AddMachinings(GDB_ID.NULL, True, False)
' Aggiorno regioni per nesting
m_MainWindow.m_CadCutPageUC.m_NestPage.UpdateNestRegions()
+ m_MainWindow.m_CadCutPageUC.m_NestPage.EnableReferenceRegion(False)
+ ' Visualizzo i pezzi parcheggiati (per inserire correttamente in parcheggio i pezzi del grezzo)
+ ShowParkedParts()
' Verifico ogni singolo pezzo
Dim bReducedCut As Boolean = (GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 0, m_MainWindow.GetMachIniFile()) <> 0)
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId)
@@ -595,6 +598,8 @@ Public Class RawPartPageUC
End If
nPartId = nNextPartId
End While
+ ' Nascondo i pezzi parcheggiati
+ HideParkedParts()
' Se altrimenti progetto con cornici
ElseIf nPrjType = CurrentProjectPageUC.PRJ_TYPE.FRAMES Then
' Reinserisco tutte le lavorazioni delle cornici
@@ -960,6 +965,8 @@ Public Class RawPartPageUC
ElseIf m_RawHeight < EPS_SMALL Then
' Se ci sono pezzi
If EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId) <> GDB_ID.NULL Then
+ ' Visualizzo i pezzi parcheggiati (per inserire correttamente in parcheggio i pezzi del grezzo)
+ ShowParkedParts()
' Parcheggio pezzi presenti nel grezzo e li tolgo da VeinMatcing
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_CurrProjPage.m_nRawId)
While nPartId <> GDB_ID.NULL
diff --git a/SplitAuto.vb b/SplitAuto.vb
index cd496b1..e160188 100644
--- a/SplitAuto.vb
+++ b/SplitAuto.vb
@@ -693,12 +693,12 @@ Public Module SplitAuto
Dim rmData As New RawMoveData
If PutVacuumCupsOnRaw(vNewRaws(1), rmData) AndAlso
SafeMoveRawPart(vNewRaws(1), vtMove, dMinMove) Then
- rmData.m_vtMove = vtMove
+ rmData.m_vtRawMove = vtMove
SaveOneMoveInfoInDisposition(nDispId, rmData)
Return True
ElseIf PutVacuumCupsOnRaw(vNewRaws(0), rmData) AndAlso
SafeMoveRawPart(vNewRaws(0), vtMove2, dMinMove) Then
- rmData.m_vtMove = vtMove2
+ rmData.m_vtRawMove = vtMove2
SaveOneMoveInfoInDisposition(nDispId, rmData)
Return True
Else
diff --git a/VacuumCups.vb b/VacuumCups.vb
index ad04f0c..75e552c 100644
--- a/VacuumCups.vb
+++ b/VacuumCups.vb
@@ -15,14 +15,16 @@ Module VacuumCups
Friend Class RawMoveData
Public m_nId As Integer
- Public m_vtMove As Vector3d
+ Public m_vtRawMove As Vector3d
+ Public m_dRawAngRotDeg As Double
Public m_vtDelta As Vector3d
Public m_dAngRotDeg As Double
Public m_sCups As String
Sub New()
m_nId = GDB_ID.NULL
- m_vtMove = Vector3d.NULL()
+ m_vtRawMove = Vector3d.NULL()
+ m_dRawAngRotDeg = 0
m_vtDelta = Vector3d.NULL()
m_dAngRotDeg = 0
m_sCups = String.Empty
@@ -30,7 +32,8 @@ Module VacuumCups
Sub New(nId As Integer)
m_nId = nId
- m_vtMove = Vector3d.NULL()
+ m_vtRawMove = Vector3d.NULL()
+ m_dRawAngRotDeg = 0
m_vtDelta = Vector3d.NULL()
m_dAngRotDeg = 0
m_sCups = String.Empty
@@ -260,7 +263,7 @@ Module VacuumCups
Dim vtDelta As Vector3d = frCurrRef.Orig() - ptRawCen
' Assegno dati noti al movimento del grezzo
rmData.m_nId = nRawId
- rmData.m_vtMove = Vector3d.NULL()
+ rmData.m_vtRawMove = Vector3d.NULL()
rmData.m_vtDelta = vtDelta
rmData.m_dAngRotDeg = dRotAngDeg
Dim sVal As String = String.Empty
@@ -314,10 +317,7 @@ Module VacuumCups
Next
If b3Vac.IsEmpty() Then Return INFINITO
' Se box maggiore di quello del pezzo, scarto soluzione
- If Not ((b3Vac.DimX() < b3Raw.DimX() And b3Vac.DimY() < b3Raw.DimY()) Or
- (b3Vac.DimX() < b3Raw.DimY() And b3Vac.DimY() < b3Raw.DimX())) Then
- Return INFINITO
- End If
+ If b3Vac.Radius() > b3Raw.Radius() Then Return INFINITO
' Determino il movimento
vtMove = ptRawCen - b3Vac.Center()
b3Vac.Move(vtMove)
@@ -395,7 +395,8 @@ Module VacuumCups
Friend Function SaveOneMoveInfo(nId As Integer, rmData As RawMoveData) As Boolean
' Assegno le informazioni
EgtSetInfo(nId, "Id", rmData.m_nId)
- EgtSetInfo(nId, "Mv", rmData.m_vtMove)
+ EgtSetInfo(nId, "Mv", rmData.m_vtRawMove)
+ EgtSetInfo(nId, "Rr", rmData.m_dRawAngRotDeg)
EgtSetInfo(nId, "Dt", rmData.m_vtDelta)
EgtSetInfo(nId, "Ad", rmData.m_dAngRotDeg)
EgtSetInfo(nId, "Vc", rmData.m_sCups)
@@ -404,9 +405,10 @@ Module VacuumCups
End Function
Friend Function RemoveOneMoveInfo(nId As Integer) As Boolean
- ' Assegno le informazioni
+ ' Rimuovo le informazioni
EgtRemoveInfo(nId, "Id")
EgtRemoveInfo(nId, "Mv")
+ EgtRemoveInfo(nId, "Rr")
EgtRemoveInfo(nId, "Dt")
EgtRemoveInfo(nId, "Ad")
EgtRemoveInfo(nId, "Vc")
@@ -415,8 +417,8 @@ Module VacuumCups
End Function
Friend Function SaveOneMoveInfoInDisposition(nDispId As Integer, rmData As RawMoveData) As Boolean
- ' Se movimento trascurabile, inutile salvare
- If rmData.m_vtMove.IsSmall() Then Return True
+ ' Se movimento e rotazione trascurabili, inutile salvare
+ If rmData.m_vtRawMove.IsSmall() AndAlso Math.Abs(rmData.m_dRawAngRotDeg) < EPS_ANG_SMALL Then Return True
' Creo il gruppo
Dim nRpmId As Integer = EgtCreateGroup(nDispId)
If nRpmId = GDB_ID.NULL Then Return False
@@ -445,7 +447,8 @@ Module VacuumCups
' Recupero le informazioni
Dim rmData As New RawMoveData
EgtGetInfo(nRpmId, "Id", rmData.m_nId)
- EgtGetInfo(nRpmId, "Mv", rmData.m_vtMove)
+ EgtGetInfo(nRpmId, "Mv", rmData.m_vtRawMove)
+ EgtGetInfo(nRpmId, "Rr", rmData.m_dRawAngRotDeg)
EgtGetInfo(nRpmId, "Dt", rmData.m_vtDelta)
EgtGetInfo(nRpmId, "Ad", rmData.m_dAngRotDeg)
EgtGetInfo(nRpmId, "Vc", rmData.m_sCups)
@@ -494,7 +497,16 @@ Module VacuumCups
Dim nInd As Integer = AddRawMoveData(nRawId, rmList)
If nInd = -1 Then Return -1
' Aggiorno i valori
- rmList(nInd).m_vtMove += vtMove
+ rmList(nInd).m_vtRawMove += vtMove
+ Return nInd
+ End Function
+
+ Friend Function AddRawMoveData(nRawId As Integer, dRawAngRotDeg As Double, ByRef rmList As List(Of RawMoveData)) As Integer
+ ' Recupero o creo record con dati del grezzo indicato
+ Dim nInd As Integer = AddRawMoveData(nRawId, rmList)
+ If nInd = -1 Then Return -1
+ ' Aggiorno i valori
+ rmList(nInd).m_dRawAngRotDeg += dRawAngRotDeg
Return nInd
End Function
@@ -502,9 +514,11 @@ Module VacuumCups
' Recupero o creo record con dati del grezzo indicato
Dim nInd As Integer = AddRawMoveData(rmData.m_nId, rmList)
If nInd = -1 Then Return -1
- ' Aggiorno i valori
- rmList(nInd).m_vtDelta = rmData.m_vtDelta
- rmList(nInd).m_dAngRotDeg = rmData.m_dAngRotDeg
+ ' Aggiorno i valori (tengo conto di quanto già ruotato il pezzo)
+ Dim vtDeltaRot As New Vector3d(rmData.m_vtDelta)
+ vtDeltaRot.Rotate(Vector3d.Z_AX(), -rmList(nInd).m_dRawAngRotDeg)
+ rmList(nInd).m_vtDelta = vtDeltaRot
+ rmList(nInd).m_dAngRotDeg = rmData.m_dAngRotDeg - rmList(nInd).m_dRawAngRotDeg
rmList(nInd).m_sCups = rmData.m_sCups
Return nInd
End Function