diff --git a/AlarmsPageUC.xaml b/AlarmsPageUC.xaml index af2bbf9..de34f29 100644 --- a/AlarmsPageUC.xaml +++ b/AlarmsPageUC.xaml @@ -64,6 +64,11 @@ + + + - - + + diff --git a/NestPageUC.xaml.vb b/NestPageUC.xaml.vb index 10a1688..19e3965 100644 --- a/NestPageUC.xaml.vb +++ b/NestPageUC.xaml.vb @@ -291,10 +291,8 @@ Public Class NestPageUC Public Function InsertOnePart(ByVal nId As Integer) As Boolean ' Se esiste grezzo e pezzo in parcheggio, lo metto nella tavola If m_CurrProjPage.m_nRawId <> GDB_ID.NULL AndAlso EgtIsPart(nId) Then - Dim ptPmin, ptPmax As Point3d - EgtGetBBoxGlob(nId, BBFLAG, ptPmin, ptPmax) - ptPmin.z = m_ptRawMax.z - EgtAddPartToRawPart(nId, ptPmin, m_nRawId) + Dim ptP As New Point3d(0, 0, m_ptRawMax.z - m_ptRawMin.z) + EgtAddPartToRawPart(nId, ptP, m_nRawId) If EgtPackPart(nId, m_ptRawMin.x + m_dKerf, m_ptRawMin.y + m_dKerf, m_ptRawMax.x - m_dKerf, m_ptRawMax.y - m_dKerf, m_dMinDist, True) Then Return True diff --git a/NumericKeyboardWD.xaml.vb b/NumericKeyboardWD.xaml.vb index 7094034..b3f868c 100644 --- a/NumericKeyboardWD.xaml.vb +++ b/NumericKeyboardWD.xaml.vb @@ -3,11 +3,12 @@ Imports EgtUILib Public Class NumericKeyboardWD - Dim MainWindowUC As MainWindow = Application.Current.MainWindow - Public m_CurrentTxBx As TextBox - Public m_CurrentLbl As String = String.Empty + Private MainWindowUC As MainWindow = Application.Current.MainWindow + Friend m_DoubleResult As Double = 0 + Friend m_CurrentTxBx As TextBox + Friend m_CurrentLbl As String = String.Empty Private m_sErrorString As String = String.Empty - Dim m_bErrorState As Boolean = False + Friend m_bErrorState As Boolean = False Private Sub NumericKeyboardWD_Initialized(sender As Object, e As EventArgs) m_sErrorString = EgtMsg(MSG_NUMERICKEYBOARDWD + 1) @@ -141,10 +142,9 @@ Public Class NumericKeyboardWD End Sub Private Sub Evaluate() - Dim DoubleResult As Double = 0 - Dim bOk As Boolean = EgtUILib.EgtLuaEvalNumExpr(NumericKeyboardWDTextBox.Text, DoubleResult) + Dim bOk As Boolean = EgtUILib.EgtLuaEvalNumExpr(NumericKeyboardWDTextBox.Text, m_DoubleResult) If bOk Then - NumericKeyboardWDTextBox.Text = DoubleResult.ToString(CultureInfo.InvariantCulture) + NumericKeyboardWDTextBox.Text = m_DoubleResult.ToString(CultureInfo.InvariantCulture) If m_bErrorState Then m_bErrorState = False NumericKeyboardWDTitle.Foreground = Brushes.Black diff --git a/RawPartPageUC.xaml.vb b/RawPartPageUC.xaml.vb index d0d39a7..de3ed15 100644 --- a/RawPartPageUC.xaml.vb +++ b/RawPartPageUC.xaml.vb @@ -299,81 +299,81 @@ Public Class RawPartPageUC End If End Function - Friend Sub UpdateRawPart() - ' Raccolgo i dati del grezzo rettangolare - Dim dLength As Double - If Not StringToDouble(LengthTxBx.Text, dLength) Or dLength < EPS_SMALL Then - Return - End If - m_RawLength = dLength - Dim dWidth As Double - If Not StringToDouble(WidthTxBx.Text, dWidth) Or dWidth < EPS_SMALL Then - Return - End If - m_RawWidth = dWidth - Dim dHeight As Double - If Not StringToDouble(HeightTxBx.Text, dHeight) Or dHeight < -EPS_ZERO Then - Return - End If - Dim bHeightModif As Boolean = (Math.Abs(dHeight - m_RawHeight) > EPS_SMALL) - m_RawHeight = dHeight - Dim dOffsetX As Double - If Not StringToDouble(OffsetXTxBx.Text, dOffsetX) Then - Return - End If - m_RawOffsX = dOffsetX - Dim dOffsetY As Double - If Not StringToDouble(OffsetYTxBx.Text, dOffsetY) Then - Return - End If - m_RawOffsY = dOffsetY - Dim dKerf As Double - If Not StringToDouble(KerfTxBx.Text, dKerf) Then - Return - End If - If dKerf < EPS_SMALL Then - dKerf = 0 - End If - m_RawKerf = dKerf - ' Se cambiato spessore e c'è foto, aggiorno quota fotografia - If bHeightModif And m_CurrProjPage.GetPhoto() <> GDB_ID.NULL Then - ' Aggiorno spessore in progetto corrente - m_CurrProjPage.m_dRawHeight = m_RawHeight - m_CurrProjPage.HeightTxBx.Text = DoubleToString(m_RawHeight, 2) - ' Ricarico fotografia - Dim sPath As String = String.Empty - EgtGetPhotoPath(m_CurrProjPage.GetPhoto(), sPath) - m_MainWindow.m_CadCutPageUC.PostPhoto(sPath) - End If - ' Se non esiste già il grezzo e richiesto, lo inserisco - Dim nRawId As Integer = EgtGetFirstRawPart() - If nRawId = GDB_ID.NULL And m_RawHeight > EPS_SMALL Then - ' recupero il colore - Dim Col As New Color3d(64, 192, 255, 40) - GetPrivateProfileColor(S_RAWPART, K_RAWCOLOR, Col, m_MainWindow.GetIniFile()) - ' in presenza di foto rendo molto più trasparente - If m_CurrProjPage.GetPhoto() <> GDB_ID.NULL Then - Col.A = 20 - End If - m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, - m_RawWidth + 2 * m_RawKerf, m_RawHeight - DELTAZ_RAW, Col) - ' se esiste e da cancellare - ElseIf m_RawHeight < EPS_SMALL Then - EgtRemoveRawPart(nRawId) - m_CurrProjPage.m_nRawId = GDB_ID.NULL - ' Altrimenti lo modifico - Else - m_CurrProjPage.m_nRawId = nRawId - EgtModifyRawPartSize(nRawId, m_RawLength + 2 * m_RawKerf, - m_RawWidth + 2 * m_RawKerf, m_RawHeight - DELTAZ_RAW) - End If - UpdateRawPartKerf() - ' Sistemo la posizione - Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrProjPage.m_dAddTable) - EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, ptRef, MCH_CR.BL) - ' Aggiorno visualizzazione - EgtZoom(ZM.ALL) - End Sub + Friend Sub UpdateRawPart() + ' Raccolgo i dati del grezzo rettangolare + Dim dLength As Double + If Not StringToDouble(LengthTxBx.Text, dLength) Or dLength < EPS_SMALL Then + Return + End If + m_RawLength = dLength + Dim dWidth As Double + If Not StringToDouble(WidthTxBx.Text, dWidth) Or dWidth < EPS_SMALL Then + Return + End If + m_RawWidth = dWidth + Dim dHeight As Double + If Not StringToDouble(HeightTxBx.Text, dHeight) Or dHeight < -EPS_ZERO Then + Return + End If + Dim bHeightModif As Boolean = (Math.Abs(dHeight - m_RawHeight) > EPS_SMALL) + m_RawHeight = dHeight + Dim dOffsetX As Double + If Not StringToDouble(OffsetXTxBx.Text, dOffsetX) Then + Return + End If + m_RawOffsX = dOffsetX + Dim dOffsetY As Double + If Not StringToDouble(OffsetYTxBx.Text, dOffsetY) Then + Return + End If + m_RawOffsY = dOffsetY + Dim dKerf As Double + If Not StringToDouble(KerfTxBx.Text, dKerf) Then + Return + End If + If dKerf < EPS_SMALL Then + dKerf = 0 + End If + m_RawKerf = dKerf + ' Se cambiato spessore e c'è foto, aggiorno quota fotografia + If bHeightModif And m_CurrProjPage.GetPhoto() <> GDB_ID.NULL Then + ' Aggiorno spessore in progetto corrente + m_CurrProjPage.m_dRawHeight = m_RawHeight + m_CurrProjPage.HeightTxBx.Text = DoubleToString(m_RawHeight, 2) + ' Ricarico fotografia + Dim sPath As String = String.Empty + EgtGetPhotoPath(m_CurrProjPage.GetPhoto(), sPath) + m_MainWindow.m_CadCutPageUC.PostPhoto(sPath) + End If + ' Recupero il colore + Dim Col As New Color3d(64, 192, 255, 40) + GetPrivateProfileColor(S_RAWPART, K_RAWCOLOR, Col, m_MainWindow.GetIniFile()) + ' in presenza di foto rendo molto più trasparente + If m_CurrProjPage.GetPhoto() <> GDB_ID.NULL Then + Col.A = 20 + End If + ' Se non esiste già il grezzo e richiesto, lo inserisco + Dim nRawId As Integer = EgtGetFirstRawPart() + If nRawId = GDB_ID.NULL And m_RawHeight > EPS_SMALL Then + m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, + m_RawWidth + 2 * m_RawKerf, m_RawHeight - DELTAZ_RAW, Col) + ' se esiste e da cancellare + ElseIf m_RawHeight < EPS_SMALL Then + EgtRemoveRawPart(nRawId) + m_CurrProjPage.m_nRawId = GDB_ID.NULL + ' Altrimenti lo modifico + Else + m_CurrProjPage.m_nRawId = nRawId + EgtModifyRawPart(nRawId, Point3d.ORIG(), m_RawLength + 2 * m_RawKerf, + m_RawWidth + 2 * m_RawKerf, m_RawHeight - DELTAZ_RAW, Col) + End If + UpdateRawPartKerf() + ' Sistemo la posizione + Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrProjPage.m_dAddTable) + EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, ptRef, MCH_CR.BL) + ' Aggiorno visualizzazione + EgtZoom(ZM.ALL) + End Sub Private Function UpdateRawPartKerf() As Boolean ' Se non c'è il grezzo, esco diff --git a/SimulationPageUC.xaml b/SimulationPageUC.xaml index fecf9f2..8258d2d 100644 --- a/SimulationPageUC.xaml +++ b/SimulationPageUC.xaml @@ -6,121 +6,119 @@ mc:Ignorable="d" d:DesignHeight="853.3" d:DesignWidth="1280" Initialized="SimulationPage_Initialized" Loaded="SimulationPage_Loaded"> - - - - + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - - - - - - - - + - + - + diff --git a/SimulationPageUC.xaml.vb b/SimulationPageUC.xaml.vb index 8894539..b4e489d 100644 --- a/SimulationPageUC.xaml.vb +++ b/SimulationPageUC.xaml.vb @@ -16,7 +16,7 @@ Public Class SimulationPageUC ' Stato bottone Play Private m_bPlay As Boolean = True - ' Coeeficiente per valore Slider + ' Coefficiente per valore Slider Private m_SliderX As Double = 1 Friend Sub ResetSimulation() @@ -71,6 +71,10 @@ Public Class SimulationPageUC ' Salvo il progetto con le lavorazioni Dim sMchPath As String = m_MainWindow.GetTempDir() & "\" & "MachProj.nge" m_CurrProjPage.SaveFile(sMchPath) + ' Nascondo eventuali pezzi in parcheggio + HideParkedParts() + ' Visualizzo tutta la macchina + EgtShowOnlyTable(False) ' Imposto vista 3d isometrica di tutto EgtSetView(VT.ISO_SE, False) EgtZoom(ZM.ALL) @@ -176,11 +180,16 @@ Public Class SimulationPageUC End Sub Private Sub ShowCncData() + ' Assi ShowAxisNameVal(0, L1NameTxBl.Text, L1ValueTxBl.Text) ShowAxisNameVal(1, L2NameTxBl.Text, L2ValueTxBl.Text) ShowAxisNameVal(2, L3NameTxBl.Text, L3ValueTxBl.Text) ShowAxisNameVal(3, R1NameTxBl.Text, R1ValueTxBl.Text) ShowAxisNameVal(4, R2NameTxBl.Text, R2ValueTxBl.Text) + ' Tipo di movimento e feed + ShowMoveTypeFeed() + ' Nome utensile e speed + ShowToolNameSpeed() End Sub Private Function ShowAxisNameVal(ByVal nInd As Integer, ByRef sName As String, ByRef sVal As String) As Boolean @@ -197,6 +206,39 @@ Public Class SimulationPageUC End If End Function + Private Function ShowMoveTypeFeed() As Boolean + Dim nG As Integer = 0 + Dim dFeed As Double = 0 + If EgtSimGetMoveInfo(nG, dFeed) Then + If nG <> 0 Then + GCodeTxBl.Text = "G" & nG.ToString() + FValueTxBl.Text = "F" & DoubleToString(dFeed, 0) + Else + GCodeTxBl.Text = "G" & nG.ToString() + FValueTxBl.Text = "" + End If + Return True + Else + GCodeTxBl.Text = "" + FValueTxBl.Text = "" + Return False + End If + End Function + + Private Function ShowToolNameSpeed() As Boolean + Dim sTool As String = String.Empty + Dim dSpeed As Double = 0 + If EgtSimGetToolInfo(sTool, dSpeed) Then + TNameTxBl.Text = sTool + SValueTxBl.Text = "S" & DoubleToString(dSpeed, 0) + Return True + Else + TNameTxBl.Text = "" + SValueTxBl.Text = "" + Return False + End If + End Function + Private Sub ExitBtnUC_Click(sender As Object, e As RoutedEventArgs) ' Mi assicuro di terminare la simulazione ResetSimulation() diff --git a/SingleCutUC.xaml b/SingleCutUC.xaml index 609ae52..687158d 100644 --- a/SingleCutUC.xaml +++ b/SingleCutUC.xaml @@ -41,6 +41,9 @@ HorizontalAlignment="Center" VerticalAlignment="Center" Width="75" TextAlignment="Center" Style="{StaticResource NumericKeyboard}" /> + +