From cbe9efacbbeb67079e684bb4d2cc3fbe91e92d66 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Fri, 9 Sep 2022 21:06:35 +0200 Subject: [PATCH] - introdotta simulazione - migliorato SliceManager - introdotto calcolo tempo e massa materiale --- Icarus/Constants/Const3dPrint.vb | 2 + Icarus/Constants/ConstMachIni.vb | 4 + Icarus/Icarus.vbproj | 26 ++ Icarus/Resources/SimulTab/Pause.png | Bin 0 -> 394 bytes Icarus/Resources/SimulTab/Play.png | Bin 0 -> 549 bytes Icarus/Resources/SimulationPanel/HeadMode.png | Bin 0 -> 1153 bytes Icarus/Resources/SimulationPanel/MachMode.png | Bin 0 -> 1305 bytes Icarus/Resources/SimulationPanel/Pause.png | Bin 0 -> 394 bytes Icarus/Resources/SimulationPanel/Play.png | Bin 0 -> 549 bytes Icarus/Resources/SimulationPanel/PlayStep.png | Bin 0 -> 550 bytes Icarus/Resources/SimulationPanel/Stop.png | Bin 0 -> 412 bytes Icarus/Resources/SimulationPanel/ToolMode.png | Bin 0 -> 1026 bytes Icarus/RightPanel/RightPanelV.xaml | 3 + Icarus/RightPanel/RightPanelVM.vb | 17 + Icarus/SimulationPanel/MachineAxis.vb | 116 ++++++ Icarus/SimulationPanel/MyEstimations.vb | 97 +++++ Icarus/SimulationPanel/MySimulation.vb | 111 ++++++ Icarus/SimulationPanel/SimulationPanelV.xaml | 128 +++++++ .../SimulationPanel/SimulationPanelV.xaml.vb | 3 + Icarus/SimulationPanel/SimulationPanelVM.vb | 358 ++++++++++++++++++ Icarus/SliceManager/SliceManagerV.xaml | 53 +-- Icarus/SliceManager/SliceManagerVM.vb | 253 +++++++++---- Icarus/TSFEditor/TFSEditorVM.vb | 38 +- Icarus/Utility/CurrentMachine.vb | 16 +- Icarus/Utility/Dictionary.xaml | 1 + Icarus/Utility/LuaExec.vb | 15 +- Icarus/Utility/Map.vb | 12 + 27 files changed, 1108 insertions(+), 145 deletions(-) create mode 100644 Icarus/Resources/SimulTab/Pause.png create mode 100644 Icarus/Resources/SimulTab/Play.png create mode 100644 Icarus/Resources/SimulationPanel/HeadMode.png create mode 100644 Icarus/Resources/SimulationPanel/MachMode.png create mode 100644 Icarus/Resources/SimulationPanel/Pause.png create mode 100644 Icarus/Resources/SimulationPanel/Play.png create mode 100644 Icarus/Resources/SimulationPanel/PlayStep.png create mode 100644 Icarus/Resources/SimulationPanel/Stop.png create mode 100644 Icarus/Resources/SimulationPanel/ToolMode.png create mode 100644 Icarus/SimulationPanel/MachineAxis.vb create mode 100644 Icarus/SimulationPanel/MyEstimations.vb create mode 100644 Icarus/SimulationPanel/MySimulation.vb create mode 100644 Icarus/SimulationPanel/SimulationPanelV.xaml create mode 100644 Icarus/SimulationPanel/SimulationPanelV.xaml.vb create mode 100644 Icarus/SimulationPanel/SimulationPanelVM.vb 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 0000000000000000000000000000000000000000..f7c517691d915b76f4d06dc501e82669004603e7 GIT binary patch literal 394 zcmeAS@N?(olHy`uVBq!ia0vp^?I6s-1|)5sdx0d_lDyqr82*Fcg1yTp14TFsJR*x3 z82FBWFymBhK53vJdx@v7EBk#;Az@PspZD|Z7#JAEJzX3_DsH{KZOD7TfXDTqg;x6_ z?p=$tyX2W>UQ(UOeh7fHbf>#0Y?3M|q5 if#f5w<_4hOW~(s>@^fBY=M)7DH3m;tKbLh*2~7YNSa^g0 literal 0 HcmV?d00001 diff --git a/Icarus/Resources/SimulTab/Play.png b/Icarus/Resources/SimulTab/Play.png new file mode 100644 index 0000000000000000000000000000000000000000..322e67eb2879211399599168af01ef0974860cc8 GIT binary patch literal 549 zcmeAS@N?(olHy`uVBq!ia0vp^?I6s-1|)5sdx0d_lDyqr82*Fcg1yTp14TFsJR*x3 z82FBWFymBhK53vJdx@v7EBk#;Az?FK!$Qt`3=E8$JY5_^DsH{KyOFoaL8Kw^{Eh6K zIR|Y^cx3#JU9g?g*!F_ue3WyNQ;1&w`}dj_`)o8GXb5hc&=wWNbWqWPrTu|`Op|i~ z2Op55g34uS2g(K}XaA0CbCE7PBHZluYD8Pvj zb!482CWxn;y#JnhZffVk24*gc1rWkH6qyGTpYk?8sK9}dU8La8($ksyEnWVfsGC>N zGgHLZzWa0Q;kV3u8V?$nunC|xBEQ!QbNe=?##~2t~P-%JDFrM`Q^QrmzN~~VvnZ|gcKkI z2mwNX5Fi8y0YZQfAOr{jLj6=|^#_QExMd{yUqf&QO|l!nPp1y^gi*+Oz#Sy3o~k_} z@=NQCk(4}PFztAPJ#aG^Cmj@#&AJ~(mH=$n(vc+$rj>R4V&x$bftw@RO*n1se9Qcf zdPkEv69~mdKU$w1uu$Rj+3N_d?oqGQlIMpstRWwz&!vn zBJxg~OxmhuzdNZ7NnH}0+3R)H#GOU!{-j407HiZ$1YpjpI}4zgKteKy(C>)#R6Q8A z>`273aTju1Lh#JuNF(~~8F0~OJoVXF5(s%XOFKS&6_Itl?e*CWv&2TIcbAA%oVr~A zI@{G_+|n5p*C6V^zmqh6fa_Px0$3A~Z!X9*eTFvYZKS7C2ePNYVibj&tR!QmE_#+7ygxZ zs&uSI>@Q;VOY%s|_YThNjsPeDSoSPsoz8M7%}PSEQjm(DU;!vaI5Ow-`Gbhf(NIzd zT5q(a5VYg&S|8!;5bwGhC9^4N0)nKlkxIu9Hc)R-LEN_6Bvl8kGn@v5Tmr3X3}5JN zMa!m|nLN zbiI*Q$gLG2cOwlK0X);PzL-)l@XsE;IMQJEy)WjgzN8&^&2(jmXt$s%#gbmf8(AIP zcw}1ceoKzwMC7G$sr4Es4zQWF6m%pUgpeFgsuG^!!CHNpL~=TdNohtB)}v0EVkBb= z&XVl&4PL=bkz5AwHmgIJr1oIO^8XLVIS0^sO8{;HxMp!YuJ4=B@`nJPSW)P%3=UqB z#TeDfuaN8qunAyICud$nUN;yN`3T^-E|nm8AHY$4cE|D`)&TrA0+NLkB=!@mLlaYU z1Hdbi3jlTuj2b{b+itXei&3$wI`B6D-s|<0h*YvVk8D<)%ARPF0C=p2BR#&e1GD=C zaG}N-q{#zWs6iI-gfgNJW*-@Swt)26K@}@s0&p6@V68*kc7#wi@kA$ zB1<_Ad^e}^{{(ACxx4gQ%iDPXt0J;u;*SyUVBUYz$t2orNrd=j*P|-syk{L*pGA7q zqwG8v7eI>#pPo82s3I-dxyDh2J)OdzIRk_MAwUQa0)zk|KnM^5ga9ExXe9jsc{#(0 Tfr@|=00000NkvXXu0mjfs?_<> literal 0 HcmV?d00001 diff --git a/Icarus/Resources/SimulationPanel/MachMode.png b/Icarus/Resources/SimulationPanel/MachMode.png new file mode 100644 index 0000000000000000000000000000000000000000..5765f57433728e7f97d442ef6ecc608634d442d4 GIT binary patch literal 1305 zcmV+!1?KvRP)=IhOyiGyI0 zNhX^y`}2!<<3HEhk~CAR1Jk}MmcQzi7rgF5crXJ0C3Z^V+bZhTga55>JSKnbYX5O z0I{SfGXsg+2c1vID??JjB60>Y5;U+pTk$qQciu#3HhWqE~`* zti*PXV;&sQW#I997~>VnKX@+R8%`-E4yL89+B(j2g|6%^B7iF#%+IDwL8UeKkoVh$ zL$Ul4Hjo(mKrxXKH6VJLjFystyOJFrlJR|v7<@)teXf0g><5eIJt_!CLP2ZHEOXn7AA2i1wk_T^oHbM-%3$~y zpQl#)B3GR|%7Tm$J3MBUUyt;@9tqGpm6-Co2;RS?W(Tdgq^twLSqER>Fa9~PLhJd0 zFhTc3ZxxLD7wl8TzPpf#1}*N0;;mHot4bduB!S<5!JP8rlMV8-CGRr~X)b~zd(}@e zMYAueduUPyAKyyZ8`V7&iHO=3qKo`?qKPwv!6cJRGRY*9Omb-QUw{Dsym-kY%<)x< P00000NkvXXu0mjf;#gM{ literal 0 HcmV?d00001 diff --git a/Icarus/Resources/SimulationPanel/Pause.png b/Icarus/Resources/SimulationPanel/Pause.png new file mode 100644 index 0000000000000000000000000000000000000000..f7c517691d915b76f4d06dc501e82669004603e7 GIT binary patch literal 394 zcmeAS@N?(olHy`uVBq!ia0vp^?I6s-1|)5sdx0d_lDyqr82*Fcg1yTp14TFsJR*x3 z82FBWFymBhK53vJdx@v7EBk#;Az@PspZD|Z7#JAEJzX3_DsH{KZOD7TfXDTqg;x6_ z?p=$tyX2W>UQ(UOeh7fHbf>#0Y?3M|q5 if#f5w<_4hOW~(s>@^fBY=M)7DH3m;tKbLh*2~7YNSa^g0 literal 0 HcmV?d00001 diff --git a/Icarus/Resources/SimulationPanel/Play.png b/Icarus/Resources/SimulationPanel/Play.png new file mode 100644 index 0000000000000000000000000000000000000000..322e67eb2879211399599168af01ef0974860cc8 GIT binary patch literal 549 zcmeAS@N?(olHy`uVBq!ia0vp^?I6s-1|)5sdx0d_lDyqr82*Fcg1yTp14TFsJR*x3 z82FBWFymBhK53vJdx@v7EBk#;Az?FK!$Qt`3=E8$JY5_^DsH{KyOFoaL8Kw^{Eh6K zIR|Y^cx3#JU9g?g*!F_ue3WyNQ;1&w`}dj_`)o8GXb5hc&=wWNbWqWPrTu|`Op|i~ z2Op55g34uS2g(K}XaA0CbCE7PBHZluYD8Pvj zb!482CWxn;y#JnhZffVk24*gc1rWkH6qyGTpYk?8sK9}dU8La8($ksyEnWVfsGC>N zGgHLZzWa0Q;kV3u8V?$nunh?GkaPS>ev|wp}ARyD^ z4CHX4at|s3Wli=xyDolWdGwMgL0e|$+_``Lb#U;RV#BA4_Q&qfvJF#cWEQdj6UW|7 zx_)}0N86vU)^{@N-}YbMJ$Ffh%-lMgU*%1qD@{qTqvsvMzFA@D841SBDl zsUiFrO24FgJZN~5+k4wsUZsq$Qb82tZVwc1D4T3wA6co*%_uMyfZGq>J3B`{FDiZz=?K;GapvA-7molnz1R6US4|A09oZn5c7o=kDJX1!IR)k} uf(jlnfRs8GPd&o5!xHKbe46WbF>IZ~&v|cxuK_R|89ZJ6T-G@yGywq9&4n=l literal 0 HcmV?d00001 diff --git a/Icarus/Resources/SimulationPanel/ToolMode.png b/Icarus/Resources/SimulationPanel/ToolMode.png new file mode 100644 index 0000000000000000000000000000000000000000..199aadace6671cdcba0568977f1a03e162f1e0ae GIT binary patch literal 1026 zcmV+d1pWJoP)udfA5`EKUCG!cUlCAgwRMNVy6oh77{DA-B?+$@HhAy#GZvjgr%|( z7J^7f2t|+#rKp*XX=mEL7JV)^6A~8pPTii9oZQ|sH|d<;dCv2m_q}6)vBXNe{Xd^Hr7)RZGwpAcfH%2oX z0k#3>fseonpc5zo*EDwNPrmVALr6^MBybg&1A2kwz$*P+0PX>kW_BuL?=ENaYUoMYNTxq;9NOeq4)0N;UmZ3ASE>-8PxG&ZKOOt(au5W0X5TImR=0%eWI zZH)lbbUy)1nc2R)C?V2>BdK8-FfMh(trMu|^Bz6>8psWVSpM_6F9=F0@yw*gdu5K@ zQp5VZK&VRU^SZi1WpXM=l^#bUdzWmFqIda^jhO8D(ceE#)lh9BD&% zuYKO02$SD{hsh&_RzA{sA(Cel|9c2#X6`-BdjrKg{4ljYt0??*psjkT;!(^Y75UZgxR#YA!Jkm!ygn(7HdTJd=)VFGvs zyb}Z$ls0)tDQ^&N0h^RC#g*nyEYudq1)-6M410k4c`C1&yH|lbz<#NqralgQ)mTF+ z8B_{Bnl~i?T$B<9wDJ`loXQCZRp21-)ZM>iS$@x=W1*~mK-uKiL~1>)>lR=K za3N1cm1Yn(f!n|lWsRQ&V?yVIj!}#5{p#`la5Rxz!!*3K?3SqId@N=C2AwUQa w0)zk|KnM^5ga9Ex2oM5<03kpK5dO9O0G72F!tEu8asU7T07*qoM6N<$f=ffW?*IS* literal 0 HcmV?d00001 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +