diff --git a/ConstGen.vb b/ConstGen.vb
index a95d08e..d550f88 100644
--- a/ConstGen.vb
+++ b/ConstGen.vb
@@ -244,6 +244,8 @@ Module ConstGen
Public Const SELECT_REGION_LAYER As String = "SelectRegion"
' Info per stato pezzo da OmagVIEW
Public Const INFO_PARTOK As String = "POK"
+ ' Info in pezzo per stato rotazione
+ Public Const INFO_PARTROT As String = "ROT"
' Nome di pezzo che รจ una cornice
Public Const NAME_FRAME As String = "Frame"
diff --git a/NestPageUC.xaml.vb b/NestPageUC.xaml.vb
index 26c8f3e..10a7560 100644
--- a/NestPageUC.xaml.vb
+++ b/NestPageUC.xaml.vb
@@ -215,7 +215,9 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
- EgtAlignPartOnCollision(nMoveId, m_bReducedCut, bAlignMoved)
+ If Not GetLockOnRotation( nMoveId) Then
+ EgtAlignPartOnCollision(nMoveId, m_bReducedCut, bAlignMoved)
+ End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(nMoveId, m_bReducedCut, m_dSnapDist, bSnapMoved)
@@ -367,7 +369,9 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
- EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ If Not GetLockOnRotation( GDB_ID.SEL) Then
+ EgtAlignPartOnCollision( GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist, bSnapMoved)
@@ -401,7 +405,9 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
- EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ If Not GetLockOnRotation( GDB_ID.SEL) Then
+ EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist, bSnapMoved)
@@ -435,7 +441,9 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
- EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ If Not GetLockOnRotation( GDB_ID.SEL) Then
+ EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist, bSnapMoved)
@@ -469,7 +477,9 @@ Public Class NestPageUC
Dim bAlignMoved As Boolean = False
Dim bSnapMoved As Boolean = False
If m_bMagnetic Then
- EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ If Not GetLockOnRotation( GDB_ID.SEL) Then
+ EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut, bAlignMoved)
+ End If
If m_dSnapDist > EPS_SMALL Then
EgtRestoreCollInfo()
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist, bSnapMoved)
@@ -575,31 +585,41 @@ Public Class NestPageUC
If m_nPartPos <> PART_POS.IN_TABLE Then
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
- ' Calcolo il centro di rotazione come centro del pezzo
- Dim ptCen As Point3d
- If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
- ' Rotazione del pezzo attorno al suo centro
- EgtRotate(nId, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
- ' Sistemazione nel parcheggio
- PackPartInStore(nId)
+ ' Se pezzo con rotazione libera
+ If Not EgtExistsInfo( nId, INFO_PARTROT) Then
+ ' Calcolo il centro di rotazione come centro del pezzo
+ Dim ptCen As Point3d
+ If Not EgtGetPartPartClusterCenterGlob(nId, ptCen) Then Return False
+ ' Rotazione del pezzo attorno al suo centro
+ EgtRotate(nId, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
+ ' Sistemazione nel parcheggio
+ PackPartInStore(nId)
+ End If
' Passo al successivo selezionato
nId = EgtGetNextSelectedObj()
End While
Return True
' Altrimenti li ruoto tenendo conto delle collisioni
Else
- ' Calcolo il centro di rotazione come centro del cluster
- Dim ptCen As Point3d
- If Not EgtGetPartPartClusterCenterGlob(GDB_ID.SEL, ptCen) Then Return False
- ' Aggiorno regioni per nesting
- UpdateNestRegions()
- EnableReferenceRegion(False)
- ' Verifico rotazione complessiva
- EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
- If EgtVerifyPart(GDB_ID.SEL, m_bReducedCut) Then Return True
- ' Provo rotazione parziale (dopo aver annullato la complessiva)
- EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), -dAngRotDeg, GDB_RT.GLOB)
- Return EgtRotatePart(GDB_ID.SEL, m_bReducedCut, ptCen, dAngRotDeg)
+ ' Verifico se ci sono dei pezzi bloccati in rotazione
+ Dim bLockedRot As Boolean = GetLockOnRotation( GDB_ID.SEL)
+ ' Se tutti i pezzi possono ruotare
+ If Not bLockedRot Then
+ ' Calcolo il centro di rotazione come centro del cluster
+ Dim ptCen As Point3d
+ If Not EgtGetPartPartClusterCenterGlob(GDB_ID.SEL, ptCen) Then Return False
+ ' Aggiorno regioni per nesting
+ UpdateNestRegions()
+ EnableReferenceRegion(False)
+ ' Verifico rotazione complessiva
+ EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
+ If EgtVerifyPart(GDB_ID.SEL, m_bReducedCut) Then Return True
+ ' Provo rotazione parziale (dopo aver annullato la complessiva)
+ EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), -dAngRotDeg, GDB_RT.GLOB)
+ Return EgtRotatePart(GDB_ID.SEL, m_bReducedCut, ptCen, dAngRotDeg)
+ Else
+ Return False
+ End If
End If
End Function
@@ -1115,6 +1135,87 @@ Public Class NestPageUC
EgtDraw()
End Sub
+ Private Sub PartRotOnBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOnBtn.Click
+ EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
+ ' Se non ci sono pezzi selezionati o non sono in parcheggio, esco
+ If EgtGetSelectedObjCount() = 0 OrElse m_nPartPos <> PART_POS.OUT_TABLE Then Return
+ ' Tolgo blocco rotazione sui pezzi selezionati
+ Dim nId As Integer = EgtGetFirstSelectedObj()
+ While nId <> GDB_ID.NULL
+ ' Se rotazione bloccata, tolgo blocco e aggiorno info
+ If EgtExistsInfo( nId, INFO_PARTROT) Then
+ ' Rimuovo flag di rotazione bloccata
+ EgtRemoveInfo( nId, INFO_PARTROT)
+ ' Tolgo da info sul pezzo Codice
+ Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION))
+ While nTextId <> GDB_ID.NULL
+ If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then
+ Dim sText As String = ""
+ EgtTextGetContent( nTextId, sText)
+ sText = sText.Replace( "
(X)", "")
+ EgtModifyText( nTextId, sText)
+ Exit While
+ End If
+ nTextId = EgtGetNext( nTextId)
+ End While
+ End If
+ ' Passo al successivo selezionato
+ nId = EgtGetNextSelectedObj()
+ End While
+ ' Aggiorno visualizzazione
+ EgtDraw()
+ End Sub
+
+ Private Sub PartRotOffBtn_Click(sender As Object, e As RoutedEventArgs) Handles PartRotOffBtn.Click
+ EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
+ ' Se non ci sono pezzi selezionati o non sono in parcheggio, esco
+ If EgtGetSelectedObjCount() = 0 OrElse m_nPartPos <> PART_POS.OUT_TABLE Then Return
+ ' Metto blocco rotazione sui pezzi selezionati
+ Dim nId As Integer = EgtGetFirstSelectedObj()
+ While nId <> GDB_ID.NULL
+ ' Se rotazione libera, applico blocco e aggiorno info
+ If Not EgtExistsInfo( nId, INFO_PARTROT) Then
+ ' Imposto flag di rotazione bloccata
+ EgtSetInfo( nId, INFO_PARTROT, 1)
+ ' Inserisco in info sul pezzo Codice
+ Dim nTextId As Integer = EgtGetFirstInGroup( EgtGetFirstNameInGroup( nId, NAME_REGION))
+ While nTextId <> GDB_ID.NULL
+ If EgtGetType( nTextId) = GDB_TY.EXT_TEXT Then
+ Dim sText As String = ""
+ EgtTextGetContent( nTextId, sText)
+ sText &= "
(X)"
+ EgtModifyText( nTextId, sText)
+ Exit While
+ End If
+ nTextId = EgtGetNext( nTextId)
+ End While
+ End If
+ ' Passo al successivo selezionato
+ nId = EgtGetNextSelectedObj()
+ End While
+ ' Aggiorno visualizzazione
+ EgtDraw()
+ End Sub
+
+ Private Function GetLockOnRotation( nPartId As Integer) As Boolean
+ ' Se singolo pezzo
+ If nPartId <> GDB_ID.SEL Then
+ Return EgtExistsInfo( nPartId, INFO_PARTROT)
+ ' Altrimenti tutti i selezionati
+ Else
+ Dim bLockedRot As Boolean = False
+ Dim nId As Integer = EgtGetFirstSelectedObj()
+ While nId <> GDB_ID.NULL
+ If EgtExistsInfo( nId, INFO_PARTROT) Then
+ bLockedRot = True
+ Exit While
+ End If
+ nId = EgtGetNextSelectedObj()
+ End While
+ Return bLockedRot
+ End If
+ End Function
+
Private Sub StepMoveTxBx_EgtClosed(sender As Object, e As EventArgs) Handles StepMoveTxBx.EgtClosed
Dim dVal As Double
If StringToLen(StepMoveTxBx.Text, dVal) Then