diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index f967e0d..58e38a6 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -116,6 +116,8 @@ Module ConstIni Public Const K_LASTCOLOR As String = "LastColor" Public Const K_COLOR As String = "Color" + Public Const S_FRAMECOMPO As String = "FrameCompo" + Public Const S_EXTCOMPO As String = "Compo" Public Const S_INTCOMPO As String = "InternalCompo" @@ -223,6 +225,12 @@ Module ConstIni Public Const K_RAWOFFSX As String = "OffsX" Public Const K_RAWOFFSY As String = "OffsY" Public Const K_RAWKERF As String = "Kerf" + Public Const K_ENABLEOTHERREFTAB As String = "EnableOtherRefTab" + Public Const K_OTHERREFTAB As String = "OtherRefTab" + Public Const K_OTHERREFTABX As String = "OtherRefTabX" + Public Const K_OTHERREFTABY As String = "OtherRefTabY" + Public Const K_OTHERREFTABPOS As String = "OtherRefTabPos" + Public Const S_RAWMOVE As String = "RawMove" Public Const K_RAWSTEP As String = "Step" diff --git a/DirectCuts/ControlsMachineButtonUC.xaml.vb b/DirectCuts/ControlsMachineButtonUC.xaml.vb index 0c75611..19d7587 100644 --- a/DirectCuts/ControlsMachineButtonUC.xaml.vb +++ b/DirectCuts/ControlsMachineButtonUC.xaml.vb @@ -683,6 +683,17 @@ Public MustInherit Class MachineButton End If EgtLuaSetGlobNumVar("CMD.S", dSpeed) + ' versione 2.5e1 + EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text) + Dim sToolPos As String = String.Empty + If EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sToolPos) Then + EgtLuaGetGlobStringVar("CMD.TCPOS", sToolPos) + End If + Dim dToolDiam As Double = 0 + If EgtTdbGetCurrToolParam(MCH_TP.DIAM, dToolDiam) Then + EgtLuaSetGlobNumVar("CMD.DIAM", dToolDiam * 1000) + End If + Dim dL1, dL2, dL3, dR1, dR2 As Double m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) EgtLuaSetGlobNumVar("CMD.L1", dL1) diff --git a/DirectCuts/FlatteningCut.xaml.vb b/DirectCuts/FlatteningCut.xaml.vb index 3ecd661..bec8c15 100644 --- a/DirectCuts/FlatteningCut.xaml.vb +++ b/DirectCuts/FlatteningCut.xaml.vb @@ -186,7 +186,10 @@ Public Class FlatteningCut WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_MACHTYPE, m_nMachType.ToString(), m_MainWindow.GetIniFile()) WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_ROTLOCK, If( m_bRotLock, "1", "0"), m_MainWindow.GetIniFile()) WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_POSX, DoubleToString( m_ptTipP1.x, 2), m_MainWindow.GetIniFile()) - WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_POSY, DoubleToString( m_ptTipP1.y, 2), m_MainWindow.GetIniFile()) + WritePrivateProfileString(S_DIRECTCUTS, K_DC_FLATT_POSY, DoubleToString(m_ptTipP1.y, 2), m_MainWindow.GetIniFile()) + ' imposto la Z di sicurezza corretta + EgtMdbSetGeneralParam(MCH_GP.SAFEZ, DirectCutPageUC.m_dZSafe) + EgtMdbSave() ' Se non vado in simulazione If Not m_bSimul Then ' Dichiaro sottopagina da non riattivare diff --git a/DirectCuts/MachineButtonsUC.xaml.vb b/DirectCuts/MachineButtonsUC.xaml.vb index c60c413..f5c6827 100644 --- a/DirectCuts/MachineButtonsUC.xaml.vb +++ b/DirectCuts/MachineButtonsUC.xaml.vb @@ -380,6 +380,17 @@ Public Class MachineButtonsUC EgtTdbGetCurrToolParam(MCH_TP.SPEED, dSpeed) End If EgtLuaSetGlobNumVar("CMD.S", dSpeed) + ' versione 2.5e1 + EgtTdbSetCurrTool(m_MainWindow.m_CurrentProjectPageUC.ToolTxBx.Text) + Dim sToolPos As String = String.Empty + If EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sToolPos) Then + EgtLuaGetGlobStringVar("CMD.TCPOS", sToolPos) + End If + Dim dToolDiam As Double = 0 + If EgtTdbGetCurrToolParam(MCH_TP.DIAM, dToolDiam) Then + EgtLuaSetGlobNumVar("CMD.DIAM", dToolDiam * 1000) + End If + Dim dL1, dL2, dL3, dR1, dR2 As Double m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2) EgtLuaSetGlobNumVar("CMD.L1", dL1) diff --git a/DrawImport/CompoDimensionUC.xaml.vb b/DrawImport/CompoDimensionUC.xaml.vb index 8b220e8..edd3dcc 100644 --- a/DrawImport/CompoDimensionUC.xaml.vb +++ b/DrawImport/CompoDimensionUC.xaml.vb @@ -37,7 +37,7 @@ Public Class CompoDimensionUC InternComponentBtn.Content = EgtMsg(MSG_COMPONENTPAGEUC + 47) ' Componenti interni If Not String.IsNullOrEmpty(sCompoDir) Then bEnableAlzFront = True - AlzFrontBtn.Content = "Alzatine & Frontalini" + AlzFrontBtn.Content = EgtMsg(91137) Else AlzFrontBtn.Visibility = Visibility.Collapsed End If @@ -107,8 +107,10 @@ Public Class CompoDimensionUC Friend Sub ShowAlzFrontBtn(ByVal value As Boolean) If value Then AlzFrontBtn.Visibility = Visibility.Visible + m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Visibility.Hidden Else AlzFrontBtn.Visibility = Visibility.Hidden + m_MainWindow.m_DrawPageUC.MessageGrid.Visibility = Visibility.Visible End If End Sub diff --git a/DrawImport/DrawPageUC.xaml.vb b/DrawImport/DrawPageUC.xaml.vb index 07eeff8..ea50b56 100644 --- a/DrawImport/DrawPageUC.xaml.vb +++ b/DrawImport/DrawPageUC.xaml.vb @@ -283,6 +283,19 @@ Public Class DrawPageUC m_sCsvOrder = "" m_sCsvList = "" m_sCsvName = "" + + ' Visuliazzazione dei bottoni per modifica dei componenti + If m_MainWindow.FrameCutBtn.IsChecked Then + SideAngleBtn.Visibility = Visibility.Hidden + FiloTopBtn.Visibility = Visibility.Hidden + EngraveBtn.Visibility = Visibility.Hidden + DripCutBtn.Visibility = Visibility.Hidden + Else + SideAngleBtn.Visibility = Visibility.Visible + FiloTopBtn.Visibility = Visibility.Visible + EngraveBtn.Visibility = Visibility.Visible + DripCutBtn.Visibility = Visibility.Visible + End If End Sub ' recupero il click sulla scena ed assegno il metodo a secondo della pagina aperta @@ -553,6 +566,7 @@ Public Class DrawPageUC OkBtn.IsEnabled = True End Sub + ' Navigazione nelle due pagine per la selezione dei componenti da disegnare Friend Sub BackBtn_Click(sender As Object, e As RoutedEventArgs) Handles BackBtn.Click m_SceneButtons.MeasureBtn.IsChecked = False DrawPage_Unloaded(sender, e) @@ -1124,6 +1138,30 @@ Public Class DrawPageUC Return True End Function + Private Function MakeSectionFrameInsert() As Boolean + ' m_MainWindow.m_ImportPageUC.LoadFrame() + ' recupero il primo layer del primo pezzo + Dim nLayerId As Integer = EgtGetFirstLayer(EgtGetFirstPart()) + If nLayerId = GDB_ID.NULL Then Return False + ' percorso in cui salvare tempora + Dim sTmpFile As String = m_MainWindow.GetTempDir() & "\Frame.Nge" + If Not EgtSaveObjToFile(nLayerId, sTmpFile, NGE.BIN) Then Return False + ' Passo al contesto principale + EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx()) + ' Inserisco il pezzo + If Not My.Computer.FileSystem.FileExists(sTmpFile) Then Return False + EgtInsertFile(sTmpFile) + ' Ne recupero l'Id + Dim nPartId As Integer = EgtGetLastPart() + ' Creo la cornice + m_MainWindow.m_FrameCutPageUC.CreateFrame(nPartId) + ' Ricalcolo lavorazioni + AddFrameMachinings(m_MainWindow.m_FrameCutPageUC.m_FrameMachiningUC.m_dStartTrim, m_MainWindow.m_FrameCutPageUC.m_FrameMachiningUC.m_dEndTrim) + ' Cancello il file + My.Computer.FileSystem.DeleteFile(sTmpFile) + Return True + End Function + Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click m_bBackFromInternalCompo = False m_bInternalCompo = False @@ -1139,7 +1177,12 @@ Public Class DrawPageUC Dim InsNbr As Integer = Int32.Parse(PartNumTxBx.Text) ' Passo al contesto principale 'MakeInsert(InsNbr, sPartName) - MakeMultipleInsert(InsNbr, sPartName) + If m_MainWindow.FrameCutBtn.IsChecked Then + MakeSectionFrameInsert() + Else + MakeMultipleInsert(InsNbr, sPartName) + End If + ' Aggiorno ambiente principale EgtZoom(ZM.ALL) ' Elimino nome del componente precedente @@ -1153,7 +1196,7 @@ Public Class DrawPageUC ' 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) - m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut + m_MainWindow.m_ActivePage = If(m_MainWindow.FrameCutBtn.IsChecked, MainWindow.Pages.FrameCut, MainWindow.Pages.CadCut) End Sub @@ -1174,7 +1217,7 @@ Public Class DrawPageUC ' 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) - m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut + m_MainWindow.m_ActivePage = If(m_MainWindow.FrameCutBtn.IsChecked, MainWindow.Pages.FrameCut, MainWindow.Pages.CadCut) End Sub Private Sub TrfDataBtn_Click(sender As Object, e As RoutedEventArgs) Handles TrfDataBtn.Click diff --git a/DrawImport/FiloTopUC.xaml.vb b/DrawImport/FiloTopUC.xaml.vb index bb4da9b..2c3bf6f 100644 --- a/DrawImport/FiloTopUC.xaml.vb +++ b/DrawImport/FiloTopUC.xaml.vb @@ -39,7 +39,8 @@ Public Class FiloTopUC ' Imposto messaggi ParameterTxBl.Text = EgtMsg( MSG_IMPORTPAGEUC + 10) ' Offset - Parameter2TxBl.Text = EgtMsg( MSG_IMPORTPAGEUC + 11) ' Affondamento + Parameter2TxBl.Text = EgtMsg(MSG_IMPORTPAGEUC + 11) ' Affondamento + Parameter3TxBl.Text = EgtMsg(91138) If m_CallingPage = MainWindow.Pages.Draw Then ' Imposto questa come pagina correntemente visualizzata nella drawpage diff --git a/DrawImport/MainComponentPageUC.xaml.vb b/DrawImport/MainComponentPageUC.xaml.vb index 35e769a..1026925 100644 --- a/DrawImport/MainComponentPageUC.xaml.vb +++ b/DrawImport/MainComponentPageUC.xaml.vb @@ -41,6 +41,7 @@ Public Class MainComponentPageUC m_MainWindow.m_DrawPageUC.FiloTopBtn.IsEnabled = False m_MainWindow.m_DrawPageUC.EngraveBtn.IsEnabled = False m_MainWindow.m_DrawPageUC.DripCutBtn.IsEnabled = False + m_MainWindow.m_DrawPageUC.m_bBackFromInternalCompo = False End Sub Private Function GetButton(ByVal nInd As Integer) As Button @@ -167,7 +168,7 @@ Public Class MainComponentPageUC Private Sub Compo_Click(sender As Object, e As RoutedEventArgs) Handles Compo1.Click, Compo2.Click, Compo3.Click, Compo4.Click, Compo5.Click, Compo6.Click, Compo7.Click, Compo8.Click CurrentBtn = DirectCast(e.Source, Button) - Dim CompoName As String = S_COMPO & GetIndexFromButton(CurrentBtn).ToString + Dim CompoName As String = If(m_MainWindow.FrameCutBtn.IsChecked, S_FRAMECOMPO, S_COMPO) & GetIndexFromButton(CurrentBtn).ToString m_sCurrCompoFam = CompoName m_SecondaryComponentPage.m_sCurrCompo = String.Empty Dim nCount As Integer = GetPrivateProfileInt(CompoName, K_CMP_COUNT, 0, m_MainWindow.GetIniFile()) @@ -251,13 +252,18 @@ Public Class MainComponentPageUC End Sub Private Sub LoadPage() + If m_MainWindow.FrameCutBtn.IsChecked Then + LoadFramePage() + Return + End If + Dim nDeltaSecondPage As Integer = 8 ' Leggo numero di componenti presenti Dim nCompoNumber As Integer = GetPrivateProfileInt(S_COMPO, K_CMP_COUNT, 0, m_MainWindow.GetIniFile()) ' Calcolo indici a seconda della pagina in cui sono If m_bIsFirstPage Then ClearButton(nCompoNumber) - nDeltaSecondPage = 0 + nDeltaSecondPage = 0 Else ClearButton(nCompoNumber) nDeltaSecondPage = 8 @@ -325,16 +331,86 @@ Public Class MainComponentPageUC End Sub + Private Sub LoadFramePage() + Dim nDeltaSecondPage As Integer = 8 + ' Leggo numero di componenti presenti + Dim nCompoNumber As Integer = GetPrivateProfileInt(S_FRAMECOMPO, K_CMP_COUNT, 0, m_MainWindow.GetIniFile()) + ' Calcolo indici a seconda della pagina in cui sono + If m_bIsFirstPage Then + ClearButton(nCompoNumber) + nDeltaSecondPage = 0 + Else + ClearButton(nCompoNumber) + nDeltaSecondPage = 8 + End If + + ' Creazione converter da String a ImageSource + Dim ImageConverter As New ImageSourceConverter + Dim ThicknessConverter As New ThicknessConverter + + 'Assegnazione immagine e testo ai Button + For index As Integer = 1 To 8 + Dim CustomThickness As New Thickness(0) + Dim nCompoName As Integer = GetPrivateProfileInt(S_FRAMECOMPO & index + nDeltaSecondPage, "Name", 0, m_MainWindow.GetIniFile()) + Dim sCompoImage As String = "" + Dim sCompoImageSource As ImageSource + + 'verifico presenza immagine e la aggiungo + If GetPrivateProfileString(S_FRAMECOMPO & index + nDeltaSecondPage, "Image", "", sCompoImage, m_MainWindow.GetIniFile()) <> 0 Then + Try + sCompoImageSource = ImageConverter.ConvertFromString(m_MainWindow.GetResourcesDir() & "\" & sCompoImage) + GetImage(index).Height = 65 + GetImage(index).Width = 65 + GetImage(index).Source = sCompoImageSource + Catch ex As Exception + EgtOutLog("Error loading image " & sCompoImage) + sCompoImage = String.Empty + GetImage(index).Height = 0 + GetImage(index).Width = 0 + CustomThickness.Right = 0 + GetImage(index).Margin = CustomThickness + End Try + Else + 'Se non c'è l'immagine azzero la distanza tra testo e immagine + CustomThickness.Right = 0 + GetImage(index).Margin = CustomThickness + End If + + 'verifico presenza testo + If nCompoName > 0 Then + Dim sCompoName As String = EgtMsg(MSG_COMPONENTPAGEUC + nCompoName) + 'verifico presenza immagine + If sCompoImage.Length > 0 Then + 'se la lunghezza del testo è maggiore di 15 lo taglio + If sCompoName.Length > 15 Then + sCompoName = sCompoName.Substring(0, 15) + End If + GetLabel(index).Text = sCompoName + 'Se ci sono sia testo che immagine imposto un margine di 10 + CustomThickness.Right = 10 + GetImage(index).Margin = CustomThickness + Else + 'se l'immagine non c'è e il testo è maggiore di 20 lo taglio + If sCompoName.Length > 20 Then + sCompoName = sCompoName.Substring(0, 20) + End If + GetLabel(index).Text = sCompoName + End If + Else + 'Se non c'è testo azzero la distanza tra testo e immagine + CustomThickness.Right = 0 + GetImage(index).Margin = CustomThickness + End If + + Next + + End Sub + ' Gestione bottone altri componenti Private Sub Compo9_Click(sender As Object, e As RoutedEventArgs) Handles Compo9.Click If m_bIsFirstPage Then m_bIsFirstPage = False LoadPage() - 'Compo9.SetValue(Grid.ColumnProperty, 1) - 'Compo9.SetValue(Grid.ColumnSpanProperty, 1) - 'ImageCompo9.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri("/Resources/NumericKeyboardArrow.png", UriKind.Relative)) - 'ImageCompo9.Visibility = Windows.Visibility.Visible - 'LabelCompo9.Visibility = Windows.Visibility.Hidden Compo9.SetValue(Grid.ColumnProperty, 0) Compo9.SetValue(Grid.ColumnSpanProperty, 2) ImageCompo9.Visibility = Windows.Visibility.Hidden diff --git a/Frames/FrameCutPageUC.xaml b/Frames/FrameCutPageUC.xaml index f08c171..e54fe50 100644 --- a/Frames/FrameCutPageUC.xaml +++ b/Frames/FrameCutPageUC.xaml @@ -7,124 +7,132 @@ mc:Ignorable="d" d:DesignHeight="853.3" d:DesignWidth="1280"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - + + + - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + - + + + diff --git a/Frames/FrameCutPageUC.xaml.vb b/Frames/FrameCutPageUC.xaml.vb index d4195b8..64efaf9 100644 --- a/Frames/FrameCutPageUC.xaml.vb +++ b/Frames/FrameCutPageUC.xaml.vb @@ -81,6 +81,8 @@ Public Class FrameCutPageUC m_ProjectMgr.CSVBtn.Visibility = Windows.Visibility.Hidden m_ProjectMgr.VeinMatchingBtn.Visibility = Windows.Visibility.Hidden m_ProjectMgr.RegisterBtn.Visibility = Windows.Visibility.Hidden + ' Visualizzo il bottone per l'importazione dei compo frame + CompoBtn.Visibility = If(GetPrivateProfileInt(S_FRAMECOMPO, K_CMP_COUNT, 0, m_MainWindow.GetIniFile()) > 0, Visibility.Visible, Visibility.Hidden) ' Recupero dimensioni e kerf del grezzo m_nRawId = EgtGetFirstRawPart() GetRawBox(m_RawBox) @@ -436,6 +438,16 @@ Public Class FrameCutPageUC End If End Sub + Private Sub CompoBtn_Click(sender As Object, e As RoutedEventArgs) Handles CompoBtn.Click + m_MainWindow.TestOff() + m_MainWindow.DragRettangleOff() + m_MainWindow.SplitCurvWJOff() + m_MainWindow.StartCurvWJOff() + m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC) + m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_DrawPageUC) + m_MainWindow.m_ActivePage = MainWindow.Pages.Draw + End Sub + Friend Function CreateFrame(nPartId As Integer) As Boolean If Not MyCreateFrame( nPartId) Then EgtErase( nPartId) diff --git a/Machine/AlarmsPageUC.xaml.vb b/Machine/AlarmsPageUC.xaml.vb index 0062d9f..94a1d16 100644 --- a/Machine/AlarmsPageUC.xaml.vb +++ b/Machine/AlarmsPageUC.xaml.vb @@ -1189,6 +1189,12 @@ Public Class AlarmsPageUC EgtLuaSetGlobNumVar("CMD.THICK", dToolThick * 1000) EgtTdbGetCurrToolParam(MCH_TP.LEN, dToolLen) EgtLuaSetGlobNumVar("CMD.LENGTH", dToolLen * 1000) + ' Nuova varibile per gestione tastatura utensili Frankfurt (Polishing) + Dim nType As Integer + EgtTdbGetCurrToolParam(MCH_TP.TYPE, nType) + If m_CurrentMachine.bPolishingWheel AndAlso nType = MCH_TY.MILL_POLISHING Then + EgtLuaSetGlobStringVar("CMD.POLISHING", "1") + End If EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches()) EgtLuaCallFunction("CMD.CmdString") ' Leggo variabili diff --git a/Machine/PolishingsPageUC.xaml.vb b/Machine/PolishingsPageUC.xaml.vb index d2f9c98..90e78f5 100644 --- a/Machine/PolishingsPageUC.xaml.vb +++ b/Machine/PolishingsPageUC.xaml.vb @@ -61,8 +61,8 @@ Public Class PolishingsPageUC RepeatTxBl.Text = EgtMsg(91093) ' Ripetizioni StepTxBl.Text = EgtMsg(90787) ' Passo OffSetTxBl.Text = EgtMsg(91089) ' Offset - RadiusTxBl.Text = "Raggio" - DistanceTxBl.Text = "Distanza" + RadiusTxBl.Text = EgtMsg(91139) ' Raggio + DistanceTxBl.Text = EgtMsg(91140) ' Distanza LiLoGpBx.Header = EgtMsg(91094) ' Attacco/Uscita LiLenTxBl.Text = EgtMsg(91097) ' Lunghezza LiHeightTxBl.Text = EgtMsg(91095) ' Altezza diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb index 604b116..f4079ff 100644 --- a/MainWindow.xaml.vb +++ b/MainWindow.xaml.vb @@ -328,8 +328,8 @@ Class MainWindow ' Verifico abilitazione nesting automatico m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey) ' Recupero opzioni della chiave - Dim bKey As Boolean = EgtGetKeyLevel(9423, 2504, 1, m_nKeyLevel) And - EgtGetKeyOptions(9423, 2504, 1, m_nKeyOptions) + Dim bKey As Boolean = EgtGetKeyLevel(9423, 2505, 1, m_nKeyLevel) And + EgtGetKeyOptions(9423, 2505, 1, m_nKeyOptions) ' Verifico abilitazione prodotto Dim bProd As Boolean = GetKeyOption(KEY_OPT.CUT_BASE) ' Inizializzazione generale di EgtInterface diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 8259ae7..3ff3127 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -62,5 +62,5 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index 67d9d3a..ae8414c 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -245,6 +245,9 @@ CicloStartWD.xaml + + OtherRefTabWD.xaml + SlabIdWD.xaml @@ -519,6 +522,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -1330,6 +1337,9 @@ + + + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe diff --git a/OmagCUTDarkDictionary.xaml b/OmagCUTDarkDictionary.xaml index 117213d..09a91d1 100644 --- a/OmagCUTDarkDictionary.xaml +++ b/OmagCUTDarkDictionary.xaml @@ -32,6 +32,7 @@ + diff --git a/OmagCUTDictionary.xaml b/OmagCUTDictionary.xaml index 2506d46..49d1b50 100644 --- a/OmagCUTDictionary.xaml +++ b/OmagCUTDictionary.xaml @@ -102,6 +102,7 @@ + diff --git a/RawPhoto/OtherRefTabWD.xaml b/RawPhoto/OtherRefTabWD.xaml new file mode 100644 index 0000000..c0e1502 --- /dev/null +++ b/RawPhoto/OtherRefTabWD.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RawPhoto/OtherRefTabWD.xaml.vb b/RawPhoto/OtherRefTabWD.xaml.vb new file mode 100644 index 0000000..a2a8f51 --- /dev/null +++ b/RawPhoto/OtherRefTabWD.xaml.vb @@ -0,0 +1,108 @@ +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib + +Public Class OtherRefTabWD + Dim m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + Dim m_RawPartPage As RawPartPageUC + + Private m_sPosX As String = "0" + Private m_sPosY As String = "0" + + Private m_dPrevOffsetX As Double = 0 + Private m_dPrevOffsetY As Double = 0 + + Private m_SelIndex As Integer = 0 + + Sub New(Owner As Window, PosX As String, PosY As String, OffsetX As Double, OffsetY As Double, OtherRefMode As Integer) + Me.Owner = Owner + ' La chiamata è richiesta dalla finestra di progettazione. + InitializeComponent() + + ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). + m_sPosX = PosX + m_sPosY = PosY + m_dPrevOffsetX = OffsetX + m_dPrevOffsetY = OffsetY + m_SelIndex = OtherRefMode + End Sub + + Private Sub OtherRrefTabWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + ' costruisco il riferimento alla pagina Raw + m_RawPartPage = m_MainWindow.m_RawPartPage + ' posiziono la finestra + Me.Top = Owner.Top + Owner.Height / 4 - Me.Height / 2 + Me.Left = Owner.Left + Owner.Width / 6 - Me.Width / 2 + RefRawTxbl.Text = "Raw reference" + RefTabXTxbl.Text = "Position X" + RefTabYTxbl.Text = "Position Y" + RefTabModeCmBx.ItemsSource = m_RawPartPage.m_OtherRefTabList + RefTabModeCmBx.SelectedIndex = m_RawPartPage.m_OtherRefTabPos + End Sub + + Private Sub OtherRrefTabWD_Load(sender As Object, e As EventArgs) Handles Me.Loaded + RefTabXTxBx.Text = m_sPosX + RefTabYTxBx.Text = m_sPosY + End Sub + + Private Sub RefTabModeCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles RefTabModeCmBx.SelectionChanged + m_RawPartPage.m_OtherRefTabPos = RefTabModeCmBx.SelectedIndex + WritePrivateProfileString(S_RAWPART, K_OTHERREFTABPOS, m_RawPartPage.m_OtherRefTabPos.ToString, m_MainWindow.GetIniFile()) + m_RawPartPage.RefTabModeChange() + End Sub + + Private Sub RefTabXTxBx_EgtClosed(sender As Object, e As EventArgs) Handles RefTabXTxBx.EgtClosed + Dim ptMin, ptMax As Point3d + If EgtGetTableArea(1, ptMin, ptMax) Then + Dim dX As Double = 0 + StringToLen(RefTabXTxBx.Text, dX) + If Not (dX > 0 And dX < ptMax.x - ptMin.x) Then + If dX > 0 Then + dX = ptMax.x - ptMin.x + Else + dX = 0 + End If + RefTabXTxBx.Text = LenToString(dX, 2) + ' errore, posizione fuori dalla tavola + End If + m_RawPartPage.m_OtherRefTabX = dX + m_RawPartPage.RefTabModeChange() + End If + End Sub + + Private Sub RefTabYTxBx_EgtClosed(sender As Object, e As EventArgs) Handles RefTabYTxBx.EgtClosed + Dim ptMin, ptMax As Point3d + If EgtGetTableArea(1, ptMin, ptMax) Then + Dim dY As Double = 0 + StringToLen(RefTabYTxBx.Text, dY) + If Not (dY > 0 And dY < ptMax.y - ptMin.y) Then + If dY > 0 Then + dY = ptMax.y - ptMin.y + Else + dY = 0 + End If + RefTabYTxBx.Text = LenToString(dY, 2) + ' errore, posizione fuori dalla tavola + End If + m_RawPartPage.m_OtherRefTabY = dY + m_RawPartPage.RefTabModeChange() + End If + End Sub + + Private Sub OkBtn_Click() Handles OkBtn.Click + WritePrivateProfileString(S_RAWPART, K_OTHERREFTABX, DoubleToString(RefTabXTxBx.Text, 2), m_MainWindow.GetIniFile()) + WritePrivateProfileString(S_RAWPART, K_OTHERREFTABY, DoubleToString(RefTabYTxBx.Text, 2), m_MainWindow.GetIniFile()) + WritePrivateProfileString(S_RAWPART, K_OTHERREFTABPOS, m_RawPartPage.m_OtherRefTabPos.ToString, m_MainWindow.GetIniFile()) + Me.Close() + End Sub + + Private Sub ExitBtn_Click() Handles ExitBtn.Click + ' riposiziono l'origine + m_RawPartPage.m_OtherRefTabX = m_sPosX + m_RawPartPage.m_OtherRefTabY = m_sPosY + ' ripristino il valore della combobox + m_RawPartPage.m_OtherRefTabPos = m_SelIndex + m_RawPartPage.RefTabModeChange() + End Sub + +End Class diff --git a/RawPhoto/RawPartPageUC.xaml b/RawPhoto/RawPartPageUC.xaml index 19e776b..16132dd 100644 --- a/RawPhoto/RawPartPageUC.xaml +++ b/RawPhoto/RawPartPageUC.xaml @@ -6,76 +6,76 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="853.3" d:DesignWidth="1280" Loaded="RawPartPage_Loaded" Initialized="RawPartPage_Initialized" Unloaded="RawPartPage_Unloaded"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - + + - - + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + @@ -85,114 +85,123 @@ - - - + - - + - - + - - + - - + - - - - + - + + + - - - - - - + + + + + + - + - - + + - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + + + + - + - + - + + + + - - - - - + + + + + + diff --git a/RawPhoto/RawPartPageUC.xaml.vb b/RawPhoto/RawPartPageUC.xaml.vb index e71653f..8098754 100644 --- a/RawPhoto/RawPartPageUC.xaml.vb +++ b/RawPhoto/RawPartPageUC.xaml.vb @@ -1,6 +1,9 @@ Imports System.Globalization +Imports System.IO +Imports System.Windows.Media.Animation Imports EgtUILib Imports EgtWPFLib +Imports Microsoft.VisualBasic.Devices Public Class RawPartPageUC @@ -78,6 +81,16 @@ Public Class RawPartPageUC ' Costante raggio cerchietto Private Const RAD_CIRCLE As Double = 30 + ' Riferimento grezzo + Private m_bEnableOtherRefTab As Boolean = False + Private m_bOtherRefTab As Boolean + Public m_OtherRefTabX As Double = 0 + Public m_OtherRefTabY As Double = 0 + Public m_OtherRefTabList(3) As String + Public m_OtherRefTabPos As Integer = 0 + Private m_nOtherRefTabLay As Integer = GDB_ID.NULL + Private m_OtherRefTabPoint As Point3d + ' mostra la pagina delle lavorazioni Private m_SmartMachiningPage As Boolean = False @@ -105,6 +118,13 @@ Public Class RawPartPageUC FROM_SAW = 7 End Enum + Private Enum OTHERREFMODE As Integer + BL = 0 + BR = 1 + TR = 2 + TL = 3 + End Enum + Private Sub RawPartPage_Initialized(sender As Object, e As EventArgs) 'Creazione della Page UserControl e relative impostazioni @@ -145,6 +165,13 @@ Public Class RawPartPageUC ReDim Preserve m_RawModeListEx(3) End If RawModeCmBx.ItemsSource = m_RawModeList + + ' Creo la lista dei riferimenti tavola + m_OtherRefTabList(OTHERREFMODE.BL) = "Bottom left" + m_OtherRefTabList(OTHERREFMODE.BR) = "Bottom right" + m_OtherRefTabList(OTHERREFMODE.TR) = "Top right" + m_OtherRefTabList(OTHERREFMODE.TL) = "Top left" + ' lista per selezione RawModeDamaged m_RawModeDamagedList(0) = EgtMsg(MSG_RAWPARTPAGEUC + 2) 'Per Punti m_RawModeDamagedList(1) = EgtMsg(MSG_RAWPARTPAGEUC + 30) 'Da Laser @@ -184,6 +211,8 @@ Public Class RawPartPageUC RemoveBtn.Content = EgtMsg(MSG_RAWPARTPAGEUC + 15) 'Remove - Rimuovi CloseBtn.Content = EgtMsg(MSG_RAWPARTPAGEUC + 31) 'Close - Chiudi ConfirmPhotoBtn.Content = EgtMsg(MSG_RAWPARTPAGEUC + 24) 'Conferma + + OtherRefTabTxBl.Text = "New Ref On Tab" End Sub Private Sub RawPartPage_Loaded(sender As Object, e As RoutedEventArgs) @@ -277,6 +306,12 @@ Public Class RawPartPageUC Utility.SetBlockAndSlabNbr(sBlock, sSlabNbr) End If End If + + ' Carico le info del riferimento alternativo della tavola + m_nOtherRefTabLay = EgtCreateGroup(GDB_ID.ROOT) + EgtSetLevel(m_nTempLay, GDB_LV.TEMP) + LoadOtherRefTab() + ' Assegno dati grezzo rettangolare ai textbox LengthTxBx.Text = LenToString(m_RawLength, 2) WidthTxBx.Text = LenToString(m_RawWidth, 2) @@ -320,6 +355,36 @@ Public Class RawPartPageUC Next End Sub + Private Sub LoadOtherRefTab() + m_bEnableOtherRefTab = (GetPrivateProfileInt(S_RAWPART, K_ENABLEOTHERREFTAB, 0, m_MainWindow.GetIniFile()) <> 0) + If Not m_bEnableOtherRefTab Then + OtherRefTabBtn.Visibility = Visibility.Collapsed + OtherRefTabChBx.Visibility = Visibility.Collapsed + OtherRefTabTxBl.Visibility = Visibility.Collapsed + Return + End If + m_bOtherRefTab = (GetPrivateProfileInt(S_RAWPART, K_OTHERREFTAB, 0, m_MainWindow.GetIniFile()) <> 0) + m_OtherRefTabX = GetPrivateProfileDouble(S_RAWPART, K_OTHERREFTABX, 0, m_MainWindow.GetIniFile()) + m_OtherRefTabY = GetPrivateProfileDouble(S_RAWPART, K_OTHERREFTABY, 0, m_MainWindow.GetIniFile()) + m_OtherRefTabPos = GetPrivateProfileInt(S_RAWPART, K_OTHERREFTABPOS, 0, m_MainWindow.GetIniFile()) + ' RefTabPosCmbx.SelectedIndex = m_OtherRefTabPos + OtherRefTabChBx.IsChecked = m_bOtherRefTab + ' se riferimento tavola differente da quello atteso + If m_bOtherRefTab Then + ' dasibilito la modifica dei parametri di Offset + OffsetXTxBx.IsEnabled = False + OffsetYTxBx.IsEnabled = False + UpdateOffsetText() + End If + + ' Rimuovo eventuali crocette create acquisendo i punti nel disegno + EgtEmptyGroup(m_nOtherRefTabLay) + ' Acquisisco punto da disegno + m_OtherRefTabPoint = New Point3d(m_ptTableMin.x + m_OtherRefTabX, m_ptTableMin.y + m_OtherRefTabY, m_ptTableMin.z + 0.15 + m_CurrentMachine.dAdditionalTable) + CreateOtherRefTab(m_nOtherRefTabLay, m_OtherRefTabPoint) + ' EgtDraw() + End Sub + Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene ' Verifico di essere il gestore attivo If Not m_bActive Then Return @@ -930,6 +995,13 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = True + OtherRefTabBtn.IsEnabled = True + ' disegno il riferimento + m_OtherRefTabPoint = New Point3d(m_ptTableMin.x + m_OtherRefTabX, m_ptTableMin.y + m_OtherRefTabY, m_ptTableMin.z + 0.15 + m_CurrentMachine.dAdditionalTable) + CreateOtherRefTab(m_nOtherRefTabLay, m_OtherRefTabPoint) + End If Case RAWMODE.BY_POINTS RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Collapsed @@ -946,6 +1018,12 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate e foto DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + ' disettivo la possibilità di modificare il riferimento + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.FROM_LASER RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Collapsed @@ -962,6 +1040,11 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate e foto DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.DAMAGED RawModeCmBx.IsEnabled = False RawModeDamagedCmBx.Visibility = Visibility.Visible @@ -980,6 +1063,11 @@ Public Class RawPartPageUC DamagedAreaGpBx.Visibility = Windows.Visibility.Visible ' Disattivo bottoni foto ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.FROM_PHOTO RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Collapsed @@ -992,6 +1080,11 @@ Public Class RawPartPageUC DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ' Visualizzo bottoni foto ConfirmPhotoBtn.Visibility = Windows.Visibility.Visible + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.DAMAGED_BY_LASER RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Visible @@ -1008,6 +1101,11 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate e foto DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.DAMAGED_BY_SAW RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Visible @@ -1024,6 +1122,11 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate e foto DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If Case RAWMODE.FROM_SAW RawModeCmBx.IsEnabled = True RawModeDamagedCmBx.Visibility = Visibility.Collapsed @@ -1040,11 +1143,26 @@ Public Class RawPartPageUC ' Disattivo bottoni zone rovinate e foto DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden + If m_bEnableOtherRefTab Then + OtherRefTabChBx.IsEnabled = False + OtherRefTabBtn.IsEnabled = False + EgtEmptyGroup(m_nOtherRefTabLay) + End If End Select + ' se abilitato nuovo riferimento del grezzo disabilito le text per offset + If OtherRefTabChBx.IsChecked Then + OffsetXTxBx.IsEnabled = False + OffsetYTxBx.IsEnabled = False + End If End Sub Private Sub OutlineBtn_Click(sender As Object, e As RoutedEventArgs) Handles OutlineBtn.Click If m_ActiveRawMode = RAWMODE.DAMAGED Or m_ActiveRawMode = RAWMODE.DAMAGED_BY_LASER Or m_ActiveRawMode = RAWMODE.DAMAGED_BY_SAW Then + If m_bEnableOtherRefTab Then + OtherRefTabTxBl.Visibility = Visibility.Visible + OtherRefTabBtn.Visibility = Visibility.Visible + OtherRefTabChBx.Visibility = Visibility.Visible + End If ' m_ActiveRawMode = RAWMODE.BY_POINTS m_ActiveRawMode = m_PrecActiveRawMode RawModeCmBx.SelectedIndex = m_ActiveRawMode @@ -1055,6 +1173,12 @@ Public Class RawPartPageUC End Sub Private Sub DamagedBtn_Click(sender As Object, e As RoutedEventArgs) Handles DamagedBtn.Click + If m_bEnableOtherRefTab Then + OtherRefTabTxBl.Visibility = Visibility.Hidden + OtherRefTabBtn.Visibility = Visibility.Hidden + OtherRefTabChBx.Visibility = Visibility.Hidden + OtherRefTabBtn.IsEnabled = False + End If m_PrecActiveRawMode = m_ActiveRawMode If m_PrecActiveRawMode = RAWMODE.FROM_LASER Then m_ActiveRawMode = RAWMODE.DAMAGED_BY_LASER @@ -1843,6 +1967,7 @@ Public Class RawPartPageUC WidthTxBx.Text = LenToString(m_RawWidth, 2) m_CurrProjPage.SetErrorMessage(EgtMsg(MSG_RAWPARTPAGEUC + 17) & " " & LenToString(dMaxWidth, 2)) 'Massima larghezza = End If + RefTabModeChange() End Sub Private Sub HeightTxBx_EgtClosed(sender As Object, e As EventArgs) Handles HeightTxBx.EgtClosed @@ -1872,6 +1997,7 @@ Public Class RawPartPageUC HeightTxBx.Text = LenToString(m_RawHeight, 3) m_CurrProjPage.SetErrorMessage(EgtMsg(MSG_RAWPARTPAGEUC + 18)) 'Non sono ammessi spessori negativi End If + RefTabModeChange() End Sub Private Sub OffsetXTxBx_EgtClosed(sender As Object, e As EventArgs) Handles OffsetXTxBx.EgtClosed @@ -1918,6 +2044,108 @@ Public Class RawPartPageUC End If End Sub +#Region "OTHERREFTAB" + + Private Sub OtherRefTabChBx_Click(sender As Object, e As EventArgs) Handles OtherRefTabChBx.Click + If OtherRefTabChBx.IsChecked Then + m_bOtherRefTab = True + MoveRawToOtherRefTab() + Else + m_bOtherRefTab = False + 'MoveRawToMaiRefTab() + End If + UpdateOffsetText() + RawModeView() + WritePrivateProfileString(S_RAWPART, K_OTHERREFTAB, If(m_bOtherRefTab, "1", "0"), m_MainWindow.GetIniFile()) + End Sub + + Public Sub RefTabModeChange() + MoveRawToMaiRefTab() + MoveRawToOtherRefTab() + UpdateRefTabDraw() + UpdateOffsetText() + End Sub + + Public Sub UpdateRefTabDraw() + ' Rimuovo eventuali crocette create acquisendo i punti nel disegno + EgtEmptyGroup(m_nOtherRefTabLay) + ' Acquisisco punto da disegno + m_OtherRefTabPoint = New Point3d(m_ptTableMin.x + m_OtherRefTabX, m_ptTableMin.y + m_OtherRefTabY, m_ptTableMin.z + 0.15) + CreateOtherRefTab(m_nOtherRefTabLay, m_OtherRefTabPoint) + EgtDraw() + End Sub + + Private Sub UpdateOffsetText() + Dim ptRawMin, ptRawMax As Point3d + Dim dInvertKerf As Double = 1 + If GetRawBox(ptRawMin, ptRawMax) Then + ' kerf + EgtGetInfo(EgtGetFirstRawPart(), KEY_KERF, m_RawKerf) + ' verifico se il kerf è negativo + EgtGetInfo(EgtGetFirstRawPart(), KEY_INVERT_KERF, dInvertKerf) + ' aggiorno dati grezzo + If dInvertKerf < 0 Then + m_RawOffsX = ptRawMin.x - m_ptTableMin.x + m_RawOffsY = ptRawMin.y - m_ptTableMin.y + Else + m_RawOffsX = ptRawMin.x - m_ptTableMin.x + m_RawKerf * dInvertKerf + m_RawOffsY = ptRawMin.y - m_ptTableMin.y + m_RawKerf * dInvertKerf + End If + OffsetXTxBx.Text = LenToString(m_RawOffsX, 2) + OffsetYTxBx.Text = LenToString(m_RawOffsY, 2) + End If + End Sub + + Private Sub MoveRawToOtherRefTab() + Dim dKerf As Double = 0 + StringToLen(KerfTxBx.Text, dKerf) + Select Case m_OtherRefTabPos + Case OTHERREFMODE.BL + m_RawOffsX = m_OtherRefTabX + If((dKerf < 0), -dKerf, dKerf) + m_RawOffsY = m_OtherRefTabY + If((dKerf < 0), -dKerf, dKerf) + Case OTHERREFMODE.BR + m_RawOffsX = m_OtherRefTabX - m_RawLength - If((dKerf < 0), -dKerf, dKerf) + m_RawOffsY = m_OtherRefTabY + If((dKerf < 0), -dKerf, dKerf) + Case OTHERREFMODE.TR + m_RawOffsX = m_OtherRefTabX - m_RawLength - If((dKerf < 0), -dKerf, dKerf) + m_RawOffsY = m_OtherRefTabY - m_RawWidth - If((dKerf < 0), -dKerf, dKerf) + Case OTHERREFMODE.TL + m_RawOffsX = m_OtherRefTabX + If((dKerf < 0), -dKerf, dKerf) + m_RawOffsY = m_OtherRefTabY - m_RawWidth - If((dKerf < 0), -dKerf, dKerf) + Case Else + End Select + UpdateRawPart() + End Sub + + Private Sub MoveRawToMaiRefTab() + Dim dKerf As Double = 0 + StringToLen(KerfTxBx.Text, dKerf) + Select Case m_OtherRefTabPos + Case OTHERREFMODE.BR + m_RawOffsX = If((dKerf < 0), 0, dKerf) + m_RawOffsY = If((dKerf < 0), 0, dKerf) + Case OTHERREFMODE.BL + m_RawOffsX = If((dKerf < 0), 0, dKerf) + m_RawOffsY = If((dKerf < 0), 0, dKerf) + Case OTHERREFMODE.TL + m_RawOffsX = If((dKerf < 0), 0, dKerf) + m_RawOffsY = If((dKerf < 0), 0, dKerf) + Case OTHERREFMODE.TR + m_RawOffsX = If((dKerf < 0), 0, dKerf) + m_RawOffsY = If((dKerf < 0), 0, dKerf) + Case Else + End Select + UpdateRawPart() + End Sub + + Private Sub OtherRefTabBtn_Click(sender As Object, e As EventArgs) Handles OtherRefTabBtn.Click + ' apro la finestra per gestire il riferimento + Dim OthWD As New OtherRefTabWD(m_MainWindow, LenToString(m_OtherRefTabX, 2), LenToString(m_OtherRefTabY, 2), m_RawOffsX, m_RawOffsY, m_OtherRefTabPos) + OthWD.ShowDialog() + End Sub + +#End Region ' OtherRefTab + Private Sub KerfTxBx_EgtClosed(sender As Object, e As EventArgs) Handles KerfTxBx.EgtClosed Dim dKerf As Double If Not StringToLen(KerfTxBx.Text, dKerf) Then @@ -1960,6 +2188,8 @@ Public Class RawPartPageUC Else CreateRawFromPhotoContour() End If + ' Forzo il riposizionamento del grezzo + RefTabModeChange() ' Ridisegno EgtDraw() ElseIf dKerf >= dMinKerf And dKerf < 0 Then @@ -2022,6 +2252,8 @@ Public Class RawPartPageUC Else CreateRawFromPhotoContour() End If + ' Forzo il riposizionamento del grezzo + RefTabModeChange() ' Ridisegno EgtDraw() ElseIf dKerf < dMinKerf Then @@ -2267,6 +2499,7 @@ Public Class RawPartPageUC Private Sub RawPartPage_Unloaded(sender As Object, e As RoutedEventArgs) ' Rimuovo layer temporaneo per crocette EgtErase(m_nTempLay) + EgtErase(m_nOtherRefTabLay) ' Dichiaro pagina non attiva m_bActive = False End Sub @@ -2582,4 +2815,44 @@ Public Class RawPartPageUC Return True End Function + Private Function CreateOtherRefTab(nLayerId As Integer, ptP As Point3d) As Boolean + EgtEmptyGroup(m_nOtherRefTabLay) + If Not m_bOtherRefTab Or Not OtherRefTabChBx.IsEnabled Then + EgtDraw() + Return False + End If + + If File.Exists(m_MainWindow.GetResourcesDir() & "\" & "RefTabBL.nge") Then + ' Aggiungo disegno staffa fermo pezzo + EgtInsertFile(m_MainWindow.GetResourcesDir() & "\" & "RefTabBL.nge") + Dim nLastPart As Integer = EgtGetLastPart() + Dim Lay As Integer = EgtGetFirstInGroup(nLastPart) + Dim Ent As Integer = EgtGetFirstInGroup(Lay) + While Ent <> -1 + Dim NextEnt As Integer = EgtGetNext(Ent) + EgtRelocate(Ent, nLayerId) + EgtMove(Ent, ptP - Point3d.ORIG) + EgtRotate(Ent, ptP, Vector3d.Z_AX, 90 * m_OtherRefTabPos) + Ent = NextEnt + End While + EgtErase(nLastPart) + Else + ' Aggiungo crocette + ptP += New Vector3d(0, 0, 0.15) + Dim vtCrossX As New Vector3d(100, 0, 0) + Dim vtCrossY As New Vector3d(0, 100, 0) + Dim vtCrossZ As New Vector3d(0, 0, 100) + Dim nCrossId1 = EgtCreateLine(nLayerId, ptP, ptP + vtCrossX) + EgtSetColor(nCrossId1, New Color3d(245, 0, 0)) + Dim nCrossId2 = EgtCreateLine(nLayerId, ptP, ptP + vtCrossY) + EgtSetColor(nCrossId2, New Color3d(0, 245, 0)) + Dim nCrossId3 = EgtCreateLine(nLayerId, ptP, ptP + vtCrossZ) + EgtSetColor(nCrossId3, New Color3d(0, 0, 245)) + End If + + EgtDraw() + 'EgtSaveFile("C:\EgtData\OmagCUT\Temp\MyTest.nge", NGE.BIN) + Return True + End Function + End Class diff --git a/Resources/NewIcons/RefTab.png b/Resources/NewIcons/RefTab.png new file mode 100644 index 0000000..70ff54d Binary files /dev/null and b/Resources/NewIcons/RefTab.png differ diff --git a/VeinMatching/VeinMatchingWindow.xaml.vb b/VeinMatching/VeinMatchingWindow.xaml.vb index 9ae2f64..ec8996f 100644 --- a/VeinMatching/VeinMatchingWindow.xaml.vb +++ b/VeinMatching/VeinMatchingWindow.xaml.vb @@ -4,6 +4,7 @@ Imports System.Collections.ObjectModel Imports System.Runtime.InteropServices Imports EgtUILib Imports EgtWPFLib +Imports OmagCUT.VeinMatchingWindow Public Class VeinMatchingWindow @@ -19,6 +20,11 @@ Public Class VeinMatchingWindow Private m_nIdToSel As Integer = GDB_ID.NULL Private m_nIdToDesel As Integer = GDB_ID.NULL + Enum ALETTE + F = 2 + A = 1 + End Enum + Private Sub Window_Initialized(sender As Object, e As EventArgs) ' Assegnazione scena all'host e posizionamento nella PlacePageGrid VeinMatchingSceneHost.Child = VeinMatchingScene @@ -267,7 +273,7 @@ Friend Module VeinMatching Dim nRegId As Integer = EgtGetFirstInGroup(nRegLayId) While nRegId <> GDB_ID.NULL If EgtGetType(nRegId) = GDB_TY.SRF_FRGN Then - Exit While + Exit While End If nRegId = EgtGetNext(nRegId) End While @@ -364,19 +370,21 @@ Friend Module VeinMatching ' Imposto il contesto del progetto EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx()) ' Riattivo il gruppo di lavoro - EgtSetCurrMachGroup( EgtGetFirstMachGroup()) + EgtSetCurrMachGroup(EgtGetFirstMachGroup()) ' Verifico quali pezzi sono nel grezzo, per dichiararlo al VM - nId = EgtGetFirstPartInRawPart( CamAuto.GetCurrentRaw()) + nId = EgtGetFirstPartInRawPart(CamAuto.GetCurrentRaw()) While nId <> GDB_ID.NULL ' Dichiaro pezzo nel grezzo per VM - VeinMatching.OnInsertPartInRaw( nId) + VeinMatching.OnInsertPartInRaw(nId) ' Passo al pezzo successivo nId = EgtGetNextPartInRawPart(nId) End While ' Ripristino visualizzazione di eventuali pezzi in parcheggio ShowParkedParts() ' Ripristino il contesto corrente - EgtSetCurrentContext( nCurrCtx) + EgtSetCurrentContext(nCurrCtx) + + ' EgtSaveFile("C:\EgtData\OmagCUT\Temp\MyVeinMatch.nge", NGE.TEXT) Return True End Function @@ -422,11 +430,11 @@ Friend Module VeinMatching nCurrId = EgtGetFirstNameInGroup(nVeinId2, NAME_PREVIEW) EgtSetStatus(nCurrId, GDB_ST.OFF) ' Se esiste OutLoop.orig OutLoop -> OutLoop.mach e OutLoop.orig -> OutLoop - Dim nOutLoopOrig As Integer = EgtGetFirstNameInGroup( nVeinId2, NAME_OUTLOOP & ".orig") + Dim nOutLoopOrig As Integer = EgtGetFirstNameInGroup(nVeinId2, NAME_OUTLOOP & ".orig") If nOutLoopOrig <> GDB_ID.NULL Then - Dim nOutLoop As Integer = EgtGetFirstNameInGroup( nVeinId2, NAME_OUTLOOP) - EgtSetName( nOutLoop, NAME_OUTLOOP & ".mach") - EgtSetName( nOutLoopOrig, NAME_OUTLOOP) + Dim nOutLoop As Integer = EgtGetFirstNameInGroup(nVeinId2, NAME_OUTLOOP) + EgtSetName(nOutLoop, NAME_OUTLOOP & ".mach") + EgtSetName(nOutLoopOrig, NAME_OUTLOOP) End If ' Se necessario, ripristino il contesto originale If nCurrCtx > 0 Then EgtSetCurrentContext(nCurrCtx) @@ -555,8 +563,8 @@ Friend Module VeinMatching ' Se richiesto, eseguo deselezione If bDeselect Then EgtDeselectObj(nId) - End If - EgtDraw() + End If + EgtDraw() EgtSetCurrentContext(nMainCtx) Return True End Function @@ -1039,37 +1047,44 @@ Friend Module VeinMatching End Function Friend Function MoveAlettaSolid(ByRef Item As Aletta, ByRef ThicknessRaw As Double) As Boolean - + ' A: alzatina, F: frontalino Dim nType As Integer If Not EgtGetInfo(Item.IdSideRef, "AF", nType) Then Return False - Dim ptSRef, ptERef, ptE As Point3d + Dim ptSRef, ptERef, ptS, ptE As Point3d + ' Piano cucina If Not EgtStartPoint(Item.IdSideRef, GDB_ID.ROOT, ptSRef) Then Return False If Not EgtEndPoint(Item.IdSideRef, GDB_ID.ROOT, ptERef) Then Return False + ' AlzFront + If Not EgtStartPoint(Item.SideId, GDB_ID.ROOT, ptS) Then Return False If Not EgtEndPoint(Item.SideId, GDB_ID.ROOT, ptE) Then Return False + ' vettore lato cucina + Dim vtRotRef As Vector3d = ptERef - ptSRef + ' vettore lato AlzFront + Dim vtRot As Vector3d = ptE - ptS + ' ruoto il solido intorno al lato di riferimento - Dim vtRot As Vector3d = ptERef - ptSRef - If nType = 1 Then - EgtRotate(Item.PartId, ptE, vtRot, -90, GDB_RT.GLOB) - ElseIf nType = 2 Then + If nType = ALETTE.A Then EgtRotate(Item.PartId, ptE, vtRot, 90, GDB_RT.GLOB) + ElseIf nType = ALETTE.F Then + EgtRotate(Item.PartId, ptE, vtRot, -90, GDB_RT.GLOB) End If ' punto di riferimento per la traslazione sul solido Dim ptSolid As Point3d - If nType = 1 Then + If nType = ALETTE.A Then ' cerco id della curva che definisce la front face Dim nSolidGrp As Integer = EgtGetFirstNameInGroup(Item.PartId, NAME_VM_SOLID) Dim nFrontCrvId As Integer = EgtGetFirstInGroup(nSolidGrp) - EgtStartPoint(nFrontCrvId, ptSolid) - ElseIf nType = 2 Then - EgtStartPoint(Item.SideId, ptSolid) + EgtStartPoint(nFrontCrvId, GDB_ID.ROOT, ptSolid) + ElseIf nType = ALETTE.F Then + EgtStartPoint(Item.SideId, GDB_ID.ROOT, ptSolid) End If - Dim ItemFrame As New Frame3d - If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False - ptSolid.ToGlob(ItemFrame) + ' Dim ItemFrame As New Frame3d + ' If Not EgtGetGroupGlobFrame(Item.PartId, ItemFrame) Then Return False + ' ptSolid.ToGlob(ItemFrame) 'punto di riferimento per la traslazione sul piano cucina Dim ptKitchen As Point3d = ptERef @@ -1077,6 +1092,16 @@ Friend Module VeinMatching Dim vtMove As Vector3d = ptKitchen - ptSolid EgtMove(Item.PartId, vtMove, GDB_RT.GLOB) + ' eventualmente ruoto per allineare l'alzatina al piano cucina + Dim dLRef, dAngVRef, dAngHRef As Double + vtRotRef.ToSpherical(dLRef, dAngVRef, dAngHRef) + Dim dL, dAngV, dAngH As Double + vtRot.Rotate(Vector3d.Z_AX, 180) + vtRot.ToSpherical(dL, dAngV, dAngH) + Dim dDelta As Double = dAngHRef - dAngH + If Math.Abs(dDelta) < EPS_ANG_SMALL Then Return True + EgtRotate(Item.PartId, ptKitchen, Vector3d.Z_AX, dDelta, GDB_RT.GLOB) + Return True End Function @@ -1206,7 +1231,7 @@ Friend Module VeinMatching ' Se necessario, cambio contesto If m_nVeinCtx <> nCurrCtx Then If EgtSetCurrentContext(m_nVeinCtx) Then - Return If( nCurrCtx > 0, nCurrCtx, -2) + Return If(nCurrCtx > 0, nCurrCtx, -2) Else Return 0 End If @@ -1268,7 +1293,7 @@ Friend Module VeinMatching While nId <> GDB_ID.NULL Dim nOriId As Integer If EgtGetInfo(nId, KEY_ORI_ID, nOriId) AndAlso nOriId = nPartId Then - Exit While + Exit While End If nId = EgtGetNextPart(nId) End While