From b434f8003041d7440a318cc217f9594914aa5662 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Wed, 3 May 2023 18:09:58 +0200 Subject: [PATCH 01/11] Correzione gestione Z safe, cambio versione 2.5e1 --- DirectCuts/FlatteningCut.xaml.vb | 5 ++++- MainWindow.xaml.vb | 4 ++-- My Project/AssemblyInfo.vb | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) 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/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: ' - - + + From 6863186e0739510730224e8ade756e97a89f115b Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Thu, 4 May 2023 14:37:17 +0200 Subject: [PATCH 02/11] Aggiunto nuovo parametro per tastatura --- Machine/AlarmsPageUC.xaml.vb | 6 ++++++ 1 file changed, 6 insertions(+) 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 From b1410ca11cc4701b0e98a6d012432723e9cb4743 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Fri, 5 May 2023 13:12:15 +0200 Subject: [PATCH 03/11] Aggiunti parametri TCPOS e DIAM per comandi diretti --- DirectCuts/ControlsMachineButtonUC.xaml.vb | 11 +++++++++++ DirectCuts/MachineButtonsUC.xaml.vb | 11 +++++++++++ 2 files changed, 22 insertions(+) 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/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) From 07cf7ced426000d181fad1e2aff6ffb007c46221 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Mon, 8 May 2023 20:04:56 +0200 Subject: [PATCH 04/11] Definizione nuovp roferimento su stavola --- Constants/ConstIni.vb | 5 + OmagCUT.vbproj | 7 + RawPhoto/OtherRefTabWD.xaml | 68 +++++++ RawPhoto/OtherRefTabWD.xaml.vb | 67 +++++++ RawPhoto/RawPartPageUC.xaml | 317 ++++++++++++++++++--------------- RawPhoto/RawPartPageUC.xaml.vb | 189 ++++++++++++++++++++ 6 files changed, 509 insertions(+), 144 deletions(-) create mode 100644 RawPhoto/OtherRefTabWD.xaml create mode 100644 RawPhoto/OtherRefTabWD.xaml.vb diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index f967e0d..c21f5ef 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -223,6 +223,11 @@ 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_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/OmagCUT.vbproj b/OmagCUT.vbproj index 67d9d3a..b0037d3 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 diff --git a/RawPhoto/OtherRefTabWD.xaml b/RawPhoto/OtherRefTabWD.xaml new file mode 100644 index 0000000..33a1a72 --- /dev/null +++ b/RawPhoto/OtherRefTabWD.xaml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RawPhoto/OtherRefTabWD.xaml.vb b/RawPhoto/OtherRefTabWD.xaml.vb new file mode 100644 index 0000000..19eb1ba --- /dev/null +++ b/RawPhoto/OtherRefTabWD.xaml.vb @@ -0,0 +1,67 @@ +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib + +Public Class OtherRefTabWD + Dim m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow) + + Private m_sPosX As String = "0" + Private m_sPosY As String = "0" + + Sub New(Owner As Window, PosX As String, PosY As String) + 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 + End Sub + + Private Sub OtherRrefTabWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized + Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 + Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2 + RefTabXTxbl.Text = "Position X" + RefTabYTxbl.Text = "Position Y" + 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 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 dX > 0 And ptMax.x - ptMin.x Then + + Else + ' errore, posizione fuori dalla tavola + End If + 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 dY > 0 And ptMax.y - ptMin.y Then + + Else + ' errore, posizione fuori dalla tavola + End If + 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()) + Me.Close() + End Sub + +End Class diff --git a/RawPhoto/RawPartPageUC.xaml b/RawPhoto/RawPartPageUC.xaml index 19e776b..ecd0ab4 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,143 @@ - - - + - - + - - + - - + - - + - - - - + - + + + - - - - - - + + + + + + - + - - + + - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + + + + - + - + - + + + + - - - - - + + + + + + diff --git a/RawPhoto/RawPartPageUC.xaml.vb b/RawPhoto/RawPartPageUC.xaml.vb index e71653f..a3e051c 100644 --- a/RawPhoto/RawPartPageUC.xaml.vb +++ b/RawPhoto/RawPartPageUC.xaml.vb @@ -1,6 +1,8 @@ Imports System.Globalization +Imports System.Windows.Media.Animation Imports EgtUILib Imports EgtWPFLib +Imports Microsoft.VisualBasic.Devices Public Class RawPartPageUC @@ -77,6 +79,14 @@ Public Class RawPartPageUC Private Const SAFE_RAW_DIST As Double = 5 ' Costante raggio cerchietto Private Const RAD_CIRCLE As Double = 30 + ' Riferimento grezzo + Private m_bOtherRefTab As Boolean + Private m_OtherRefTabX As Double = 0 + Private m_OtherRefTabY As Double = 0 + Private m_OtherRefTabList(3) As String + Private 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 +115,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 +162,14 @@ Public Class RawPartPageUC ReDim Preserve m_RawModeListEx(3) End If RawModeCmBx.ItemsSource = m_RawModeList + + ' Creo la lista dei riferimenti tavola + m_OtherRefTabList(OTHERREFMODE.BL) = "BL" + m_OtherRefTabList(OTHERREFMODE.BR) = "BR" + m_OtherRefTabList(OTHERREFMODE.TR) = "TR" + m_OtherRefTabList(OTHERREFMODE.TL) = "TL" + RefTabPosCmbx.ItemsSource = m_OtherRefTabList + ' lista per selezione RawModeDamaged m_RawModeDamagedList(0) = EgtMsg(MSG_RAWPARTPAGEUC + 2) 'Per Punti m_RawModeDamagedList(1) = EgtMsg(MSG_RAWPARTPAGEUC + 30) 'Da Laser @@ -184,6 +209,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 + + OtherRefTabGpBx.Header = "New Ref On Tab" End Sub Private Sub RawPartPage_Loaded(sender As Object, e As RoutedEventArgs) @@ -277,6 +304,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 +353,38 @@ Public Class RawPartPageUC Next End Sub + Private Sub LoadOtherRefTab() + 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 + '' Posiziono il grezzo nell'origine della tavola + 'OffsetXTxBx.Text = "0" + 'm_RawOffsX = 0 + 'OffsetYTxBx.Text = "0" + 'm_RawOffsY = 0 + 'MoveRawToOtherRefTab() + UpdateOffsetText() + Else + 'MoveRawToOtherRefTab() + 'MoveRawToMaiRefTab() + 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) + 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 @@ -1041,6 +1106,11 @@ Public Class RawPartPageUC DamagedAreaGpBx.Visibility = Windows.Visibility.Hidden ConfirmPhotoBtn.Visibility = Windows.Visibility.Hidden 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 @@ -1843,6 +1913,7 @@ Public Class RawPartPageUC WidthTxBx.Text = LenToString(m_RawWidth, 2) m_CurrProjPage.SetErrorMessage(EgtMsg(MSG_RAWPARTPAGEUC + 17) & " " & LenToString(dMaxWidth, 2)) 'Massima larghezza = End If + RefTabPosCmbx_SelectionChanged(Nothing, Nothing) End Sub Private Sub HeightTxBx_EgtClosed(sender As Object, e As EventArgs) Handles HeightTxBx.EgtClosed @@ -1872,6 +1943,7 @@ Public Class RawPartPageUC HeightTxBx.Text = LenToString(m_RawHeight, 3) m_CurrProjPage.SetErrorMessage(EgtMsg(MSG_RAWPARTPAGEUC + 18)) 'Non sono ammessi spessori negativi End If + RefTabPosCmbx_SelectionChanged(Nothing, Nothing) End Sub Private Sub OffsetXTxBx_EgtClosed(sender As Object, e As EventArgs) Handles OffsetXTxBx.EgtClosed @@ -1918,6 +1990,103 @@ 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 + + Private Sub RefTabPosCmbx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles RefTabPosCmbx.SelectionChanged + If Not OtherRefTabChBx.IsChecked Then Return + m_OtherRefTabPos = RefTabPosCmbx.SelectedIndex + WritePrivateProfileString(S_RAWPART, K_OTHERREFTABPOS, m_OtherRefTabPos.ToString, m_MainWindow.GetIniFile()) + MoveRawToMaiRefTab() + MoveRawToOtherRefTab() + UpdateOffsetText() + 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 acquisuire la posizione del nuovo riferimento + Dim OthWD As New OtherRefTabWD(m_MainWindow, LenToString(m_OtherRefTabX, 2), LenToString(m_OtherRefTabY, 2)) + OthWD.ShowDialog() + ' aggiorno la posizione del punto + LoadOtherRefTab() + 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 +2129,8 @@ Public Class RawPartPageUC Else CreateRawFromPhotoContour() End If + ' Forzo il riposizionamento del grezzo + RefTabPosCmbx_SelectionChanged(Nothing, Nothing) ' Ridisegno EgtDraw() ElseIf dKerf >= dMinKerf And dKerf < 0 Then @@ -2022,6 +2193,8 @@ Public Class RawPartPageUC Else CreateRawFromPhotoContour() End If + ' Forzo il riposizionamento del grezzo + RefTabPosCmbx_SelectionChanged(Nothing, Nothing) ' Ridisegno EgtDraw() ElseIf dKerf < dMinKerf Then @@ -2267,6 +2440,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 +2756,19 @@ Public Class RawPartPageUC Return True End Function + Private Function CreateOtherRefTab(nLayerId As Integer, ptP As Point3d) As Boolean + ' 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)) + Return True + End Function + End Class From 65d8f58b45bb43c1406e717693aabb730611ac69 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 9 May 2023 17:15:10 +0200 Subject: [PATCH 05/11] Migliorata impaginazione dati e disegno RefTab --- Constants/ConstIni.vb | 1 + OmagCUT.vbproj | 3 + OmagCUTDarkDictionary.xaml | 1 + OmagCUTDictionary.xaml | 1 + RawPhoto/OtherRefTabWD.xaml | 38 ++++--- RawPhoto/OtherRefTabWD.xaml.vb | 63 +++++++++--- RawPhoto/RawPartPageUC.xaml | 26 +---- RawPhoto/RawPartPageUC.xaml.vb | 174 ++++++++++++++++++++++++--------- Resources/NewIcons/RefTab.png | Bin 0 -> 10924 bytes 9 files changed, 216 insertions(+), 91 deletions(-) create mode 100644 Resources/NewIcons/RefTab.png diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index c21f5ef..6114169 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -223,6 +223,7 @@ 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" diff --git a/OmagCUT.vbproj b/OmagCUT.vbproj index b0037d3..ae8414c 100644 --- a/OmagCUT.vbproj +++ b/OmagCUT.vbproj @@ -1337,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 index 33a1a72..c0e1502 100644 --- a/RawPhoto/OtherRefTabWD.xaml +++ b/RawPhoto/OtherRefTabWD.xaml @@ -4,16 +4,16 @@ xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib" FontFamily="{DynamicResource OmagCut_Font}" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent" - Title="ModifStartEndWD" Height="300.9" Width="426.5" ShowInTaskbar="False"> + Title="ModifStartEndWD" Height="250" Width="320" ShowInTaskbar="False"> - + - + - + - + - + - + + + - - + + + + + + + + + - - - + diff --git a/RawPhoto/OtherRefTabWD.xaml.vb b/RawPhoto/OtherRefTabWD.xaml.vb index 19eb1ba..a2a8f51 100644 --- a/RawPhoto/OtherRefTabWD.xaml.vb +++ b/RawPhoto/OtherRefTabWD.xaml.vb @@ -4,11 +4,17 @@ 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" - Sub New(Owner As Window, PosX As String, PosY As String) + 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() @@ -16,13 +22,22 @@ Public Class OtherRefTabWD ' 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 - Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2 - Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2 + ' 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 @@ -30,18 +45,29 @@ Public Class OtherRefTabWD 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 dX > 0 And ptMax.x - ptMin.x Then - - Else + 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 @@ -49,19 +75,34 @@ Public Class OtherRefTabWD If EgtGetTableArea(1, ptMin, ptMax) Then Dim dY As Double = 0 StringToLen(RefTabYTxBx.Text, dY) - If dY > 0 And ptMax.y - ptMin.y Then - - Else + 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 ecd0ab4..16132dd 100644 --- a/RawPhoto/RawPartPageUC.xaml +++ b/RawPhoto/RawPartPageUC.xaml @@ -157,29 +157,9 @@ - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - + + + - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + - + + + diff --git a/Frames/FrameCutPageUC.xaml.vb b/Frames/FrameCutPageUC.xaml.vb index d4195b8..852f7ca 100644 --- a/Frames/FrameCutPageUC.xaml.vb +++ b/Frames/FrameCutPageUC.xaml.vb @@ -436,6 +436,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) From a941f963c225784a087e9736e51198579bbdec2f Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Tue, 16 May 2023 10:31:58 +0200 Subject: [PATCH 09/11] Disabilito i comandi dei compo piani --- DrawImport/DrawPageUC.xaml.vb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DrawImport/DrawPageUC.xaml.vb b/DrawImport/DrawPageUC.xaml.vb index afa48c8..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 From 4c282d7531bb9c4045ecd21afd7e115d5f30735a Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Thu, 18 May 2023 11:13:40 +0200 Subject: [PATCH 10/11] Abilito visualizzazione pulsante per inserimento FrameCompo --- Constants/ConstIni.vb | 2 ++ DrawImport/MainComponentPageUC.xaml.vb | 8 ++++---- Frames/FrameCutPageUC.xaml.vb | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 6114169..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" diff --git a/DrawImport/MainComponentPageUC.xaml.vb b/DrawImport/MainComponentPageUC.xaml.vb index e6daf2f..4a32026 100644 --- a/DrawImport/MainComponentPageUC.xaml.vb +++ b/DrawImport/MainComponentPageUC.xaml.vb @@ -167,7 +167,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 = If(m_MainWindow.FrameCutBtn.IsChecked, "FrameCompo", 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()) @@ -333,7 +333,7 @@ Public Class MainComponentPageUC Private Sub LoadFramePage() Dim nDeltaSecondPage As Integer = 8 ' Leggo numero di componenti presenti - Dim nCompoNumber As Integer = GetPrivateProfileInt("FrameCompo", K_CMP_COUNT, 0, m_MainWindow.GetIniFile()) + 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) @@ -350,12 +350,12 @@ Public Class MainComponentPageUC 'Assegnazione immagine e testo ai Button For index As Integer = 1 To 8 Dim CustomThickness As New Thickness(0) - Dim nCompoName As Integer = GetPrivateProfileInt("FrameCompo" & index + nDeltaSecondPage, "Name", 0, m_MainWindow.GetIniFile()) + 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("FrameCompo" & index + nDeltaSecondPage, "Image", "", sCompoImage, m_MainWindow.GetIniFile()) <> 0 Then + 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 diff --git a/Frames/FrameCutPageUC.xaml.vb b/Frames/FrameCutPageUC.xaml.vb index 852f7ca..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) From a04e2cbe62580d5698db1334deb3fcbc18fcb962 Mon Sep 17 00:00:00 2001 From: Nicola Pievani Date: Thu, 18 May 2023 14:43:03 +0200 Subject: [PATCH 11/11] Gestione avanzata posizionamento pezzi VeinMatch --- VeinMatching/VeinMatchingWindow.xaml.vb | 77 ++++++++++++++++--------- 1 file changed, 51 insertions(+), 26 deletions(-) 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