From c529c9dd59ddeec93118459195387fee4d024eb5 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Sun, 23 Aug 2015 09:50:47 +0000 Subject: [PATCH] OmagCUT : - aggiungo file mancanti. --- Application.xaml | 7 + Application.xaml.vb | 47 +++ BarLavoraUC.xaml | 14 + BarLavoraUC.xaml.vb | 3 + BarNestingUC.xaml | 14 + BarNestingUC.xaml.vb | 3 + ComponentiUC.xaml | 130 +++++++ ComponentiUC.xaml.vb | 428 ++++++++++++++++++++++ ConstGen.vb | 45 +++ ConstIni.vb | 91 +++++ ConstMsg.vb | 5 + CorniciUC.xaml | 27 ++ CorniciUC.xaml.vb | 3 + FlatPartsImportUC.xaml | 37 ++ FlatPartsImportUC.xaml.vb | 113 ++++++ GrezzoUC.xaml | 143 ++++++++ GrezzoUC.xaml.vb | 43 +++ LavoroInCorsoUC.xaml | 26 ++ LavoroInCorsoUC.xaml.vb | 12 + MainWindow.xaml | 300 +++++++++++++++ MainWindow.xaml.vb | 292 +++++++++++++++ My Project/AssemblyInfo.vb | 59 +++ My Project/MyExtensions/MyWpfExtension.vb | 121 ++++++ My Project/Resources.Designer.vb | 63 ++++ My Project/Resources.resx | 117 ++++++ My Project/Settings.Designer.vb | 71 ++++ My Project/Settings.settings | 7 + NumericKeyboardWD.xaml | 74 ++++ NumericKeyboardWD.xaml.vb | 134 +++++++ OmagCUT.sln | 22 ++ OmagCUT.vbproj | 263 +++++++++++++ OmagCUTDictionary.xaml | 285 ++++++++++++++ OmagCUTDictionary.xaml.vb | 22 ++ Resources/ExitIcon.png | Bin 0 -> 5648 bytes Resources/Lama.jpg | Bin 0 -> 21904 bytes Resources/LogoOmag.jpg | Bin 0 -> 11098 bytes Resources/ZigZag.jpg | Bin 0 -> 22574 bytes TagliCadUC.xaml | 69 ++++ TagliCadUC.xaml.vb | 41 +++ TagliDirettiUC.xaml | 26 ++ TagliDirettiUC.xaml.vb | 3 + app.config | 23 ++ 42 files changed, 3183 insertions(+) create mode 100644 Application.xaml create mode 100644 Application.xaml.vb create mode 100644 BarLavoraUC.xaml create mode 100644 BarLavoraUC.xaml.vb create mode 100644 BarNestingUC.xaml create mode 100644 BarNestingUC.xaml.vb create mode 100644 ComponentiUC.xaml create mode 100644 ComponentiUC.xaml.vb create mode 100644 ConstGen.vb create mode 100644 ConstIni.vb create mode 100644 ConstMsg.vb create mode 100644 CorniciUC.xaml create mode 100644 CorniciUC.xaml.vb create mode 100644 FlatPartsImportUC.xaml create mode 100644 FlatPartsImportUC.xaml.vb create mode 100644 GrezzoUC.xaml create mode 100644 GrezzoUC.xaml.vb create mode 100644 LavoroInCorsoUC.xaml create mode 100644 LavoroInCorsoUC.xaml.vb create mode 100644 MainWindow.xaml create mode 100644 MainWindow.xaml.vb create mode 100644 My Project/AssemblyInfo.vb create mode 100644 My Project/MyExtensions/MyWpfExtension.vb create mode 100644 My Project/Resources.Designer.vb create mode 100644 My Project/Resources.resx create mode 100644 My Project/Settings.Designer.vb create mode 100644 My Project/Settings.settings create mode 100644 NumericKeyboardWD.xaml create mode 100644 NumericKeyboardWD.xaml.vb create mode 100644 OmagCUT.sln create mode 100644 OmagCUT.vbproj create mode 100644 OmagCUTDictionary.xaml create mode 100644 OmagCUTDictionary.xaml.vb create mode 100644 Resources/ExitIcon.png create mode 100644 Resources/Lama.jpg create mode 100644 Resources/LogoOmag.jpg create mode 100644 Resources/ZigZag.jpg create mode 100644 TagliCadUC.xaml create mode 100644 TagliCadUC.xaml.vb create mode 100644 TagliDirettiUC.xaml create mode 100644 TagliDirettiUC.xaml.vb create mode 100644 app.config diff --git a/Application.xaml b/Application.xaml new file mode 100644 index 0000000..2e13841 --- /dev/null +++ b/Application.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/Application.xaml.vb b/Application.xaml.vb new file mode 100644 index 0000000..9bc84c8 --- /dev/null +++ b/Application.xaml.vb @@ -0,0 +1,47 @@ +Imports System.Windows.Forms + +Class Application + + ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException + ' can be handled in this file. + + Protected Overrides Sub OnStartup(e As StartupEventArgs) + MyBase.OnStartup(e) + Dim mainWindow As New MainWindow + Dim thisDpiWidthFactor As Double + Dim thisDpiHeightFactor As Double + mainWindow.Show() + 'Controllo che abbia creato la finestra per evitare crash se non c'è la chiave + If (IsNothing(Application.Current.MainWindow)) Then + Exit Sub + End If + CalculateDpiFactors(mainWindow, thisDpiWidthFactor, thisDpiHeightFactor) + + + If (Screen.AllScreens.Length > 1) Then + Dim s2 As Screen = Screen.AllScreens(1) + Dim r2 As System.Drawing.Rectangle = s2.WorkingArea + + mainWindow.Top = r2.Top / thisDpiHeightFactor + mainWindow.Left = r2.Left / thisDpiWidthFactor + + + Else + Dim s1 As Screen = Screen.AllScreens(0) + Dim r1 As System.Drawing.Rectangle = s1.WorkingArea + mainWindow.Top = r1.Top + mainWindow.Left = r1.Left + + + End If + End Sub + + Private Shared Sub CalculateDpiFactors(ByRef mainwindow As Window, ByRef thisDpiWidthFactor As Double, ByRef thisDpiHeightFactor As Double) + Dim MainWindowPresentationSource As PresentationSource = PresentationSource.FromVisual(Application.Current.MainWindow) + Dim m As New Matrix + m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice + thisDpiWidthFactor = m.M11 + thisDpiHeightFactor = m.M22 + End Sub + +End Class diff --git a/BarLavoraUC.xaml b/BarLavoraUC.xaml new file mode 100644 index 0000000..7d8fccc --- /dev/null +++ b/BarLavoraUC.xaml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/BarLavoraUC.xaml.vb b/BarLavoraUC.xaml.vb new file mode 100644 index 0000000..5cbdebe --- /dev/null +++ b/BarLavoraUC.xaml.vb @@ -0,0 +1,3 @@ +Public Class BarLavoraUC + +End Class diff --git a/BarNestingUC.xaml b/BarNestingUC.xaml new file mode 100644 index 0000000..37b56b5 --- /dev/null +++ b/BarNestingUC.xaml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/BarNestingUC.xaml.vb b/BarNestingUC.xaml.vb new file mode 100644 index 0000000..e6c431f --- /dev/null +++ b/BarNestingUC.xaml.vb @@ -0,0 +1,3 @@ +Public Class BarNestingUC + +End Class diff --git a/ComponentiUC.xaml b/ComponentiUC.xaml new file mode 100644 index 0000000..af38e75 --- /dev/null +++ b/ComponentiUC.xaml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ComponentiUC.xaml.vb b/ComponentiUC.xaml.vb new file mode 100644 index 0000000..ca8bab5 --- /dev/null +++ b/ComponentiUC.xaml.vb @@ -0,0 +1,428 @@ +Imports EgtUILib +Imports System.Globalization + +Public Class ComponentiUC + + Dim MainWindowUC As MainWindow = Application.Current.MainWindow + Private WithEvents m_Controller3 As New Controller + + 'Per creazione Scene + Friend Shared WithEvents ScenaComponenti As New Scene + Dim ScenaComponentiHost As New System.Windows.Forms.Integration.WindowsFormsHost + + 'Per Scena Componenti + ' Constants + Private Const NUM_VAR As Integer = 10 + Private Const LUA_CMP_VARS As String = "CMP" + Private Const LUA_CMP_DRAW As String = "CMP_Draw" + + ' Properties + Private m_sCompoDir As String = String.Empty + Private m_sCompoName As String = String.Empty + Private m_CVars(NUM_VAR - 1) As CompoVar + Private m_bDrawOk As Boolean = False + Private m_bFirst As Boolean = True + + Private Sub ComponentiUC_Initialized(sender As Object, e As EventArgs) + + ScenaComponentiHost.Child = ScenaComponenti + ScenaComponentiHost.SetValue(Grid.ColumnProperty, 1) + ScenaComponentiHost.SetValue(Grid.RowProperty, 0) + ScenaComponentiHost.SetValue(Grid.RowSpanProperty, 2) + Me.BackGroundGridComponenti.Children.Add(ScenaComponentiHost) + + End Sub + + Private Sub ComponentiUC_Loaded(sender As Object, e As RoutedEventArgs) + + If (Not m_bFirst) Then + EgtSetCurrentContext(ScenaComponenti.GetCtx()) + Return + End If + + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, MainWindow.GetIniFile()) + ScenaComponenti.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, MainWindow.GetIniFile()) + Dim BackBotColor As New Color3d(BackTopColor) + GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, MainWindow.GetIniFile()) + ScenaComponenti.SetViewBackground(BackTopColor, BackBotColor) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, MainWindow.GetIniFile()) + ScenaComponenti.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, MainWindow.GetIniFile()) + ScenaComponenti.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, MainWindow.GetIniFile()) + ScenaComponenti.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, MainWindow.GetIniFile()) + ScenaComponenti.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, MainWindow.GetIniFile()) + Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, MainWindow.GetIniFile()) <> 0) + Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, MainWindow.GetIniFile()) + Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, MainWindow.GetIniFile()) + ScenaComponenti.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + 'Inizializzazione delle viste + ScenaComponenti.Init() + m_Controller3.SetScene(ScenaComponenti) + ' leggo direttorio componenti + GetPrivateProfileString(S_COMPO, K_COMPODIR, "", m_sCompoDir, MainWindow.GetIniFile()) + m_bFirst = False + End Sub + + Private Sub TriangleBtnUC_Click(sender As Object, e As RoutedEventArgs) + ' Carico componente + LoadCurrentCompo("Triangolo3L") + End Sub + + Private Sub RectangleTrapeziumBtnUC_Click(sender As Object, e As RoutedEventArgs) + + End Sub + + Private Sub LoadCurrentCompo(ByVal sCompo As String) + ' verifico se cambiato + 'If sCompo = m_sCompoName Then + ' Return + 'End If + m_sCompoName = sCompo + 'Pulisco l'ambiente lua + ResetLuaVariables() + ' Carico il file ed eseguo in modalità anteprima + Dim bOk As Boolean = ExecCompoFile() + Dim sMsg As String = String.Empty + bOk = bOk AndAlso MakePreview(sMsg) + If Not bOk Then + EgtNewFile() + End If + tbMsg.Text = sMsg + tbMsg.Background = If(m_bDrawOk, Brushes.White, Brushes.Tomato) + ScenaComponenti.ZoomAll() + ' leggo variabili e aggiorno griglia + ReadAndShowVariables() + ' abilito bottoni Vista e Inserisci + btnView.IsEnabled = True + btnInsert.IsEnabled = True + ' un pezzo da inserire + tbNbr.Text = "1" + End Sub + + Private Sub ViewBtnUC_Click(sender As Object, e As RoutedEventArgs) + ViewRefresh() + End Sub + + Private Sub ViewRefresh() + ' aggiorno le variabili dalla griglia + UpdateVariables() + ' ricalcolo il disegno + Dim sMsg As String = String.Empty + MakePreview(sMsg) + tbMsg.Text = sMsg + tbMsg.Background = If(m_bDrawOk, Brushes.White, Brushes.Tomato) + ' aggiorno visualizzazione + EgtSetView(VT.TOP, False) + EgtZoom(ZM.ALL) + End Sub + + Private Sub InsertBtnUC_Click(sender As Object, e As RoutedEventArgs) + ' aggiorno visualizzazione + ViewRefresh() + ' se errore esco + If Not m_bDrawOk Then + Return + End If + ' Leggo numero di pezzi da inserire + Dim InsNbr As Integer = tbNbr.Text + 'Pulisco la scena dl componente + EgtNewFile() + ' Passo al contesto principale + EgtSetCurrentContext(MainWindowUC.ActiveScene.GetCtx()) + ' Inserisco il componente nel DB geometrico principale + MakeInsert(InsNbr) + ' Aggiorno ambiente principale + EgtZoom(ZM.ALL) + 'Reset nome componente corrente + m_sCompoName = String.Empty + ResetLuaVariables() + ' Chiudo il dialogo + MainWindowUC.TagliCadContent.Content = MainWindowUC.m_TagliCadUC + End Sub + + Private Function ExecCompoFile() As Boolean + ' Costruisco path completa del componente + Dim sPath = m_sCompoDir & "\" & m_sCompoName & ".lua" + ' Carico il file + Return EgtLuaExecFile(sPath) + End Function + + Private Function ReadAndShowVariables() As Boolean + ' recupero nome, tipo e valore delle variabili globali + For i As Integer = 1 To NUM_VAR + Dim CVar = New CompoVar + If CVar.NameTypeValueFromLua(i) Then + m_CVars(i - 1) = CVar + Else + m_CVars(i - 1) = Nothing + End If + Next + ' aggiorno la griglia dalle variabili + For i As Integer = 1 To NUM_VAR + If m_CVars(i - 1) IsNot Nothing Then + GetNameEdit(i).Text = m_CVars(i - 1).m_sName + GetNameEdit(i).Visibility = Windows.Visibility.Visible + GetValueEdit(i).Text = m_CVars(i - 1).ToString() + GetValueEdit(i).Visibility = Windows.Visibility.Visible + Else + GetNameEdit(i).Visibility = Windows.Visibility.Hidden + GetValueEdit(i).Visibility = Windows.Visibility.Hidden + End If + Next + Return True + End Function + + Private Function UpdateVariables() As Boolean + ' aggiorno le variabili + For i As Integer = 1 To NUM_VAR + If m_CVars(i - 1) IsNot Nothing Then + ' interpreto il valore, se non riesco ripristino default + If Not m_CVars(i - 1).FromString(GetValueEdit(i).Text) Then + GetValueEdit(i).Text = m_CVars(i - 1).ToString() + End If + ' aggiorno la corrispondente variabile lua + If Not m_CVars(i - 1).ToLua(i) Then + Dim sErr As String = String.Empty + EgtLuaGetLastError(sErr) + EgtOutLog(sErr) + End If + End If + Next + Return True + End Function + + Private Function ResetLuaVariables() As Boolean + EgtLuaResetGlobVar(LUA_CMP_VARS) + EgtLuaResetGlobVar(LUA_CMP_DRAW) + Return False + End Function + + Private Function MakePreview(ByRef sMsg As String) As Boolean + If Not EgtLuaExecLine(LUA_CMP_DRAW & "(true)") Then + sMsg = "Error in component execution" + m_bDrawOk = False + Else + EgtLuaGetGlobStringVar(LUA_CMP_VARS & ".MSG", sMsg) + Dim nErr As Integer = 0 + EgtLuaGetGlobIntVar(LUA_CMP_VARS & ".ERR", nErr) + m_bDrawOk = (nErr = 0) + End If + Return m_bDrawOk + End Function + + Private Function MakeInsert(ByVal nNbr As Integer) As Boolean + ' abilito registrazione + EgtEnableCommandLogger() + ' ricarico componente corrente + ExecCompoFile() + ' aggiorno variabili + UpdateVariables() + ' elimino eventuali precedenti pezzi vuoti + EgtEraseEmptyParts() + ' eseguo inserimento + For i As Integer = 1 To nNbr + ' Inserisco il componente + If Not EgtLuaExecLine(LUA_CMP_DRAW & "(false)") Then + Dim sErr As String = String.Empty + EgtLuaGetLastError(sErr) + EgtOutLog(sErr) + Exit For + End If + ' Ne recupero l'Id + Dim nId2 As Integer = EgtGetLastPart() + ' Lo posiziono in ordine + EgtPackPart(nId2, PACK_MAX_X, PACK_OFFS) + Next + ' disabilito registrazione + EgtDisableCommandLogger() + Return True + End Function + + Private Function GetNameEdit(ByVal nInd As Integer) As TextBox + Select Case nInd + Case 1 + Return tbName1 + Case 2 + Return tbName2 + Case 3 + Return tbName3 + Case 4 + Return tbName4 + Case 5 + Return tbName5 + Case 6 + Return tbName6 + Case 7 + Return tbName7 + Case 8 + Return tbName8 + Case 9 + Return tbName9 + Case Else + Return tbName10 + End Select + End Function + + Private Function GetValueEdit(ByVal nInd As Integer) As TextBox + Select Case nInd + Case 1 + Return tbValue1 + Case 2 + Return tbValue2 + Case 3 + Return tbValue3 + Case 4 + Return tbValue4 + Case 5 + Return tbValue5 + Case 6 + Return tbValue6 + Case 7 + Return tbValue7 + Case 8 + Return tbValue8 + Case 9 + Return tbValue9 + Case Else + Return tbValue10 + End Select + End Function + + Private Class CompoVar + + ' Public Members + Public m_sName As String + Public m_nType As Integer + Public m_bVal As Boolean + Public m_nVal As Integer + Public m_dVal As Double + Public m_sVal As String + + ' Constants + Const LUA_NAME As String = LUA_CMP_VARS & ".N" + Const LUA_TYPE As String = LUA_CMP_VARS & ".T" + Const LUA_VALUE As String = LUA_CMP_VARS & ".V" + + Public Sub New() + m_nType = 0 + End Sub + + Public Overrides Function ToString() As String + Select Case m_nType + Case 1 ' booleano + Return m_bVal.ToString() + Case 2 ' intero + Return m_nVal.ToString() + Case 3 ' lunghezza + Return EgtToUiUnits(m_dVal).ToString("F4", CultureInfo.InvariantCulture) + Case 4 ' double + Return m_dVal.ToString("F4", CultureInfo.InvariantCulture) + Case 5 ' stringa + Return m_sVal + End Select + Return "" + End Function + + Public Function FromString(ByVal sVal As String) As Boolean + Select Case m_nType + Case 1 ' booleano + Dim bVal As Boolean = False + If Boolean.TryParse(sVal, bVal) Then + m_bVal = bVal + Return True + End If + Case 2 ' intero + Dim dVal As Double + If EgtLuaEvalNumExpr(sVal, dVal) Then + m_nVal = CInt(dVal) + Return True + End If + Case 3 ' lunghezza + Dim dVal As Double + If EgtLuaEvalNumExpr(sVal, dVal) Then + m_dVal = EgtFromUiUnits(dVal) + Return True + End If + Case 4 ' double + Dim dVal As Double + If EgtLuaEvalNumExpr(sVal, dVal) Then + m_dVal = dVal + Return True + End If + Case 5 'stringa + m_sVal = sVal + Return True + End Select + Return False + End Function + + Public Function ToLua(ByVal nInd As Integer) As Boolean + Select Case m_nType + Case 1 + Return EgtLuaSetGlobBoolVar(LUA_VALUE & nInd.ToString(), m_bVal) + Case 2 + Return EgtLuaSetGlobIntVar(LUA_VALUE & nInd.ToString(), m_nVal) + Case 3, 4 + Return EgtLuaSetGlobNumVar(LUA_VALUE & nInd.ToString(), m_dVal) + Case 5 + Return EgtLuaSetGlobStringVar(LUA_VALUE & nInd.ToString(), m_sVal) + End Select + Return False + End Function + + Public Function NameTypeValueFromLua(ByVal nInd As Integer) As Boolean + Dim bOk As Boolean = True + bOk = bOk AndAlso EgtLuaGetGlobStringVar(LUA_NAME & nInd.ToString(), m_sName) + bOk = bOk AndAlso EgtLuaGetGlobIntVar(LUA_TYPE & nInd.ToString(), m_nType) + Select Case m_nType + Case 1 + Return bOk AndAlso EgtLuaGetGlobBoolVar(LUA_VALUE & nInd.ToString(), m_bVal) + Case 2 + Return bOk AndAlso EgtLuaGetGlobIntVar(LUA_VALUE & nInd.ToString(), m_nVal) + Case 3, 4 + Return bOk AndAlso EgtLuaGetGlobNumVar(LUA_VALUE & nInd.ToString(), m_dVal) + Case 5 + Return bOk AndAlso EgtLuaGetGlobStringVar(LUA_VALUE & nInd.ToString(), m_sVal) + End Select + Return False + End Function + + End Class + + Private Sub CloseBtnUC_Click(sender As Object, e As RoutedEventArgs) + 'Pulisco la scena dl componente + EgtNewFile() + ' Passo al contesto principale + EgtSetCurrentContext(MainWindowUC.ActiveScene.GetCtx()) + ' Aggiorno ambiente principale + EgtZoom(ZM.ALL) + 'Reset nome componente corrente + m_sCompoName = String.Empty + ResetLuaVariables() + ' Chiudo il dialogo + MainWindowUC.TagliCadContent.Content = MainWindowUC.m_TagliCadUC + End Sub + + Private Sub ComponentiUC_Unloaded(sender As Object, e As RoutedEventArgs) + 'ScenaComponenti.Terminate() + End Sub + +End Class diff --git a/ConstGen.vb b/ConstGen.vb new file mode 100644 index 0000000..1914012 --- /dev/null +++ b/ConstGen.vb @@ -0,0 +1,45 @@ +'---------------------------------------------------------------------------- +' EgalTech 2015-2015 +'---------------------------------------------------------------------------- +' File : ConstGen.vb Data : 12.02.15 Versione : 1.6b3 +' Contenuto : Modulo costanti generali. +' +' +' +' Modifiche : 12.02.15 DS Creazione modulo. +' +' +'---------------------------------------------------------------------------- + +Module ConstGen + +' File con direttorio radice dei dati +Public Const DAT_FILE_NAME As String = "DataRoot.Ini" +Public Const S_DATA As String = "Data" + Public Const K_DATAROOT As String = "DataRoot" + + ' File con dati di licenza + Public Const LIC_FILE_NAME As String = "OmagCUT.lic" + Public Const S_LICENCE As String = "Licence" + Public Const K_KEY As String = "Key" + + ' File di log generale + Public Const GENLOG_FILE_NAME As String = "OmagCUTLog.txt" + + ' File di log dei comandi + Public Const CMDLOG_FILE_NAME As String = "OmagCUTLog.tua" + +' Sottodirettorio di configurazione +Public Const CONF_DIR As String = "Config" + +' Sottodirettorio temporaneo +Public Const TEMP_DIR As String = "Temp" + +' Sottodirettorio di default per le macchine +Public Const MACHINES_DFL_DIR As String = "Machines" + +' Costanti per Pack dei pezzi in Special +Public Const PACK_MAX_X As Double = 2500 +Public Const PACK_OFFS As Double = 20 + +End Module diff --git a/ConstIni.vb b/ConstIni.vb new file mode 100644 index 0000000..66d5aba --- /dev/null +++ b/ConstIni.vb @@ -0,0 +1,91 @@ +'---------------------------------------------------------------------------- +' EgalTech 2015-2015 +'---------------------------------------------------------------------------- +' File : ConstIni.vb Data : 12.02.15 Versione : 1.6b3 +' Contenuto : Modulo costanti sezione e chiavi per file Ini. +' +' +' +' Modifiche : 12.02.15 DS Creazione modulo. +' +' +'---------------------------------------------------------------------------- + +Module ConstIni + + Public Const INI_FILE_NAME As String = "OmagCUT.ini" + + Public Const S_GENERAL As String = "General" + Public Const K_DEBUG As String = "Debug" + Public Const K_LICENCE As String = "Licence" + Public Const K_USERLEVEL As String = "UserLevel" + Public Const K_MAXINST As String = "MaxInstances" + Public Const K_INSTANCES As String = "Instances" + Public Const K_COMMANDLOG As String = "CommandLog" + Public Const K_MESSAGES As String = "Messages" + Public Const K_WINPLACE As String = "WinPlace" + Public Const K_LASTNGEDIR As String = "LastNgeDir" + Public Const K_LASTNGEOBJDIR As String = "LastNgeObjDir" + Public Const K_LASTLUADIR As String = "LastLuaDir" + Public Const K_LASTIMPDIR As String = "LastImpDir" + Public Const K_LASTEXPDIR As String = "LastExpDir" + + Public Const S_LUA As String = "Lua" + Public Const K_LIBSDIR As String = "LibsDir" + Public Const K_BASELIB As String = "BaseLib" + + Public Const S_GEOMDB As String = "GeomDB" + Public Const K_DEFAULTFONT As String = "DefaultFont" + Public Const K_NFEFONTDIR As String = "NfeFontDir" + Public Const K_DEFAULTCOLOR As String = "DefaultColor" + Public Const K_SAVETYPE As String = "SaveType" + + Public Const S_OPENGL As String = "OpenGL" + Public Const K_DOUBLEBUFFER As String = "DoubleBuffer" + Public Const K_COLORBITS As String = "ColorBits" + Public Const K_DEPTHBITS As String = "DepthBits" + Public Const K_DRIVER As String = "Driver" + + Public Const S_SCENE As String = "Scene" + Public Const K_BACKTOP As String = "BackTop" + Public Const K_BACKBOTTOM As String = "BackBottom" + Public Const K_SHOWGFRAME As String = "ShowGFrame" + Public Const K_MARK As String = "Mark" + Public Const K_SELSURF As String = "SelSurf" + Public Const K_SHOWMODE As String = "ShowMode" + Public Const K_CURVEDIR As String = "CurveDir" + Public Const K_SHOWTRIAADV As String = "ShowTriaAdv" + Public Const K_ZOOMWIN As String = "ZoomWin" + Public Const K_DISTLINE As String = "DistLine" + Public Const K_MMUNITS As String = "MmUnits" + + Public Const S_GRID As String = "Grid" + Public Const K_SHOWGRID As String = "ShowGrid" + Public Const K_SHOWFRAME As String = "ShowFrame" + Public Const K_SNAPSTEP As String = "SnapStep" + Public Const K_SNAPSTEPINCH As String = "SnapStepInch" + Public Const K_MINLINESSTEP As String = "MinLineSStep" + Public Const K_MAJLINESSTEP As String = "MajLineSStep" + Public Const K_EXTSSTEP As String = "ExtSStep" + Public Const K_MINLNCOLOR As String = "MinLnColor" + Public Const K_MAJLNCOLOR As String = "MajLnColor" + + Public Const S_TABSPECIAL As String = "TabSpecial" + Public Const K_TSSHOW As String = "Show" + + Public Const S_COMPO As String = "Compo" + Public Const K_CMPWINPLACE As String = "WinPlace" + Public Const K_COMPODIR As String = "CompoDir" + + Public Const S_FLATPARTS As String = "FlatParts" + Public Const K_FLPWINPLACE As String = "WinPlace" + Public Const K_FLPCURRDIR As String = "CurrDir" + + Public Const S_MACH As String = "Mach" + Public Const K_MACHINESDIR As String = "MachinesDir" + + Public Const S_MRUFILES As String = "MruFiles" + Public Const S_MRUSCRIPTS As String = "MruScripts" + Public Const K_FILE As String = "File" + +End Module diff --git a/ConstMsg.vb b/ConstMsg.vb new file mode 100644 index 0000000..11fa8bf --- /dev/null +++ b/ConstMsg.vb @@ -0,0 +1,5 @@ +Module ConstMsg + + Public Const MSG_TAGLICAD As Integer = 9000 + +End Module diff --git a/CorniciUC.xaml b/CorniciUC.xaml new file mode 100644 index 0000000..30f4e01 --- /dev/null +++ b/CorniciUC.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/CorniciUC.xaml.vb b/CorniciUC.xaml.vb new file mode 100644 index 0000000..dd6ce6d --- /dev/null +++ b/CorniciUC.xaml.vb @@ -0,0 +1,3 @@ +Public Class CorniciUC + +End Class diff --git a/FlatPartsImportUC.xaml b/FlatPartsImportUC.xaml new file mode 100644 index 0000000..ca227db --- /dev/null +++ b/FlatPartsImportUC.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlatPartsImportUC.xaml.vb b/FlatPartsImportUC.xaml.vb new file mode 100644 index 0000000..0b30807 --- /dev/null +++ b/FlatPartsImportUC.xaml.vb @@ -0,0 +1,113 @@ +Imports EgtUILib + +Public Class FlatPartsImportUC + + ''Per creazione Scene + 'Friend Shared WithEvents ScenaFlatPartsImport As New Scene + 'Dim ScenaFlatPartsImportHost As New System.Windows.Forms.Integration.WindowsFormsHost + + ''Per ScenaFlatPartsImport + '' Properties + 'Private m_sCurrDir As String = String.Empty + 'Private m_sCurrFile As String = String.Empty + 'Private m_nFileType As Integer = FT.NULL + 'Private m_bFirst As Boolean = True + + Private Sub FlatPartsImportUC_Initialized(sender As Object, e As EventArgs) + + ' ScenaFlatPartsImportHost.Child = ScenaFlatPartsImport + ' ScenaFlatPartsImportHost.SetValue(Grid.ColumnProperty, 1) + ' ScenaFlatPartsImportHost.SetValue(Grid.RowProperty, 0) + ' ScenaFlatPartsImportHost.SetValue(Grid.RowSpanProperty, 2) + ' Me.BackGroundGridFlatPartsImport.Children.Add(ScenaFlatPartsImportHost) + + End Sub + + Private Sub FlatPartsImportUC_Loaded(sender As Object, e As RoutedEventArgs) + + ' If (Not m_bFirst) Then + ' EgtSetCurrentContext(ScenaFlatPartsImport.GetCtx()) + ' Return + ' End If + + ' ' imposto colore di default + ' Dim DefColor As New Color3d(0, 0, 0) + ' GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetDefaultMaterial(DefColor) + ' ' imposto colori sfondo + ' Dim BackTopColor As New Color3d(192, 192, 192) + ' GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, MainWindow.GetIniFile()) + ' Dim BackBotColor As New Color3d(BackTopColor) + ' GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetViewBackground(BackTopColor, BackBotColor) + ' ' imposto colore di evidenziazione + ' Dim MarkColor As New Color3d(255, 255, 0) + ' GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetMarkMaterial(MarkColor) + ' ' imposto colore per superfici selezionate + ' Dim SelSurfColor As New Color3d(255, 255, 192) + ' GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetSelSurfMaterial(SelSurfColor) + ' ' imposto tipo e colore del rettangolo di zoom + ' Dim bOutline As Boolean = True + ' Dim ZwColor As New Color3d(0, 0, 0) + ' GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetZoomWinAttribs(bOutline, ZwColor) + ' ' imposto colore della linea di distanza + ' Dim DstLnColor As New Color3d(255, 0, 0) + ' GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetDistLineMaterial(DstLnColor) + ' ' imposto parametri OpenGL + ' Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, MainWindow.GetIniFile()) + ' Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, MainWindow.GetIniFile()) <> 0) + ' Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, MainWindow.GetIniFile()) + ' Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, MainWindow.GetIniFile()) + ' ScenaFlatPartsImport.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + ' ' inizializzo la scena (DB geometrico + visualizzazione) + ' ScenaFlatPartsImport.Init() + ' ' leggo direttorio corrente + ' GetPrivateProfileString(S_FLATPARTS, K_FLPCURRDIR, "", m_sCurrDir, MainWindow.GetIniFile()) + ' ' lo carico + ' LoadCurrDir() + ' ' imposto misura + ' If EgtUiUnitsAreMM() Then + ' rbMm.Select() + ' Else + ' rbInch.Select() + ' End If + + End Sub + + Private Sub ScenaFlatPartsImportUC_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) + ' ' Recupero item selezionato + ' Dim vItems As ListView.SelectedListViewItemCollection = ListView1.SelectedItems + ' If vItems.Count() = 0 Then + ' Return + ' End If + ' ' A seconda del tipo + ' Select Case vItems(0).ImageIndex + ' Case 0 ' Vai nel direttorio padre + ' m_sCurrDir = IO.Path.GetDirectoryName(m_sCurrDir) + ' m_sCurrFile = "" + ' LoadCurrDir() + ' ListView1.Items(0).Selected = True + ' ListView1.Items(0).Focused = True + ' Case 1 ' Vai nella radice del disco + ' m_sCurrDir = vItems(0).Text + ' m_sCurrFile = "" + ' LoadCurrDir() + ' ListView1.Items(0).Selected = True + ' ListView1.Items(0).Focused = True + ' Case 2 ' Vai nel sottodirettorio + ' m_sCurrDir = IO.Path.Combine(m_sCurrDir, vItems(0).Text) + ' m_sCurrFile = "" + ' LoadCurrDir() + ' ListView1.Items(0).Selected = True + ' ListView1.Items(0).Focused = True + ' Case 3 ' File + ' m_sCurrFile = vItems(0).Text + ' LoadCurrFile() + ' End Select + End Sub + +End Class diff --git a/GrezzoUC.xaml b/GrezzoUC.xaml new file mode 100644 index 0000000..9a79111 --- /dev/null +++ b/GrezzoUC.xaml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb new file mode 100644 index 0000000..fd293bd --- /dev/null +++ b/MainWindow.xaml.vb @@ -0,0 +1,292 @@ +Imports System.Runtime.InteropServices +Imports System.Threading + +Imports System.Windows.Controls +Imports System.Globalization +Imports EgtUILib +Imports EgtUILib.EgtInterface +Imports EgtUILib.Scene +Imports System.Text + +Class MainWindow + + Private m_sDataRoot As String = String.Empty + Private m_sConfigDir As String = String.Empty + Private m_sTempDir As String = String.Empty + Private m_sMachinesRoot As String = String.Empty + Private Shared m_sIniFile As String = String.Empty + Private m_nDebug As Integer = 0 + Private WithEvents m_Controller1 As New Controller + Private WithEvents m_Controller2 As New Controller + + 'Per creazione Scene + Friend WithEvents MachiningScene As Scene + Friend WithEvents ActiveScene As Scene + Friend TavolaInLavorazioneHost As New System.Windows.Forms.Integration.WindowsFormsHost + Friend TavolaInProgettoHost As New System.Windows.Forms.Integration.WindowsFormsHost + + 'Per TagliCadUC + Friend m_TagliCadUC As TagliCadUC + Private m_ComponentiUC As ComponentiUC + Friend m_GrezzoUC As GrezzoUC + Friend WithEvents m_NumericKeyboardWD As NumericKeyboardWD + + 'Riferimento alla textbox che ha aperto la tastiera + 'Friend m_TxBxGotKeyboardFocus As TextBox + + '*********************************************** + + Public Shared Function GetIniFile() As String + Return m_sIniFile + End Function + + Private Sub Window_Initialized(sender As Object, e As EventArgs) + + ' Impostazione path radice per i dati + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + End If + ' Impostazione direttorio di configurazione + m_sConfigDir = m_sDataRoot & "\" & CONF_DIR + ' Impostazione direttorio per file temporanei + m_sTempDir = m_sDataRoot & "\" & TEMP_DIR + ' Impostazione path Ini file + m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME + ' Impostazione direttorio per le macchine + If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot, m_sIniFile) = 0 Then + m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR + End If + ' Leggo e imposto chiave di protezione + Dim sLicFileName As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_sIniFile) + Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName + Dim sKey As String = String.Empty + GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) + EgtSetKey(sKey) + 'Inizializzazione generale di EgtInterface + m_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0, m_sIniFile) + Dim sLogFile As String = m_sTempDir & "\" & GENLOG_FILE_NAME + Dim sLogMsg As String = My.Application.Info.Description.ToString() & " ver. " & My.Application.Info.Version.ToString() + EgtInit(m_nDebug, sLogFile, sLogMsg) + ' Leggo file messaggi + Dim sMsgFile As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgFile, m_sIniFile) + Dim sMsgFilePath As String = m_sConfigDir & "\" & sMsgFile + If Not EgtLoadMessages(sMsgFilePath) Then + EgtOutLog("Error in EgtLoadMessages") + End If + + 'Creazione UserControl dinamici + m_TagliCadUC = New TagliCadUC + m_ComponentiUC = New ComponentiUC + m_GrezzoUC = New GrezzoUC + m_NumericKeyboardWD = New NumericKeyboardWD + + 'Posiziono gli Host nelle rispettive griglie + TavolaInLavorazioneHost.SetValue(Grid.ColumnProperty, 0) + TavolaInLavorazioneHost.SetValue(Grid.RowProperty, 1) + TavolaInProgettoHost.SetValue(Grid.ColumnProperty, 0) + TavolaInProgettoHost.SetValue(Grid.RowProperty, 1) + + 'Assegno l'host TavolaInLavorazioneHost a LavoroInCorsoUC + LavoroInCorsoUC.BackGroundGridLavoroInCorso.Children.Add(TavolaInLavorazioneHost) + + End Sub + + Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) + + 'Assegno la NumericKeyboardWD come child della MainWindow + m_NumericKeyboardWD.Owner = Me + + 'Creo la scena + Me.MachiningScene = New Scene + Me.ActiveScene = New Scene + + 'Assegno il controllo Scena come Child dell'host + TavolaInLavorazioneHost.Child = MachiningScene + TavolaInProgettoHost.Child = ActiveScene + + '' Impostazione path radice per i dati + 'm_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + 'If GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then + ' m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + 'End If + '' Impostazione direttorio di configurazione + 'm_sConfigDir = m_sDataRoot & "\" & CONF_DIR + '' Impostazione direttorio per file temporanei + 'm_sTempDir = m_sDataRoot & "\" & TEMP_DIR + '' Impostazione path Ini file + 'm_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME + '' Impostazione direttorio per le macchine + 'If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot, m_sIniFile) = 0 Then + ' m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR + 'End If + '' Leggo e imposto chiave di protezione + 'Dim sLicFileName As String = String.Empty + 'GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName, m_sIniFile) + 'Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName + 'Dim sKey As String = String.Empty + 'GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) + 'EgtSetKey(sKey) + ''Inizializzazione generale di EgtInterface + 'm_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0, m_sIniFile) + 'Dim sLogFile As String = m_sTempDir & "\" & GENLOG_FILE_NAME + 'Dim sLogMsg As String = My.Application.Info.Description.ToString() & " ver. " & My.Application.Info.Version.ToString() + 'EgtInit(m_nDebug, sLogFile, sLogMsg) + '' Leggo file messaggi + 'Dim sMsgFile As String = String.Empty + 'GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgFile, m_sIniFile) + 'Dim sMsgFilePath As String = m_sConfigDir & "\" & sMsgFile + 'If Not EgtLoadMessages(sMsgFilePath) Then + ' EgtOutLog("Error in EgtLoadMessages") + 'End If + ' imposto dir font Nfe e font default + Dim sNfeDir As String = String.Empty + GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir, m_sIniFile) + Dim sDefFont As String = String.Empty + GetPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont, m_sIniFile) + EgtSetFont(sNfeDir, sDefFont) + ' imposto direttorio di default per libreria Lua + Dim sLuaLibsDir As String = String.Empty + GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir, m_sIniFile) + EgtSetLuaLibs(sLuaLibsDir) + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_sIniFile) + MachiningScene.SetDefaultMaterial(DefColor) + ActiveScene.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_sIniFile) + Dim BackBotColor As New Color3d(BackTopColor) + GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_sIniFile) + MachiningScene.SetViewBackground(BackTopColor, BackBotColor) + ActiveScene.SetViewBackground(BackTopColor, BackBotColor) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_sIniFile) + MachiningScene.SetMarkMaterial(MarkColor) + ActiveScene.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_sIniFile) + MachiningScene.SetSelSurfMaterial(SelSurfColor) + ActiveScene.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_sIniFile) + MachiningScene.SetZoomWinAttribs(bOutline, ZwColor) + ActiveScene.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_sIniFile) + MachiningScene.SetDistLineMaterial(DstLnColor) + ActiveScene.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_sIniFile) + Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_sIniFile) <> 0) + Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_sIniFile) + Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_sIniFile) + MachiningScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + ActiveScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + 'Inizializzazione delle viste + If Not MachiningScene.Init() Then + Close() + End If + ActiveScene.Init() + 'Impostazioni modificabili vista 2 (vanno fatte dopo Init) + 'EgtSetMarkAttribs(New Color3d(128, 255, 255)) + 'EgtSetGeoLineAttribs(New Color3d(0, 255, 0)) + 'EgtSetWinRectAttribs(False, New Color3d(255, 128, 128, 30)) + ' Impostazione dei controller + m_Controller1.SetScene(MachiningScene) + m_Controller2.SetScene(ActiveScene) + 'Attiva scena 1 + 'OnMouseDownScene(scene1) + 'Posizione e dimensioni del Form + 'If ModifierKeys <> Keys.Shift Then + ' Dim nFlag As Integer + ' Dim nLeft As Integer + ' Dim nTop As Integer + ' Dim nWidth As Integer + ' Dim nHeight As Integer + ' GetPrivateProfileWinPos("General", "WinPlace", nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile) + ' Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual + ' Me.Location = New Point(nLeft, nTop) + ' Me.Size = New Size(nWidth, nHeight) + ' WindowState = IIf(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + 'End If + + 'Eventi da UserControl + 'TagliCadUC + AddHandler m_TagliCadUC.ComponentsBtnMW_Click, AddressOf ComponentsBtnMW_Click + AddHandler m_TagliCadUC.ZoomAllBtnMW_Click, AddressOf ZoomAllBtnMW_Click + + End Sub + + Private Sub TabControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) + If (e.RemovedItems.Count > 0) Then + If (e.RemovedItems.Item(0).Equals(TabTagliDiretti)) Then + TagliDirettiUC.BackGroundGridTagliDiretti.Children.Remove(TavolaInProgettoHost) + End If + If (TabTagliCad.IsSelected = False) Then + m_TagliCadUC.BackGroundGridLavorazioniPiane.Children.Remove(TavolaInProgettoHost) + End If + If (TabLavorazioneCornici.IsSelected = False) Then + CorniciUC.BackGroundGridLavorazioneCornici.Children.Remove(TavolaInProgettoHost) + End If + + End If + + If (TabTagliDiretti.IsSelected) Then + TagliDirettiUC.BackGroundGridTagliDiretti.Children.Add(TavolaInProgettoHost) + Exit Sub + End If + If (TabTagliCad.IsSelected) Then + TagliCadContent.Content = m_TagliCadUC + m_TagliCadUC.BackGroundGridLavorazioniPiane.Children.Add(TavolaInProgettoHost) + Exit Sub + End If + If (TabLavorazioneCornici.IsSelected) Then + CorniciUC.BackGroundGridLavorazioneCornici.Children.Add(TavolaInProgettoHost) + Exit Sub + End If + + End Sub + + Private Sub ExitBtnMW_Click(sender As Object, e As RoutedEventArgs) + Close() + End Sub + + '-- ** Eventi del TABITEM LAVORAZIONI PIANE ** -- + + Private Sub ComponentsBtnMW_Click(sender As Object, e As RoutedEventArgs) + TagliCadContent.Content = m_ComponentiUC + End Sub + + Private Sub ZoomAllBtnMW_Click(sender As Object, e As RoutedEventArgs) + MachiningScene.ZoomAll() + End Sub + + 'Impedisce di clickare fuori dal UC Componenti finchè questo è aperto + Private Sub MainWindow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) + If (m_ComponentiUC.IsVisible And Not m_ComponentiUC.IsMouseOver) Then + e.Handled = True + End If + If (m_GrezzoUC.IsVisible And Not m_GrezzoUC.IsMouseOver) Then + e.Handled = True + End If + If (m_NumericKeyboardWD.IsVisible And Not m_NumericKeyboardWD.IsMouseOver) Then + e.Handled = True + End If + End Sub + + Private Sub MainWindow_KeyDown(sender As Object, e As KeyEventArgs) + If (m_NumericKeyboardWD.IsVisible And e.Key = Key.Enter) Then + m_NumericKeyboardWD.Visibility = Windows.Visibility.Hidden + End If + End Sub + +End Class \ No newline at end of file diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..ca4f1f4 --- /dev/null +++ b/My Project/AssemblyInfo.vb @@ -0,0 +1,59 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices +Imports System.Globalization +Imports System.Resources +Imports System.Windows + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'In order to begin building localizable applications, set +'CultureYouAreCodingWith in your .vbproj file +'inside a . For example, if you are using US english +'in your source files, set the to "en-US". Then uncomment the +'NeutralResourceLanguage attribute below. Update the "en-US" in the line +'below to match the UICulture setting in the project file. + +' + + +'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found. +'1st parameter: where theme specific resource dictionaries are located +'(used if a resource is not found in the page, +' or application resource dictionaries) + +'2nd parameter: where the generic resource dictionary is located +'(used if a resource is not found in the page, +'app, and any theme specific resource dictionaries) + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/My Project/MyExtensions/MyWpfExtension.vb b/My Project/MyExtensions/MyWpfExtension.vb new file mode 100644 index 0000000..2f5639e --- /dev/null +++ b/My Project/MyExtensions/MyWpfExtension.vb @@ -0,0 +1,121 @@ +#If _MyType <> "Empty" Then + +Namespace My + ''' + ''' Module used to define the properties that are available in the My Namespace for WPF + ''' + ''' + _ + Module MyWpfExtension + Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.Computer) + Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.User) + Private s_Windows As New ThreadSafeObjectProvider(Of MyWindows) + Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.Log) + ''' + ''' Returns the application object for the running application + ''' + _ + Friend ReadOnly Property Application() As Application + Get + Return CType(Global.System.Windows.Application.Current, Application) + End Get + End Property + ''' + ''' Returns information about the host computer. + ''' + _ + Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.Computer + Get + Return s_Computer.GetInstance() + End Get + End Property + ''' + ''' Returns information for the current user. If you wish to run the application with the current + ''' Windows user credentials, call My.User.InitializeWithWindowsUser(). + ''' + _ + Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.User + Get + Return s_User.GetInstance() + End Get + End Property + ''' + ''' Returns the application log. The listeners can be configured by the application's configuration file. + ''' + _ + Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.Log + Get + Return s_Log.GetInstance() + End Get + End Property + + ''' + ''' Returns the collection of Windows defined in the project. + ''' + _ + Friend ReadOnly Property Windows() As MyWindows + _ + Get + Return s_Windows.GetInstance() + End Get + End Property + _ + _ + Friend NotInheritable Class MyWindows + _ + Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Window})(ByVal Instance As T) As T + If Instance Is Nothing Then + If s_WindowBeingCreated IsNot Nothing Then + If s_WindowBeingCreated.ContainsKey(GetType(T)) = True Then + Throw New Global.System.InvalidOperationException("The window cannot be accessed via My.Windows from the Window constructor.") + End If + Else + s_WindowBeingCreated = New Global.System.Collections.Hashtable() + End If + s_WindowBeingCreated.Add(GetType(T), Nothing) + Return New T() + s_WindowBeingCreated.Remove(GetType(T)) + Else + Return Instance + End If + End Function + _ + _ + Private Sub Dispose__Instance__(Of T As Global.System.Windows.Window)(ByRef instance As T) + instance = Nothing + End Sub + _ + _ + Public Sub New() + MyBase.New() + End Sub + Private Shared s_WindowBeingCreated As Global.System.Collections.Hashtable + Public Overrides Function Equals(ByVal o As Object) As Boolean + Return MyBase.Equals(o) + End Function + Public Overrides Function GetHashCode() As Integer + Return MyBase.GetHashCode + End Function + _ + _ + Friend Overloads Function [GetType]() As Global.System.Type + Return GetType(MyWindows) + End Function + Public Overrides Function ToString() As String + Return MyBase.ToString + End Function + End Class + End Module +End Namespace +Partial Class Application + Inherits Global.System.Windows.Application + _ + _ + Friend ReadOnly Property Info() As Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo + _ + Get + Return New Global.Microsoft.VisualBasic.ApplicationServices.AssemblyInfo(Global.System.Reflection.Assembly.GetExecutingAssembly()) + End Get + End Property +End Class +#End If \ No newline at end of file diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb new file mode 100644 index 0000000..1717160 --- /dev/null +++ b/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("OmagCUT.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/My Project/Resources.resx b/My Project/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb new file mode 100644 index 0000000..160711a --- /dev/null +++ b/My Project/Settings.Designer.vb @@ -0,0 +1,71 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.34209 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + + + _ +Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property +End Class + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.OmagCUT.MySettings + Get + Return Global.OmagCUT.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/My Project/Settings.settings b/My Project/Settings.settings new file mode 100644 index 0000000..2b428d2 --- /dev/null +++ b/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/NumericKeyboardWD.xaml b/NumericKeyboardWD.xaml new file mode 100644 index 0000000..8a4c46a --- /dev/null +++ b/NumericKeyboardWD.xaml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TagliCadUC.xaml.vb b/TagliCadUC.xaml.vb new file mode 100644 index 0000000..11da1e7 --- /dev/null +++ b/TagliCadUC.xaml.vb @@ -0,0 +1,41 @@ +Public Class TagliCadUC + + Dim MainWindowUC As MainWindow = Application.Current.MainWindow + Dim m_BarLavoraUC As BarLavoraUC + Dim m_BarNestingUC As BarNestingUC + + Public Event ComponentsBtnMW_Click As RoutedEventHandler + Public Event ZoomAllBtnMW_Click As RoutedEventHandler + + Private Sub TagliCadUC_Initialized(sender As Object, e As EventArgs) + m_BarLavoraUC = New BarLavoraUC + m_BarNestingUC = New BarNestingUC + End Sub + + Private Sub TagliCadUC_Loaded(sender As Object, e As RoutedEventArgs) + RightBtnBarContent.Content = m_BarNestingUC + End Sub + + Private Sub ComponentsBtnUC_Click(sender As Object, e As RoutedEventArgs) + RaiseEvent ComponentsBtnMW_Click(sender, e) + End Sub + + Private Sub ZoomAllBtnUC_Click(sender As Object, e As RoutedEventArgs) + RaiseEvent ZoomAllBtnMW_Click(sender, e) + End Sub + + Private Sub LavoraBtnUC_Click(sender As Object, e As RoutedEventArgs) + If (RightBtnBarContent.Content = m_BarNestingUC) Then + RightBtnBarContent.Content = m_BarLavoraUC + Else + RightBtnBarContent.Content = m_BarLavoraUC + End If + End Sub + + Private Sub GrezzoBtnUC_Click(sender As Object, e As RoutedEventArgs) + MainWindowUC.m_GrezzoUC.SetValue(Grid.RowProperty, 1) + MainWindowUC.m_GrezzoUC.SetValue(Grid.RowSpanProperty, 2) + MainWindowUC.MainGrid.Children.Add(MainWindowUC.m_GrezzoUC) + End Sub + +End Class diff --git a/TagliDirettiUC.xaml b/TagliDirettiUC.xaml new file mode 100644 index 0000000..60900a6 --- /dev/null +++ b/TagliDirettiUC.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/TagliDirettiUC.xaml.vb b/TagliDirettiUC.xaml.vb new file mode 100644 index 0000000..a207999 --- /dev/null +++ b/TagliDirettiUC.xaml.vb @@ -0,0 +1,3 @@ +Public Class TagliDirettiUC + +End Class diff --git a/app.config b/app.config new file mode 100644 index 0000000..843d111 --- /dev/null +++ b/app.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + +