0532c0c486
- gestione ribs completata - nuove funzionalita' introdotte su tabella TFS - correzioni e migliorie varie
251 lines
6.8 KiB
VB.net
251 lines
6.8 KiB
VB.net
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
|
|
Public Class SliceManagerVM
|
|
Inherits VMBase
|
|
|
|
' Funzioni di callback per output in interfaccia da LUA
|
|
Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents)
|
|
|
|
Private m_SliceManagerState As CalcStates
|
|
|
|
Private m_Loading_Value As Integer = 0
|
|
Public Property Loading_Value As Integer
|
|
Get
|
|
Return m_Loading_Value
|
|
End Get
|
|
Set(value As Integer)
|
|
m_Loading_Value = value
|
|
End Set
|
|
End Property
|
|
Private Sub SetLoadingValue(value As Integer)
|
|
m_Loading_Value = value
|
|
NotifyPropertyChanged(NameOf(Loading_Value))
|
|
End Sub
|
|
|
|
Private m_Loading_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property Loading_Visibility As Visibility
|
|
Get
|
|
Return m_Loading_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Loading_Visibility = value
|
|
End Set
|
|
End Property
|
|
Private Sub SetLoadingVisibility(bIsVisible As Boolean)
|
|
m_Loading_Visibility = If(bIsVisible, Visibility.Visible, Visibility.Collapsed)
|
|
NotifyPropertyChanged(NameOf(Loading_Visibility))
|
|
End Sub
|
|
|
|
Private m_SimGen_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property SimGen_Visibility As Visibility
|
|
Get
|
|
Return m_SimGen_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_SimGen_Visibility = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Slice_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property Slice_Visibility As Visibility
|
|
Get
|
|
Return m_Slice_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Slice_Visibility = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SliceExit_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property SliceExit_Visibility As Visibility
|
|
Get
|
|
Return m_SliceExit_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_SliceExit_Visibility = value
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdSlice As ICommand
|
|
Private m_cmdSimulate As ICommand
|
|
Private m_cmdGenerate As ICommand
|
|
Private m_cmdExit As ICommand
|
|
|
|
#Region "CONSTRUCTORS"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in EgtCAM5Map
|
|
Map.SetRefSliceManagerVM(Me)
|
|
' Installo funzione gestione eventi per lua
|
|
EgtSetProcessEvents(m_ProcEventsCallback)
|
|
UpdateState(False)
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTORS
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub UpdateState(bState As Boolean)
|
|
If bState Then
|
|
m_Slice_Visibility = Visibility.Collapsed
|
|
m_SliceExit_Visibility = Visibility.Visible
|
|
m_SimGen_Visibility = Visibility.Visible
|
|
Else
|
|
m_Slice_Visibility = Visibility.Visible
|
|
m_SliceExit_Visibility = Visibility.Hidden
|
|
m_SimGen_Visibility = Visibility.Collapsed
|
|
End If
|
|
NotifyPropertyChanged(NameOf(Slice_Visibility))
|
|
NotifyPropertyChanged(NameOf(SliceExit_Visibility))
|
|
NotifyPropertyChanged(NameOf(SimGen_Visibility))
|
|
End Sub
|
|
|
|
Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer
|
|
' Se previsto, imposto progress
|
|
If nProg > 0 Then SetLoadingValue(Math.Min(nProg, 100))
|
|
'' Notifico a simulazione aggiornamento dati
|
|
'If Not IsNothing(Map.refSimulationExpanderVM) Then
|
|
' ' Uso i valori negativi del primo parametro come flag per la Simulazione
|
|
' Dim nFlag As Integer = If(nProg < 0, -nProg, 0)
|
|
' Map.refSimulationExpanderVM.SimulationExpander_Update_CncData(nFlag)
|
|
'End If
|
|
' Costringo ad aggiornare
|
|
UpdateUI()
|
|
' Eventuale attesa
|
|
Threading.Thread.Sleep(nPause)
|
|
'' Ritorno eventuale stop
|
|
'If m_bStopScript Then
|
|
' m_bStopScript = False
|
|
' Return 1
|
|
'Else
|
|
' Return 0
|
|
'End If
|
|
End Function
|
|
|
|
Friend Sub CalcSlice(bSlice As Boolean, bCalcTFS As Boolean)
|
|
If bCalcTFS Then Map.refTFSEditorVM.UpdateSpeedMinMax()
|
|
' eseguo file Lua
|
|
SetLoadingVisibility(True)
|
|
ExecSlice(bSlice, bCalcTFS)
|
|
SetLoadingVisibility(False)
|
|
Map.refTFSEditorVM.Refresh()
|
|
Map.refTopPanelVM.SelPart.RefreshPrintLayers()
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Slice"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Slice_Command As ICommand
|
|
Get
|
|
If m_cmdSlice Is Nothing Then
|
|
m_cmdSlice = New Command(AddressOf Slice)
|
|
End If
|
|
Return m_cmdSlice
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub Slice()
|
|
If IsNothing(Map.refTopPanelVM.SelPart) Then
|
|
MessageBox.Show("No parts to slice!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If IsNothing(Map.refTopPanelVM.SelMachining) Then
|
|
MessageBox.Show("No print parameters set!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
If Map.refTopPanelVM.SelPage <> Pages.SLICE Then
|
|
|
|
End If
|
|
' eseguo file Lua
|
|
CalcSlice(True, True)
|
|
Map.refTopPanelVM.SelPage = Pages.SLICE
|
|
Map.refSliderManagerVM.SetLayerIndexToMax()
|
|
End Sub
|
|
|
|
#End Region ' Slice
|
|
|
|
#Region "Exit"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Exit_Command As ICommand
|
|
Get
|
|
If m_cmdExit Is Nothing Then
|
|
m_cmdExit = New Command(AddressOf ExitCmd)
|
|
End If
|
|
Return m_cmdExit
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub ExitCmd()
|
|
Map.refTopPanelVM.SelPage = Pages.MODIFY
|
|
End Sub
|
|
|
|
#End Region ' Exit
|
|
|
|
#Region "Simulate"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Simulate_Command As ICommand
|
|
Get
|
|
If m_cmdSimulate Is Nothing Then
|
|
m_cmdSimulate = New Command(AddressOf Simulate)
|
|
End If
|
|
Return m_cmdSimulate
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub Simulate()
|
|
|
|
End Sub
|
|
|
|
#End Region ' Simulate
|
|
|
|
#Region "Generate"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do CPlaneTop.
|
|
''' </summary>
|
|
Public ReadOnly Property Generate_Command As ICommand
|
|
Get
|
|
If m_cmdGenerate Is Nothing Then
|
|
m_cmdGenerate = New Command(AddressOf Generate)
|
|
End If
|
|
Return m_cmdGenerate
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
|
|
''' </summary>
|
|
Public Sub Generate()
|
|
' eseguo file Lua
|
|
ExecGenerate()
|
|
End Sub
|
|
|
|
#End Region ' Generate
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|