OmagCUT 1.6l7 :

- migliorata interazione selezione pezzo e drag in nesting.
This commit is contained in:
Dario Sassi
2016-01-09 09:59:17 +00:00
parent 4a00413171
commit f8b978e190
4 changed files with 59 additions and 27 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ Public Class CNCommunication
Select Case m_nNCType
Case 0 'Debug
m_MachineStatus.MachineStatusGrid.Background = Brushes.Gold
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Yellow")
Case 1, 2 'Axium, Flexium
If IsNothing(m_CN) OrElse m_CN.n_state < 2 Then
' Per evitare crash con azioni verso il controllo, avvio quello di debug
+1
View File
@@ -88,6 +88,7 @@ Module ConstIni
Public Const K_DIRECT As String = "Direct"
Public Const K_STEP As String = "Step"
Public Const K_REDUCEDCUT As String = "ReducedCut"
Public Const K_RESTRADIUS As String = "RestRadius"
Public Const S_RAWPART As String = "RawPart"
Public Const K_RAWCOLOR As String = "RawColor"
+2 -2
View File
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.12.6")>
<Assembly: AssemblyFileVersion("1.6.12.6")>
<Assembly: AssemblyVersion("1.6.12.7")>
<Assembly: AssemblyFileVersion("1.6.12.7")>
+55 -24
View File
@@ -13,6 +13,8 @@ Public Class NestPageUC
NONE_TABLE = 0
OUT_TABLE = 1
End Enum
' Flag per pezzo da deselezionare
Private m_nIdToDesel As Integer = GDB_ID.NULL
' Dati del grezzo
Private m_nRawId As Integer = GDB_ID.NULL
Private m_ptRawMin As Point3d
@@ -26,7 +28,11 @@ Public Class NestPageUC
Private m_dAngStep As Double = 90
Private m_bReducedCut As Boolean = False
' Dati per Drag
Private m_nRestRadius As Integer = 3
Private m_bDrag As Boolean = False
Private m_bDragToStart As Boolean = False
Private m_bDragging As Boolean = False
Private m_locPrev As System.Drawing.Point
Private m_ptPrev As Point3d
@@ -55,12 +61,13 @@ Public Class NestPageUC
EgtOutLog("Not found current saw for nesting mindist")
m_dMinDist = 0
End If
' carico e calcolo i parametri di movimento
' carico e calcolo i parametri di movimento e drag
m_dStep = GetPrivateProfileDouble(S_NEST, K_STEP, 10, m_MainWindow.GetIniFile())
StepMoveTxBx.Text = DoubleToString(m_dStep, 3)
m_dMaxStep = Math.Max(m_ptRawMax.x - m_ptRawMin.x, m_ptRawMax.y - m_ptRawMin.y)
RotationAngleTxBx.Text = DoubleToString(m_dAngStep, 2)
m_bReducedCut = GetPrivateProfileInt(S_NEST, K_REDUCEDCUT, 0, m_MainWindow.GetIniFile())
m_nRestRadius = GetPrivateProfileInt(S_NEST, K_RESTRADIUS, 3, m_MainWindow.GetIniFile())
End Sub
Public Sub CalcRawPart()
@@ -86,34 +93,36 @@ Public Class NestPageUC
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bPartInTable As Boolean = EgtGetParent(nPartId) = m_nRawId
If EgtIsPart(nPartId) Or bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se selezionato o posizione oggetto incompatibile con flag posizione selezionati
If nStat = GDB_ST.SEL Or
(bPartInTable And m_nPartPos = PART_POS.OUT_TABLE) Or
(Not bPartInTable And m_nPartPos = PART_POS.IN_TABLE) Then
' Deseleziono
EgtDeselectObj(nPartId)
Else
EgtSelectObj(nPartId)
' Set flag posizione selezionati
m_nPartPos = IIf(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
End If
EgtDraw()
Exit While
End If
nId = EgtGetNextObjInSelWin()
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = m_nRawId)
If EgtIsPart(nPartId) Or bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
' Se selezionato o posizione oggetto incompatibile con flag posizione selezionati
If nStat = GDB_ST.SEL Or
(bPartInTable And m_nPartPos = PART_POS.OUT_TABLE) Or
(Not bPartInTable And m_nPartPos = PART_POS.IN_TABLE) Then
' Memorizzo Id da deselezionare
m_nIdToDesel = nPartId
Else
EgtSelectObj(nPartId)
' Set flag posizione selezionati
m_nPartPos = IIf(bPartInTable, PART_POS.IN_TABLE, PART_POS.OUT_TABLE)
End If
EgtDraw()
Exit While
End If
nId = EgtGetNextObjInSelWin()
End While
' Se nessun pezzo selezionato, reset flag posizione selezionati
If EgtGetSelectedObjCount() = 0 Then
m_nPartPos = PART_POS.NONE_TABLE
End If
' Dati per drag
m_locPrev = e.Location
m_bDrag = EgtUnProjectPoint(e.Location, m_ptPrev)
m_bDragToStart = m_bDrag
End Sub
Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseMoveScene
@@ -121,16 +130,30 @@ Public Class NestPageUC
If Not m_bActive Then
Return
End If
If Not m_bDrag Or m_nPartPos <> PART_POS.IN_TABLE Then
' Se drag non abilitato o pezzo non in tavola o drag già in esecuzione, esco
If Not m_bDrag Or m_nPartPos <> PART_POS.IN_TABLE Or m_bDragging Then
Return
End If
' Se primo movimento di drag, verifico si aver superato la soglia di movimento in pixel
If m_bDragToStart Then
If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And
Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then
Return
End If
m_bDragToStart = False
End If
' Inizio esecuzione di drag
m_bDragging = True
' Ricavo il punto corrente in coordinate mondo
Dim ptCurr As Point3d
EgtUnProjectPoint(e.Location, ptCurr)
' Ricavo il vettore di movimento
Dim vtMove As Vector3d = ptCurr - m_ptPrev
' Muovo i pezzi selezionati di quanto possibile
If vtMove.SqLen() > EPS_SMALL * EPS_SMALL Then
If vtMove.SqLen() > 100 * EPS_SMALL * EPS_SMALL Then
' annullo deselezione
m_nIdToDesel = GDB_ID.NULL
' muovo il pezzo
EgtMoveSelectedPartCluster(m_bReducedCut, vtMove, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
EgtDraw()
@@ -138,6 +161,8 @@ Public Class NestPageUC
' Aggiorno il punto precedente
'm_ptPrev += vtMove
m_ptPrev = ptCurr
' Terminata esecuzione di drag
m_bDragging = False
End Sub
Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseUpScene
@@ -145,6 +170,12 @@ Public Class NestPageUC
If Not m_bActive Then
Return
End If
' Se deselezione da eseguire
If m_nIdToDesel <> GDB_ID.NULL Then
EgtDeselectObj(m_nIdToDesel)
m_nIdToDesel = GDB_ID.NULL
EgtDraw()
End If
' Disabilito modalità drag
m_bDrag = False
End Sub