diff --git a/CadCutPageUC.xaml.vb b/CadCutPageUC.xaml.vb index 974f81d..41bcb29 100644 --- a/CadCutPageUC.xaml.vb +++ b/CadCutPageUC.xaml.vb @@ -7,11 +7,11 @@ Public Class CadCutPageUC Private m_MainWindow As MainWindow = Application.Current.MainWindow 'Dichiarazione delle Page UserControl - Friend m_NestPage As NestPageUC + Friend WithEvents m_NestPage As NestPageUC Friend m_SplitPage As SplitPageUC 'Variabile che indica la modalità - Private m_bNesting As Boolean = False + Friend m_bNesting As Boolean = False Private Sub CadCutPage_Initialized(sender As Object, e As EventArgs) @@ -34,7 +34,6 @@ Public Class CadCutPageUC End Sub Private Sub CadCutPage_Loaded(sender As Object, e As RoutedEventArgs) - 'Seleziono UserControl di apertura CadCutPageGrid.Children.Add(m_NestPage) m_bNesting = True diff --git a/ConstIni.vb b/ConstIni.vb index b910521..9be2a6a 100644 --- a/ConstIni.vb +++ b/ConstIni.vb @@ -81,10 +81,19 @@ Module ConstIni Public Const K_FLPWINPLACE As String = "WinPlace" Public Const K_FLPCURRDIR As String = "CurrDir" + Public Const S_NEST As String = "Nest" + Public Const K_RAWCOLOR As String = "RawColor" + Public Const K_DIRECT As String = "Direct" + Public Const K_STEP As String = "Step" + Public Const S_MACH As String = "Mach" Public Const K_MACHINESDIR As String = "MachinesDir" Public Const K_CURRMACH As String = "CurrMach" + Public Const S_MATERIALS As String = "Materials" + Public Const K_CURRMATERIAL As String = "CurrMaterial" + Public Const K_MATERIAL As String = "Material" + Public Const S_MRUFILES As String = "MruFiles" Public Const S_MRUSCRIPTS As String = "MruScripts" Public Const K_FILE As String = "File" diff --git a/CurrentProjectPageUC.xaml.vb b/CurrentProjectPageUC.xaml.vb index f174d2d..6745b61 100644 --- a/CurrentProjectPageUC.xaml.vb +++ b/CurrentProjectPageUC.xaml.vb @@ -2,6 +2,11 @@ Public Class CurrentProjectPageUC + ' Dichiarazione eventi + Friend Event OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Friend Event OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + Friend Event OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + ' Riferimento alla MainWindow Private m_MainWindow As MainWindow = Application.Current.MainWindow @@ -118,34 +123,16 @@ Public Class CurrentProjectPageUC End Sub - Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene - ' Si può selezionare solo con il tasto sinistro e se stato NULL - If e.Button <> Windows.Forms.MouseButtons.Left Or Not CurrentProjectScene.IsStatusNull() Then - Return - End If - ' Verifico se selezionato indicativo di pezzo - EgtSetObjFilterForSelect(True, True, True, True, True) - Dim nSel As Integer - 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)) - If EgtIsPart(nPartId) Or EgtGetParent(nPartId) = m_nRawId Then - Dim nStat As Integer = GDB_ST.ON_ - EgtGetStatus(nPartId, nStat) - ' Se selezionato - If nStat = GDB_ST.SEL Then - ' Deseleziono - EgtDeselectObj(nPartId) - Else - EgtSelectObj(nPartId) - End If - EgtDraw() - Exit While - End If - nId = EgtGetNextObjInSelWin() - End While + Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseDownScene + RaiseEvent OnMouseDownScene(sender, e) + End Sub + + Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseMoveScene + RaiseEvent OnMouseMoveScene(sender, e) + End Sub + + Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles CurrentProjectScene.OnMouseUpScene + RaiseEvent OnMouseUpScene(sender, e) End Sub End Class diff --git a/DrawPageUC.xaml.vb b/DrawPageUC.xaml.vb index 1525e25..f7a9910 100644 --- a/DrawPageUC.xaml.vb +++ b/DrawPageUC.xaml.vb @@ -303,7 +303,9 @@ Public Class DrawPageUC End Function Private Function MakeInsert(ByVal nNbr As Integer) As Boolean - ' recupero dimensioni del grezzo + ' Recupero flag per inserimento diretto in grezzo o in parcheggio + Dim bDirect As Boolean = GetPrivateProfileInt(S_NEST, K_DIRECT, 0, m_MainWindow.GetIniFile()) <> 0 + ' Recupero dimensioni del grezzo Dim nRawId As Integer = EgtGetFirstRawPart() Dim ptMin, ptMax As Point3d Dim nFlag As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM @@ -327,14 +329,19 @@ Public Class DrawPageUC End If ' Ne recupero l'Id Dim nId2 As Integer = EgtGetLastPart() - ' Lo posiziono in ordine - Dim ptPmin, ptPmax As Point3d - EgtGetBBoxGlob(nId2, nFlag, ptPmin, ptPmax) - ptPmin.z = ptMax.z - EgtAddPartToRawPart(nId2, ptPmin, nRawId) - If Not EgtPackPart(nId2, ptMin.x, ptMin.y, ptMax.x, ptMax.y, 4, True) Then - EgtRemovePartFromRawPart(nId2) - EgtSetStatus(nId2, GDB_ST.ON_) + ' Se richiesto posizionamento diretto nel grezzo + If bDirect Then + Dim ptPmin, ptPmax As Point3d + EgtGetBBoxGlob(nId2, nFlag, ptPmin, ptPmax) + ptPmin.z = ptMax.z + EgtAddPartToRawPart(nId2, ptPmin, nRawId) + If Not EgtPackPart(nId2, ptMin.x, ptMin.y, ptMax.x, ptMax.y, 4, True) Then + EgtRemovePartFromRawPart(nId2) + EgtSetStatus(nId2, GDB_ST.ON_) + EgtPackPart(nId2, -5000, -INFINITO, 1000, -3000, 20, False) + End If + ' Altrimenti lo posiziono in parcheggio + Else EgtPackPart(nId2, -5000, -INFINITO, 1000, -3000, 20, False) End If Next @@ -402,20 +409,18 @@ Public Class DrawPageUC 'End Sub Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click - ' se errore esco If Not m_bDrawOk Then Return End If ' Leggo numero di pezzi da inserire - 'Dim InsNbr As Integer = tbNbr.Text + Dim InsNbr As Integer = Int32.Parse(PartNumTxBx.Text) ' Passo al contesto principale EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx()) ' Inserisco il componente nel DB geometrico principale - MakeInsert(Int32.Parse(PartNumTxBx.Text)) + MakeInsert(InsNbr) ' Aggiorno ambiente principale EgtZoom(ZM.ALL) - 'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_DrawPageUC) m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC) diff --git a/ImportPageUC.xaml.vb b/ImportPageUC.xaml.vb index 88df559..4026354 100644 --- a/ImportPageUC.xaml.vb +++ b/ImportPageUC.xaml.vb @@ -338,6 +338,8 @@ Public Class ImportPageUC End Sub Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click + ' Recupero flag per inserimento diretto in grezzo o in parcheggio + Dim bDirect As Boolean = GetPrivateProfileInt(S_NEST, K_DIRECT, 0, m_MainWindow.GetIniFile()) <> 0 ' Vettore nomi file temporanei Dim sTmpFiles As New ArrayList() ' Ciclo di salvataggio dei pezzi @@ -368,14 +370,19 @@ Public Class ImportPageUC EgtInsertFile(sTmpfile) ' Ne recupero l'Id Dim nId2 As Integer = EgtGetLastPart() - ' Lo posiziono in ordine - Dim ptPmin, ptPmax As Point3d - EgtGetBBoxGlob(nId2, nFlag, ptPmin, ptPmax) - ptPmin.z = ptMax.z - EgtAddPartToRawPart(nId2, ptPmin, nRawId) - If Not EgtPackPart(nId2, ptMin.x, ptMin.y, ptMax.x, ptMax.y, 4, True) Then - EgtRemovePartFromRawPart(nId2) - EgtSetStatus(nId2, GDB_ST.ON_) + ' Se richiesto posizionamento diretto nel grezzo + If bDirect Then + Dim ptPmin, ptPmax As Point3d + EgtGetBBoxGlob(nId2, nFlag, ptPmin, ptPmax) + ptPmin.z = ptMax.z + EgtAddPartToRawPart(nId2, ptPmin, nRawId) + If Not EgtPackPart(nId2, ptMin.x, ptMin.y, ptMax.x, ptMax.y, 4, True) Then + EgtRemovePartFromRawPart(nId2) + EgtSetStatus(nId2, GDB_ST.ON_) + EgtPackPart(nId2, -5000, -INFINITO, 1000, -3000, 20, False) + End If + ' Altrimenti lo posiziono in parcheggio + Else EgtPackPart(nId2, -5000, -INFINITO, 1000, -3000, 20, False) End If ' Cancello il file diff --git a/MachineStatusUC.xaml b/MachineStatusUC.xaml index 1c31cfb..a6cd711 100644 --- a/MachineStatusUC.xaml +++ b/MachineStatusUC.xaml @@ -7,7 +7,7 @@ d:DesignHeight="85.3" d:DesignWidth="1280" Initialized="MachineStatus_Initialized"> - + diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 7ac75e7..406736e 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -192,7 +192,7 @@ Class MainWindow 'Leggo lista materiali da file ini Dim index As Integer = 1 Dim sMaterial As String = String.Empty - While GetPrivateProfileString("Materials", "Material" & index, "", sMaterial, GetIniFile) > 0 + While GetPrivateProfileString(S_MATERIALS, K_MATERIAL & index, "", sMaterial, GetIniFile) > 0 Dim cMaterial As New Material(sMaterial) m_MaterialsList.Add(cMaterial) index += 1 @@ -200,7 +200,7 @@ Class MainWindow 'Leggo materiale corrent da file ini Dim sCurrentMaterial As String = String.Empty - GetPrivateProfileString("Materials", "CurrMaterial", "", sCurrentMaterial, GetIniFile) + GetPrivateProfileString(S_MATERIALS, K_CURRMATERIAL, "", sCurrentMaterial, GetIniFile) For i As Integer = 0 To m_MaterialsList.Count - 1 If sCurrentMaterial = m_MaterialsList(i).Name Then m_nCurrentMaterial = i @@ -607,7 +607,7 @@ Class MainWindow Private Sub MainWindow_Unloaded(sender As Object, e As RoutedEventArgs) If m_nCurrentMaterial >= 0 And m_nCurrentMaterial < m_MaterialsList.Count() Then - WritePrivateProfileString("Materials", "CurrMaterial", m_MaterialsList(m_nCurrentMaterial).Name, GetIniFile()) + WritePrivateProfileString(S_MATERIALS, K_CURRMATERIAL, m_MaterialsList(m_nCurrentMaterial).Name, GetIniFile()) End If ' Terminazione generale di EgtInterface EgtExit() diff --git a/NestPageUC.xaml b/NestPageUC.xaml index 105a4d1..f63cade 100644 --- a/NestPageUC.xaml +++ b/NestPageUC.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" - d:DesignHeight="853.3" d:DesignWidth="256" Initialized="NestPage_Initialized"> + d:DesignHeight="853.3" d:DesignWidth="256" Initialized="NestPage_Initialized" Loaded="NestPage_Loaded" Unloaded="NestPage_Unloaded"> @@ -24,10 +24,9 @@ - - + @@ -67,7 +66,17 @@ VerticalAlignment="Center" /> - + + + + + + + @@ -76,7 +85,7 @@ -