OmagCUT :
- aggiunti controlli al passaggio no baffi -> controllo baffi.
This commit is contained in:
+9
-9
@@ -26,7 +26,7 @@
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Column="0">
|
||||
<Grid Grid.Column="0" Margin="-5,0,5,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
@@ -112,21 +112,21 @@
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}" />
|
||||
|
||||
|
||||
<CheckBox Name="CompleteCutsChBx" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Height="40" Width="250"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Name="CompleteCutsTxBl" Style="{StaticResource OmagCut_ToolsDBTextBlock}" Margin="10,0,0,0"
|
||||
Text="Rispetta i tagli completi"/>
|
||||
<CheckBox Name="CompleteCutsChBx" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Height="40" Width="307"
|
||||
HorizontalAlignment="Left" Margin="25,22,10.5,23" FlowDirection="RightToLeft" UseLayoutRounding="True">
|
||||
<TextBlock Name="CompleteCutsTxBl" Style="{StaticResource OmagCut_ToolsDBTextBlock}" Margin="0"
|
||||
Width="262" FlowDirection="LeftToRight"/>
|
||||
</CheckBox>
|
||||
|
||||
<TextBlock Name="SafeZTxBl" Grid.Column="0" Grid.Row="5" FontSize="20"
|
||||
Style="{StaticResource OmagCut_CenteredLowerCaseCharacterTextBlock}"/>
|
||||
Style="{StaticResource OmagCut_ToolsDBTextBlock}"/>
|
||||
<EgtWPFLib:EgtTextBox Name="SafeZTxBx" Grid.Column="1" Grid.Row="5" Width="150"
|
||||
Style="{StaticResource OmagCut_CalculatorTextBox}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<TextBlock Name="NCErrorMessages" Grid.ColumnSpan="3" FontSize="22" Width="1000"
|
||||
TextWrapping="Wrap" Margin="136,395,136,91"/>
|
||||
<TextBlock Name="NCErrorMessages" Grid.ColumnSpan="2" FontSize="22"
|
||||
TextWrapping="Wrap" Margin="32,417,140,69" Grid.Column="1"/>
|
||||
<TextBlock Name="PLCErrorMessages" Grid.ColumnSpan="3" FontSize="22" Height="35" Width="1000" Margin="136,590,136,51"/>
|
||||
<ListBox Name="ErrorLstBx" Grid.Column="1"
|
||||
Margin="0,0,0,281" >
|
||||
@@ -135,7 +135,7 @@
|
||||
<TextBlock Text="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ListBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
+14
-1
@@ -1,6 +1,7 @@
|
||||
Imports System.Windows.Threading
|
||||
Imports System.IO
|
||||
Imports EgtUILib
|
||||
Imports EgtWPFLib
|
||||
|
||||
Public Class AlarmsPageUC
|
||||
|
||||
@@ -34,6 +35,7 @@ Public Class AlarmsPageUC
|
||||
SafeZTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 5)
|
||||
CutExtraLenTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 6)
|
||||
AngleCutExtraLenTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 7)
|
||||
CompleteCutsTxBl.Text = EgtMsg(MSG_ALARMSPAGEUC + 8)
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -213,8 +215,19 @@ Public Class AlarmsPageUC
|
||||
End Sub
|
||||
|
||||
Private Sub CompleteCutsChBx_Click(sender As Object, e As RoutedEventArgs) Handles CompleteCutsChBx.Click
|
||||
Dim NestPage As NestPageUC = m_MainWindow.m_CadCutPageUC.m_NestPage
|
||||
If CompleteCutsChBx.IsChecked() Then
|
||||
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile())
|
||||
' Se pezzi in interferenza
|
||||
If Not NestPage.VerifyPartsNesting(False) Then
|
||||
' Ci sono interferenze, alcuni pezzi saranno parcheggiati. Vuoi continuare ?
|
||||
Dim Dlg As New EgtMsgBox(m_MainWindow, "", EgtMsg(91105), EgtMsgBox.Buttons.OK_CANCEL, EgtMsgBox.Icons.ESCLAMATION, 1)
|
||||
If Dlg.DialogResult = 1 Then ' Ok
|
||||
NestPage.StoreCollisionParts(False)
|
||||
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile())
|
||||
End If
|
||||
Else
|
||||
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "0", m_MainWindow.GetMachIniFile())
|
||||
End If
|
||||
Else
|
||||
WritePrivateProfileString(S_MACH_NEST, K_MACH_REDUCEDCUT, "1", m_MainWindow.GetMachIniFile())
|
||||
End If
|
||||
|
||||
@@ -64,6 +64,8 @@ Module ConstGen
|
||||
|
||||
' Contrassegno di progetto OmagCut
|
||||
Public Const NAME_PROJMARK As String = "OmagCut"
|
||||
' Info per stato flag taglio ridotto
|
||||
Public Const INFO_REDUCEDCUT = "ReducedCut"
|
||||
' Info per lavorazioni già ordinate
|
||||
Public Const INFO_MACHORDER As String = "MachOrder"
|
||||
|
||||
|
||||
@@ -346,6 +346,8 @@ Public Class CurrentProjectPageUC
|
||||
EgtSetName(nMarkId, NAME_PROJMARK)
|
||||
EgtSetLevel(nMarkId, GDB_LV.SYSTEM)
|
||||
End If
|
||||
Dim nReducedCut As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 1, m_MainWindow.GetMachIniFile())
|
||||
EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut)
|
||||
Return nMarkId
|
||||
End Function
|
||||
|
||||
|
||||
+82
-35
@@ -162,28 +162,32 @@ Public Class NestPageUC
|
||||
' 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)
|
||||
EgtMovePart(GDB_ID.SEL, m_bReducedCut, vtMove,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtSaveCollInfo()
|
||||
' se movimento risultante nullo, provo con movimento tangente
|
||||
Dim bTgMoved As Boolean = False
|
||||
If vtMove.IsSmall() Then
|
||||
' riprovo con movimento tangente
|
||||
Dim vtTgMove As Vector3d = ptCurr - m_ptPrev
|
||||
EgtTgMoveSelectedPartClusterOnCollision(m_bReducedCut, vtTgMove, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtTgMovePartOnCollision(GDB_ID.SEL, m_bReducedCut, vtTgMove,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
bTgMoved = (Not vtTgMove.IsSmall())
|
||||
End If
|
||||
' se abilitato magnetico (allineamento + snap), lo provo
|
||||
Dim bAlignMoved As Boolean = False
|
||||
Dim bSnapMoved As Boolean = False
|
||||
If m_bMagnetic Then
|
||||
EgtAlignSelectedPartClusterOnCollision(m_bReducedCut, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
If m_dSnapDist > EPS_SMALL Then
|
||||
EgtRestoreCollInfo()
|
||||
EgtMoveToSnapPointSelectedOnCollision(m_bReducedCut, m_dSnapDist, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
End If
|
||||
End If
|
||||
EgtDraw()
|
||||
@@ -221,19 +225,22 @@ Public Class NestPageUC
|
||||
|
||||
Private Sub UpBtn_Click(sender As Object, e As RoutedEventArgs) Handles UpBtn.Click
|
||||
Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedPartCluster(m_bReducedCut, New Vector3d(0, dStep, 0), m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(0, dStep, 0),
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtSaveCollInfo()
|
||||
' se abilitato magnetico (allineamento + snap), lo provo
|
||||
Dim bAlignMoved As Boolean = False
|
||||
Dim bSnapMoved As Boolean = False
|
||||
If m_bMagnetic Then
|
||||
EgtAlignSelectedPartClusterOnCollision(m_bReducedCut, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
If m_dSnapDist > EPS_SMALL Then
|
||||
EgtRestoreCollInfo()
|
||||
EgtMoveToSnapPointSelectedOnCollision(m_bReducedCut, m_dSnapDist, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
End If
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
@@ -242,19 +249,22 @@ Public Class NestPageUC
|
||||
|
||||
Private Sub DownBtn_Click(sender As Object, e As RoutedEventArgs) Handles DownBtn.Click
|
||||
Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedPartCluster(m_bReducedCut, New Vector3d(0, -dStep, 0), m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(0, -dStep, 0),
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtSaveCollInfo()
|
||||
' se abilitato magnetico (allineamento + snap), lo provo
|
||||
Dim bAlignMoved As Boolean = False
|
||||
Dim bSnapMoved As Boolean = False
|
||||
If m_bMagnetic Then
|
||||
EgtAlignSelectedPartClusterOnCollision(m_bReducedCut, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
If m_dSnapDist > EPS_SMALL Then
|
||||
EgtRestoreCollInfo()
|
||||
EgtMoveToSnapPointSelectedOnCollision(m_bReducedCut, m_dSnapDist, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
End If
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
@@ -263,19 +273,22 @@ Public Class NestPageUC
|
||||
|
||||
Private Sub RightBtn_Click(sender As Object, e As RoutedEventArgs) Handles RightBtn.Click
|
||||
Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedPartCluster(m_bReducedCut, New Vector3d(dStep, 0, 0), m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(dStep, 0, 0),
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtSaveCollInfo()
|
||||
' se abilitato magnetico (allineamento + snap), lo provo
|
||||
Dim bAlignMoved As Boolean = False
|
||||
Dim bSnapMoved As Boolean = False
|
||||
If m_bMagnetic Then
|
||||
EgtAlignSelectedPartClusterOnCollision(m_bReducedCut, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
If m_dSnapDist > EPS_SMALL Then
|
||||
EgtRestoreCollInfo()
|
||||
EgtMoveToSnapPointSelectedOnCollision(m_bReducedCut, m_dSnapDist, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
End If
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
@@ -284,19 +297,22 @@ Public Class NestPageUC
|
||||
|
||||
Private Sub LeftBtn_Click(sender As Object, e As RoutedEventArgs) Handles LeftBtn.Click
|
||||
Dim dStep As Double = If(m_bMaximizeMove, m_dMaxStep, m_dStep)
|
||||
EgtMoveSelectedPartCluster(m_bReducedCut, New Vector3d(-dStep, 0, 0), m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtMovePart(GDB_ID.SEL, m_bReducedCut, New Vector3d(-dStep, 0, 0),
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
EgtSaveCollInfo()
|
||||
' se abilitato magnetico (allineamento + snap), lo provo
|
||||
Dim bAlignMoved As Boolean = False
|
||||
Dim bSnapMoved As Boolean = False
|
||||
If m_bMagnetic Then
|
||||
EgtAlignSelectedPartClusterOnCollision(m_bReducedCut, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
EgtAlignPartOnCollision(GDB_ID.SEL, m_bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bAlignMoved)
|
||||
If m_dSnapDist > EPS_SMALL Then
|
||||
EgtRestoreCollInfo()
|
||||
EgtMoveToSnapPointSelectedOnCollision(m_bReducedCut, m_dSnapDist, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
EgtMovePartToSnapPointOnCollision(GDB_ID.SEL, m_bReducedCut, m_dSnapDist,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, bSnapMoved)
|
||||
End If
|
||||
End If
|
||||
m_CurrProjPage.ResetOrderMachiningFlag()
|
||||
@@ -332,13 +348,14 @@ Public Class NestPageUC
|
||||
' Rotazione dei pezzi attorno al loro centro
|
||||
EgtRotate(GDB_ID.SEL, ptCen, Vector3d.Z_AX(), dAngRotDeg, GDB_RT.GLOB)
|
||||
' Sistemazione nel parcheggio
|
||||
EgtPackSelectedBoxCluster(-5000, -INFINITO, 1000, -3000, 20, False)
|
||||
EgtPackBox(GDB_ID.SEL, -5000, -INFINITO, 1000, -3000, 20, False)
|
||||
Return True
|
||||
|
||||
' Altrimenti li ruoto tenendo conto delle collisioni
|
||||
Else
|
||||
Return EgtRotateSelectedPartCluster(m_bReducedCut, ptCen, dAngRotDeg, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
Return EgtRotatePart(GDB_ID.SEL, m_bReducedCut, ptCen, dAngRotDeg,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf)
|
||||
End If
|
||||
End Function
|
||||
|
||||
@@ -515,4 +532,34 @@ Public Class NestPageUC
|
||||
m_bMagnetic = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function VerifyPartsNesting(bReducedCut As Boolean) As Boolean
|
||||
' Ciclo su tutti i pezzi in tavola
|
||||
Dim nPartId As Integer = EgtGetFirstGroupInGroup(m_nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
If Not EgtVerifyPart(nPartId, bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf) Then
|
||||
Return False
|
||||
End If
|
||||
nPartId = EgtGetNextGroup(nPartId)
|
||||
End While
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Friend Function StoreCollisionParts(bReducedCut As Boolean) As Boolean
|
||||
' Ciclo su tutti i pezzi in tavola (dall'ultimo)
|
||||
Dim nPartId As Integer = EgtGetLastGroupInGroup(m_nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
Dim nPrevPartId As Integer = EgtGetPrevGroup(nPartId)
|
||||
If Not EgtVerifyPart(nPartId, bReducedCut,
|
||||
m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf,
|
||||
m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf) Then
|
||||
StoreOnePart(nPartId, True)
|
||||
End If
|
||||
nPartId = nPrevPartId
|
||||
End While
|
||||
Return True
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
+157
-131
@@ -3,42 +3,42 @@ Imports EgtUILib
|
||||
|
||||
Public Class OpenPageUC
|
||||
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
'Riferimento alla MainWindow
|
||||
Private m_MainWindow As MainWindow = Application.Current.MainWindow
|
||||
|
||||
'Dichiarazione dello UserControl SceneButtons
|
||||
Private m_SceneButtons As SceneButtonsUC
|
||||
'Dichiarazione dello UserControl SceneButtons
|
||||
Private m_SceneButtons As SceneButtonsUC
|
||||
|
||||
' Properties
|
||||
Private m_sCurrDir As String = String.Empty
|
||||
Private m_sCurrFile As String = String.Empty
|
||||
Private m_bFirst As Boolean = True
|
||||
Private m_bFileOk As Boolean = False
|
||||
' Properties
|
||||
Private m_sCurrDir As String = String.Empty
|
||||
Private m_sCurrFile As String = String.Empty
|
||||
Private m_bFirst As Boolean = True
|
||||
Private m_bFileOk As Boolean = False
|
||||
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents OpenScene As New Scene
|
||||
Dim OpenSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
' Dichiarazione Scene
|
||||
Friend WithEvents OpenScene As New Scene
|
||||
Dim OpenSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
||||
|
||||
Private Sub OpenPage_Initialized(sender As Object, e As EventArgs)
|
||||
Private Sub OpenPage_Initialized(sender As Object, e As EventArgs)
|
||||
|
||||
' Creazione dello UserControl SceneButtons
|
||||
m_SceneButtons = New SceneButtonsUC
|
||||
' Creazione dello UserControl SceneButtons
|
||||
m_SceneButtons = New SceneButtonsUC
|
||||
|
||||
' Posizionemento nella griglia del UserControl SceneButtons
|
||||
m_SceneButtons.SetValue(Grid.ColumnProperty, 1)
|
||||
UpperButtonsGrid.Children.Add(m_SceneButtons)
|
||||
' Posizionemento nella griglia del UserControl SceneButtons
|
||||
m_SceneButtons.SetValue(Grid.ColumnProperty, 1)
|
||||
UpperButtonsGrid.Children.Add(m_SceneButtons)
|
||||
|
||||
' Assegnazione scena all'host e posizionamento nella OpenPageGrid
|
||||
OpenSceneHost.Child = OpenScene
|
||||
OpenSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
OpenSceneHost.SetValue(Grid.RowProperty, 2)
|
||||
' OpenSceneHost.SetValue(Grid.RowSpanProperty, 1)
|
||||
Me.OpenPageGrid.Children.Add(OpenSceneHost)
|
||||
' Assegnazione scena all'host e posizionamento nella OpenPageGrid
|
||||
OpenSceneHost.Child = OpenScene
|
||||
OpenSceneHost.SetValue(Grid.ColumnProperty, 1)
|
||||
OpenSceneHost.SetValue(Grid.RowProperty, 2)
|
||||
' OpenSceneHost.SetValue(Grid.RowSpanProperty, 1)
|
||||
Me.OpenPageGrid.Children.Add(OpenSceneHost)
|
||||
|
||||
' Definizione del collegamento tra ItemList e ListBox1
|
||||
FileListBox.ItemsSource = m_MainWindow.m_OpenItemList
|
||||
' Definizione del collegamento tra ItemList e ListBox1
|
||||
FileListBox.ItemsSource = m_MainWindow.m_OpenItemList
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub OpenPage_Loaded(sender As Object, e As RoutedEventArgs)
|
||||
|
||||
@@ -95,114 +95,114 @@ Public Class OpenPageUC
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function LoadCurrDir() As Boolean
|
||||
' se direttorio corrente non valido, carico l'elenco dei dischi
|
||||
If String.IsNullOrWhiteSpace(m_sCurrDir) OrElse Not IO.Directory.Exists(m_sCurrDir) Then
|
||||
Return LoadDisks()
|
||||
End If
|
||||
Dim TempPath As New Text.StringBuilder(260)
|
||||
PathCompactPathEx(TempPath, m_sCurrDir, 28, 0)
|
||||
' lo visualizzo
|
||||
FilePathTxBl.Content = TempPath.ToString
|
||||
' pulisco la lista
|
||||
m_MainWindow.m_OpenItemList.Clear()
|
||||
' per risalire al direttorio padre
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem("..", 0))
|
||||
' elenco dei sottodirettori
|
||||
Dim DirInfo As New DirectoryInfo(m_sCurrDir)
|
||||
Dim vDirI As DirectoryInfo() = DirInfo.GetDirectories("*")
|
||||
Dim DirI As DirectoryInfo
|
||||
For Each DirI In vDirI
|
||||
If (DirI.Attributes And FileAttributes.Hidden) <> FileAttributes.Hidden Then
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DirI.Name, 2))
|
||||
End If
|
||||
Next
|
||||
' elenco dei file
|
||||
Dim vFileI As FileInfo() = DirInfo.GetFiles()
|
||||
Dim FileI As FileInfo
|
||||
For Each FileI In vFileI
|
||||
Dim sExt As String = Path.GetExtension(FileI.Name).ToUpper()
|
||||
If sExt = ".NGE" Then
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(FileI.Name, 3))
|
||||
End If
|
||||
Next
|
||||
' pulisco la vista
|
||||
ClearView()
|
||||
Return True
|
||||
End Function
|
||||
Private Function LoadCurrDir() As Boolean
|
||||
' se direttorio corrente non valido, carico l'elenco dei dischi
|
||||
If String.IsNullOrWhiteSpace(m_sCurrDir) OrElse Not IO.Directory.Exists(m_sCurrDir) Then
|
||||
Return LoadDisks()
|
||||
End If
|
||||
Dim TempPath As New Text.StringBuilder(260)
|
||||
PathCompactPathEx(TempPath, m_sCurrDir, 28, 0)
|
||||
' lo visualizzo
|
||||
FilePathTxBl.Content = TempPath.ToString
|
||||
' pulisco la lista
|
||||
m_MainWindow.m_OpenItemList.Clear()
|
||||
' per risalire al direttorio padre
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem("..", 0))
|
||||
' elenco dei sottodirettori
|
||||
Dim DirInfo As New DirectoryInfo(m_sCurrDir)
|
||||
Dim vDirI As DirectoryInfo() = DirInfo.GetDirectories("*")
|
||||
Dim DirI As DirectoryInfo
|
||||
For Each DirI In vDirI
|
||||
If (DirI.Attributes And FileAttributes.Hidden) <> FileAttributes.Hidden Then
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DirI.Name, 2))
|
||||
End If
|
||||
Next
|
||||
' elenco dei file
|
||||
Dim vFileI As FileInfo() = DirInfo.GetFiles()
|
||||
Dim FileI As FileInfo
|
||||
For Each FileI In vFileI
|
||||
Dim sExt As String = Path.GetExtension(FileI.Name).ToUpper()
|
||||
If sExt = ".NGE" Then
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(FileI.Name, 3))
|
||||
End If
|
||||
Next
|
||||
' pulisco la vista
|
||||
ClearView()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function LoadDisks() As Boolean
|
||||
' dir corrente vuoto
|
||||
m_sCurrDir = ""
|
||||
' lo visualizzo
|
||||
FilePathTxBl.Content = m_sCurrDir
|
||||
' pulisco la lista
|
||||
m_MainWindow.m_OpenItemList.Clear()
|
||||
' elenco dei dischi
|
||||
Dim vDriI As DriveInfo() = DriveInfo.GetDrives()
|
||||
Dim DriI As DriveInfo
|
||||
For Each DriI In vDriI
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DriI.Name, 1))
|
||||
Next
|
||||
' pulisco la vista
|
||||
ClearView()
|
||||
Return True
|
||||
End Function
|
||||
Private Function LoadDisks() As Boolean
|
||||
' dir corrente vuoto
|
||||
m_sCurrDir = ""
|
||||
' lo visualizzo
|
||||
FilePathTxBl.Content = m_sCurrDir
|
||||
' pulisco la lista
|
||||
m_MainWindow.m_OpenItemList.Clear()
|
||||
' elenco dei dischi
|
||||
Dim vDriI As DriveInfo() = DriveInfo.GetDrives()
|
||||
Dim DriI As DriveInfo
|
||||
For Each DriI In vDriI
|
||||
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DriI.Name, 1))
|
||||
Next
|
||||
' pulisco la vista
|
||||
ClearView()
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub FileListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles FileListBox.PreviewMouseUp
|
||||
' Recupero item selezionato
|
||||
If FileListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
End If
|
||||
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
||||
Private Sub FileListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles FileListBox.PreviewMouseUp
|
||||
' Recupero item selezionato
|
||||
If FileListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
End If
|
||||
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
||||
|
||||
' A seconda del tipo
|
||||
Select Case vItems.PictureID
|
||||
Case 0 ' Vai nel direttorio padre
|
||||
m_sCurrDir = IO.Path.GetDirectoryName(m_sCurrDir)
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 1 ' Vai nella radice del disco
|
||||
m_sCurrDir = vItems.Name
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 2 ' Vai nel sottodirettorio
|
||||
m_sCurrDir = IO.Path.Combine(m_sCurrDir, vItems.Name)
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 3 ' File
|
||||
m_sCurrFile = vItems.Name
|
||||
LoadCurrFile()
|
||||
End Select
|
||||
' A seconda del tipo
|
||||
Select Case vItems.PictureID
|
||||
Case 0 ' Vai nel direttorio padre
|
||||
m_sCurrDir = IO.Path.GetDirectoryName(m_sCurrDir)
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 1 ' Vai nella radice del disco
|
||||
m_sCurrDir = vItems.Name
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 2 ' Vai nel sottodirettorio
|
||||
m_sCurrDir = IO.Path.Combine(m_sCurrDir, vItems.Name)
|
||||
m_sCurrFile = ""
|
||||
LoadCurrDir()
|
||||
Case 3 ' File
|
||||
m_sCurrFile = vItems.Name
|
||||
LoadCurrFile()
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Private Sub FileListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles FileListBox.SelectionChanged
|
||||
' Recupero item selezionato
|
||||
If FileListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
End If
|
||||
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
||||
Private Sub FileListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles FileListBox.SelectionChanged
|
||||
' Recupero item selezionato
|
||||
If FileListBox.SelectedItems.Count() = 0 Then
|
||||
Return
|
||||
End If
|
||||
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
||||
|
||||
' Gestisco solo aggiornamento visualizzazione file
|
||||
If vItems.PictureID = 3 Then
|
||||
m_sCurrFile = vItems.Name
|
||||
LoadCurrFile()
|
||||
End If
|
||||
End Sub
|
||||
' Gestisco solo aggiornamento visualizzazione file
|
||||
If vItems.PictureID = 3 Then
|
||||
m_sCurrFile = vItems.Name
|
||||
LoadCurrFile()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ClearView() As Boolean
|
||||
' Pulisco il DB geometrico locale
|
||||
EgtNewFile()
|
||||
' Eseguo zoom
|
||||
OpenScene.ZoomAll()
|
||||
' Cancello messaggio
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.Transparent
|
||||
OkBtn.IsEnabled = False
|
||||
m_bFileOk = False
|
||||
Return True
|
||||
End Function
|
||||
Private Function ClearView() As Boolean
|
||||
' Pulisco il DB geometrico locale
|
||||
EgtNewFile()
|
||||
' Eseguo zoom
|
||||
OpenScene.ZoomAll()
|
||||
' Cancello messaggio
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.Transparent
|
||||
OkBtn.IsEnabled = False
|
||||
m_bFileOk = False
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function LoadCurrFile() As Boolean
|
||||
' Pulisco il DB geometrico locale
|
||||
@@ -222,23 +222,49 @@ Public Class OpenPageUC
|
||||
' Formato sconosciuto
|
||||
bOk = False
|
||||
End If
|
||||
' Cerco contrassegno di progetto OmagCut
|
||||
' Cerco contrassegno di progetto OmagCut e flag di tagli ridotti
|
||||
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
|
||||
m_bFileOk = bOk And (nMarkId <> GDB_ID.NULL)
|
||||
Dim bMarkOk = (nMarkId <> GDB_ID.NULL)
|
||||
Dim nFileReducedCut As Integer = 1
|
||||
EgtGetInfo(nMarkId, INFO_REDUCEDCUT, nFileReducedCut)
|
||||
Dim nReducedCut As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 0, m_MainWindow.GetMachIniFile())
|
||||
Dim bReducedCutOk = (nFileReducedCut = 0) OrElse
|
||||
(nFileReducedCut <> 0 And nReducedCut <> 0) OrElse
|
||||
VerifyPartsNesting(False)
|
||||
m_bFileOk = bOk And bMarkOk And bReducedCutOk
|
||||
If m_bFileOk Then
|
||||
MessageTxBx.Text = ""
|
||||
MessageBrd.Background = Brushes.Transparent
|
||||
OkBtn.IsEnabled = True
|
||||
Else
|
||||
ElseIf Not bMarkOk Then
|
||||
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
|
||||
MessageBrd.Background = Brushes.Tomato
|
||||
OkBtn.IsEnabled = False
|
||||
Else
|
||||
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 2) 'Progetto con interferenze. Per caricarlo disabilita rispetto tagli completi.
|
||||
MessageBrd.Background = Brushes.Tomato
|
||||
OkBtn.IsEnabled = False
|
||||
End If
|
||||
' Eseguo zoom
|
||||
OpenScene.ZoomAll()
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Private Function VerifyPartsNesting(bReducedCut As Boolean) As Boolean
|
||||
' Recupero il grezzo
|
||||
Dim nRawId As Integer = EgtGetFirstRawPart()
|
||||
' Ciclo su tutti i pezzi in tavola
|
||||
Dim nPartId As Integer = EgtGetFirstGroupInGroup(nRawId)
|
||||
While nPartId <> GDB_ID.NULL
|
||||
If Not EgtVerifyPart(nPartId, bReducedCut, -10000, -10000, 10000, 10000) Then
|
||||
Return False
|
||||
End If
|
||||
nPartId = EgtGetNextGroup(nPartId)
|
||||
End While
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles OpenScene.OnMouseDownScene
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user