diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab848d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,330 @@ +# ---> VisualStudio +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# ---> C Sharp +# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) +[Bb]in/ +[Oo]bj/ + +# mstest test results +TestResults + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.log +*.vspscc +*.vssscc +.builds + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper* + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +packages + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +[Bb]in +[Oo]bj +sql +TestResults +[Tt]est[Rr]esult* +*.Cache +ClientBin +[Ss]tyle[Cc]op.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + +.ionide/symbolCache.db diff --git a/3dPrintApp.sln b/3dPrintApp.sln new file mode 100644 index 0000000..da87235 --- /dev/null +++ b/3dPrintApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32002.261 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "3dPrintApp", "3dPrintApp/3dPrintApp.vbproj", "{BCDE0368-2C69-4948-8723-D0FE71417986}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BCDE0368-2C69-4948-8723-D0FE71417986}.Debug|x64.ActiveCfg = Debug|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Debug|x64.Build.0 = Debug|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Release|x64.ActiveCfg = Release|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {81E51533-B864-460A-ABD4-ADD1566CCDE0} + EndGlobalSection +EndGlobal diff --git a/3dPrintApp/3dPrintApp.sln b/3dPrintApp/3dPrintApp.sln new file mode 100644 index 0000000..7844821 --- /dev/null +++ b/3dPrintApp/3dPrintApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32002.261 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "3dPrintApp", "3dPrintApp.vbproj", "{BCDE0368-2C69-4948-8723-D0FE71417986}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BCDE0368-2C69-4948-8723-D0FE71417986}.Debug|x64.ActiveCfg = Debug|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Debug|x64.Build.0 = Debug|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Release|x64.ActiveCfg = Release|x64 + {BCDE0368-2C69-4948-8723-D0FE71417986}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {81E51533-B864-460A-ABD4-ADD1566CCDE0} + EndGlobalSection +EndGlobal diff --git a/3dPrintApp/3dPrintApp.vbproj b/3dPrintApp/3dPrintApp.vbproj new file mode 100644 index 0000000..d7c80ad --- /dev/null +++ b/3dPrintApp/3dPrintApp.vbproj @@ -0,0 +1,336 @@ + + + + Debug + AnyCPU + {BCDE0368-2C69-4948-8723-D0FE71417986} + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + WinExe + _3dPrintApp + 3dPrintApp + v4.7.2 + Custom + true + true + + + On + + + Binary + + + Off + + + On + + + true + true + true + bin\x64\Debug\ + 3dPrintApp.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + full + x64 + true + + + true + bin\x64\Release\ + 3dPrintApp.xml + true + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314 + pdbonly + x64 + true + + + + ..\..\EgtProg\DllD32\EgtUILib.dll + + + ..\..\EgtProg\DllD32\EgtWPFLib5.dll + + + packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll + + + + + + + + + + + 4.0 + + + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + + + + CurrLayerSliderV.xaml + + + + InstrumentPanelV.xaml + + + + LeftPanelV.xaml + + + + MachinePanelV.xaml + + + + ProjectV.xaml + + + + ProjManagerV.xaml + + + + + SceneHostV.xaml + + + SecondaryWindowV.xaml + + + + ShowPanelV.xaml + + + Printing3DPanelV.xaml + + + + + + StatusBarV.xaml + + + TopPanelV.xaml + + + + + Dictionary.xaml + + + + + + + + + ViewPanelV.xaml + + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Application.xaml + Code + + + MainWindow.xaml + Code + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + + + + + + + + + + + + MainWindowV.xaml + + + + Code + + + Microsoft.VisualBasic.WPF.MyExtension + 1.0.0.0 + + + True + True + Resources.resx + + + True + Settings.settings + True + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + + + SettingsSingleFileGenerator + Settings.Designer.vb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\3dPrintApp\3dPrintAppR64.exe +IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\3dPrintApp\3dPrintAppD64.exe + + \ No newline at end of file diff --git a/3dPrintApp/AboutBoxWindow/AboutBoxV.xaml b/3dPrintApp/AboutBoxWindow/AboutBoxV.xaml new file mode 100644 index 0000000..1e807e4 --- /dev/null +++ b/3dPrintApp/AboutBoxWindow/AboutBoxV.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/LeftPanel/LeftPanelV.xaml.vb b/3dPrintApp/LeftPanel/LeftPanelV.xaml.vb new file mode 100644 index 0000000..919aa0c --- /dev/null +++ b/3dPrintApp/LeftPanel/LeftPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class LeftPanelV + +End Class diff --git a/3dPrintApp/LeftPanel/LeftPanelVM.vb b/3dPrintApp/LeftPanel/LeftPanelVM.vb new file mode 100644 index 0000000..ccd634e --- /dev/null +++ b/3dPrintApp/LeftPanel/LeftPanelVM.vb @@ -0,0 +1,25 @@ +Imports System.Globalization + +Public Class LeftPanelVM + +End Class + +Public Class CenterToolTipConverter + Implements IMultiValueConverter + + Public Function Convert(ByVal values As Object(), ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IMultiValueConverter.Convert + For Each value In values + If TypeOf (value) IsNot Double Then + Return Double.NaN + End If + Next + Dim placementTargetHeight As Double = CDbl(values(0)) + Dim toolTipHeight As Double = CDbl(values(1)) + Return (placementTargetHeight / 2.0) - (toolTipHeight / 2.0) + End Function + + Public Function ConvertBack(ByVal value As Object, ByVal targetTypes As Type(), ByVal parameter As Object, ByVal culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack + Throw New NotSupportedException() + End Function + +End Class diff --git a/3dPrintApp/MachinePanel/MachinePanelV.xaml b/3dPrintApp/MachinePanel/MachinePanelV.xaml new file mode 100644 index 0000000..a963f60 --- /dev/null +++ b/3dPrintApp/MachinePanel/MachinePanelV.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/MachinePanel/MachinePanelV.xaml.vb b/3dPrintApp/MachinePanel/MachinePanelV.xaml.vb new file mode 100644 index 0000000..83a5832 --- /dev/null +++ b/3dPrintApp/MachinePanel/MachinePanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class MachinePanelV + +End Class diff --git a/3dPrintApp/MachinePanel/MachinePanelVM.vb b/3dPrintApp/MachinePanel/MachinePanelVM.vb new file mode 100644 index 0000000..5aba00d --- /dev/null +++ b/3dPrintApp/MachinePanel/MachinePanelVM.vb @@ -0,0 +1,168 @@ +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MachinePanelVM + Inherits EgtWPFLib5.MachinePanelVM + +#Region "FIELDS & PROPERTIES" + + ' Radice del direttorio delle macchine + Private m_sMachinesRoot As String + + ' Macchina correntemente selezionata e quindi attiva + Private m_SelectedMachine As Machine = Nothing + Public Overrides Property SelectedMachine As Machine + Get + Return m_SelectedMachine + End Get + Set(value As Machine) + If value IsNot m_SelectedMachine Then + ' imposto macchina in DbGeometrico + If EgtSetCurrMachine(value.Name) Then + m_SelectedMachine = value + End If + ' Salvo impostazione macchina corrente + SaveCurrentMachine() + NotifyPropertyChanged(NameOf(SelectedMachine)) + ' inizializzo la macchina selezionata come macchina corrente + InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, value.Name) + ' aggiorno nome macchina in statusbar + Map.refMyStatusBarVM.RefreshMachName() + End If + End Set + End Property + + Private m_MachPanel_IsEnabled As Boolean = True + Public Property MachPanel_IsEnabled As Boolean + Get + Return m_MachPanel_IsEnabled + End Get + Set(value As Boolean) + m_MachPanel_IsEnabled = value + NotifyPropertyChanged("MachPanel_IsEnabled") + End Set + End Property + + Private m_BeamTable_Visibility As Visibility + Public ReadOnly Property BeamTable_Visibility As Visibility + Get + Return m_BeamTable_Visibility + End Get + End Property + + Private m_WallTable_Visibility As Visibility + Public ReadOnly Property WallTable_Visibility As Visibility + Get + Return m_WallTable_Visibility + End Get + End Property + +#Region "Messages" + + Public ReadOnly Property ToolDBMsg As String + Get + Return EgtMsg(MSG_MACHINEPAGEUC + 6) + End Get + End Property + Public ReadOnly Property MachiningDbMsg As String + Get + Return EgtMsg(MSG_MACHINEPAGEUC + 7) + End Get + End Property + Public ReadOnly Property SetUpMsg As String + Get + Return EgtMsg(MSG_ALARMSPAGEUC + 33) + End Get + End Property + +#End Region ' Messages + +#Region "ToolTip" + + Public ReadOnly Property ToolDBToolTip As String + Get + Return EgtMsg(5003) + End Get + End Property + Public ReadOnly Property MachiningDbToolTip As String + Get + Return EgtMsg(5004) + End Get + End Property + Public ReadOnly Property SetUpToolTip As String + Get + Return EgtMsg(31501) + End Get + End Property + +#End Region ' ToolTip + + ' Definizione comandi + Private m_cmdBeamTable As ICommand + Private m_cmdWallTable As ICommand + +#End Region 'FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefMachinePanelVM(Me) + ' recupero cartella radice delle macchine + m_sMachinesRoot = Map.refMainWindowVM.MainWindowM.sMachinesRoot + ' Carica macchine da cartella delle macchine + MyMachine.MachineListInit(m_sMachinesRoot, MachineList) + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Friend Sub LoadCurrentMachine() + If MachineList.Count = 0 Then Return + Dim CurrMachine As Machine = Nothing + Dim CurrMachineName As String = String.Empty + GetMainPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMachineName) + Dim bFound As Boolean = False + If Not String.IsNullOrEmpty(CurrMachineName) Then + For Each Mach In MachineList + If Mach.Name = CurrMachineName Then + bFound = True + CurrMachine = Mach + Exit For + End If + Next + End If + If Not bFound And MachineList.Count > 0 Then + CurrMachine = MachineList(0) + End If + If Not IsNothing(CurrMachine) Then + If EgtSetCurrMachine(CurrMachine.Name) Then + SelectedMachine = CurrMachine + End If + End If + End Sub + + Friend Sub SaveCurrentMachine() + If IsNothing(m_SelectedMachine) Then Return + WriteMainPrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name) + End Sub + + Friend Sub UpdateCurrentMachine() + 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Dim sMachName As String = String.Empty + If EgtGetCurrMachineName(sMachName) Then + For Each Mach In MachineList + If Mach.Name = sMachName Then + SelectedMachine = Mach + Exit For + End If + Next + End If + End Sub + +#End Region + +End Class diff --git a/3dPrintApp/MainWindow.xaml b/3dPrintApp/MainWindow.xaml new file mode 100644 index 0000000..6d76522 --- /dev/null +++ b/3dPrintApp/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/3dPrintApp/MainWindow.xaml.vb b/3dPrintApp/MainWindow.xaml.vb new file mode 100644 index 0000000..922a5de --- /dev/null +++ b/3dPrintApp/MainWindow.xaml.vb @@ -0,0 +1,3 @@ +Class MainWindow + +End Class diff --git a/3dPrintApp/MainWindow/MainWindowM.vb b/3dPrintApp/MainWindow/MainWindowM.vb new file mode 100644 index 0000000..b8daf65 --- /dev/null +++ b/3dPrintApp/MainWindow/MainWindowM.vb @@ -0,0 +1,347 @@ +Imports System.Threading +Imports System.Math +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MainWindowM + +#Region "FIELDS" + + ' massimo numero di istanze del programma ammesse + Const MAX_INST As Integer = 32 + + Private m_sDataRoot As String = String.Empty + Friend ReadOnly Property sDataRoot As String + Get + Return m_sDataRoot + End Get + End Property + + Private m_sDataDir As String = String.Empty + Friend ReadOnly Property sDataDir As String + Get + Return m_sDataDir + End Get + End Property + + Private m_sConfigDir As String = String.Empty + Public ReadOnly Property sConfigDir As String + Get + Return m_sConfigDir + End Get + End Property + + Private m_nDebug As Integer = 0 + + Private m_objMutex As Mutex + + Private m_bFirstInstance As Boolean = False + Friend ReadOnly Property bFirstInstance As Boolean + Get + Return m_bFirstInstance + End Get + End Property + + Private m_nInstance As Integer = 0 + Friend ReadOnly Property nInstance As Integer + Get + Return m_nInstance + End Get + End Property + + Private m_nUserLevel As Integer = 1 + Friend ReadOnly Property nUserLevel As Integer + Get + Return m_nUserLevel + End Get + End Property + + Private m_nKeyLevel As Integer = 0 + Friend ReadOnly Property nKeyLevel As Integer + Get + Return m_nKeyLevel + End Get + End Property + + Private m_nKeyOptions As UInteger = 0 + Friend ReadOnly Property nKeyOptions As Integer + Get + Return m_nKeyOptions + End Get + End Property + + Private m_bAutoNestOption As Boolean = False + Friend ReadOnly Property AutoNestOption As Boolean + Get + Return m_bAutoNestOption + End Get + End Property + + Friend ReadOnly Property sVersion As String + Get + Return My.Application.Info.Version.Major.ToString() & "." & + My.Application.Info.Version.Minor.ToString() & + (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & + My.Application.Info.Version.Revision.ToString() + End Get + End Property + + Private m_s3dPrintingDir As String + Friend ReadOnly Property s3dPrintingDir As String + Get + Return m_s3dPrintingDir + End Get + End Property + Private m_sMachiningsDir As String + Friend ReadOnly Property sMachiningsDir As String + Get + Return m_sMachiningsDir + End Get + End Property + Private m_sMaterialsDir As String + Friend ReadOnly Property sMaterialsDir As String + Get + Return m_sMaterialsDir + End Get + End Property + + Private m_sTempDir As String + Friend ReadOnly Property sTempDir As String + Get + Return m_sTempDir + End Get + End Property + Private m_sMachinesRoot As String + Friend ReadOnly Property sMachinesRoot As String + Get + Return m_sMachinesRoot + End Get + End Property + Private m_sToolMakersDir As String + Friend ReadOnly Property sToolMakersDir As String + Get + Return m_sToolMakersDir + End Get + End Property + Private m_sResourcesRoot As String + Friend ReadOnly Property sResourcesRoot As String + Get + Return m_sResourcesRoot + End Get + End Property + Private m_sLogFile As String + Friend ReadOnly Property sLogFile As String + Get + Return m_sLogFile + End Get + End Property + +#End Region ' FIELDS + +#Region "CONSTRUCTOR" + + Sub New() + InitializeEgtEnvironment() + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Private Sub InitializeEgtEnvironment() + '' Abilito drag and drop + 'Me.AllowDrop = True + ' Impostazione path radice per i dati + m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory + If EgtUILib.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 + IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME + ' Impostazione path resources dir + m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR + ' Impostazione path machinings e materials dir + m_sMachiningsDir = m_sDataRoot & "\" & MACHININGS_DIR + m_sMaterialsDir = m_sDataRoot & "\" & MATERIALS_DIR + ' Impostazione direttorio per le macchine + If GetMainPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then + m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR + End If + ' Impostazione direttorio per toolmakers + If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then + m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR + End If + ' Impostazione direttorio 3dPrinting + If GetMainPrivateProfileString(S_PRINTING3D, K_3PRNBASEDIR, "", m_s3dPrintingDir) = 0 Then + m_s3dPrintingDir = m_sDataRoot & "\" & _3DPRINTING_DIR + End If + ' Verifico indice di istanza + ManageInstance() + ' Imposto tipo di chiave + EgtSetLockType(KEY_TYPE.HW) + ' Leggo e imposto chiave di protezione + Dim sLicFileName As String = String.Empty + GetMainPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName) + Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName + Dim sKey As String = String.Empty + EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) + EgtSetKey(sKey) + Dim sNestKey As String = "" + EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile) + 'EgtSetNestKey(sNestKey) + ' Verifico abilitazione nesting automatico + m_bAutoNestOption = Not String.IsNullOrWhiteSpace(sNestKey) + ' Recupero livello e opzioni della chiave + Dim bKey As Boolean = EgtGetKeyLevel(3279, 2405, 1, m_nKeyLevel) And + EgtGetKeyOptions(3279, 2405, 1, m_nKeyOptions) + ' Inizializzazione generale di EgtInterface + m_nDebug = GetMainPrivateProfileInt(S_GENERAL, K_DEBUG, 0) + m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", m_nInstance.ToString()) + Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & m_nInstance.ToString() & ")" & vbLf & + My.Application.Info.Title.ToString() & " ver. " & + My.Application.Info.Version.Major.ToString() & + "." & My.Application.Info.Version.Minor.ToString() & + (ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() & + My.Application.Info.Version.Revision.ToString() + EgtInit(m_nDebug, m_sLogFile, sLogMsg) + EgtSetTempDir(m_sTempDir) + EgtSetIniFile(IniFile.m_sIniFile) + ' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione) + Dim sMsgDir As String = String.Empty + If GetMainPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then + sMsgDir = m_sConfigDir + End If + ' Leggo lingua corrente + Dim sLanguage As String = String.Empty + GetMainPrivateProfileString(S_GENERAL, K_MESSAGES, "", sLanguage) + ' Recupero nome file dei messaggi della lingua corrente + Dim sMsgName As String = "EgalTechIta.txt" + Dim nIndex As Integer = 1 + While True + Dim ReadLanguage As Language = GetMainPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex) + If IsNothing(ReadLanguage) Then Exit While + If String.Compare(ReadLanguage.Name, sLanguage, True) = 0 Then + sMsgName = ReadLanguage.FilePath + Exit While + End If + nIndex += 1 + End While + ' Leggo file messaggi + Dim sMsgFilePath As String = sMsgDir & "\" & sMsgName + If Not EgtLoadMessages(sMsgFilePath) Then + EgtOutLog("Error in EgtLoadMessages") + End If + ' Leggo e imposto unità di misura per interfaccia utente + EgtSetUiUnits(GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0) + ' Leggo e imposto livello utilizzatore + m_nUserLevel = Math.Min(m_nKeyLevel, GetMainPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1)) + ' Imposto dir font Nfe e font default + Dim sNfeDir As String = String.Empty + GetMainPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir) + Dim sDefFont As String = String.Empty + GetMainPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont) + EgtSetFont(sNfeDir, sDefFont) + ' imposto dir di default per libreria Lua e lancio libreria di base + Dim sLuaLibsDir As String = String.Empty + GetMainPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir) + EgtSetLuaLibs(sLuaLibsDir) + Dim sLuaBaseLib As String = String.Empty + GetMainPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib) + EgtLuaRequire(sLuaBaseLib) + ' Info su opzioni chiave + EgtOutLog("KeyOptions : " & bKey.ToString() & " " & m_nKeyOptions.ToString()) + End Sub + + Private Sub ManageInstance() + Dim bCreated As Boolean + Try + m_objMutex = New Mutex(False, "Global\3dPrintApp", bCreated) + Catch + bCreated = False + End Try + m_bFirstInstance = bCreated + If bCreated Then + ' Prima istanza + m_nInstance = 1 + ' Aggiorno stato istanze attive + WriteMainPrivateProfileString(S_GENERAL, K_VIEWOPTIM_INSTANCES, m_nInstance.ToString()) + Else + ' Leggo il massimo numero di istanze ammesse + Dim nMaxInst As Integer = GetMaxInstances() + ' Cerco il primo indice di istanza libero + Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_VIEWOPTIM_INSTANCES, 0) + m_nInstance = 1 + Dim nMask As Integer = 1 + While (nTmp And nMask) <> 0 And m_nInstance <= MAX_INST + m_nInstance += 1 + nMask *= 2 + End While + ' Se l'indice supera il massimo + If m_nInstance > nMaxInst Then + ' porto in primo piano la prima istanza + Dim bFound As Boolean = False + ' processi del programma a 32 bit + Dim localProc As Process() = Process.GetProcessesByName("3dPrintAppR32") + For Each p As Process In localProc + If p.Id <> Process.GetCurrentProcess().Id Then + bFound = True + ShowWindow(p.MainWindowHandle, 1) + Exit For + End If + Next + ' se non trovati processi a 32 bit provo a 64 bit + If Not bFound Then + localProc = Process.GetProcessesByName("3dPrintAppR64") + For Each p As Process In localProc + If p.Id <> Process.GetCurrentProcess().Id Then + bFound = True + ShowWindow(p.MainWindowHandle, SW.RESTORE) + Exit For + End If + Next + End If + ' esco dal programma + End + End If + ' Aggiorno stato istanze attive + nTmp += (1 << (m_nInstance - 1)) + WriteMainPrivateProfileString(S_GENERAL, K_VIEWOPTIM_INSTANCES, nTmp.ToString()) + End If + End Sub + + Friend Function GetKeyOption(nKeyOpt As KEY_OPT) As Boolean + Return ((m_nKeyOptions And nKeyOpt) <> 0) + End Function + + Friend Function GetMaxInstances() As Integer + ' Leggo il massimo numero di istanze ammesse + Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXINST, 1) + Return 1 ' Max(1, Min(nMaxInst, MAX_INST)) + End Function + + Friend Function GetMaxCamInstances() As Integer + ' Leggo il massimo numero di istanze ammesse + Dim nMaxInst As Integer = GetMainPrivateProfileInt(S_GENERAL, K_MAXCAMINST, 1) + Return Max(1, Min(nMaxInst, MAX_INST)) + End Function + + Friend Sub Close() + ' Terminazione generale di EgtInterface + EgtExit() + ' Aggiorno istanze usate + m_objMutex.WaitOne(1000) + Dim nTmp As Integer = GetMainPrivateProfileInt(S_GENERAL, K_VIEWOPTIM_INSTANCES, 0) + nTmp -= (1 << (m_nInstance - 1)) + WriteMainPrivateProfileString(S_GENERAL, K_VIEWOPTIM_INSTANCES, nTmp.ToString()) + m_objMutex.ReleaseMutex() + ' Rilascio mutex + If Not IsNothing(m_objMutex) Then m_objMutex.Close() + End Sub + +#End Region ' METHODS + +End Class diff --git a/3dPrintApp/MainWindow/MainWindowV.xaml b/3dPrintApp/MainWindow/MainWindowV.xaml new file mode 100644 index 0000000..a782b35 --- /dev/null +++ b/3dPrintApp/MainWindow/MainWindowV.xaml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/3dPrintApp/MainWindow/MainWindowV.xaml.vb b/3dPrintApp/MainWindow/MainWindowV.xaml.vb new file mode 100644 index 0000000..053ef6f --- /dev/null +++ b/3dPrintApp/MainWindow/MainWindowV.xaml.vb @@ -0,0 +1,63 @@ +Imports EgtWPFLib5 +Imports EgtUILib +Imports System.Windows.Interop + +Class MainWindowV + + Private m_MainWindowVM As MainWindowVM + Private m_SceneHostWnd As SecondaryWindowV + +#Region "CONSTRUCTOR" + + Sub New() + m_MainWindowVM = New MainWindowVM + ' Funzione che interpreta l'xaml + InitializeComponent() + Me.DataContext = m_MainWindowVM + ' creo finestra della scena + AddHandler Me.Loaded, AddressOf MainWindowV_Loaded + AddHandler Me.Closing, AddressOf MainWindowV_Closing + AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown + End Sub + +#End Region ' CONSTRUCTOR + +#Region "EVENTS" + + Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) + ' Carico e imposto posizione finestra + WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me) + ' Recupero e imposto handle finestra principale + Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle + EgtSetMainWindowHandle(hMainWnd) + End Sub + + Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) + If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then + e.Cancel = True + Return + End If + ' Salvo posizione finestra (se non minimizzata) + If WindowState <> WindowState.Minimized Then + WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE) + End If + End Sub + + Private Sub MainWindowV_KeyDown(sender As Object, e As KeyEventArgs) + 'm_MainWindowVM.KeyDown(e.Key) + End Sub + + Private Sub MainWindowV_Drop(sender As Object, e As DragEventArgs) + ' Se drag di file + If e.Data.GetDataPresent(DataFormats.FileDrop) Then + ' Attivo il programma + Me.Activate() + ' Recupero l'array di stringhe con i nomi del file + Dim sFiles() As String = DirectCast(e.Data.GetData(DataFormats.FileDrop), String()) + + End If + End Sub + +#End Region ' EVENTS + +End Class diff --git a/3dPrintApp/MainWindow/MainWindowVM.vb b/3dPrintApp/MainWindow/MainWindowVM.vb new file mode 100644 index 0000000..c78cfd4 --- /dev/null +++ b/3dPrintApp/MainWindow/MainWindowVM.vb @@ -0,0 +1,280 @@ +Imports EgtUILib +Imports EgtWPFLib5 +Imports System.IO +Imports System.Threading +Imports System.Windows.Threading + +Public Class MainWindowVM + Inherits VMBase + + Private m_SupervisorCommThread As Thread + Private m_Supervisor_Timer As New DispatcherTimer + + ' Riferimento al Model della MainWindow + Private m_MainWindowM As MainWindowM + Friend ReadOnly Property MainWindowM As MainWindowM + Get + Return m_MainWindowM + End Get + End Property + + ' Variabile che indica che il programma è stato avviato correttamente (sia la mappa che l'ambiente Egt) + Private m_bInitStatus As Boolean + Friend ReadOnly Property bInitStatus As Boolean + Get + Return m_bInitStatus + End Get + End Property + + ' Titolo + Private m_Title As String = "" + Public ReadOnly Property Title As String + Get + Return m_Title + End Get + End Property + + ' proprietà che seleziona la giusta pagina del TabControl + Public Property nSelTabPage As Integer + Get + ' Return If(IsNothing(Map.refMainMenuVM.SelPage) OrElse Map.refMainMenuVM.SelPage = -1 OrElse Map.refMainMenuVM.SelPage = Pages.VIEW OrElse Map.refMainMenuVM.SelPage = Pages.MACHINING, 0, 1) + End Get + Set(value As Integer) + End Set + End Property + + Private m_MachinePanelVM As MachinePanelVM + Public ReadOnly Property MachinePanelVM As MachinePanelVM + Get + Return m_MachinePanelVM + End Get + End Property + + 'Friend m_SupervisorStop As Boolean = False + 'Private BlockedWnd As BlockedWndV + + ' definizione comandi + Private m_cmdAboutBox As ICommand + Private m_cmdCloseApplication As ICommand + +#Region "CONSTRUCTOR" + + Sub New() + ' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM + Map.BeginInit(Me) + ' Creo Model della MainWindow + m_MainWindowM = New MainWindowM + ' inizializzo machine panel + m_MachinePanelVM = New MachinePanelVM + ' inizializzo contatore per blocco da supervisore + m_Supervisor_Timer.Interval = TimeSpan.FromMilliseconds(500) + ' AddHandler m_Supervisor_Timer.Tick, AddressOf SupervisorTimer_Tick + m_Supervisor_Timer.Start() + End Sub + +#End Region ' CONSTRUCTOR + + '#Region "METHODS" + + ' Friend Sub SetTitle(sTitle As String) + ' m_Title = sTitle + ' NotifyPropertyChanged(NameOf(Title)) + ' End Sub + ' Public Sub UpdateTitle() + ' m_Title = "" + ' Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjManagerVM.CurrProj) Then + ' If Map.refProjManagerVM.CurrProj.bIsNew Then m_Title = "New - " + ' m_Title &= Map.refProjManagerVM.CurrProj.nProjId.ToString("0000") & " - " & Map.refProjManagerVM.CurrProj.sBTLFileName + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refProdManagerVM.CurrProd) Then + ' If Map.refProdManagerVM.CurrProd.bIsNew Then m_Title = "New - " + ' m_Title &= Map.refProdManagerVM.CurrProd.nProdId.ToString("0000") & " - " & Map.refProdManagerVM.CurrProd.sBTLFileName + ' End If + ' Case Pages.CONFIG + ' m_Title = "Configuration Page" + ' End Select + ' m_Title &= " - EgtBEAMWALL" + ' NotifyPropertyChanged(NameOf(Title)) + ' End Sub + + ' Friend Sub ContentRendered() + ' DbControllers.Init() + ' '' chiamata a caso su Db per inizializzarlo + ' DbControllers.m_ProjController.FindByProjDbId(0) + ' ' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine + ' If Map.EndInit() Then + ' m_bInitStatus = True + ' ' altrimenti chiudo il programma + ' Else + ' m_bInitStatus = False + ' End If + ' ' Aggiorno visualizzazione unità di misura + ' 'Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH)) + ' ' imposto MainWindow per finestra di Loading + ' LoadingWndHelper.SetMainWindow(Application.Current.MainWindow) + ' ' leggo riga di comando + ' Dim nCommandType As Integer = 0 + ' Dim nPage As Pages = Pages.VIEW + ' Dim nProdId As Integer = 0 + ' If ProcessCommandLine(nCommandType, nPage, nProdId) Then + ' Select Case nCommandType + ' Case 1 + ' Map.refProdManagerVM.SetCurrProd(nProdId) + ' Case 2 + ' ' pagina gia' impostata nella variabile + ' End Select + ' Else + ' ' setto il primo file dalla lista degli MRU come progetto corrente da aprire + ' Dim sLastProjectPath As String = String.Empty + ' GetMainPrivateProfileString(S_MRUPROJFILES, K_FILE & "1", String.Empty, sLastProjectPath) + ' If Not String.IsNullOrWhiteSpace(sLastProjectPath) AndAlso File.Exists(sLastProjectPath) Then + ' ' ricavo l'Id e il progetto associato per l'apertura di quest'ultimo + ' Dim PjId As Integer = 0 + ' Dim sPjId As String = Path.GetFileNameWithoutExtension(sLastProjectPath) + ' Integer.TryParse(sPjId, PjId) + ' Map.refProjManagerVM.SetCurrProj(PjId) + ' End If + ' End If + ' ' seleziono pagina da aprire + ' Map.refMainMenuVM.SelPage = nPage + + ' ' inizializzo thread di aggiornamento e comunicazione con DB + ' ' creo thread gestione macchina + ' m_SupervisorCommThread = New Thread(Sub() + ' SupervisorCommThread.SupervisorCommThreadFunction() + ' End Sub) + ' m_SupervisorCommThread.SetApartmentState(ApartmentState.STA) + ' ' avvio thread di gestione della macchina che avvia la connessione + ' m_SupervisorCommThread.Start() + + ' End Sub + + ' Friend Function ProcessCommandLine(ByRef nCommandType As Integer, ByRef nPage As Pages, ByRef nProdId As Integer) As Boolean + ' ' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma) + ' If Environment.GetCommandLineArgs.Count() <= 1 Then Return False + ' ' Recupero primo parametro che dovrebbe essere il tipo di modalita' riga di comando + ' Dim sFile As String = Environment.GetCommandLineArgs(1) + ' If String.IsNullOrWhiteSpace(sFile) OrElse Not Integer.TryParse(sFile, nCommandType) OrElse nCommandType <= 0 Then Return False + ' Select Case nCommandType + ' Case 1 ' apri progetto in ottimizzatore + ' ' recupero secondo parametro + ' Dim sProdId As String = Environment.GetCommandLineArgs(2) + ' If Not Integer.TryParse(sProdId, nProdId) OrElse nProdId <= 0 Then Return False + ' nPage = Pages.MACHINING + ' Return True + ' Case 2 ' apri pagina specifica senza progetto specifico + ' ' recupero secondo parametro + ' Dim sPage As String = Environment.GetCommandLineArgs(2) + ' If Not Integer.TryParse(sPage, nPage) OrElse (nPage <> Pages.VIEW AndAlso nPage <> Pages.MACHINING) Then Return False + ' Return True + ' End Select + ' Return False + ' End Function + + ' Friend Sub KeyDown(PressedKey As Key) + ' ' Con ESC esco dall'azione corrente + ' If PressedKey = Key.Escape Then + ' ' se in modifica L250 + ' If Map.refFreeContourManagerVM.bIsActive Then + ' ' se in modifica testo angolo di inclinazione + ' If Map.refFreeContourManagerVM.bIsModifyingTextAngle Then + ' Map.refFreeContourManagerVM.CloseIsModifyingTextAngle(False) + ' End If + ' ' reset Azione corrente + ' Map.refSceneHostVM.MainController.ResetStatus() + ' Map.refFreeContourInputVM.ResetInputBox() + ' End If + ' ' se misura attiva, la disattivo + ' If Map.refInstrumentPanelVM.GetDistIsChecked Then + ' Map.refInstrumentPanelVM.SetGetDistance_IsChecked(False) + ' End If + ' ' se Reset Macchina è aperto + ' If (nSelTabPage = Pages.VIEW Or nSelTabPage = Pages.MACHINING) AndAlso Map.refCALCPanelVM.ChooseMachine_Visibility = Visibility.Visible Then + ' Map.refCALCPanelVM.CloseResetMachine() + ' End If + ' ' pulisco output + ' Map.refMyStatusBarVM.ClearOutputMessage() + ' End If + ' End Sub + + ' Friend m_ManagingSupervisorStop As Boolean = False + + ' Private Sub SupervisorTimer_Tick() + ' If SupervisorCommThread.bViewerOptimizerBlocked And Not m_ManagingSupervisorStop Then + ' m_ManagingSupervisorStop = True + ' BlockedWnd = New BlockedWndV(Application.Current.MainWindow, New BlockedWndVM) + ' BlockedWnd.ShowDialog() + ' ElseIf Not SupervisorCommThread.bViewerOptimizerBlocked And m_ManagingSupervisorStop Then + ' m_ManagingSupervisorStop = False + ' BlockedWnd.Close() + ' End If + ' End Sub + + '#End Region ' METHODS + + '#Region "COMMANDS" + + '#Region "AboutBoxCommand" + + ' ' Returns a command that manage the MainWindow_Unloaded command + ' Public ReadOnly Property AboutBoxCommand() As ICommand + ' Get + ' If m_cmdAboutBox Is Nothing Then + ' m_cmdAboutBox = New Command(AddressOf AboutBox) + ' End If + ' Return m_cmdAboutBox + ' End Get + ' End Property + + ' ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. + ' Public Sub AboutBox(ByVal param As Object) + ' Dim AboutBoxWindow As New AboutBoxV + ' AboutBoxWindow.Owner = Application.Current.MainWindow + ' AboutBoxWindow.ShowDialog() + ' End Sub + + '#End Region ' AboutBoxCommand + + '#Region "CloseApplicationCommand" + + ' ' Returns a command that manage the MainWindow_Unloaded command + ' Public ReadOnly Property CloseApplicationCommand() As ICommand + ' Get + ' If m_cmdCloseApplication Is Nothing Then + ' m_cmdCloseApplication = New Command(AddressOf CloseApplication) + ' End If + ' Return m_cmdCloseApplication + ' End Get + ' End Property + + ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. + Friend Sub CloseApplication() + If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then + Return + End If + ' Gestisco eventuale file corrente modificato + Dim bOk As Boolean = True + 'bOk = ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) + ' se salvataggio annullato, rimango + If Not bOk Then Return + Dim bAllowClose As Boolean = Map.refSceneHostVM.MainController.ManageModified() + ' Salvo impostazione macchina corrente + 'Map.refMachinePanelVM.SaveCurrentMachine() + ' Se non confermata chiusura, esco + If Not bAllowClose Then Return + ' salvo modo di visualizzazione + WriteMainPrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString) + ' Termino il Model + m_MainWindowM.Close() + ' Termino il programma + Application.Current.Shutdown() + End Sub + + '#End Region ' CloseApplicationCommand + + '#End Region ' COMMANDS + +End Class diff --git a/3dPrintApp/My Project/AssemblyInfo.vb b/3dPrintApp/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..f61215d --- /dev/null +++ b/3dPrintApp/My Project/AssemblyInfo.vb @@ -0,0 +1,59 @@ +Imports System +Imports System.Globalization +Imports System.Reflection +Imports System.Resources +Imports System.Runtime.InteropServices +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/3dPrintApp/My Project/MyExtensions/MyWpfExtension.vb b/3dPrintApp/My Project/MyExtensions/MyWpfExtension.vb new file mode 100644 index 0000000..22f84b7 --- /dev/null +++ b/3dPrintApp/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/3dPrintApp/My Project/Resources.Designer.vb b/3dPrintApp/My Project/Resources.Designer.vb new file mode 100644 index 0000000..b22e10f --- /dev/null +++ b/3dPrintApp/My Project/Resources.Designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:$clrversion$ +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +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("$safeprojectname$.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(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/3dPrintApp/My Project/Resources.resx b/3dPrintApp/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/3dPrintApp/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/3dPrintApp/My Project/Settings.Designer.vb b/3dPrintApp/My Project/Settings.Designer.vb new file mode 100644 index 0000000..6e8e27f --- /dev/null +++ b/3dPrintApp/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.42000 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + 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 +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global._3dPrintApp.My.MySettings + Get + Return Global._3dPrintApp.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/3dPrintApp/My Project/Settings.settings b/3dPrintApp/My Project/Settings.settings new file mode 100644 index 0000000..40ed9fd --- /dev/null +++ b/3dPrintApp/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/3dPrintApp/ProjManager/ProjManagerV.xaml b/3dPrintApp/ProjManager/ProjManagerV.xaml new file mode 100644 index 0000000..5a85478 --- /dev/null +++ b/3dPrintApp/ProjManager/ProjManagerV.xaml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/3dPrintApp/ProjManager/ProjManagerV.xaml.vb b/3dPrintApp/ProjManager/ProjManagerV.xaml.vb new file mode 100644 index 0000000..74e0c1c --- /dev/null +++ b/3dPrintApp/ProjManager/ProjManagerV.xaml.vb @@ -0,0 +1,3 @@ +Public Class ProjManagerV + +End Class diff --git a/3dPrintApp/ProjManager/ProjManagerVM.vb b/3dPrintApp/ProjManager/ProjManagerVM.vb new file mode 100644 index 0000000..aceb184 --- /dev/null +++ b/3dPrintApp/ProjManager/ProjManagerVM.vb @@ -0,0 +1,438 @@ +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtWPFLib5 +Imports EgtUILib + +Public Class ProjManagerVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + Private m_ProjManager_IsEnabled As Boolean = True + Public ReadOnly Property ProjManager_IsEnabled As Boolean + Get + Return m_ProjManager_IsEnabled + End Get + End Property + + Private m_MruFiles As New MruList + Public ReadOnly Property MruFiles As MruList + Get + Return m_MruFiles + End Get + End Property + Public ReadOnly Property MruFileNames As ObservableCollection(Of String) + Get + For Each FileName In m_MruFiles.FileNames.ToList() + If Not File.Exists(FileName) Then + m_MruFiles.Remove(FileName) + End If + Next + Return m_MruFiles.FileNames + End Get + End Property + + ' Definizione comandi + Private m_cmdNew As ICommand + Private m_cmdOpen As ICommand + Private m_cmdOpenMruFile As ICommand + Private m_cmdSave As ICommand + Private m_cmdSaveAs As ICommand + Private m_cmdImport As ICommand + Private m_cmdOptions As ICommand + Private m_cmdSendFeedback As ICommand + + +#Region "ToolTip" + + 'Proprietà ToolTip + Public ReadOnly Property NewToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 1) + End Get + End Property + Public ReadOnly Property OpenToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 2) + End Get + End Property + Public ReadOnly Property SaveToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 3) + End Get + End Property + Public ReadOnly Property SaveAsToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 4) + End Get + End Property + Public ReadOnly Property InsertToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 5) + End Get + End Property + Public ReadOnly Property ImportBTL_ToolTip As String + Get + Return EgtMsg(61840) + End Get + End Property + Public ReadOnly Property UpdateBTL_ToolTip As String + Get + Return EgtMsg(61834) + End Get + End Property + Public ReadOnly Property ExportProject_ToolTip As String + Get + Return EgtMsg(61838) + End Get + End Property + Public ReadOnly Property ImportProject_ToolTip As String + Get + Return EgtMsg(61839) + End Get + End Property + Public ReadOnly Property GoToProd_ToolTip As String + Get + Return EgtMsg(61835) + End Get + End Property + +#End Region ' ToolTip + +#End Region ' Fields & Properties + +#Region "CONSTRUCTOR" + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefProjManagerVM(Me) + ' Impostazioni MruLists + m_MruFiles.Init(S_MRUFILES, 8) + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + +#End Region ' METHODS + +#Region "COMMANDS" + +#Region "New" + + ''' + ''' Returns a command that do Save. + ''' + Public ReadOnly Property New_Command As ICommand + Get + If m_cmdNew Is Nothing Then + m_cmdNew = New Command(AddressOf NewProject) + End If + Return m_cmdNew + End Get + End Property + + ''' + ''' Execute the Save. This method is invoked by the SaveCommand. + ''' + Public Sub NewProject() + Map.refSceneHostVM.MainController.NewProject(True) + NotifyPropertyChanged(NameOf(MruFileNames)) + End Sub + +#End Region ' New + +#Region "OpenCommand" + + ''' + ''' Returns a command that do Open. + ''' + Public ReadOnly Property OpenCommand As ICommand + Get + If m_cmdOpen Is Nothing Then + m_cmdOpen = New Command(AddressOf Open) + End If + Return m_cmdOpen + End Get + End Property + + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Friend Sub Open() + OpenProject(Nothing) + End Sub + + Friend Sub OpenProject(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + GetMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) + Map.refSceneHostVM.MainController.OpenProject(sDir) + Else + Map.refSceneHostVM.MainController.OpenProject(sFilePath, False) + End If + End Sub + +#End Region ' OpenCommand + +#Region "OpenMruFileCommand" + + ''' + ''' Returns a command that do Open. + ''' + Public ReadOnly Property OpenMruFileCommand As ICommand + Get + If m_cmdOpenMruFile Is Nothing Then + m_cmdOpenMruFile = New Command(AddressOf OpenMruFile) + End If + Return m_cmdOpenMruFile + End Get + End Property + + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Public Sub OpenMruFile(ByVal param As Object) + OpenProject(DirectCast(param, String).Replace("__", "_")) + End Sub + +#End Region ' OpenMruFileCommand + +#Region "SaveCommand" + + ''' + ''' Returns a command that do Save. + ''' + Public ReadOnly Property SaveCommand As ICommand + Get + If m_cmdSave Is Nothing Then + m_cmdSave = New Command(AddressOf SaveCmd) + End If + Return m_cmdSave + End Get + End Property + + Public Sub SaveCmd() + Save(True) + End Sub + + ''' + ''' Execute the Save. This method is invoked by the SaveCommand. + ''' + Public Sub Save(Optional bShowLoading As Boolean = False) + Map.refSceneHostVM.SaveProject() + End Sub + +#End Region ' SaveCommand + +#Region "SaveAsCommand" + + ''' + ''' Returns a command that do SaveAs. + ''' + Public ReadOnly Property SaveAsCommand As ICommand + Get + If m_cmdSaveAs Is Nothing Then + m_cmdSaveAs = New Command(AddressOf SaveAs) + End If + Return m_cmdSaveAs + End Get + End Property + + ''' + ''' Execute the SaveAs. This method is invoked by the SaveAsCommand. + ''' + Public Sub SaveAs(ByVal param As Object) + Map.refSceneHostVM.SaveAsProject() + End Sub + +#End Region ' SaveAsCommand + +#Region "Import" + + ''' + ''' Returns a command that do Import. + ''' + Public ReadOnly Property ImportCommand As ICommand + Get + If m_cmdImport Is Nothing Then + m_cmdImport = New Command(AddressOf Import) + End If + Return m_cmdImport + End Get + End Property + + ''' + ''' Execute the Import. This method is invoked by the ImportCommand. + ''' + Public Sub Import(ByVal param As Object) + Map.refSceneHostVM.InsertProject() + End Sub + +#End Region ' Import + +#Region "Options" + + ''' + ''' Returns a command that do Export. + ''' + Public ReadOnly Property OptionsCommand As ICommand + Get + If m_cmdOptions Is Nothing Then + m_cmdOptions = New Command(AddressOf Options) + End If + Return m_cmdOptions + End Get + End Property + + ''' + ''' Execute the Export. This method is invoked by the ExportCommand. + ''' + Public Sub Options(ByVal param As Object) + 'Dim OptionsWindow As New OptionWindowV + 'OptionsWindow.DataContext = New OptionWindowVM + 'OptionsWindow.Owner = Application.Current.MainWindow + 'OptionsWindow.ShowDialog() + End Sub + +#End Region ' Options + +#Region "SendFeedback" + + ''' + ''' Returns a command that do SendFeedback. + ''' + Public ReadOnly Property SendFeedbackCommand As ICommand + Get + If m_cmdSendFeedback Is Nothing Then + m_cmdSendFeedback = New Command(AddressOf SendFeedback) + End If + Return m_cmdSendFeedback + End Get + End Property + + ''' + ''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand. + ''' + Public Sub SendFeedback(ByVal param As Object) + ' Recupero indirizzo a cui spedire la mail + Dim sSupportAddress As String = String.Empty + GetMainPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress) + ' se vuoto do messaggio di errore ed esco + If String.IsNullOrWhiteSpace(sSupportAddress) Then + MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 10), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + ' Recupero numero chiave + Dim sKey As String = String.Empty + EgtGetKeyInfo(sKey) + ' Recupero file del progetto corrente + Dim sCurrProject As String = String.Empty + EgtGetCurrFilePath(sCurrProject) + ' se nome file vuoto, chiedo se si vuole salvare + If String.IsNullOrWhiteSpace(sCurrProject) Then + If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then + Map.refSceneHostVM.SaveProject() + End If + EgtGetCurrFilePath(sCurrProject) + ' se modificato, chiedo se si vuole salvare + Else + If EgtGetModified() Then + If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then + Map.refSceneHostVM.SaveProject() + End If + End If + End If + ' Verifico se il progetto corrente è una porta + Dim nPartId As Integer = EgtGetFirstPart() + If nPartId = GDB_ID.NULL Then + nPartId = EgtGetFirstPartInRawPart(EgtGetFirstRawPart()) + End If + Dim sPartName As String = String.Empty + EgtGetName(nPartId, sPartName) + Dim bPrjIsDoor As Boolean = (String.Compare(sPartName, "DOOR") = 0) + ' Recupero macchine dei gruppi di lavoro del progetto + Dim Machines As New List(Of String) + Dim nMchGrpId As Integer = EgtGetFirstMachGroup() + While nMchGrpId <> GDB_ID.NULL + Dim sMachineName As String = String.Empty + EgtGetMachGroupMachineName(nMchGrpId, sMachineName) + If Not String.IsNullOrWhiteSpace(sMachineName) Then + Machines.Add(sMachineName) + End If + nMchGrpId = EgtGetNextMachGroup(nMchGrpId) + End While + ' Recupero altri file con lo stesso nome del progetto + Dim OtherFiles As New List(Of String) + If Not String.IsNullOrWhiteSpace(sCurrProject) Then + Dim sCurrProjectDir As String = Path.GetDirectoryName(sCurrProject) + If Not String.IsNullOrWhiteSpace(sCurrProjectDir) Then + Dim TempFiles() As String = Directory.GetFiles(sCurrProjectDir) + For FileIndex = 0 To TempFiles.Count - 1 + If Path.GetFileNameWithoutExtension(TempFiles(FileIndex)).Contains(Path.GetFileNameWithoutExtension(sCurrProject)) AndAlso TempFiles(FileIndex) <> sCurrProject Then + OtherFiles.Add(TempFiles(FileIndex)) + End If + Next + End If + End If + ' Creo zip file da allegare + Dim sZipToCreate As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip" + If File.Exists(sZipToCreate) Then + File.Delete(sZipToCreate) + End If + Try + Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out) + ' aggiungo file macchine + For Each sMachineName As String In Machines + Dim sMachineDir As String = Map.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sMachineName + If Directory.Exists(sMachineDir) Then + zip.AddItem(sMachineDir, sMachineName) + End If + Next + ' aggiungo progetto corrente + If File.Exists(sCurrProject) Then + zip.AddItem(sCurrProject, "") + End If + ' aggiungo file log + If File.Exists(Map.refMainWindowVM.MainWindowM.sLogFile) Then + zip.AddItem(Map.refMainWindowVM.MainWindowM.sLogFile, "") + End If + ' aggiungo file ausiliari + For Each sOther As String In OtherFiles + zip.AddItem(sOther, "") + Next + ' salvo lo zip + zip.Save() + End Using + Catch ex1 As Exception + EgtOutLog("Exception in zip: " & ex1.ToString()) + End Try + ' preparo la mail per il supporto + Dim bEx As Boolean = False + Try + Dim sAddressArray As String() = sSupportAddress.Split(CType(",", Char())) + Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtCAM5 Feedback - " & sKey) + SendFeedbackWindow.Recipients.Add(sAddressArray(0)) + For index As Integer = 1 To sAddressArray.Length() - 1 + SendFeedbackWindow.Recipients.Add(sAddressArray(index), EgtWPFLib5.MapiMailMessage.RecipientType.CC) + Next + If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then + SendFeedbackWindow.Files.Add(Map.refMainWindowVM.MainWindowM.sTempDir & "\Feedback.zip") + End If + SendFeedbackWindow.ShowDialog() + Catch ex As Exception + EgtOutLog("Feedback exception: " & ex.ToString) + bEx = True + End Try + If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then + MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information) + Else + Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(MSG_TOPCOMMANDBAR + 14), 5) + End If + End Sub + +#End Region ' SendFeedback + +#End Region ' Commands + +End Class diff --git a/3dPrintApp/Project/ProjectV.xaml b/3dPrintApp/Project/ProjectV.xaml new file mode 100644 index 0000000..723a05c --- /dev/null +++ b/3dPrintApp/Project/ProjectV.xaml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/Project/ProjectV.xaml.vb b/3dPrintApp/Project/ProjectV.xaml.vb new file mode 100644 index 0000000..32a2c3b --- /dev/null +++ b/3dPrintApp/Project/ProjectV.xaml.vb @@ -0,0 +1,3 @@ +Public Class ProjectV + +End Class diff --git a/3dPrintApp/Project/ProjectVM.vb b/3dPrintApp/Project/ProjectVM.vb new file mode 100644 index 0000000..2afdde7 --- /dev/null +++ b/3dPrintApp/Project/ProjectVM.vb @@ -0,0 +1,478 @@ +Imports System.Windows.Threading +Imports EgtWPFLib5 +Imports EgtUILib +Imports System.Collections.ObjectModel +Imports System.IO + +Public Class ProjectVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + Private m_MaterialList As New List(Of String) + Public ReadOnly Property MaterialList As List(Of String) + Get + Return m_MaterialList + End Get + End Property + + Private m_SelMaterial As String + Public Property SelMaterial As String + Get + Return m_SelMaterial + End Get + Set(value As String) + m_SelMaterial = value + WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, value) + End Set + End Property + + Private m_PartList As New ObservableCollection(Of Print3dPartVM) + Public ReadOnly Property PartList As ObservableCollection(Of Print3dPartVM) + Get + Return m_PartList + End Get + End Property + + Private m_SelPart As Print3dPartVM + Public Property SelPart As Print3dPartVM + Get + Return m_SelPart + End Get + Set(value As Print3dPartVM) + m_SelPart = value + ' Eseguo la selezione + EgtDeselectAll() + EgtSelectPartObjs(m_SelPart.nPartId) + EgtDraw() + End Set + End Property + + Private m_MachiningLib As New List(Of String) + Public ReadOnly Property MachiningLib As List(Of String) + Get + Return m_MachiningLib + End Get + End Property + + 'Private m_Calc_Timer As New DispatcherTimer + + 'Private Property m_GridDims As New ObservableCollection(Of GridDimension) + 'Public Property GridDims As ObservableCollection(Of GridDimension) + ' Get + ' Return m_GridDims + ' End Get + ' Set + ' m_GridDims = Value + ' NotifyPropertyChanged(NameOf(GridDims)) + ' End Set + 'End Property + + 'Private m_BTLStructureVM As BTLStructureVM + 'Public Property BTLStructureVM As BTLStructureVM + ' Get + ' Return m_BTLStructureVM + ' End Get + ' Set(value As BTLStructureVM) + ' m_BTLStructureVM = value + ' NotifyPropertyChanged(NameOf(BTLStructureVM)) + ' End Set + 'End Property + + 'Private m_MachGroupPanelVM As MyMachGroupPanelVM + 'Public Property MachGroupPanelVM As MyMachGroupPanelVM + ' Get + ' Return m_MachGroupPanelVM + ' End Get + ' Set(value As MyMachGroupPanelVM) + ' m_MachGroupPanelVM = value + ' NotifyPropertyChanged(NameOf(MachGroupPanelVM)) + ' End Set + 'End Property + + 'Private m_bCalcRunning As Boolean = False + 'Public ReadOnly Property bCalcRunning As Boolean + ' Get + ' Return m_bCalcRunning + ' End Get + 'End Property + 'Private m_bLockUX As Boolean = False + + 'Private m_LeftPanel_Visibility As Boolean = True + 'Public Property LeftPanel_Visibility As Visibility + ' Get + ' Return If(m_LeftPanel_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_LeftPanel_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetLeftPanel_Visibility(IsVisible As Boolean) + ' m_LeftPanel_Visibility = IsVisible + 'End Sub + + 'Private m_TopPanel_Visibility As Boolean = False + 'Public Property TopPanel_Visibility As Visibility + ' Get + ' Return If(m_TopPanel_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_TopPanel_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetTopPanel_Visibility(IsVisible As Boolean) + ' m_TopPanel_Visibility = IsVisible + 'End Sub + + 'Private m_BottomPanel_Visibility As Boolean = True + 'Public Property BottomPanel_Visibility As Visibility + ' Get + ' Return If(m_BottomPanel_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_BottomPanel_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetBottomPanel_Visibility(IsVisible As Boolean) + ' m_BottomPanel_Visibility = IsVisible + 'End Sub + + 'Private m_PartManager_Visibility As Boolean = True + 'Public ReadOnly Property PartManager_Visibility As Visibility + ' Get + ' Return If(Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refProjectVM.BTLStructureVM.SelBTLPartsCnt = 1, Visibility.Visible, Visibility.Collapsed) + ' End Get + 'End Property + + 'Private m_FeatureManager_Visibility As Boolean = True + 'Public Property FeatureManager_Visibility As Visibility + ' Get + ' Return If(m_FeatureManager_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_FeatureManager_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetFeatureManager_Visibility(IsVisible As Boolean) + ' m_FeatureManager_Visibility = IsVisible + 'End Sub + + 'Private m_ShowBeamPanel_Visibility As Boolean = True + 'Public Property ShowBeamPanel_Visibility As Visibility + ' Get + ' Return If(m_ShowBeamPanel_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_ShowBeamPanel_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetShowBeamPanel_Visibility(IsVisible As Boolean) + ' m_ShowBeamPanel_Visibility = IsVisible + 'End Sub + + 'Private m_ProjManager_Visibility As Boolean = True + 'Public Property ProjManager_Visibility As Visibility + ' Get + ' Return If(m_ProjManager_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_ProjManager_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetProjManager_Visibility(IsVisible As Boolean) + ' m_ProjManager_Visibility = IsVisible + 'End Sub + + 'Private m_ProdManager_Visibility As Boolean = True + 'Public Property ProdManager_Visibility As Visibility + ' Get + ' Return If(m_ProdManager_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_ProdManager_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetProdManager_Visibility(IsVisible As Boolean) + ' m_ProdManager_Visibility = IsVisible + 'End Sub + + 'Private m_OptimizePanel_Visibility As Boolean = True + 'Public Property OptimizePanel_Visibility As Visibility + ' Get + ' Return If(m_OptimizePanel_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_OptimizePanel_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetOptimizePanel_Visibility(IsVisible As Boolean) + ' m_OptimizePanel_Visibility = IsVisible + ' NotifyPropertyChanged(NameOf(OptimizePanel_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.CalcRotFlip_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.Optimize_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.OriginType_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.ViewPage_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.MachiningPage_Visibility)) + ' Map.refOptimizePanelVM.NotifyPropertyChanged(NameOf(Map.refOptimizePanelVM.NestingOption_Visibility)) + 'End Sub + + 'Friend Sub NotifyCalcPanel_Visibility() + ' Map.refCALCPanelVM.NotifyPropertyChanged(NameOf(Map.refCALCPanelVM.ViewPage_Visibility)) + 'End Sub + + 'Private m_FreeContourManager_Visibility As Boolean = False + 'Public Property FreeContourManager_Visibility As Visibility + ' Get + ' Return If(m_FreeContourManager_Visibility, Visibility.Visible, Visibility.Collapsed) + ' End Get + ' Set(value As Visibility) + ' m_FreeContourManager_Visibility = (value = Visibility.Visible) + ' End Set + 'End Property + 'Friend Sub SetFreeContourManager_Visibility(IsVisible As Boolean) + ' m_FreeContourManager_Visibility = IsVisible + ' NotifyPropertyChanged("FreeContourManager_Visibility") + 'End Sub + + 'Friend Sub NotifyAllPanelVisibility() + ' NotifyPropertyChanged("LeftPanel_Visibility") + ' NotifyPropertyChanged("TopPanel_Visibility") + ' NotifyPropertyChanged("BottomPanel_Visibility") + ' NotifyPropertyChanged("PartManager_Visibility") + ' NotifyPropertyChanged("FeatureManager_Visibility") + ' NotifyPropertyChanged("ShowBeamPanel_Visibility") + ' NotifyPropertyChanged("ProjManager_Visibility") + ' NotifyPropertyChanged("ProdManager_Visibility") + ' NotifyCalcPanel_Visibility() + 'End Sub + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefProjectVM(Me) + ' imposto timer per aggiornamenti Calc + 'm_Calc_Timer.Interval = TimeSpan.FromMilliseconds(500) + 'AddHandler m_Calc_Timer.Tick, AddressOf Calc_Timer_Tick + '' imposto dimensioni colonne/righe della Grid + 'DimensionsIniFile.ReadGridDimensions(ConstDims.PROJECT_VIEW, GridDims) + ' carico lista materiali + InitMaterialList() + ' carico lista parametri di stampa + InitMachiningsList() + End Sub + +#End Region ' CONSTRUCTOR + + '#Region "METHODS" + + Friend Sub AddNewPart(sFile As String) + ' rinomino pezzo e layer + Dim nPartId As Integer = EgtGetLastPart() + EgtSetName(nPartId, "PART") + Dim nLayerId As Integer = EgtGetFirstInGroup(nPartId) + EgtSetName(nLayerId, "OriginalSolid") + ' posiziono il pezzo al centro + Dim b3Part As New BBox3d + EgtGetBBoxGlob(nPartId, GDB_BB.EXACT, b3Part) + Dim dPosX As Double = (CurrentMachine.b3Tab.DimX() / 2) - (b3Part.DimX() / 2) + Dim dPosY As Double = (CurrentMachine.b3Tab.DimY() / 2) - (b3Part.DimY() / 2) + + ' Posiziono il pezzo e aggiorno il suo box + Dim vtMove As Vector3d = New Point3d(dPosX, dPosY, 0) - b3Part.Min() + EgtMove(nPartId, vtMove) + b3Part.Move(vtMove) + + ' Creo il frame del pezzo + Dim frPart = New Frame3d(b3Part.Center() - 0.5 * b3Part.DimZ() * Vector3d.Z_AX(), Frame3d.TYPE.TOP) + Dim nFrameId = EgtCreateGeoFrame(nPartId, frPart, GDB_RT.GLOB) + If nFrameId <> GDB_ID.NULL Then + EgtSetName(nFrameId, "FramePart") + EgtSetMode(nFrameId, GDB_MD.LOCKED) + End If + + EgtAddMachGroup("3dPrint") + EgtSetTable("Tab") + + Dim nRawId As Integer = EgtAddRawPart(b3Part.Min, b3Part.DimX, b3Part.DimY, b3Part.DimZ, New Color3d(128, 128, 128, 30)) + EgtAddPartToRawPart(nPartId, b3Part.Min, nRawId) + EgtMoveToCornerRawPart(nRawId, New Point3d(dPosX, dPosY, 0), MCH_CR.BL) + + EgtResetCurrMachGroup() + + ' creo lo start point + Dim ptStart As Point3d = b3Part.Center() - 0.6 * b3Part.DimY() * Vector3d.Y_AX() - 0.5 * b3Part.DimZ() * Vector3d.Z_AX() + Dim nPtStartId As Integer = EgtCreateGeoPoint(nPartId, ptStart, GDB_RT.GLOB) + If nPtStartId <> GDB_ID.NULL Then + EgtSetName(nPtStartId, "StartPoint") + EgtSetColor(nPtStartId, New Color3d(255, 0, 0)) + End If + + ' aggiungo a lista pezzi e seleziono + Dim NewPart As New Print3dPartVM(nPartId, sFile) + PartList.Add(NewPart) + SelPart = NewPart + NotifyPropertyChanged(NameOf(SelPart)) + + End Sub + + Friend Sub SelPartFromId(nPartId As Integer) + Dim PartToSel As Print3dPartVM = m_PartList.First(Function(x) x.nPartId = nPartId) + If Not IsNothing(PartToSel) Then + SelPart = PartToSel + NotifyPropertyChanged(NameOf(SelPart)) + End If + End Sub + + Friend Sub InitMaterialList() + Dim MaterialFiles As String() = Directory.GetFiles(Map.refMainWindowVM.MainWindowM.sMaterialsDir) + For Each Material In MaterialFiles + If String.Compare(Path.GetExtension(Material), "csv", True) Then + MaterialList.Add(Path.GetFileNameWithoutExtension(Material)) + End If + Next + Dim sCurrMaterial As String = "" + GetMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, "", sCurrMaterial) + If MaterialList.Contains(sCurrMaterial) Then + m_SelMaterial = sCurrMaterial + End If + End Sub + + Friend Sub InitMachiningsList() + Dim MachiningFiles As String() = Directory.GetFiles(Map.refMainWindowVM.MainWindowM.sMachiningsDir) + For Each Machining In MachiningFiles + If String.Compare(Path.GetExtension(Machining), "ini", True) Then + m_MachiningLib.Add(Path.GetFileNameWithoutExtension(Machining)) + End If + Next + End Sub + + ' Friend Sub SetCalcRunning(value As Boolean) + ' If value Then m_Calc_Timer.Start() + ' m_bCalcRunning = value + ' End Sub + + ' Friend Sub ManageIsEnabled(bIsEnabled As Boolean) + ' Map.refInstrumentPanelVM.SetInstrumentPanelIsEnabled(bIsEnabled) + ' Map.refCALCPanelVM.SetCalcPanelIsEnabled(bIsEnabled) + ' Map.refMainMenuVM.SetMainMenuIsEnabled(bIsEnabled) + ' Map.refPartManagerVM.SetPartManagerIsEnabled(bIsEnabled) + ' Map.refLeftPanelVM.SetLeftPanelIsEnabled(bIsEnabled) + ' Map.refProjManagerVM.SetProjManagerIsEnabled(bIsEnabled) + ' Map.refProdManagerVM.SetProdManagerIsEnabled(bIsEnabled) + ' Map.refTopPanelVM.SetTopPanelIsEnabled(bIsEnabled) + ' Map.refOptimizePanelVM.SetOptimizePanelIsEnabled(bIsEnabled) + ' Map.refFeatureManagerVM.SetFeatureManagerIsEnabled(bIsEnabled) + ' End Sub + + ' 'Private Sub Calc_Timer_Tick() + ' ' If m_bCalcRunning <> m_bLockUX Then + ' ' ' se calcolo iniziato + ' ' If m_bCalcRunning Then + ' ' ManageIsEnabled(False) + ' ' ' aggiungere gestione colonne editabili delle tabelle + ' ' If Not IsNothing(Map.refPartListVM.colPart_Do) Then + ' ' Map.refPartListVM.colPart_Do.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then + ' ' Map.refFeatureListVM.colFeature_Do.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then + ' ' Map.refPParameterListVM.colPParam_Value.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refQParameterListVM.colQParam_Value) Then + ' ' Map.refQParameterListVM.colQParam_Value.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refQParameterListVM.colQParam_Custom) Then + ' ' Map.refQParameterListVM.colQParam_Custom.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then + ' ' Map.refRawPartListVM.colRawPart_StartCut.IsReadOnly = True + ' ' End If + ' ' If m_BTLStructureVM.nPROJTYPE <> BWType.BEAM AndAlso Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then + ' ' Map.refRawPartListVM.colRawPart_W.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then + ' ' Map.refRawPartListVM.colRawPart_L.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Offset.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Rot) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Rot.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Flip) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Flip.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosX) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_PosX.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosY) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_PosY.IsReadOnly = True + ' ' End If + ' ' If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then + ' ' Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = True + ' ' End If + ' ' m_bLockUX = True + ' ' ' se calcolo finito + ' ' Else + ' ' ManageIsEnabled(True) + ' ' ' aggiungere gestione colonne editabili delle tabelle + ' ' If Not IsNothing(Map.refPartListVM.colPart_Do) Then + ' ' Map.refPartListVM.colPart_Do.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refFeatureListVM.colFeature_Do) Then + ' ' Map.refFeatureListVM.colFeature_Do.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPParameterListVM.colPParam_Value) Then + ' ' Map.refPParameterListVM.colPParam_Value.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refQParameterListVM.colQParam_Value) Then + ' ' Map.refQParameterListVM.colQParam_Value.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refQParameterListVM.colQParam_Custom) Then + ' ' Map.refQParameterListVM.colQParam_Custom.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refRawPartListVM.colRawPart_StartCut) Then + ' ' Map.refRawPartListVM.colRawPart_StartCut.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refRawPartListVM.colRawPart_W) Then + ' ' Map.refRawPartListVM.colRawPart_W.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refRawPartListVM.colRawPart_L) Then + ' ' Map.refRawPartListVM.colRawPart_L.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Offset) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Offset.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Rot) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Rot.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_Flip) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_Flip.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosX) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_PosX.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refPartInRawPartListVM.colPartInRawPart_PosY) Then + ' ' Map.refPartInRawPartListVM.colPartInRawPart_PosY.IsReadOnly = False + ' ' End If + ' ' If Not IsNothing(Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do) Then + ' ' Map.refFeatureInPartInRawPartListVM.colFeatureInPartInRawPart_Do.IsReadOnly = False + ' ' End If + ' ' ' fermo il timer + ' ' If Not m_bCalcRunning Then + ' ' m_Calc_Timer.Stop() + ' ' m_bLockUX = False + ' ' End If + ' ' End If + ' ' End If + + ' 'End Sub + + '#End Region ' METHODS + +End Class + diff --git a/3dPrintApp/Resources/AboutBoxImage.png b/3dPrintApp/Resources/AboutBoxImage.png new file mode 100644 index 0000000..a11230b Binary files /dev/null and b/3dPrintApp/Resources/AboutBoxImage.png differ diff --git a/3dPrintApp/Resources/CALCPanel/ChooseMachine.png b/3dPrintApp/Resources/CALCPanel/ChooseMachine.png new file mode 100644 index 0000000..4ec67a8 Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/ChooseMachine.png differ diff --git a/3dPrintApp/Resources/CALCPanel/Edit.png b/3dPrintApp/Resources/CALCPanel/Edit.png new file mode 100644 index 0000000..ac7c56e Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/Edit.png differ diff --git a/3dPrintApp/Resources/CALCPanel/ResetCalc.png b/3dPrintApp/Resources/CALCPanel/ResetCalc.png new file mode 100644 index 0000000..ad0f349 Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/ResetCalc.png differ diff --git a/3dPrintApp/Resources/CALCPanel/Simulate.png b/3dPrintApp/Resources/CALCPanel/Simulate.png new file mode 100644 index 0000000..9e20532 Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/Simulate.png differ diff --git a/3dPrintApp/Resources/CALCPanel/Verify.png b/3dPrintApp/Resources/CALCPanel/Verify.png new file mode 100644 index 0000000..aa40374 Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/Verify.png differ diff --git a/3dPrintApp/Resources/CALCPanel/VerifyAll.png b/3dPrintApp/Resources/CALCPanel/VerifyAll.png new file mode 100644 index 0000000..886a130 Binary files /dev/null and b/3dPrintApp/Resources/CALCPanel/VerifyAll.png differ diff --git a/3dPrintApp/Resources/Configuration/MachiningsTable.png b/3dPrintApp/Resources/Configuration/MachiningsTable.png new file mode 100644 index 0000000..5ab6b0c Binary files /dev/null and b/3dPrintApp/Resources/Configuration/MachiningsTable.png differ diff --git a/3dPrintApp/Resources/DrawPanel/AddPointCurve.png b/3dPrintApp/Resources/DrawPanel/AddPointCurve.png new file mode 100644 index 0000000..5bd7bfb Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/AddPointCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ApproxCurve.png b/3dPrintApp/Resources/DrawPanel/ApproxCurve.png new file mode 100644 index 0000000..593f866 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ApproxCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Arc3P.png b/3dPrintApp/Resources/DrawPanel/Arc3P.png new file mode 100644 index 0000000..1df2af4 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Arc3P.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ArcCSE.png b/3dPrintApp/Resources/DrawPanel/ArcCSE.png new file mode 100644 index 0000000..64e2aee Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ArcCSE.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ArcFlip.png b/3dPrintApp/Resources/DrawPanel/ArcFlip.png new file mode 100644 index 0000000..4468ce0 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ArcFlip.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ArcPDP.png b/3dPrintApp/Resources/DrawPanel/ArcPDP.png new file mode 100644 index 0000000..f74b1a5 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ArcPDP.png differ diff --git a/3dPrintApp/Resources/DrawPanel/BreakCurve.png b/3dPrintApp/Resources/DrawPanel/BreakCurve.png new file mode 100644 index 0000000..183d4a2 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/BreakCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Chamfer.png b/3dPrintApp/Resources/DrawPanel/Chamfer.png new file mode 100644 index 0000000..a10190d Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Chamfer.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ChangeColor.png b/3dPrintApp/Resources/DrawPanel/ChangeColor.png new file mode 100644 index 0000000..3497b6b Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ChangeColor.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ChangeColorAlpha.png b/3dPrintApp/Resources/DrawPanel/ChangeColorAlpha.png new file mode 100644 index 0000000..04bb076 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ChangeColorAlpha.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ChangeLayer.png b/3dPrintApp/Resources/DrawPanel/ChangeLayer.png new file mode 100644 index 0000000..cb06885 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ChangeLayer.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ChangeStart.png b/3dPrintApp/Resources/DrawPanel/ChangeStart.png new file mode 100644 index 0000000..1321300 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ChangeStart.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Circle3P.png b/3dPrintApp/Resources/DrawPanel/Circle3P.png new file mode 100644 index 0000000..ae4f8bd Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Circle3P.png differ diff --git a/3dPrintApp/Resources/DrawPanel/CircleCD.png b/3dPrintApp/Resources/DrawPanel/CircleCD.png new file mode 100644 index 0000000..5480d8f Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/CircleCD.png differ diff --git a/3dPrintApp/Resources/DrawPanel/CircleCP.png b/3dPrintApp/Resources/DrawPanel/CircleCP.png new file mode 100644 index 0000000..77a481b Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/CircleCP.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Delete.png b/3dPrintApp/Resources/DrawPanel/Delete.png new file mode 100644 index 0000000..b90063f Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Delete.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExplodeCurve.png b/3dPrintApp/Resources/DrawPanel/ExplodeCurve.png new file mode 100644 index 0000000..be9e1c7 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExplodeCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExplodeSurf.png b/3dPrintApp/Resources/DrawPanel/ExplodeSurf.png new file mode 100644 index 0000000..b62f3e9 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExplodeSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExtendCurve.png b/3dPrintApp/Resources/DrawPanel/ExtendCurve.png new file mode 100644 index 0000000..cbf8d91 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExtendCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExtractFacetLoops.png b/3dPrintApp/Resources/DrawPanel/ExtractFacetLoops.png new file mode 100644 index 0000000..2fd4591 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExtractFacetLoops.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExtractLoops.png b/3dPrintApp/Resources/DrawPanel/ExtractLoops.png new file mode 100644 index 0000000..6c71a4c Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExtractLoops.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ExtractSurfFacet.png b/3dPrintApp/Resources/DrawPanel/ExtractSurfFacet.png new file mode 100644 index 0000000..7660171 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ExtractSurfFacet.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Extrude.png b/3dPrintApp/Resources/DrawPanel/Extrude.png new file mode 100644 index 0000000..1b245f2 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Extrude.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Fillet.png b/3dPrintApp/Resources/DrawPanel/Fillet.png new file mode 100644 index 0000000..b40c377 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Fillet.png differ diff --git a/3dPrintApp/Resources/DrawPanel/IntersectSurfSurf.png b/3dPrintApp/Resources/DrawPanel/IntersectSurfSurf.png new file mode 100644 index 0000000..1f4c4aa Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/IntersectSurfSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/InvertCurve.png b/3dPrintApp/Resources/DrawPanel/InvertCurve.png new file mode 100644 index 0000000..e10899d Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/InvertCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/InvertSurf.png b/3dPrintApp/Resources/DrawPanel/InvertSurf.png new file mode 100644 index 0000000..5b3bf7f Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/InvertSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/JoinCurve.png b/3dPrintApp/Resources/DrawPanel/JoinCurve.png new file mode 100644 index 0000000..666b2e6 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/JoinCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Line2P.png b/3dPrintApp/Resources/DrawPanel/Line2P.png new file mode 100644 index 0000000..2690838 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Line2P.png differ diff --git a/3dPrintApp/Resources/DrawPanel/LinePDL.png b/3dPrintApp/Resources/DrawPanel/LinePDL.png new file mode 100644 index 0000000..043fe98 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/LinePDL.png differ diff --git a/3dPrintApp/Resources/DrawPanel/LinearDimension.png b/3dPrintApp/Resources/DrawPanel/LinearDimension.png new file mode 100644 index 0000000..706c9e8 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/LinearDimension.png differ diff --git a/3dPrintApp/Resources/DrawPanel/MergeSurf.png b/3dPrintApp/Resources/DrawPanel/MergeSurf.png new file mode 100644 index 0000000..f3f6ed3 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/MergeSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Mirror.png b/3dPrintApp/Resources/DrawPanel/Mirror.png new file mode 100644 index 0000000..c8edab7 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Mirror.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Mirror3D.png b/3dPrintApp/Resources/DrawPanel/Mirror3D.png new file mode 100644 index 0000000..a169939 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Mirror3D.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ModifyCurve.png b/3dPrintApp/Resources/DrawPanel/ModifyCurve.png new file mode 100644 index 0000000..f84dfcf Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ModifyCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ModifyText.png b/3dPrintApp/Resources/DrawPanel/ModifyText.png new file mode 100644 index 0000000..ba37037 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ModifyText.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Move.png b/3dPrintApp/Resources/DrawPanel/Move.png new file mode 100644 index 0000000..78ab3a2 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Move.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Offset.png b/3dPrintApp/Resources/DrawPanel/Offset.png new file mode 100644 index 0000000..81c0be2 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Offset.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Plane.png b/3dPrintApp/Resources/DrawPanel/Plane.png new file mode 100644 index 0000000..bb85fcb Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Plane.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Point.png b/3dPrintApp/Resources/DrawPanel/Point.png new file mode 100644 index 0000000..5a43bfe Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Point.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Polygon.png b/3dPrintApp/Resources/DrawPanel/Polygon.png new file mode 100644 index 0000000..fe09e3a Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Polygon.png differ diff --git a/3dPrintApp/Resources/DrawPanel/PolygonSide.png b/3dPrintApp/Resources/DrawPanel/PolygonSide.png new file mode 100644 index 0000000..c90cd4b Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/PolygonSide.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Rectangle2P.png b/3dPrintApp/Resources/DrawPanel/Rectangle2P.png new file mode 100644 index 0000000..51bb0a7 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Rectangle2P.png differ diff --git a/3dPrintApp/Resources/DrawPanel/RemoveColor.png b/3dPrintApp/Resources/DrawPanel/RemoveColor.png new file mode 100644 index 0000000..c3b2850 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/RemoveColor.png differ diff --git a/3dPrintApp/Resources/DrawPanel/RemovePointCurve.png b/3dPrintApp/Resources/DrawPanel/RemovePointCurve.png new file mode 100644 index 0000000..ee039fe Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/RemovePointCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Revolve.png b/3dPrintApp/Resources/DrawPanel/Revolve.png new file mode 100644 index 0000000..821795f Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Revolve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Rotate.png b/3dPrintApp/Resources/DrawPanel/Rotate.png new file mode 100644 index 0000000..ec86735 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Rotate.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Rotate3D.png b/3dPrintApp/Resources/DrawPanel/Rotate3D.png new file mode 100644 index 0000000..f9d6d3d Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Rotate3D.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Ruled.png b/3dPrintApp/Resources/DrawPanel/Ruled.png new file mode 100644 index 0000000..25aa70c Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Ruled.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Scale.png b/3dPrintApp/Resources/DrawPanel/Scale.png new file mode 100644 index 0000000..ab5f447 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Scale.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Scale3D.png b/3dPrintApp/Resources/DrawPanel/Scale3D.png new file mode 100644 index 0000000..08bf3a1 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Scale3D.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Screw.png b/3dPrintApp/Resources/DrawPanel/Screw.png new file mode 100644 index 0000000..f9d5227 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Screw.png differ diff --git a/3dPrintApp/Resources/DrawPanel/SolidAddSurf.png b/3dPrintApp/Resources/DrawPanel/SolidAddSurf.png new file mode 100644 index 0000000..cd687b1 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/SolidAddSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/SolidIntersectSurf.png b/3dPrintApp/Resources/DrawPanel/SolidIntersectSurf.png new file mode 100644 index 0000000..b5d1518 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/SolidIntersectSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/SolidSubtractSurf.png b/3dPrintApp/Resources/DrawPanel/SolidSubtractSurf.png new file mode 100644 index 0000000..0672f49 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/SolidSubtractSurf.png differ diff --git a/3dPrintApp/Resources/DrawPanel/SplitCurve.png b/3dPrintApp/Resources/DrawPanel/SplitCurve.png new file mode 100644 index 0000000..25386eb Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/SplitCurve.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Swept.png b/3dPrintApp/Resources/DrawPanel/Swept.png new file mode 100644 index 0000000..88f86ee Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Swept.png differ diff --git a/3dPrintApp/Resources/DrawPanel/Text.png b/3dPrintApp/Resources/DrawPanel/Text.png new file mode 100644 index 0000000..c7af3e0 Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/Text.png differ diff --git a/3dPrintApp/Resources/DrawPanel/ThickCurve.png b/3dPrintApp/Resources/DrawPanel/ThickCurve.png new file mode 100644 index 0000000..03ac50c Binary files /dev/null and b/3dPrintApp/Resources/DrawPanel/ThickCurve.png differ diff --git a/3dPrintApp/Resources/EgtBEAMWALL.ico b/3dPrintApp/Resources/EgtBEAMWALL.ico new file mode 100644 index 0000000..90d6296 Binary files /dev/null and b/3dPrintApp/Resources/EgtBEAMWALL.ico differ diff --git a/3dPrintApp/Resources/InstrumentPanel/Analyze.png b/3dPrintApp/Resources/InstrumentPanel/Analyze.png new file mode 100644 index 0000000..e322f1d Binary files /dev/null and b/3dPrintApp/Resources/InstrumentPanel/Analyze.png differ diff --git a/3dPrintApp/Resources/InstrumentPanel/ChangeParam.png b/3dPrintApp/Resources/InstrumentPanel/ChangeParam.png new file mode 100644 index 0000000..d8c892a Binary files /dev/null and b/3dPrintApp/Resources/InstrumentPanel/ChangeParam.png differ diff --git a/3dPrintApp/Resources/InstrumentPanel/GetDist.png b/3dPrintApp/Resources/InstrumentPanel/GetDist.png new file mode 100644 index 0000000..520e406 Binary files /dev/null and b/3dPrintApp/Resources/InstrumentPanel/GetDist.png differ diff --git a/3dPrintApp/Resources/InstrumentPanel/Statistics.png b/3dPrintApp/Resources/InstrumentPanel/Statistics.png new file mode 100644 index 0000000..7b449f4 Binary files /dev/null and b/3dPrintApp/Resources/InstrumentPanel/Statistics.png differ diff --git a/3dPrintApp/Resources/LeftPanel/AddFeature.png b/3dPrintApp/Resources/LeftPanel/AddFeature.png new file mode 100644 index 0000000..c32126a Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/AddFeature.png differ diff --git a/3dPrintApp/Resources/LeftPanel/AddPart.png b/3dPrintApp/Resources/LeftPanel/AddPart.png new file mode 100644 index 0000000..1668e53 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/AddPart.png differ diff --git a/3dPrintApp/Resources/LeftPanel/AddToRawPart.png b/3dPrintApp/Resources/LeftPanel/AddToRawPart.png new file mode 100644 index 0000000..f45b5b1 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/AddToRawPart.png differ diff --git a/3dPrintApp/Resources/LeftPanel/CopyFeature.png b/3dPrintApp/Resources/LeftPanel/CopyFeature.png new file mode 100644 index 0000000..1c75bbf Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/CopyFeature.png differ diff --git a/3dPrintApp/Resources/LeftPanel/CopyPart.png b/3dPrintApp/Resources/LeftPanel/CopyPart.png new file mode 100644 index 0000000..4134ad8 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/CopyPart.png differ diff --git a/3dPrintApp/Resources/LeftPanel/MacroFeature.png b/3dPrintApp/Resources/LeftPanel/MacroFeature.png new file mode 100644 index 0000000..27354f1 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/MacroFeature.png differ diff --git a/3dPrintApp/Resources/LeftPanel/NewRawPart.png b/3dPrintApp/Resources/LeftPanel/NewRawPart.png new file mode 100644 index 0000000..b7cb987 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/NewRawPart.png differ diff --git a/3dPrintApp/Resources/LeftPanel/RemoveFeature.png b/3dPrintApp/Resources/LeftPanel/RemoveFeature.png new file mode 100644 index 0000000..4d2f756 Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/RemoveFeature.png differ diff --git a/3dPrintApp/Resources/LeftPanel/RemovePart.png b/3dPrintApp/Resources/LeftPanel/RemovePart.png new file mode 100644 index 0000000..3f9973d Binary files /dev/null and b/3dPrintApp/Resources/LeftPanel/RemovePart.png differ diff --git a/3dPrintApp/Resources/MainMenu/Send.png b/3dPrintApp/Resources/MainMenu/Send.png new file mode 100644 index 0000000..a9bcbe4 Binary files /dev/null and b/3dPrintApp/Resources/MainMenu/Send.png differ diff --git a/3dPrintApp/Resources/MovePartInRawPart/MoveLeftParts.png b/3dPrintApp/Resources/MovePartInRawPart/MoveLeftParts.png new file mode 100644 index 0000000..25b6de3 Binary files /dev/null and b/3dPrintApp/Resources/MovePartInRawPart/MoveLeftParts.png differ diff --git a/3dPrintApp/Resources/MovePartInRawPart/MoveRightParts.png b/3dPrintApp/Resources/MovePartInRawPart/MoveRightParts.png new file mode 100644 index 0000000..551c31f Binary files /dev/null and b/3dPrintApp/Resources/MovePartInRawPart/MoveRightParts.png differ diff --git a/3dPrintApp/Resources/OptimizePanel/FlipRot.png b/3dPrintApp/Resources/OptimizePanel/FlipRot.png new file mode 100644 index 0000000..1feba5c Binary files /dev/null and b/3dPrintApp/Resources/OptimizePanel/FlipRot.png differ diff --git a/3dPrintApp/Resources/OptimizePanel/UnlockFlip.png b/3dPrintApp/Resources/OptimizePanel/UnlockFlip.png new file mode 100644 index 0000000..77be85a Binary files /dev/null and b/3dPrintApp/Resources/OptimizePanel/UnlockFlip.png differ diff --git a/3dPrintApp/Resources/OptimizePanel/UnlockRotation.png b/3dPrintApp/Resources/OptimizePanel/UnlockRotation.png new file mode 100644 index 0000000..ef225a8 Binary files /dev/null and b/3dPrintApp/Resources/OptimizePanel/UnlockRotation.png differ diff --git a/3dPrintApp/Resources/OptimizePanel/Warehouse.png b/3dPrintApp/Resources/OptimizePanel/Warehouse.png new file mode 100644 index 0000000..024e2a6 Binary files /dev/null and b/3dPrintApp/Resources/OptimizePanel/Warehouse.png differ diff --git a/3dPrintApp/Resources/PartManager/LeftInvert.png b/3dPrintApp/Resources/PartManager/LeftInvert.png new file mode 100644 index 0000000..25b6de3 Binary files /dev/null and b/3dPrintApp/Resources/PartManager/LeftInvert.png differ diff --git a/3dPrintApp/Resources/PartManager/LeftRotate.png b/3dPrintApp/Resources/PartManager/LeftRotate.png new file mode 100644 index 0000000..2df81e1 Binary files /dev/null and b/3dPrintApp/Resources/PartManager/LeftRotate.png differ diff --git a/3dPrintApp/Resources/PartManager/Locked.old.png b/3dPrintApp/Resources/PartManager/Locked.old.png new file mode 100644 index 0000000..273cb2e Binary files /dev/null and b/3dPrintApp/Resources/PartManager/Locked.old.png differ diff --git a/3dPrintApp/Resources/PartManager/Locked.png b/3dPrintApp/Resources/PartManager/Locked.png new file mode 100644 index 0000000..93b1273 Binary files /dev/null and b/3dPrintApp/Resources/PartManager/Locked.png differ diff --git a/3dPrintApp/Resources/PartManager/RightInvert.png b/3dPrintApp/Resources/PartManager/RightInvert.png new file mode 100644 index 0000000..f2d8c5c Binary files /dev/null and b/3dPrintApp/Resources/PartManager/RightInvert.png differ diff --git a/3dPrintApp/Resources/PartManager/RightRotate.png b/3dPrintApp/Resources/PartManager/RightRotate.png new file mode 100644 index 0000000..2eb4182 Binary files /dev/null and b/3dPrintApp/Resources/PartManager/RightRotate.png differ diff --git a/3dPrintApp/Resources/PartManager/Unlocked.old.png b/3dPrintApp/Resources/PartManager/Unlocked.old.png new file mode 100644 index 0000000..9266567 Binary files /dev/null and b/3dPrintApp/Resources/PartManager/Unlocked.old.png differ diff --git a/3dPrintApp/Resources/PartManager/Unlocked.png b/3dPrintApp/Resources/PartManager/Unlocked.png new file mode 100644 index 0000000..f0500eb Binary files /dev/null and b/3dPrintApp/Resources/PartManager/Unlocked.png differ diff --git a/3dPrintApp/Resources/ProjectManager/ExportProject.png b/3dPrintApp/Resources/ProjectManager/ExportProject.png new file mode 100644 index 0000000..1c8d93a Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/ExportProject.png differ diff --git a/3dPrintApp/Resources/ProjectManager/GoToProd.png b/3dPrintApp/Resources/ProjectManager/GoToProd.png new file mode 100644 index 0000000..ca0eb96 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/GoToProd.png differ diff --git a/3dPrintApp/Resources/ProjectManager/GoToProj.png b/3dPrintApp/Resources/ProjectManager/GoToProj.png new file mode 100644 index 0000000..8eb9666 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/GoToProj.png differ diff --git a/3dPrintApp/Resources/ProjectManager/Import.png b/3dPrintApp/Resources/ProjectManager/Import.png new file mode 100644 index 0000000..1e19eab Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/Import.png differ diff --git a/3dPrintApp/Resources/ProjectManager/ImportBTL.png b/3dPrintApp/Resources/ProjectManager/ImportBTL.png new file mode 100644 index 0000000..7be9497 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/ImportBTL.png differ diff --git a/3dPrintApp/Resources/ProjectManager/ImportProject.png b/3dPrintApp/Resources/ProjectManager/ImportProject.png new file mode 100644 index 0000000..2c32c08 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/ImportProject.png differ diff --git a/3dPrintApp/Resources/ProjectManager/New.png b/3dPrintApp/Resources/ProjectManager/New.png new file mode 100644 index 0000000..78a5a0b Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/New.png differ diff --git a/3dPrintApp/Resources/ProjectManager/Open.png b/3dPrintApp/Resources/ProjectManager/Open.png new file mode 100644 index 0000000..616c02b Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/Open.png differ diff --git a/3dPrintApp/Resources/ProjectManager/Options.png b/3dPrintApp/Resources/ProjectManager/Options.png new file mode 100644 index 0000000..6fb84bb Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/Options.png differ diff --git a/3dPrintApp/Resources/ProjectManager/Save.png b/3dPrintApp/Resources/ProjectManager/Save.png new file mode 100644 index 0000000..0eca260 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/Save.png differ diff --git a/3dPrintApp/Resources/ProjectManager/SaveAs.png b/3dPrintApp/Resources/ProjectManager/SaveAs.png new file mode 100644 index 0000000..1d5cfae Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/SaveAs.png differ diff --git a/3dPrintApp/Resources/ProjectManager/Send.png b/3dPrintApp/Resources/ProjectManager/Send.png new file mode 100644 index 0000000..a9bcbe4 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/Send.png differ diff --git a/3dPrintApp/Resources/ProjectManager/UpdateBTL.png b/3dPrintApp/Resources/ProjectManager/UpdateBTL.png new file mode 100644 index 0000000..18fa216 Binary files /dev/null and b/3dPrintApp/Resources/ProjectManager/UpdateBTL.png differ diff --git a/3dPrintApp/Resources/ShowBeamPanel/ShowAll.png b/3dPrintApp/Resources/ShowBeamPanel/ShowAll.png new file mode 100644 index 0000000..37a0de8 Binary files /dev/null and b/3dPrintApp/Resources/ShowBeamPanel/ShowAll.png differ diff --git a/3dPrintApp/Resources/ShowBeamPanel/ShowBuilding.png b/3dPrintApp/Resources/ShowBeamPanel/ShowBuilding.png new file mode 100644 index 0000000..419a955 Binary files /dev/null and b/3dPrintApp/Resources/ShowBeamPanel/ShowBuilding.png differ diff --git a/3dPrintApp/Resources/ShowBeamPanel/ShowSolid.png b/3dPrintApp/Resources/ShowBeamPanel/ShowSolid.png new file mode 100644 index 0000000..383a95e Binary files /dev/null and b/3dPrintApp/Resources/ShowBeamPanel/ShowSolid.png differ diff --git a/3dPrintApp/Resources/ShowPanel/CurveDir.png b/3dPrintApp/Resources/ShowPanel/CurveDir.png new file mode 100644 index 0000000..f7e12b5 Binary files /dev/null and b/3dPrintApp/Resources/ShowPanel/CurveDir.png differ diff --git a/3dPrintApp/Resources/ShowPanel/RenderingHL.png b/3dPrintApp/Resources/ShowPanel/RenderingHL.png new file mode 100644 index 0000000..8aa5a3a Binary files /dev/null and b/3dPrintApp/Resources/ShowPanel/RenderingHL.png differ diff --git a/3dPrintApp/Resources/ShowPanel/RenderingSH.png b/3dPrintApp/Resources/ShowPanel/RenderingSH.png new file mode 100644 index 0000000..0c6690d Binary files /dev/null and b/3dPrintApp/Resources/ShowPanel/RenderingSH.png differ diff --git a/3dPrintApp/Resources/ShowPanel/RenderingWF.png b/3dPrintApp/Resources/ShowPanel/RenderingWF.png new file mode 100644 index 0000000..1f2de62 Binary files /dev/null and b/3dPrintApp/Resources/ShowPanel/RenderingWF.png differ diff --git a/3dPrintApp/Resources/Statistics/CopyToClipboard.png b/3dPrintApp/Resources/Statistics/CopyToClipboard.png new file mode 100644 index 0000000..e41378a Binary files /dev/null and b/3dPrintApp/Resources/Statistics/CopyToClipboard.png differ diff --git a/3dPrintApp/Resources/Statistics/PrintPDF.png b/3dPrintApp/Resources/Statistics/PrintPDF.png new file mode 100644 index 0000000..1a973e8 Binary files /dev/null and b/3dPrintApp/Resources/Statistics/PrintPDF.png differ diff --git a/3dPrintApp/Resources/TopPanel/CopyRawPart.png b/3dPrintApp/Resources/TopPanel/CopyRawPart.png new file mode 100644 index 0000000..bbe681b Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/CopyRawPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/MoveDownPart.png b/3dPrintApp/Resources/TopPanel/MoveDownPart.png new file mode 100644 index 0000000..25b6de3 Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/MoveDownPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/MovePartInRawPart.png b/3dPrintApp/Resources/TopPanel/MovePartInRawPart.png new file mode 100644 index 0000000..c4dcd5a Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/MovePartInRawPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/MoveUpPart.png b/3dPrintApp/Resources/TopPanel/MoveUpPart.png new file mode 100644 index 0000000..551c31f Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/MoveUpPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/ProduceAllRawPart.png b/3dPrintApp/Resources/TopPanel/ProduceAllRawPart.png new file mode 100644 index 0000000..8b79c88 Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/ProduceAllRawPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/ProduceRawPart.png b/3dPrintApp/Resources/TopPanel/ProduceRawPart.png new file mode 100644 index 0000000..4963035 Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/ProduceRawPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/RemovePart.old.png b/3dPrintApp/Resources/TopPanel/RemovePart.old.png new file mode 100644 index 0000000..aa4257e Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/RemovePart.old.png differ diff --git a/3dPrintApp/Resources/TopPanel/RemovePart.png b/3dPrintApp/Resources/TopPanel/RemovePart.png new file mode 100644 index 0000000..dedca01 Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/RemovePart.png differ diff --git a/3dPrintApp/Resources/TopPanel/RemoveRawPart.png b/3dPrintApp/Resources/TopPanel/RemoveRawPart.png new file mode 100644 index 0000000..cb298d1 Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/RemoveRawPart.png differ diff --git a/3dPrintApp/Resources/TopPanel/ReorderPart.png b/3dPrintApp/Resources/TopPanel/ReorderPart.png new file mode 100644 index 0000000..9c7ffef Binary files /dev/null and b/3dPrintApp/Resources/TopPanel/ReorderPart.png differ diff --git a/3dPrintApp/Resources/TreeView/Folder.png b/3dPrintApp/Resources/TreeView/Folder.png new file mode 100644 index 0000000..2c1339d Binary files /dev/null and b/3dPrintApp/Resources/TreeView/Folder.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromBACK.png b/3dPrintApp/Resources/ViewPanel/LookFromBACK.png new file mode 100644 index 0000000..0c2790c Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromBACK.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromBOTTOM.png b/3dPrintApp/Resources/ViewPanel/LookFromBOTTOM.png new file mode 100644 index 0000000..6a48b64 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromBOTTOM.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromFRONT.png b/3dPrintApp/Resources/ViewPanel/LookFromFRONT.png new file mode 100644 index 0000000..08abc99 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromFRONT.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromISO_NE.png b/3dPrintApp/Resources/ViewPanel/LookFromISO_NE.png new file mode 100644 index 0000000..e0c71ba Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromISO_NE.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromISO_NW.png b/3dPrintApp/Resources/ViewPanel/LookFromISO_NW.png new file mode 100644 index 0000000..203e290 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromISO_NW.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromISO_SE.png b/3dPrintApp/Resources/ViewPanel/LookFromISO_SE.png new file mode 100644 index 0000000..2891088 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromISO_SE.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromISO_SW.png b/3dPrintApp/Resources/ViewPanel/LookFromISO_SW.png new file mode 100644 index 0000000..909e25e Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromISO_SW.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromLEFT.png b/3dPrintApp/Resources/ViewPanel/LookFromLEFT.png new file mode 100644 index 0000000..d4a4e85 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromLEFT.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromRIGHT.png b/3dPrintApp/Resources/ViewPanel/LookFromRIGHT.png new file mode 100644 index 0000000..f182c1a Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromRIGHT.png differ diff --git a/3dPrintApp/Resources/ViewPanel/LookFromTOP.png b/3dPrintApp/Resources/ViewPanel/LookFromTOP.png new file mode 100644 index 0000000..214358d Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/LookFromTOP.png differ diff --git a/3dPrintApp/Resources/ViewPanel/ZoomAll.png b/3dPrintApp/Resources/ViewPanel/ZoomAll.png new file mode 100644 index 0000000..e1a27d1 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/ZoomAll.png differ diff --git a/3dPrintApp/Resources/ViewPanel/ZoomIn.png b/3dPrintApp/Resources/ViewPanel/ZoomIn.png new file mode 100644 index 0000000..b370a3e Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/ZoomIn.png differ diff --git a/3dPrintApp/Resources/ViewPanel/ZoomOut.png b/3dPrintApp/Resources/ViewPanel/ZoomOut.png new file mode 100644 index 0000000..187a1a0 Binary files /dev/null and b/3dPrintApp/Resources/ViewPanel/ZoomOut.png differ diff --git a/3dPrintApp/SceneHost/MySceneHostVM.vb b/3dPrintApp/SceneHost/MySceneHostVM.vb new file mode 100644 index 0000000..a1d0d8f --- /dev/null +++ b/3dPrintApp/SceneHost/MySceneHostVM.vb @@ -0,0 +1,717 @@ +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 +Imports Microsoft.Win32 + +Public Class MySceneHostVM + Inherits EgtWPFLib5.SceneHostVM + + Friend m_bIsFocused As Boolean + Friend Sub SetIsFocused(bValue As Boolean) + m_bIsFocused = bValue + End Sub + + ' Identificativi per pezzo da selezionare/deselezionare + Private m_nIdToSel As Integer = GDB_ID.NULL + Private m_nIdToDesel As Integer = GDB_ID.NULL + ' Dati movimento + Private m_dMaxStep As Double = 0 + ' Dati per Drag + Private m_nRestRadius As Integer = 5 + Private m_bDrag As Boolean = False + Private m_bDragToStart As Boolean = False + Private m_bVerify As Boolean = False + Private m_bFromParking As Boolean = False + Private m_bDragging As Boolean = False + Private m_locPrev As System.Drawing.Point + Private m_ptPrev As Point3d + Private m_vtTotMove As Vector3d + Private m_dSnapDist As Double = 0 + + Private bReducedCut As Boolean = False + Private m_bMagnetic As Boolean + + ' punto di snap per inizializzazione + Private m_SnapType As SP + Friend ReadOnly Property SnapType As SP + Get + Return m_SnapType + End Get + End Property + +#Region "CONSTRUCTOR" + + Sub New() + MyBase.New() + AddHandler MainController.OnNewProject, AddressOf OnNewProject + AddHandler MainController.OnOpenProject, AddressOf OnOpenProject + AddHandler MainController.OnSavingProject, AddressOf OnSavingProject + AddHandler MainController.OnSavedProject, AddressOf OnSavedProject + AddHandler MainController.OnInsertedProject, AddressOf OnInsertedProject + AddHandler MainController.OnImportingProject, AddressOf OnImportingProject + AddHandler MainController.OnImportedProject, AddressOf OnImportedProject + AddHandler MainController.PrepareInputBox, AddressOf PrepareInputBox + AddHandler MainController.SetInputBoxText, AddressOf SetInputBoxText + AddHandler MainController.SetInputBoxCheck, AddressOf SetInputBoxCheck + AddHandler MainController.AddInputBoxCombo, AddressOf AddInputBoxCombo + AddHandler MainController.UpdateUI, AddressOf UpdateUI + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Overrides Sub InitScene() + InitSceneEvents() + ' Inizializzazione Scena + PreInitializeScene() + ' Se tutto bene + If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT._3DPRINT) Then + PostInitializeScene() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + EgtSetCurrentContext(MainScene.GetCtx()) + ' inizializzo gestore lavorazioni + EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir) + Return + End If + ' Problemi + ' Se manca la chiave + If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then + EgtOutLog("Missing Dongle") + ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error) + ' Altrimenti manca la licenza + Else + EgtOutLog("Problems with Licence") + ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then + ' Apro dialogo per richiesta file licenza + Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With { + .DefaultExt = ".lic", + .Filter = "Licences (.lic)|*.lic", + .CheckFileExists = True, + .ValidateNames = True + } + If LicDlg.ShowDialog() = True Then + ' Recupero il direttorio del file + Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName) + ' Se il file non è già nel direttorio di configurazione lo copio + If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then + Try + File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True) + Catch ex As Exception + End Try + End If + ' Imposto il nuovo file di licenza nell'Ini + WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName) + End If + End If + End If + ' Chiudo il programma + End + End Sub + + Public Overrides Sub InitSceneEvents() + AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos + AddHandler MainScene.OnMouseSetObjFilterForSelect, AddressOf OnMouseSetObjFilterForSelect + AddHandler MainScene.OnMouseSelectedAll, AddressOf OnMouseSelectedAll + AddHandler MainScene.OnMouseDeselectedAll, AddressOf OnMouseDeselectedAll + AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene + AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene + AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene + AddHandler MainScene.OnMouseSelectedObj, AddressOf OnMouseSelectedObj + AddHandler MainScene.OnMouseSelectedPart, AddressOf OnMouseSelectedPart + AddHandler MainScene.OnMouseSelectedLayer, AddressOf OnMouseSelectedLayer + AddHandler MainScene.OnMouseSelectedPath, AddressOf OnMouseSelectedPath + AddHandler MainScene.OnMousePointFromSelection, AddressOf OnMousePointFromSelection + AddHandler MainScene.OnMouseDone, AddressOf OnMouseDone + AddHandler MainScene.OnMouseSelectedPoint, AddressOf OnMouseSelectedPoint + AddHandler MainScene.OnMouseSelectedDir, AddressOf OnMouseSelectedDir + AddHandler MainScene.OnMouseMoveSelPoint, AddressOf OnMouseMoveSelPoint + AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance + AddHandler MainScene.KeyDown, AddressOf OnKeyDown + AddHandler MainScene.OnCloseGetDist, AddressOf OnCloseGetDist + AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType + End Sub + + Private Sub PreInitializeScene() + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) + MainScene.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) + Dim BackBotColor As New Color3d(BackTopColor) + GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) + MainScene.SetViewBackground(BackTopColor, BackBotColor) + ' imposto spessore linee + Dim nLineWidth As Integer = 1 + nLineWidth = GetMainPrivateProfileInt(S_SCENE, K_LINEWIDTH, nLineWidth) + MainScene.SetLineWidth(nLineWidth) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor) + MainScene.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) + MainScene.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) + MainScene.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) + MainScene.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3) + Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) + Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) + Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) + MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + End Sub + + Private Sub PostInitializeScene() + ' Impostazioni Controller + MainController.SetScene(MainScene) + MainController.SetSurfTmTolerance(0.05) + MainController.SetUseCustomColors(True, S_SCENE, K_CUSTOMCOLORS) + ' imposto unità di misura per interfaccia utente + Dim nMeasureUnit As Integer = GetMainPrivateProfileInt(S_SCENE, K_MMUNITS, 1) + EgtSetUiUnits(nMeasureUnit <> 0) + 'Map.refMyStatusBarVM.SetMeasureUnit(nMeasureUnit <> 0) + ' imposto visualizzazione riferimento globale + EgtSetGlobFrameShow(True) + ' imposto i dati della griglia + 'LoadGridData() + EgtSetGridFrame(Frame3d.GLOB) + EgtSetGridGeo(10, 10, 100, 484) + EgtSetGridColor(New Color3d(160, 160, 160), New Color3d(160, 160, 160)) + EgtSetGridShow(True, False) + ' imposto tipo coordinate + MainScene.SetGridCursorPos(True) + ' modo di visualizzazione + Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) + '''Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM)) + ' visualizzazione avanzata dei triangoli costituenti le superfici + Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) + EgtSetShowTriaAdv(bShowTriaAdv) + ' tipo visualizzazione per Zmap + Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) + EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) + ' tipo snap point + MainScene.SetSnapPointType(SP.PT_SKETCH) + ' visualizzazione assemblato + Dim nShowBuilding As Boolean = GetMainPrivateProfileInt(S_SCENE, K_SHOWBUILDING, 0) <> 0 + '''Map.refShowBeamPanelVM.SetShowBuilding(nShowBuilding) + ' nascondo input box + '''Map.refFreeContourInputVM.ResetInputBox() + End Sub + +#End Region ' METHODS + +#Region "ProjectManager" + + Public Overrides Sub NewProject() + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = MainController.NewProject() + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub OpenProject(sFilePath As String) + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = False + If String.IsNullOrEmpty(sFilePath) Then + ' Recupero cartella dell'ultimo progetto aperto + Dim sDir As String = MainController.GetCurrFile() + If String.IsNullOrWhiteSpace(sDir) Then + GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir) + End If + If Not String.IsNullOrWhiteSpace(sDir) Then + sDir = Path.GetDirectoryName(sDir) + End If + bOk = MainController.OpenProject(sDir) + Else + bOk = MainController.OpenProject(sFilePath, False) + End If + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub SaveProject() + MyBase.SaveProject() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub SaveAsProject() + MyBase.SaveAsProject() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub InsertProject() + ' eseguo + Dim sDir As String = String.Empty + GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir) + Dim OpenFileDialog As New OpenFileDialog With {.Title = "Insert", + .Filter = "Stereolithography (*.stl)|*.stl" & + "|New geometry EgalTech(*.nge)|*.nge" & + "|All Files (*.*)|*.*", + .FilterIndex = 1, + .InitialDirectory = sDir} + If Not OpenFileDialog.ShowDialog Then + Return + End If + Dim sFile As String = String.Empty + sFile = OpenFileDialog.FileName + MainController.InsertProject(sFile, False) + End Sub + + Public Overrides Sub ImportProject() + Dim sDir As String = String.Empty + GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir) + If Not String.IsNullOrWhiteSpace(sDir) Then + sDir = Path.GetDirectoryName(sDir) + End If + sDir.TrimEnd("\"c) + MainController.ImportProject(sDir) + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Friend Sub PreExecScript(bScriptInMru As Boolean) + 'm_bScriptInMru = bScriptInMru + End Sub + + Friend Sub ExecScript(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + 'GetMainPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) + MainController.Exec(sDir) + Else + MainController.Exec(sFilePath, False) + End If + Dim bMachiningMode As Boolean = EgtGetCurrMachGroup() <> GDB_ID.NULL + If Not bMachiningMode And EgtGetCurrLayer() = GDB_ID.NULL Then + Dim nCurrPart As Integer = EgtGetCurrPart() + If nCurrPart = GDB_ID.NULL Or Not EgtSetCurrPartLayer(nCurrPart, EgtGetFirstLayer(nCurrPart, True)) Then + EgtResetCurrPartLayer() + End If + End If + End Sub + +#End Region ' ProjectManager + +#Region "SCENE EVENTS" + + Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) + Map.refMyStatusBarVM.SetCurrPos(sCursorPos) + End Sub + + Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + End Sub + + Private Sub OnMouseSelectedAll(ByVal sender As Object, bOnlyVisble As Boolean) + End Sub + + Private Sub OnMouseDeselectedAll(ByVal sender As Object) + End Sub + + Private Sub OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseDownScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseDownScene(sender, e) + ' Else + ' View_Feature_OnMouseDownScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseDownScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseDownScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseMoveScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseMoveScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseMoveScene(sender, e) + ' Else + ' View_Feature_OnMouseMoveScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseMoveScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseMoveScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseUpScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseUpScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseUpScene(sender, e) + ' Else + ' View_Feature_OnMouseUpScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseUpScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseUpScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' ' se sto editando testo angoli + ' If Map.refFreeContourManagerVM.bIsModifyingTextAngle Then + ' ' passo testo selezionato + ' Map.refFreeContourManagerVM.TextAngleSelected(nId) + ' End If + ' MainController.MouseSelectedObj(nId, bLast) + 'End If + End Sub + + Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedPart(nId) + 'End If + End Sub + + Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedLayer(nId) + 'End If + End Sub + + Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedPath(nId, bHaltOnFork) + 'End If + End Sub + + Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.SetPointFromSelection(nId, PtP, nAux) + 'End If + End Sub + + Private Sub OnMouseDone(ByVal sender As Object) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.Done(Map.refFreeContourInputVM.Text) + 'End If + End Sub + + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control + ' MainController.MouseSelectedPoint(PtP, nSep, nId, bDone) + 'End If + End Sub + + Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.SetLastVector3d(VtDir) + 'End If + End Sub + + Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseMoveInSelectionPoint(PtP) + 'End If + End Sub + + Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) + Map.refMyStatusBarVM.SetOutputMessage(sDistance) + End Sub + + Private Sub OnKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' ' Con DEL eseguo cancellazione delle entità selezionate + ' If e.KeyData = System.Windows.Forms.Keys.Delete Then + ' MainController.SetLastInteger(GDB_ID.SEL) + ' MainController.ExecuteCommand(Controller.CMD.DELETE) + ' ' Con SPAZIO ripeto l'ultimo comando + ' ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then + ' MainController.RepeatLastCommand() + ' ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco + ' ElseIf e.KeyData = System.Windows.Forms.Keys.A And MainController.GetContinue() Then + ' MainController.ContinueArcPDP() + ' ' Con 'L' e in modalità continuazione, forzo il passaggio a retta + ' ElseIf e.KeyData = System.Windows.Forms.Keys.L And MainController.GetContinue() Then + ' MainController.ContinueLine2P() + ' ' Con 'V' cambio lo stato del check + ' ElseIf e.KeyData = System.Windows.Forms.Keys.V Then + ' Map.refFreeContourInputVM.ChangeInputBoxCheck() + ' End If + 'End If + End Sub + + Private Sub OnCloseGetDist(sender As System.Object) + Map.refInstrumentPanelVM.SetGetDistance_IsChecked(False) + End Sub + + Friend Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) + m_SnapType = nSpType + If Not IsNothing(Map.refMyStatusBarVM) Then Map.refMyStatusBarVM.SetSnapPointType(nSpType) + End Sub + +#End Region ' SCENE EVENTS + +#Region "CONTROLLER EVENTS" + + Private Sub OnNewProject(sender As Object, bOk As Boolean) + CurrentMachine.CreateMachineTable() + If Not bOk Then + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error + End If + EgtZoom(ZM.ALL) + MainScene.SetStatusNull() + End Sub + + Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) + EgtZoom(ZM.ALL) + WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + Map.refProjManagerVM.MruFiles.Add(sFile) + Else + Map.refProjManagerVM.MruFiles.Remove(sFile) + Dim sMsg As String + If My.Computer.FileSystem.FileExists(sFile) Then + sMsg = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file + Else + sMsg = EgtMsg(10009) & " '" & sFile & "'" 'Missing file + End If + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error + End If + MainScene.SetStatusNull() + End Sub + + Private Sub OnSavingProject(ByVal sender As Object, sFile As String) + End Sub + + Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + Map.refProjManagerVM.MruFiles.Add(sFile) + Else + Map.refProjManagerVM.MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub + + Private Sub OnInsertedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + ' Segnalo eventuale errore + If Not bOk Then + Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + Else + ' lo aggiungo alla lista pezzi + Map.refProjectVM.AddNewPart(sFile) + End If + EgtDraw() + MainScene.SetStatusNull() + End Sub + + Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) + If nType <> FT.NULL Then + If nType = FT.CNC Then + nFlag = GetMainPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE) + Else + nFlag = 0 + End If + ' Abilito progress e bottone stop + Map.refMyStatusBarVM.StartLoading("", True) + Else + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error + End If + End Sub + + Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + EgtZoom(ZM.ALL) + ' Disabilito progress e bottone stop + Map.refMyStatusBarVM.EndLoading("") + ' Salvo path + WriteMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile)) + ' Segnalo eventuale errore + If Not bOk Then + Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + ElseIf Path.GetExtension(sFile) <> ".cnc" Then + ' creo oggetto pezzo in lista + 'Map.refProjectVM. + End If + MainScene.SetStatusNull() + End Sub + + Private Sub PrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String, + ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) + 'Map.refFreeContourInputVM.PrepareInputBox(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn) + End Sub + + Private Sub SetInputBoxText(ByVal sText As String) + 'Map.refFreeContourInputVM.SetInputBoxText(sText) + End Sub + + Private Sub SetInputBoxCheck(ByVal bCheck As Boolean) + 'Map.refFreeContourInputVM.SetInputBoxCheck(bCheck) + End Sub + + Private Sub AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) + 'Map.refFreeContourInputVM.AddInputBoxCombo(sText, bSelected) + End Sub + + Private Sub UpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) + '' pulisco input e relativi messaggi + 'Map.refFreeContourInputVM.ResetInputBox() + If MainController.GetContinue() Then + Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc + Else + Map.refMyStatusBarVM.ClearOutputMessage() + End If + End Sub + +#End Region ' CONTROLLER EVENTS + +#Region "Part" + + Friend Sub Basic_OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs) + ' Verifico se selezionato indicativo di pezzo + EgtSetObjFilterForSelWin(True, True, True, True, True) + Dim nSel As Integer + EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + ' Recupero l'identificativo del pezzo cui appartiene + Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) + Dim bFound As Boolean = False + If EgtIsPart(nPartId) Then bFound = True + If Not bFound Then + nId = EgtGetNextObjInSelWin() + Continue While + End If + Dim nStat As Integer = GDB_ST.ON_ + EgtGetStatus(nPartId, nStat) + ' Se già selezionato + If nStat = GDB_ST.SEL Then + ' Memorizzo Id da deselezionare + m_nIdToDesel = nPartId + Else + ' Memorizzo Id da selezionare + m_nIdToSel = nPartId + End If + Exit While + nId = EgtGetNextObjInSelWin() + End While + ' Dati per drag + m_bDragToStart = True + End Sub + + Friend Sub Basic_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + ' Se drag non abilitato o già in esecuzione, esco + If Not m_bDragToStart Then Return + ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel + If m_bDragToStart Then + If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And + Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then + Return + End If + m_bDragToStart = False + End If + End Sub + + Friend Sub Basic_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + ' Se eseguito drag + If Not m_bDragToStart Then + ' Se selezione da eseguire + ElseIf m_nIdToSel <> GDB_ID.NULL Then + ' Se pezzo da selezionare non è già selezionato + 'If EgtIsSelectedObj(m_nIdToSel) Then + ' Eseguo la selezione + Map.refProjectVM.SelPartFromId(m_nIdToSel) + 'EgtDeselectAll() + 'EgtSelectPartObjs(m_nIdToSel) + 'EgtSelectObj(m_nIdToSel) + 'EgtSetMark(m_nIdToSel) + 'End If + 'If IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) OrElse Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId <> m_nIdToSel Then + ' ' Eseguo la selezione + ' For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList + ' If BTLPart.nPartId = m_nIdToSel Then + ' BTLPart.SetIsSelected(True) + ' ElseIf BTLPart.IsSelected Then + ' BTLPart.SetIsSelected(False) + ' End If + ' Next + ' End If + End If + ' Reset + m_bDrag = False + m_nIdToSel = GDB_ID.NULL + m_nIdToDesel = GDB_ID.NULL + EgtDraw() + End Sub + +#End Region ' Part + +End Class diff --git a/3dPrintApp/SceneHost/MySceneHostVM.vb.bak b/3dPrintApp/SceneHost/MySceneHostVM.vb.bak new file mode 100644 index 0000000..b07847b --- /dev/null +++ b/3dPrintApp/SceneHost/MySceneHostVM.vb.bak @@ -0,0 +1,655 @@ +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MySceneHostVM + Inherits EgtWPFLib5.SceneHostVM + + Friend m_bIsFocused As Boolean + Friend Sub SetIsFocused(bValue As Boolean) + m_bIsFocused = bValue + End Sub + + ' Identificativi per pezzo da selezionare/deselezionare + Private m_nIdToSel As Integer = GDB_ID.NULL + Private m_nIdToDesel As Integer = GDB_ID.NULL + ' Dati movimento + Private m_dMaxStep As Double = 0 + ' Dati per Drag + Private m_nRestRadius As Integer = 5 + Private m_bDrag As Boolean = False + Private m_bDragToStart As Boolean = False + Private m_bVerify As Boolean = False + Private m_bFromParking As Boolean = False + Private m_bDragging As Boolean = False + Private m_locPrev As System.Drawing.Point + Private m_ptPrev As Point3d + Private m_vtTotMove As Vector3d + Private m_dSnapDist As Double = 0 + + + Private bReducedCut As Boolean = False + Private m_bMagnetic As Boolean + +#Region "CONSTRUCTOR" + + Sub New() + MyBase.New() + AddHandler MainController.OnNewProject, AddressOf OnNewProject + AddHandler MainController.OnOpenProject, AddressOf OnOpenProject + AddHandler MainController.OnSavingProject, AddressOf OnSavingProject + AddHandler MainController.OnSavedProject, AddressOf OnSavedProject + AddHandler MainController.OnImportingProject, AddressOf OnImportingProject + AddHandler MainController.OnImportedProject, AddressOf OnImportedProject + AddHandler MainController.PrepareInputBox, AddressOf PrepareInputBox + AddHandler MainController.SetInputBoxText, AddressOf SetInputBoxText + AddHandler MainController.SetInputBoxCheck, AddressOf SetInputBoxCheck + AddHandler MainController.AddInputBoxCombo, AddressOf AddInputBoxCombo + AddHandler MainController.UpdateUI, AddressOf UpdateUI + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Overrides Sub InitScene() + InitSceneEvents() + ' Inizializzazione Scena + PreInitializeScene() + ' Se tutto bene + If MainScene.Init() And Map.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT._3DPRINT) Then + PostInitializeScene() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + EgtSetCurrentContext(MainScene.GetCtx()) + ' inizializzo gestore travi e pareti + EgtInitBeamMgr(EIB_FL.TS3_POS + EIB_FL.USEUATTR) + ' inizializzo gestore lavorazioni + EgtInitMachMgr(Map.refMainWindowVM.MainWindowM.sMachinesRoot, Map.refMainWindowVM.MainWindowM.sToolMakersDir) + Return + End If + ' Problemi + ' Se manca la chiave + If Map.refMainWindowVM.MainWindowM.nKeyLevel = -1 Or Map.refMainWindowVM.MainWindowM.nKeyLevel = -2 Then + EgtOutLog("Missing Dongle") + ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error) + ' Altrimenti manca la licenza + Else + EgtOutLog("Problems with Licence") + ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then + ' Apro dialogo per richiesta file licenza + Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With { + .DefaultExt = ".lic", + .Filter = "Licences (.lic)|*.lic", + .CheckFileExists = True, + .ValidateNames = True + } + If LicDlg.ShowDialog() = True Then + ' Recupero il direttorio del file + Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName) + ' Se il file non è già nel direttorio di configurazione lo copio + If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(Map.refMainWindowVM.MainWindowM.sConfigDir), StringComparison.OrdinalIgnoreCase) Then + Try + File.Copy(LicDlg.FileName, Path.Combine(Map.refMainWindowVM.MainWindowM.sConfigDir, LicDlg.SafeFileName), True) + Catch ex As Exception + End Try + End If + ' Imposto il nuovo file di licenza nell'Ini + WriteMainPrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName) + End If + End If + End If + ' Chiudo il programma + End + End Sub + + Public Overrides Sub InitSceneEvents() + AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos + AddHandler MainScene.OnMouseSetObjFilterForSelect, AddressOf OnMouseSetObjFilterForSelect + AddHandler MainScene.OnMouseSelectedAll, AddressOf OnMouseSelectedAll + AddHandler MainScene.OnMouseDeselectedAll, AddressOf OnMouseDeselectedAll + AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene + AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene + AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene + AddHandler MainScene.OnMouseSelectedObj, AddressOf OnMouseSelectedObj + AddHandler MainScene.OnMouseSelectedPart, AddressOf OnMouseSelectedPart + AddHandler MainScene.OnMouseSelectedLayer, AddressOf OnMouseSelectedLayer + AddHandler MainScene.OnMouseSelectedPath, AddressOf OnMouseSelectedPath + AddHandler MainScene.OnMousePointFromSelection, AddressOf OnMousePointFromSelection + AddHandler MainScene.OnMouseDone, AddressOf OnMouseDone + AddHandler MainScene.OnMouseSelectedPoint, AddressOf OnMouseSelectedPoint + AddHandler MainScene.OnMouseSelectedDir, AddressOf OnMouseSelectedDir + AddHandler MainScene.OnMouseMoveSelPoint, AddressOf OnMouseMoveSelPoint + AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance + AddHandler MainScene.KeyDown, AddressOf OnKeyDown + AddHandler MainScene.OnCloseGetDist, AddressOf OnCloseGetDist + AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType + End Sub + + Private Sub PreInitializeScene() + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) + MainScene.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) + Dim BackBotColor As New Color3d(BackTopColor) + GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) + MainScene.SetViewBackground(BackTopColor, BackBotColor) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor) + MainScene.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) + MainScene.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) + MainScene.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) + MainScene.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3) + Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) + Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) + Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) + MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + End Sub + + Private Sub PostInitializeScene() + ' Impostazioni Controller + MainController.SetScene(MainScene) + ' imposto tipo coordinate + MainScene.SetGridCursorPos(True) + ' modo di visualizzazione + Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) + '''Map.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM)) + ' visualizzazione avanzata dei triangoli costituenti le superfici + Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) + EgtSetShowTriaAdv(bShowTriaAdv) + ' tipo visualizzazione per Zmap + Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) + EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) + ' tipo snap point + MainScene.SetSnapPointType(SP.PT_SKETCH) + ' visualizzazione assemblato + Dim nShowBuilding As Boolean = GetMainPrivateProfileInt(S_SCENE, K_SHOWBUILDING, 0) <> 0 + '''Map.refShowBeamPanelVM.SetShowBuilding(nShowBuilding) + ' nascondo input box + '''Map.refFreeContourInputVM.ResetInputBox() + End Sub + +#End Region ' METHODS + +#Region "ProjectManager" + + Public Overrides Sub NewProject() + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = MainController.NewProject() + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub OpenProject(sFilePath As String) + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = False + If String.IsNullOrEmpty(sFilePath) Then + ' Recupero cartella dell'ultimo progetto aperto + Dim sDir As String = MainController.GetCurrFile() + If String.IsNullOrWhiteSpace(sDir) Then + GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir) + End If + If Not String.IsNullOrWhiteSpace(sDir) Then + sDir = Path.GetDirectoryName(sDir) + End If + bOk = MainController.OpenProject(sDir) + Else + bOk = MainController.OpenProject(sFilePath, False) + End If + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub SaveProject() + MyBase.SaveProject() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub SaveAsProject() + MyBase.SaveAsProject() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub ImportProject() + Dim sDir As String = String.Empty + GetMainPrivateProfileString(S_MRUIMPORT, K_FILE & "1", "", sDir) + If Not String.IsNullOrWhiteSpace(sDir) Then + sDir = Path.GetDirectoryName(sDir) + End If + sDir.TrimEnd("\"c) + MainController.ImportProject(sDir) + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + End Sub + + Friend Sub PreExecScript(bScriptInMru As Boolean) + 'm_bScriptInMru = bScriptInMru + End Sub + + Friend Sub ExecScript(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + 'GetMainPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) + MainController.Exec(sDir) + Else + MainController.Exec(sFilePath, False) + End If + Dim bMachiningMode As Boolean = EgtGetCurrMachGroup() <> GDB_ID.NULL + If Not bMachiningMode And EgtGetCurrLayer() = GDB_ID.NULL Then + Dim nCurrPart As Integer = EgtGetCurrPart() + If nCurrPart = GDB_ID.NULL Or Not EgtSetCurrPartLayer(nCurrPart, EgtGetFirstLayer(nCurrPart, True)) Then + EgtResetCurrPartLayer() + End If + End If + End Sub + +#End Region ' ProjectManager + +#Region "SCENE EVENTS" + + Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) + Map.refMyStatusBarVM.SetCurrPos(sCursorPos) + End Sub + + Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) + End Sub + + Private Sub OnMouseSelectedAll(ByVal sender As Object, bOnlyVisble As Boolean) + End Sub + + Private Sub OnMouseDeselectedAll(ByVal sender As Object) + End Sub + + Private Sub OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseDownScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseDownScene(sender, e) + ' Else + ' View_Feature_OnMouseDownScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseDownScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseDownScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseMoveScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseMoveScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseMoveScene(sender, e) + ' Else + ' View_Feature_OnMouseMoveScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseMoveScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseMoveScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseUpScene(sender As Object, e As Forms.MouseEventArgs) + If e.Button = Forms.MouseButtons.Middle Then Return + If Map.refInstrumentPanelVM.GetDistIsChecked Then Return + Basic_OnMouseUpScene(sender, e) + 'Select Case Map.refMainMenuVM.SelPage + ' Case Pages.VIEW + ' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then + ' If Map.refFreeContourManagerVM.bIsActive Then Return + ' If Map.refShowBeamPanelVM.bShowAll Then + ' View_Part_OnMouseUpScene(sender, e) + ' Else + ' View_Feature_OnMouseUpScene(sender, e) + ' End If + ' End If + ' Case Pages.MACHINING + ' If Not IsNothing(Map.refMachGroupPanelVM) AndAlso Not IsNothing(Map.refMachGroupPanelVM.SelectedMachGroup) Then + ' Dim SelectedMachGroup As MyMachGroupVM = Map.refMachGroupPanelVM.SelectedMachGroup + ' If EgtGetCurrMachGroup() = GDB_ID.NULL Then Return + ' If SelectedMachGroup.nType = BWType.BEAM Then + ' Beam_OnMouseUpScene(sender, e) + ' ElseIf SelectedMachGroup.nType = BWType.WALL Then + ' Wall_OnMouseUpScene(sender, e) + ' End If + ' End If + 'End Select + End Sub + + Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' ' se sto editando testo angoli + ' If Map.refFreeContourManagerVM.bIsModifyingTextAngle Then + ' ' passo testo selezionato + ' Map.refFreeContourManagerVM.TextAngleSelected(nId) + ' End If + ' MainController.MouseSelectedObj(nId, bLast) + 'End If + End Sub + + Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedPart(nId) + 'End If + End Sub + + Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedLayer(nId) + 'End If + End Sub + + Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseSelectedPath(nId, bHaltOnFork) + 'End If + End Sub + + Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.SetPointFromSelection(nId, PtP, nAux) + 'End If + End Sub + + Private Sub OnMouseDone(ByVal sender As Object) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.Done(Map.refFreeContourInputVM.Text) + 'End If + End Sub + + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control + ' MainController.MouseSelectedPoint(PtP, nSep, nId, bDone) + 'End If + End Sub + + Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.SetLastVector3d(VtDir) + 'End If + End Sub + + Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' MainController.MouseMoveInSelectionPoint(PtP) + 'End If + End Sub + + Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) + Map.refMyStatusBarVM.SetOutputMessage(sDistance) + End Sub + + Private Sub OnKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) + '' Se in modalità edit L250 + 'If Map.refMainMenuVM.SelPage = Pages.VIEW AndAlso Not IsNothing(Map.refProjectVM.BTLStructureVM) AndAlso Map.refFreeContourManagerVM.bIsActive Then + ' ' Con DEL eseguo cancellazione delle entità selezionate + ' If e.KeyData = System.Windows.Forms.Keys.Delete Then + ' MainController.SetLastInteger(GDB_ID.SEL) + ' MainController.ExecuteCommand(Controller.CMD.DELETE) + ' ' Con SPAZIO ripeto l'ultimo comando + ' ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then + ' MainController.RepeatLastCommand() + ' ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco + ' ElseIf e.KeyData = System.Windows.Forms.Keys.A And MainController.GetContinue() Then + ' MainController.ContinueArcPDP() + ' ' Con 'L' e in modalità continuazione, forzo il passaggio a retta + ' ElseIf e.KeyData = System.Windows.Forms.Keys.L And MainController.GetContinue() Then + ' MainController.ContinueLine2P() + ' ' Con 'V' cambio lo stato del check + ' ElseIf e.KeyData = System.Windows.Forms.Keys.V Then + ' Map.refFreeContourInputVM.ChangeInputBoxCheck() + ' End If + 'End If + End Sub + + Private Sub OnCloseGetDist(sender As System.Object) + Map.refInstrumentPanelVM.SetGetDistance_IsChecked(False) + End Sub + + Friend Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) + If Not IsNothing(Map.refMyStatusBarVM) Then Map.refMyStatusBarVM.SetSnapPointType(nSpType) + End Sub + +#End Region ' SCENE EVENTS + +#Region "CONTROLLER EVENTS" + + Private Sub OnNewProject(sender As Object, bOk As Boolean) + EgtZoom(ZM.ALL) + If Not bOk Then + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error + End If + MainScene.SetStatusNull() + End Sub + + Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) + EgtZoom(ZM.ALL) + WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + Map.refProjManagerVM.MruFiles.Add(sFile) + Else + Map.refProjManagerVM.MruFiles.Remove(sFile) + Dim sMsg As String + If My.Computer.FileSystem.FileExists(sFile) Then + sMsg = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file + Else + sMsg = EgtMsg(10009) & " '" & sFile & "'" 'Missing file + End If + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error + End If + MainScene.SetStatusNull() + End Sub + + Private Sub OnSavingProject(ByVal sender As Object, sFile As String) + End Sub + + Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + WriteMainPrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + Map.refProjManagerVM.MruFiles.Add(sFile) + Else + Map.refProjManagerVM.MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub + + Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) + If nType <> FT.NULL Then + If nType = FT.CNC Then + nFlag = GetMainPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE) + Else + nFlag = 0 + End If + ' Abilito progress e bottone stop + Map.refMyStatusBarVM.StartLoading("", True) + Else + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error + End If + End Sub + + Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + EgtZoom(ZM.ALL) + ' Disabilito progress e bottone stop + Map.refMyStatusBarVM.EndLoading("") + ' Salvo path + WriteMainPrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile)) + ' Segnalo eventuale errore + If Not bOk Then + Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + MainScene.SetStatusNull() + End Sub + + Private Sub PrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String, + ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) + 'Map.refFreeContourInputVM.PrepareInputBox(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn) + End Sub + + Private Sub SetInputBoxText(ByVal sText As String) + 'Map.refFreeContourInputVM.SetInputBoxText(sText) + End Sub + + Private Sub SetInputBoxCheck(ByVal bCheck As Boolean) + 'Map.refFreeContourInputVM.SetInputBoxCheck(bCheck) + End Sub + + Private Sub AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) + 'Map.refFreeContourInputVM.AddInputBoxCombo(sText, bSelected) + End Sub + + Private Sub UpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) + '' pulisco input e relativi messaggi + 'Map.refFreeContourInputVM.ResetInputBox() + If MainController.GetContinue() Then + Map.refMyStatusBarVM.SetOutputMessage(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc + Else + Map.refMyStatusBarVM.ClearOutputMessage() + End If + End Sub + +#End Region ' CONTROLLER EVENTS + +#Region "Part" + + Friend Sub Basic_OnMouseDownScene(sender As Object, e As Forms.MouseEventArgs) + ' Verifico se selezionato indicativo di pezzo + EgtSetObjFilterForSelWin(True, True, True, True, True) + Dim nSel As Integer + EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL + ' Recupero l'identificativo del pezzo cui appartiene + Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) + Dim bFound As Boolean = False + If EgtIsPart(nPartId) Then bFound = True + If Not bFound Then + nId = EgtGetNextObjInSelWin() + Continue While + End If + Dim nStat As Integer = GDB_ST.ON_ + EgtGetStatus(nPartId, nStat) + ' Se già selezionato + If nStat = GDB_ST.SEL Then + ' Memorizzo Id da deselezionare + m_nIdToDesel = nPartId + Else + ' Memorizzo Id da selezionare + m_nIdToSel = nPartId + End If + Exit While + nId = EgtGetNextObjInSelWin() + End While + ' Dati per drag + m_bDragToStart = True + End Sub + + Friend Sub Basic_OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + ' Se drag non abilitato o già in esecuzione, esco + If Not m_bDragToStart Then Return + ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel + If m_bDragToStart Then + If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And + Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then + Return + End If + m_bDragToStart = False + End If + End Sub + + Friend Sub Basic_OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) + ' Se eseguito drag + If Not m_bDragToStart Then + ' Se selezione da eseguire + ElseIf m_nIdToSel <> GDB_ID.NULL Then + ' Se pezzo da selezionare non è già selezionato + 'If EgtIsSelectedObj(m_nIdToSel) Then + ' Eseguo la selezione + EgtDeselectAll() + EgtSelectPartObjs(m_nIdToSel) + 'EgtSelectObj(m_nIdToSel) + 'EgtSetMark(m_nIdToSel) + 'End If + 'If IsNothing(Map.refProjectVM.BTLStructureVM.SelBTLPart) OrElse Map.refProjectVM.BTLStructureVM.SelBTLPart.nPartId <> m_nIdToSel Then + ' ' Eseguo la selezione + ' For Each BTLPart In Map.refProjectVM.BTLStructureVM.BTLPartVMList + ' If BTLPart.nPartId = m_nIdToSel Then + ' BTLPart.SetIsSelected(True) + ' ElseIf BTLPart.IsSelected Then + ' BTLPart.SetIsSelected(False) + ' End If + ' Next + ' End If + End If + ' Reset + m_bDrag = False + m_nIdToSel = GDB_ID.NULL + m_nIdToDesel = GDB_ID.NULL + EgtDraw() + End Sub + +#End Region ' Part + +End Class diff --git a/3dPrintApp/SceneHost/SceneHostV.xaml b/3dPrintApp/SceneHost/SceneHostV.xaml new file mode 100644 index 0000000..22e5547 --- /dev/null +++ b/3dPrintApp/SceneHost/SceneHostV.xaml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/3dPrintApp/SceneHost/SceneHostV.xaml.vb b/3dPrintApp/SceneHost/SceneHostV.xaml.vb new file mode 100644 index 0000000..259a9a2 --- /dev/null +++ b/3dPrintApp/SceneHost/SceneHostV.xaml.vb @@ -0,0 +1,33 @@ +Imports System.Windows.Interop +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class SceneHostV + + Private m_MySceneHostVM As MySceneHostVM + + Sub New() + ' This call is required by the designer. + InitializeComponent() + ' Assegno al riferimento locale al VM il VM preso dal DataContext + Me.DataContext = New MySceneHostVM + m_MySceneHostVM = DirectCast(Me.DataContext, MySceneHostVM) + m_MySceneHostVM.SetMainScene(MainScene) + End Sub + + Private Sub MainScene_GotFocus() Handles MainScene.GotFocus + m_MySceneHostVM.SetIsFocused(True) + EgtOutLog("MainScene_GotFocus") + ' Map.refSecondaryWindowV.Topmost = True + 'Map.refSecondaryWindowVM.SetVisibility(True) + End Sub + + Private Sub MainScene_LostFocus() Handles MainScene.LostFocus + m_MySceneHostVM.SetIsFocused(False) + EgtOutLog("MainScene_LostFocus") + ' Map.refSecondaryWindowV.Topmost = False + 'Map.refSecondaryWindowVM.SetVisibility(False) + End Sub + +End Class diff --git a/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml b/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml new file mode 100644 index 0000000..d9c5d4b --- /dev/null +++ b/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml.vb b/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml.vb new file mode 100644 index 0000000..47bec95 --- /dev/null +++ b/3dPrintApp/SecondaryWindow/SecondaryWindowV.xaml.vb @@ -0,0 +1,65 @@ +Imports EgtWPFLib5 +Imports EgtUILib + +Public Class SecondaryWindowV + + Private m_SecondaryWindowVM As SecondaryWindowVM + +#Region "CONSTRUCTOR" + + Sub New(Owner As Window) + ' Funzione che interpreta l'xaml + InitializeComponent() + m_SecondaryWindowVM = New SecondaryWindowVM + Me.DataContext = m_SecondaryWindowVM + Map.SetRefSecondaryWindowV(Me) + AddHandler Me.ContentRendered, AddressOf SecondaryWindowV_ContentRendered + AddHandler Me.Loaded, AddressOf SecondaryWindowV_Loaded + AddHandler Me.Closing, AddressOf SecondaryWindowV_Closing + AddHandler Me.LocationChanged, AddressOf SecondaryWindowV_LocationChanged + AddHandler Me.SizeChanged, AddressOf SecondaryWindowV_SizeChanged + AddHandler Me.StateChanged, AddressOf SecondaryWindowV_StateChanged + End Sub + + Private Sub SecondaryWindowV_ContentRendered(sender As Object, e As EventArgs) + m_SecondaryWindowVM.ContentRendered() + End Sub + + Private Sub SecondaryWindowV_Loaded(sender As Object, e As RoutedEventArgs) + ' Carico e imposto posizione finestra + WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me) + End Sub + + Private Sub SecondaryWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) + If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then + e.Cancel = True + Return + End If + ' Salvo posizione finestra (se non minimizzata) + If WindowState <> WindowState.Minimized Then + WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE) + End If + End Sub + + Private Sub SecondaryWindowV_LocationChanged(sender As Object, e As EventArgs) + Application.Current.MainWindow.Top = Me.Top + Application.Current.MainWindow.Left = Me.Left + End Sub + + Private Sub SecondaryWindowV_SizeChanged(sender As Object, e As SizeChangedEventArgs) + If Not IsNothing(Application.Current.MainWindow) Then + If e.WidthChanged Then Application.Current.MainWindow.Width = e.NewSize.Width + If e.HeightChanged Then Application.Current.MainWindow.Height = e.NewSize.Height + Application.Current.MainWindow.InvalidateVisual() + End If + End Sub + + Private Sub SecondaryWindowV_StateChanged(sender As Object, e As EventArgs) + Application.Current.MainWindow.WindowState = Me.WindowState + Application.Current.MainWindow.Topmost = True + Application.Current.MainWindow.Topmost = False + End Sub + +#End Region ' CONSTRUCTOR + +End Class diff --git a/3dPrintApp/SecondaryWindow/SecondaryWindowVM.vb b/3dPrintApp/SecondaryWindow/SecondaryWindowVM.vb new file mode 100644 index 0000000..a3eda04 --- /dev/null +++ b/3dPrintApp/SecondaryWindow/SecondaryWindowVM.vb @@ -0,0 +1,71 @@ +Imports EgtWPFLib5 +Imports EgtUILib + +Public Class SecondaryWindowVM + Inherits VMBase + + Private m_Visibility As Boolean + Public Property Visibility As Visibility + Get + Return If(m_Visibility, Visibility.Visible, Visibility.Collapsed) + End Get + Set(value As Visibility) + m_Visibility = (value = Visibility.Visible) + End Set + End Property + + Friend Sub SetVisibility(bValue As Boolean) + If bValue <> m_Visibility Then + m_Visibility = bValue + NotifyPropertyChanged(NameOf(Visibility)) + End If + End Sub + + ' definizione comandi + Private m_cmdAboutBox As ICommand + Private m_cmdCloseApplication As ICommand + +#Region "CONSTRUCTOR" + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefSecondaryWindowVM(Me) + End Sub + +#End Region ' CONSTRUCTOR + + Friend Sub ContentRendered() + ' Seleziono la macchina impostata nel file ini + Map.refMachinePanelVM.LoadCurrentMachine() + ' imposto SnapPoint + Map.refMyStatusBarVM.SetSnapPointType(Map.refSceneHostVM.SnapType) + Map.refMyStatusBarVM.SetMeasureUnit(EgtUiUnitsAreMM) + EgtSetView(VT.ISO_SW, False) + ' creo nuovo progetto di partenza + Map.refProjManagerVM.NewProject() + End Sub + +#Region "COMMANDS" + +#Region "CloseApplicationCommand" + + ' Returns a command that manage the MainWindow_Unloaded command + Public ReadOnly Property CloseApplicationCommand() As ICommand + Get + If m_cmdCloseApplication Is Nothing Then + m_cmdCloseApplication = New Command(AddressOf CloseApplication) + End If + Return m_cmdCloseApplication + End Get + End Property + + ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. + Public Sub CloseApplication(ByVal param As Object) + Map.refMainWindowVM.CloseApplication() + End Sub + +#End Region ' CloseApplicationCommand + +#End Region ' COMMANDS + +End Class diff --git a/3dPrintApp/ShowPanel/ShowPanelV.xaml b/3dPrintApp/ShowPanel/ShowPanelV.xaml new file mode 100644 index 0000000..73a49e0 --- /dev/null +++ b/3dPrintApp/ShowPanel/ShowPanelV.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/ShowPanel/ShowPanelV.xaml.vb b/3dPrintApp/ShowPanel/ShowPanelV.xaml.vb new file mode 100644 index 0000000..9840677 --- /dev/null +++ b/3dPrintApp/ShowPanel/ShowPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class ShowPanelV + +End Class diff --git a/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml b/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml new file mode 100644 index 0000000..7cffe68 --- /dev/null +++ b/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml.vb b/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml.vb new file mode 100644 index 0000000..f216a8c --- /dev/null +++ b/3dPrintApp/Special-3dPrinting/Printing3DPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class Printing3DPanelV + +End Class diff --git a/3dPrintApp/Special-3dPrinting/Printing3DPanelVM.vb b/3dPrintApp/Special-3dPrinting/Printing3DPanelVM.vb new file mode 100644 index 0000000..08b72d6 --- /dev/null +++ b/3dPrintApp/Special-3dPrinting/Printing3DPanelVM.vb @@ -0,0 +1,108 @@ +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class Printing3DPanelVM + + Private m_ButtonList As New List(Of ButtonItem) + Public ReadOnly Property ButtonList As List(Of ButtonItem) + Get + Return m_ButtonList + End Get + End Property + + Sub New() + ' Inizializzo i bottoni leggendoli da file ini + Dim BtnIndex As Integer = 1 + Dim CurrBtn As ButtonItem = Nothing + While GetPrivateProfileButton(S_PRINTING3D, K_BUTTON & BtnIndex, Map.refMainWindowVM.MainWindowM.s3dPrintingDir, CurrBtn) + m_ButtonList.Add(CurrBtn) + BtnIndex += 1 + End While + End Sub + +End Class + +Public Class ButtonItem + Inherits VMBase + + Private m_sImagePath As String + Public ReadOnly Property ImagePath As String + Get + Return m_sImagePath + End Get + End Property + Private m_sLuaCmdPath As String + Private m_sToolTip As String + Public ReadOnly Property ToolTip As String + Get + Return m_sToolTip + End Get + End Property + Private m_nDrawMachOrBoth As Integer + Public ReadOnly Property nDrawMachOrBoth As Integer + Get + Return m_nDrawMachOrBoth + End Get + End Property + Friend m_Btn_Visibility As Visibility + Public ReadOnly Property Btn_Visibility As Visibility + Get + Return m_Btn_Visibility + End Get + End Property + + Friend m_Btn_IsEnabled As Boolean = True + Public ReadOnly Property Btn_IsEnabled As Boolean + Get + Return m_Btn_IsEnabled + End Get + End Property + + ' Definizione comandi + Private m_cmdLuaExec As ICommand + + Sub New(sLuaCmdPath As String, sImagePath As String, sToolTip As String, sDrawMachOrBoth As String) + If File.Exists(sImagePath) Then + m_sImagePath = sImagePath + Else + m_sImagePath = Map.refMainWindowVM.MainWindowM.sResourcesRoot & "\" & sImagePath + End If + m_sLuaCmdPath = sLuaCmdPath + m_sToolTip = sToolTip + If Not Integer.TryParse(sDrawMachOrBoth, m_nDrawMachOrBoth) Then m_nDrawMachOrBoth = 0 + End Sub + +#Region "COMMANDS" + +#Region "LuaExecCommand" + + ''' + ''' Returns a command that do New. + ''' + Public ReadOnly Property LuaExecCommand As ICommand + Get + If m_cmdLuaExec Is Nothing Then + m_cmdLuaExec = New Command(AddressOf LuaExec) + End If + Return m_cmdLuaExec + End Get + End Property + + ''' + ''' Execute the New. This method is invoked by the NewCommand. + ''' + Public Sub LuaExec(ByVal param As Object) + If String.IsNullOrWhiteSpace(m_sLuaCmdPath) Then Return + If Not File.Exists(m_sLuaCmdPath) Then Return + If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return + ' eseguo file Lua + Map.refSceneHostVM.PreExecScript(False) + Map.refSceneHostVM.ExecScript(m_sLuaCmdPath) + End Sub + +#End Region ' LuaExecCommand + +#End Region ' Commands + +End Class \ No newline at end of file diff --git a/3dPrintApp/Special-3dPrinting/Printing3DUtility.vb b/3dPrintApp/Special-3dPrinting/Printing3DUtility.vb new file mode 100644 index 0000000..bb3bd08 --- /dev/null +++ b/3dPrintApp/Special-3dPrinting/Printing3DUtility.vb @@ -0,0 +1,26 @@ +Imports EgtWPFLib5 + +Module Printing3DUtility + + Public Function GetPrivateProfileButton(sSection As String, sKey As String, sBaseDir As String, ByRef ReadedButtonItem As ButtonItem) As Boolean + ReadedButtonItem = Nothing + Dim sVal As String = String.Empty + GetmainPrivateProfileString(sSection, sKey, "", sVal) + If String.IsNullOrWhiteSpace(sVal) Then Return False + Dim sItems() As String = sVal.Split(",".ToCharArray) + If sItems.Count() >= 1 Then + Dim sLuaPath As String = sItems(0) + Dim sImagePath As String = If(sItems.Count() >= 2, sItems(1), "") + Dim sToolTip As String = If(sItems.Count() >= 3, sItems(2), "") + Dim sDrawMachOrBoth As String = If(sItems.Count() >= 4 AndAlso Not String.IsNullOrWhiteSpace(sItems(3)), sItems(3), "1") + If Not String.IsNullOrWhiteSpace(sBaseDir) And Not String.IsNullOrWhiteSpace(sLuaPath) Then + If sLuaPath.Contains(".lua") Then sLuaPath = sBaseDir & "\" & sLuaPath + If Not String.IsNullOrWhiteSpace(sImagePath) Then sImagePath = sBaseDir & "\" & sImagePath + End If + ReadedButtonItem = New ButtonItem(sLuaPath, sImagePath, sToolTip, sDrawMachOrBoth) + Return True + End If + Return False + End Function + +End Module diff --git a/3dPrintApp/StatusBar/MyStatusBarVM.vb b/3dPrintApp/StatusBar/MyStatusBarVM.vb new file mode 100644 index 0000000..4524b04 --- /dev/null +++ b/3dPrintApp/StatusBar/MyStatusBarVM.vb @@ -0,0 +1,142 @@ +Imports System.Runtime.InteropServices +Imports System.Threading +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MyStatusBarVM + Inherits EgtWPFLib5.StatusBarVM + + ' Funzioni di callback per output in interfaccia da LUA + Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) + Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) + + Private m_bStopProgress As Boolean + Friend ReadOnly Property bStopProgress As Boolean + Get + Return m_bStopProgress + End Get + End Property + + 'Public ReadOnly Property CurrMachine As String + ' Get + ' Return If(Not IsNothing(Map.refMachinePanelVM.SelectedMachine), Map.refMachinePanelVM.SelectedMachine.Name, "") + ' End Get + 'End Property + + ' Definizione comandi + Private m_cmdStopProgress As ICommand + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefMyStatusBarVM(Me) + ' Installo funzione gestione eventi per lua + EgtSetProcessEvents(m_ProcEventsCallback) + ' Installo funzione output testo su status per lua + EgtSetOutText(m_OutTextCallback) + End Sub + + Friend Overloads Sub SetSnapPointType(sSnapPntType As SP) + Dim BtnColor As Brush + BtnColor = New SolidColorBrush(SystemColors.ControlColor) + Select Case sSnapPntType + Case SP.PT_SKETCH + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point + Case SP.PT_GRID + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point + Case SP.PT_END + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point + Case SP.PT_MID + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point + Case SP.CENTER + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center + Case SP.CENTROID + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid + Case SP.PT_NEAR + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point + Case SP.PT_INTERS + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point + Case SP.PT_TANGENT + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point + Case SP.PT_PERPENDICULAR + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point + Case SP.PT_MINDIST + Map.refMyStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point + Case Else + Map.refMyStatusBarVM.SetSnapPointType("---", BtnColor) + End Select + End Sub + + Friend Sub ResetStopProgress() + m_bStopProgress = False + End Sub + + Public Function OutText(ByRef psText As IntPtr) As Boolean + ' Assegno stringa + OutputMessage = (Marshal.PtrToStringUni(psText)) + ' Costringo ad aggiornare + UpdateUI() + Return True + End Function + + Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer + ' Se previsto, imposto progress + If nProg > 0 Then SetLoadingProgress(Math.Min(nProg, 100)) + ' Costringo ad aggiornare + UpdateUI() + ' Eventuale attesa + Thread.Sleep(nPause) + ' Ritorno eventuale stop + If m_bStopProgress Then + m_bStopProgress = False + Return 1 + Else + Return 0 + End If + End Function + + Friend Sub StartLoading(sMessage As String, bIsStop As Boolean) + Map.refMyStatusBarVM.SetLoadingProgress_Visibility(True) + Map.refMyStatusBarVM.SetStopProgress_IsActive(bIsStop) + Map.refMyStatusBarVM.SetStopProgress_IsEnabled(bIsStop) + Map.refMyStatusBarVM.SetOutputMessage(sMessage) + End Sub + + Friend Sub EndLoading(sMessage As String, Optional nMessageTime As Integer = 3) + Map.refMyStatusBarVM.SetLoadingProgress_Visibility(False) + Map.refMyStatusBarVM.SetStopProgress_IsActive(False) + Map.refMyStatusBarVM.SetStopProgress_IsEnabled(False) + Map.refMyStatusBarVM.SetOutputMessage(sMessage, nMessageTime) + End Sub + + Friend Sub RefreshMachName() + ' NotifyPropertyChanged(NameOf(CurrMachine)) + End Sub + +#Region "COMMANDS" + +#Region "StopProgress" + + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property StopProgress_Command As ICommand + Get + If m_cmdStopProgress Is Nothing Then + m_cmdStopProgress = New Command(AddressOf StopProgress) + End If + Return m_cmdStopProgress + End Get + End Property + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub StopProgress() + m_bStopProgress = True + End Sub + +#End Region ' StopProgress + +#End Region ' COMMANDS + +End Class diff --git a/3dPrintApp/StatusBar/StatusBarV.xaml b/3dPrintApp/StatusBar/StatusBarV.xaml new file mode 100644 index 0000000..a6a1bf3 --- /dev/null +++ b/3dPrintApp/StatusBar/StatusBarV.xaml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/ViewPanel/ViewPanelV.xaml.vb b/3dPrintApp/ViewPanel/ViewPanelV.xaml.vb new file mode 100644 index 0000000..d9dd0b2 --- /dev/null +++ b/3dPrintApp/ViewPanel/ViewPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class ViewPanelV + +End Class diff --git a/3dPrintApp/ViewPanel/ViewPanelVM.vb b/3dPrintApp/ViewPanel/ViewPanelVM.vb new file mode 100644 index 0000000..7f7c3d1 --- /dev/null +++ b/3dPrintApp/ViewPanel/ViewPanelVM.vb @@ -0,0 +1,231 @@ +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class ViewPanelVM + Inherits vmbase + +#Region "FIELDS & PROPERTIES" + + ' Definizione comandi + Private m_cmdZoomAll As ICommand + Private m_cmdTopView As ICommand + Private m_cmdFrontView As ICommand + Private m_cmdLeftView As ICommand + Private m_cmdBackView As ICommand + Private m_cmdRightView As ICommand + Private m_cmdIsoViewSW As ICommand + +#Region "ToolTip" + + Public ReadOnly Property ZoomAllToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 4) + End Get + End Property + + Public ReadOnly Property LookFromTopToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 7) + End Get + End Property + + Public ReadOnly Property LookFromFrontToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 8) + End Get + End Property + + Public ReadOnly Property LookFromLeftToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 9) + End Get + End Property + + Public ReadOnly Property LookFromBackToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 10) + End Get + End Property + + Public ReadOnly Property LookFromRightToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 11) + End Get + End Property + + Public ReadOnly Property LookFromIso_SWToolTip As String + Get + Return EgtMsg(MSG_GRIDVIEWPANEL + 12) + End Get + End Property + +#End Region ' ToolTip + +#End Region ' FIELDS & PROPERTIES + +#Region "COMMANDS" + +#Region "ZoomAllCommand" + + ''' + ''' Returns a command that do ZoomAll. + ''' + Public ReadOnly Property ZoomAllCommand As ICommand + Get + If m_cmdZoomAll Is Nothing Then + m_cmdZoomAll = New Command(AddressOf ZoomAll) + End If + Return m_cmdZoomAll + End Get + End Property + + ''' + ''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand. + ''' + Public Sub ZoomAll(ByVal param As Object) + Map.refSceneHostVM.MainScene.ZoomAll() + End Sub + +#End Region ' ZoomAllCommand + +#Region "TopViewCommand" + + ''' + ''' Returns a command that do TopView. + ''' + Public ReadOnly Property TopViewCommand As ICommand + Get + If m_cmdTopView Is Nothing Then + m_cmdTopView = New Command(AddressOf TopView) + End If + Return m_cmdTopView + End Get + End Property + + ''' + ''' Execute the TopView. This method is invoked by the TopViewCommand. + ''' + Public Sub TopView(ByVal param As Object) + Map.refSceneHostVM.MainScene.TopView() + End Sub + +#End Region ' TopViewCommand + +#Region "FrontViewCommand" + + ''' + ''' Returns a command that do FrontView. + ''' + Public ReadOnly Property FrontViewCommand As ICommand + Get + If m_cmdFrontView Is Nothing Then + m_cmdFrontView = New Command(AddressOf FrontView) + End If + Return m_cmdFrontView + End Get + End Property + + ''' + ''' Execute the FrontView. This method is invoked by the FrontViewCommand. + ''' + Public Sub FrontView(ByVal param As Object) + Map.refSceneHostVM.MainScene.FrontView() + End Sub + +#End Region ' FrontViewCommand + +#Region "LeftViewCommand" + + ''' + ''' Returns a command that do LeftView. + ''' + Public ReadOnly Property LeftViewCommand As ICommand + Get + If m_cmdLeftView Is Nothing Then + m_cmdLeftView = New Command(AddressOf LeftView) + End If + Return m_cmdLeftView + End Get + End Property + + ''' + ''' Execute the LeftView. This method is invoked by the LeftViewCommand. + ''' + Public Sub LeftView(ByVal param As Object) + Map.refSceneHostVM.MainScene.LeftView() + End Sub + +#End Region ' LeftViewCommand + +#Region "BackViewCommand" + + ''' + ''' Returns a command that do BackView. + ''' + Public ReadOnly Property BackViewCommand As ICommand + Get + If m_cmdBackView Is Nothing Then + m_cmdBackView = New Command(AddressOf BackView) + End If + Return m_cmdBackView + End Get + End Property + + ''' + ''' Execute the BackView. This method is invoked by the BackViewCommand. + ''' + Public Sub BackView(ByVal param As Object) + Map.refSceneHostVM.MainScene.BackView() + End Sub + +#End Region ' BackViewCommand + +#Region "RightViewCommand" + + ''' + ''' Returns a command that do RightView. + ''' + Public ReadOnly Property RightViewCommand As ICommand + Get + If m_cmdRightView Is Nothing Then + m_cmdRightView = New Command(AddressOf RightView) + End If + Return m_cmdRightView + End Get + End Property + + ''' + ''' Execute the RightView. This method is invoked by the RightViewCommand. + ''' + Public Sub RightView(ByVal param As Object) + Map.refSceneHostVM.MainScene.RightView() + End Sub + +#End Region ' RightViewCommand + +#Region "IsoViewSWCommand" + + ''' + ''' Returns a command that do IsoViewSW. + ''' + Public ReadOnly Property IsoViewSWCommand As ICommand + Get + If m_cmdIsoViewSW Is Nothing Then + m_cmdIsoViewSW = New Command(AddressOf IsoViewSW) + End If + Return m_cmdIsoViewSW + End Get + End Property + + ''' + ''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand. + ''' + Public Sub IsoViewSW(ByVal param As Object) + Map.refSceneHostVM.MainScene.IsoViewSW() + End Sub + +#End Region ' IsoViewSWCommand + +#End Region ' COMMANDS + +End Class \ No newline at end of file diff --git a/3dPrintApp/packages.config b/3dPrintApp/packages.config new file mode 100644 index 0000000..fdc9817 --- /dev/null +++ b/3dPrintApp/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file