diff --git a/Icarus/Constants/Const3dPrint.vb b/Icarus/Constants/Const3dPrint.vb index 5359e83..fc7ea12 100644 --- a/Icarus/Constants/Const3dPrint.vb +++ b/Icarus/Constants/Const3dPrint.vb @@ -1,6 +1,7 @@ Public Module Const3dPrint Public Const TABLE = "Table" + Public Const TABLE_OUTLINE = "TableOutline" Public Const PART = "Part" Public Const ORIGINAL_SOLID = "OriginalSolid" Public Const PRINT_SOLID = "PrintSolid" @@ -31,6 +32,7 @@ Public Const KEY_LENGTH = "Length" Public Const KEY_SPEED = "Speed" Public Const KEY_SLICEID = "SliceId" + Public Const KEY_MASS = "PrintMass" ' parametri Materiali diff --git a/Icarus/Constants/ConstMachIni.vb b/Icarus/Constants/ConstMachIni.vb index ead4012..624bb60 100644 --- a/Icarus/Constants/ConstMachIni.vb +++ b/Icarus/Constants/ConstMachIni.vb @@ -24,6 +24,10 @@ Public Const TS3DATA_FILE As String = "Ts3Data.lua" + Public Const S_MACHINING As String = "Machining" + Public Const K_MACH_INITSCRIPT As String = "InitScript" + Public Const K_MACH_EXITSCRIPT As String = "ExitScript" + ' Public Const S_PRINTING3D As String = "3dPrinting" Public Const K_SPEED_MIN As String = "SpeedMin" Public Const K_SPEED_MAX As String = "SpeedMax" diff --git a/Icarus/Icarus.vbproj b/Icarus/Icarus.vbproj index e4b1545..cd7c403 100644 --- a/Icarus/Icarus.vbproj +++ b/Icarus/Icarus.vbproj @@ -176,6 +176,12 @@ ShowPanelV.xaml + + + + SimulationPanelV.xaml + + SliceManagerV.xaml @@ -319,6 +325,10 @@ MSBuild:Compile Designer + + Designer + XamlIntelliSenseFileGenerator + Designer MSBuild:Compile @@ -512,6 +522,22 @@ + + + + + + + + + + + + + + + + IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\Icarus\IcarusR64.exe diff --git a/Icarus/Resources/SimulTab/Pause.png b/Icarus/Resources/SimulTab/Pause.png new file mode 100644 index 0000000..f7c5176 Binary files /dev/null and b/Icarus/Resources/SimulTab/Pause.png differ diff --git a/Icarus/Resources/SimulTab/Play.png b/Icarus/Resources/SimulTab/Play.png new file mode 100644 index 0000000..322e67e Binary files /dev/null and b/Icarus/Resources/SimulTab/Play.png differ diff --git a/Icarus/Resources/SimulationPanel/HeadMode.png b/Icarus/Resources/SimulationPanel/HeadMode.png new file mode 100644 index 0000000..ff90ba9 Binary files /dev/null and b/Icarus/Resources/SimulationPanel/HeadMode.png differ diff --git a/Icarus/Resources/SimulationPanel/MachMode.png b/Icarus/Resources/SimulationPanel/MachMode.png new file mode 100644 index 0000000..5765f57 Binary files /dev/null and b/Icarus/Resources/SimulationPanel/MachMode.png differ diff --git a/Icarus/Resources/SimulationPanel/Pause.png b/Icarus/Resources/SimulationPanel/Pause.png new file mode 100644 index 0000000..f7c5176 Binary files /dev/null and b/Icarus/Resources/SimulationPanel/Pause.png differ diff --git a/Icarus/Resources/SimulationPanel/Play.png b/Icarus/Resources/SimulationPanel/Play.png new file mode 100644 index 0000000..322e67e Binary files /dev/null and b/Icarus/Resources/SimulationPanel/Play.png differ diff --git a/Icarus/Resources/SimulationPanel/PlayStep.png b/Icarus/Resources/SimulationPanel/PlayStep.png new file mode 100644 index 0000000..60e8c55 Binary files /dev/null and b/Icarus/Resources/SimulationPanel/PlayStep.png differ diff --git a/Icarus/Resources/SimulationPanel/Stop.png b/Icarus/Resources/SimulationPanel/Stop.png new file mode 100644 index 0000000..adecf17 Binary files /dev/null and b/Icarus/Resources/SimulationPanel/Stop.png differ diff --git a/Icarus/Resources/SimulationPanel/ToolMode.png b/Icarus/Resources/SimulationPanel/ToolMode.png new file mode 100644 index 0000000..199aada Binary files /dev/null and b/Icarus/Resources/SimulationPanel/ToolMode.png differ diff --git a/Icarus/RightPanel/RightPanelV.xaml b/Icarus/RightPanel/RightPanelV.xaml index a4c4d29..5692a12 100644 --- a/Icarus/RightPanel/RightPanelV.xaml +++ b/Icarus/RightPanel/RightPanelV.xaml @@ -35,6 +35,9 @@ + + + diff --git a/Icarus/RightPanel/RightPanelVM.vb b/Icarus/RightPanel/RightPanelVM.vb index 72f0eb7..9dad6ef 100644 --- a/Icarus/RightPanel/RightPanelVM.vb +++ b/Icarus/RightPanel/RightPanelVM.vb @@ -14,6 +14,7 @@ Public Class RightPanelVM SHELLNUMBER = 5 AUXSOLIDPARAM = 6 TFSEDITOR = 7 + SIMULATION = 8 End Enum Private m_SelPanel As Panels @@ -27,6 +28,20 @@ Public Class RightPanelVM End Property Friend Sub SetSelPanel(Panel As Panels) If Panel = m_SelPanel Then Return + Select Case m_SelPanel + Case Panels.NULL + + Case Panels.MATERIALDB + + Case Panels.PRINTPARAMDB + + Case Panels.RIBPARAM + + Case Panels.TFSEDITOR + + Case Panels.SIMULATION + Map.refSimulationPanelVM.ExitSimulation() + End Select m_SelPanel = Panel Select Case Panel Case Panels.NULL @@ -40,6 +55,8 @@ Public Class RightPanelVM Case Panels.TFSEDITOR 'Map.refTFSEditorVM.Refresh() + Case Panels.SIMULATION + Map.refSimulationPanelVM.InitSimulation() End Select NotifyPropertyChanged(NameOf(SelPanel)) End Sub diff --git a/Icarus/SimulationPanel/MachineAxis.vb b/Icarus/SimulationPanel/MachineAxis.vb new file mode 100644 index 0000000..02023c7 --- /dev/null +++ b/Icarus/SimulationPanel/MachineAxis.vb @@ -0,0 +1,116 @@ +Imports System.ComponentModel +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MachineAxis + Inherits VMBase + + Private m_IsReadOnlyAxesValue As Boolean + Public Property IsReadOnlyAxesValue As Boolean + Get + Return m_IsReadOnlyAxesValue + End Get + Set(value As Boolean) + If value <> m_IsReadOnlyAxesValue Then + m_IsReadOnlyAxesValue = value + NotifyPropertyChanged("IsReadOnlyAxesValue") + NotifyPropertyChanged("IsEnabledAxesValue") + End If + End Set + End Property + + Public ReadOnly Property IsEnabledAxesValue As Boolean + Get + Return Not m_IsReadOnlyAxesValue + End Get + End Property + + ' Definizione comandi + Private m_cmdManualAxisModify As ICommand + + Private m_Name As String + Public Property Name As String + Get + Return m_Name + End Get + Set(value As String) + m_Name = value + End Set + End Property + + Private m_Token As String + Public Property Token As String + Get + Return m_Token + End Get + Set(value As String) + If value <> m_Token Then + m_Token = value + NotifyPropertyChanged("Token") + End If + End Set + End Property + + Private m_Linear As Boolean + Public WriteOnly Property Linear As Boolean + Set(value As Boolean) + m_Linear = value + End Set + End Property + + Private m_Value As String + Public Property Value As String + Get + Return m_Value + End Get + Set(value As String) + m_Value = value + NotifyPropertyChanged("Value") + End Set + End Property + + Sub New() + IsReadOnlyAxesValue = True + End Sub + +#Region "COMMANDS" + +#Region "ManualAxisModifyCommand" + + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property ManualAxisModifyCommand As ICommand + Get + If m_cmdManualAxisModify Is Nothing Then + m_cmdManualAxisModify = New Command(AddressOf ManualAxisModify) + End If + Return m_cmdManualAxisModify + End Get + End Property + + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub ManualAxisModify(ByVal param As Object) + Dim dVal As Double + If m_Linear Then + StringToLen(m_Value, dVal) + Else + StringToDouble(m_Value, dVal) + End If + EgtSetAxisPos(m_Name, dVal) + EgtGetAxisPos(m_Name, dVal) + If m_Linear Then + Value = LenToString(dVal, 3) + Else + Value = DoubleToString(dVal, 3) + End If + EgtDraw() + End Sub + +#End Region ' ManualAxisModifyCommand + +#End Region + +End Class diff --git a/Icarus/SimulationPanel/MyEstimations.vb b/Icarus/SimulationPanel/MyEstimations.vb new file mode 100644 index 0000000..dd6fc8a --- /dev/null +++ b/Icarus/SimulationPanel/MyEstimations.vb @@ -0,0 +1,97 @@ +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MyEstimations + Inherits EstimationsVM + +#Region "FIELDS & PROPERTIES" + + Private m_Estimation_IsEnabled As Boolean = False + Public Property Estimation_IsEnabled As Boolean + Get + Return m_Estimation_IsEnabled + End Get + Set(value As Boolean) + m_Estimation_IsEnabled = value + NotifyPropertyChanged("Estimation_IsEnabled") + End Set + End Property + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New() + + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Public Overrides Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean + Dim bOk As Boolean = True + ' Recupero e verifico la path del progetto corrente + Dim sCurrFilePath As String = String.Empty + EgtGetCurrFilePath(sCurrFilePath) + If bAskSave Then + If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then + ' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ? + If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then + ' Abbandono + bOk = False + Else + ' Lancio salvataggio + 'OmagOFFICEMap.refSceneHostVM.SaveProject() + EgtGetCurrFilePath(sCurrFilePath) + ' Se non salvato, abbandono + If EgtGetModified() Then bOk = False + End If + End If + Else + If String.IsNullOrEmpty(sCurrFilePath) Then + ' File delle stime non trovato + MessageBox.Show(EgtMsg(MSG_SIMULATION + 18), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning) + bOk = False + End If + End If + ' Creo la path del file di stima e relativo info (con nome gruppo se gestiti) + If Not String.IsNullOrEmpty(sCurrFilePath) Then + sEstFile = Path.ChangeExtension(sCurrFilePath, Nothing) + sInfo = "EgtCAM5 - " & sCurrFilePath + Dim sMGrpName As String = String.Empty + If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then + sEstFile &= "_" & sMGrpName & ".html" + sInfo &= "-" & sMGrpName + Else + sEstFile &= ".html" + End If + End If + Return bOk + End Function + +#Region "Details" + + Public Overrides Sub Details(ByVal param As Object) + '' Determino il nome del file contenente le stime + 'Dim sEstFile As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sTempDir & "\MachProj.html" + 'Dim sInfo As String = "" + ''GetEstimationFileName(False, sEstFile, sInfo) + '' Verifico che il file esista + 'If Not File.Exists(sEstFile) Then + ' ' File delle stime non trovato + ' MessageBox.Show(EgtMsg(MSG_SIMULATION + 15), EgtMsg(MSG_SIMULATION + 14), MessageBoxButton.OK, MessageBoxImage.Warning) + ' Return + 'End If + '' Visualizzazione + 'Dim EstimationsWnd As New EstimationsDetailsWndV(Application.Current.MainWindow, New EstimationsDetailsWndVM(sEstFile, CurrentMachine.sMachIniFile)) + 'EstimationsWnd.ShowDialog() + End Sub + +#End Region ' Details + +#End Region ' METHODS + +End Class diff --git a/Icarus/SimulationPanel/MySimulation.vb b/Icarus/SimulationPanel/MySimulation.vb new file mode 100644 index 0000000..7308161 --- /dev/null +++ b/Icarus/SimulationPanel/MySimulation.vb @@ -0,0 +1,111 @@ +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MySimulation + Inherits SimulationVM + +#Region "FIELDS & PROPERTIES" + + Public Overrides Property SliderValue As Double + Get + Return m_SliderValue + End Get + Set(value As Double) + If Math.Abs(value - m_SliderValue) > EPS_SMALL Then + m_SliderValue = value + EgtSimSetStep(m_SliderValue * GetSliderX()) + NotifyPropertyChanged("SliderValue") + End If + End Set + End Property + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTOR" + + Sub New() + SetPlayImagePath("/Resources/SimulTab/Play.png") + SetPauseImagePath("/Resources/SimulTab/Pause.png") + SetPauseMsg(EgtMsg(90561)) ' Pausa + SetStopMsg(EgtMsg(90562)) ' Simulazione interrotta + SetHomeMsg(EgtMsg(90564)) ' Home + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Public Overrides Sub ExecSim() + EgtSimStart(False) + EgtSimSetStep(SliderValue * GetSliderX()) + Dim nShowDataCounter As Integer = 0 + While GetStatus() <> MCH_SIM_ST.UI_STOP + ' Se simulazione in svolgimento + If GetStatus() = MCH_SIM_ST.UI_PLAY Or GetStatus() = MCH_SIM_ST.UI_STEP Then + ' Eseguo movimento + Dim nMove As Integer + Dim bMove As Boolean = EgtSimMove(nMove) + ' Se arrivato a fine step e sono in step + If bMove Then + If GetStatus() = MCH_SIM_ST.UI_STEP And nMove = MCH_SIM.END_STEP Then + ' Imposto stato Pausa + SetSimulationStatus(MCH_SIM_ST.UI_PAUSE) + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 11) ' Pausa + ' Aggiornamenti per bottone Play/Pause + SetShowPlay(True) + NotifyPropertyChanged("PlayPauseImage") + End If + ' Se movimento non riuscito + Else + SetSimulationStatus(MCH_SIM_ST.UI_STOP) + ' Aggiornamenti per bottone Play/Pause + SetShowPlay(True) + NotifyPropertyChanged("PlayPauseImage") + Select Case nMove + Case MCH_SIM.END_ + StatusMsg = EgtMsg(MSG_SIMULATIONPAGEUC + 1) 'Simulazione completata + Case MCH_SIM.STOP_ + ' Simulazione fermata dall'utente (non necessita messaggio) + Case MCH_SIM.OUTSTROKE + Dim sInfo As String = String.Empty + EgtGetOutstrokeInfo(sInfo) + MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 2) & " " & sInfo, EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Extracorsa ... + Case MCH_SIM.DIR_ERR + MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 3), EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Direzione utensile irraggiungibile + Case Else + MessageBox.Show(EgtMsg(MSG_SIMULATIONPAGEUC + 4), EgtMsg(MSG_SIMULATIONPAGEUC + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Errore + End Select + End If + ' Aggiorno stato visualizzazione macchina (dipende anche da utensile) + UpdateMachView() + ' Aggiorno visualizzazione + EgtDraw() + ' Aggiorno dati CNC + ShowCncData() + Else + ' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU + System.Threading.Thread.Sleep(1) + End If + ' Costringo ad aggiornare UI + UpdateUI() + End While + End Sub + + Public Overrides Sub OnPostSetSimulationStatus(value As MCH_SIM_ST) + 'If OmagOFFICE.refMainWindowVM.MainWindowM.nUserLevel >= 10 AndAlso + ' (GetStatus() = MCH_SIM_ST.UI_PAUSE OrElse GetStatus() = MCH_SIM_ST.UI_STOP) Then + ' For Index = 0 To MachineAxisList.Count - 1 + ' MachineAxisList(Index).IsReadOnlyAxesValue = False + ' Next + 'Else + ' For Index = 0 To MachineAxisList.Count - 1 + ' MachineAxisList(Index).IsReadOnlyAxesValue = True + ' Next + 'End If + End Sub + +#End Region ' METHODS + +End Class diff --git a/Icarus/SimulationPanel/SimulationPanelV.xaml b/Icarus/SimulationPanel/SimulationPanelV.xaml new file mode 100644 index 0000000..0f07085 --- /dev/null +++ b/Icarus/SimulationPanel/SimulationPanelV.xaml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +