diff --git a/3dPrintApp/3dPrintApp.vbproj b/3dPrintApp/3dPrintApp.vbproj index d7c80ad..1954acd 100644 --- a/3dPrintApp/3dPrintApp.vbproj +++ b/3dPrintApp/3dPrintApp.vbproj @@ -78,6 +78,11 @@ MSBuild:Compile Designer + + ChooseReferenceWndV.xaml + + + @@ -87,10 +92,23 @@ + + ControllerInputPanelV.xaml + + CurrLayerSliderV.xaml + + DispositionPanelV.xaml + + + + ImportPanelV.xaml + + + InstrumentPanelV.xaml @@ -103,6 +121,13 @@ MachinePanelV.xaml + + + CurrMachiningPanelV.xaml + + + + ProjectV.xaml @@ -111,6 +136,10 @@ ProjManagerV.xaml + + RightPanelV.xaml + + SceneHostV.xaml @@ -122,11 +151,19 @@ ShowPanelV.xaml + + SliceManagerV.xaml + + Printing3DPanelV.xaml + + StartMachPanelV.xaml + + StatusBarV.xaml @@ -135,11 +172,16 @@ TopPanelV.xaml + + + TFSEditorV.xaml + Dictionary.xaml + @@ -149,10 +191,26 @@ ViewPanelV.xaml + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + Designer MSBuild:Compile + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -165,6 +223,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -189,6 +251,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -201,10 +267,18 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -213,6 +287,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -274,6 +352,8 @@ Settings.Designer.vb + + @@ -327,7 +407,48 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\3dPrintApp\3dPrintAppR64.exe diff --git a/3dPrintApp/ChooseReferenceWnd/ChooseReferenceWndV.xaml b/3dPrintApp/ChooseReferenceWnd/ChooseReferenceWndV.xaml new file mode 100644 index 0000000..2308e70 --- /dev/null +++ b/3dPrintApp/ChooseReferenceWnd/ChooseReferenceWndV.xaml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/StartMachPanel/StartMachPanelV.xaml.vb b/3dPrintApp/StartMachPanel/StartMachPanelV.xaml.vb new file mode 100644 index 0000000..b2a208b --- /dev/null +++ b/3dPrintApp/StartMachPanel/StartMachPanelV.xaml.vb @@ -0,0 +1,3 @@ +Public Class StartMachPanelV + +End Class diff --git a/3dPrintApp/StartMachPanel/StartMachPanelVM.vb b/3dPrintApp/StartMachPanel/StartMachPanelVM.vb new file mode 100644 index 0000000..5f80228 --- /dev/null +++ b/3dPrintApp/StartMachPanel/StartMachPanelVM.vb @@ -0,0 +1,473 @@ +Imports System.Globalization +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class StartMachPanelVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + Public Enum StartMachTypes As Integer + NULL = 0 + POINT = 1 + COMPO = 2 + End Enum + + Private m_nPartId As Integer = GDB_ID.NULL + Private m_nStartMachLayerId As Integer = GDB_ID.NULL + Private m_nStartMachId As Integer = GDB_ID.NULL + + Private m_TypeList() As Boolean = {True, False} + Public ReadOnly Property TypeList As Boolean() + Get + Return m_TypeList + End Get + End Property + + Public Property SelType As StartMachTypes + Get + Dim Index As Integer = m_TypeList.FirstOrDefault(Function(x) x) + Select Case Index + Case -1 + Return StartMachTypes.NULL + Case 0 + Return StartMachTypes.POINT + Case 1 + Return StartMachTypes.COMPO + End Select + End Get + Set(value As StartMachTypes) + m_TypeList(value - 1) = True + End Set + End Property + + Public Property sXPos As String + Get + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Return LenToString(ptReference.x, 1) + End Get + Set(value As String) + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Dim dNewXPos As Double = ptReference.x + StringToLen(value, dNewXPos) + If dNewXPos >= 0 AndAlso dNewXPos <= CurrentMachine.b3Tab.DimX Then + EgtMove(m_nStartMachId, New Point3d(dNewXPos, ptReference.y, ptReference.z) - ptReference) + EgtDraw() + Else + NotifyPropertyChanged(NameOf(sXPos)) + End If + End Set + End Property + + Public Property sYPos As String + Get + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Return LenToString(ptReference.y, 1) + End Get + Set(value As String) + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Dim dNewYPos As Double = ptReference.y + StringToLen(value, dNewYPos) + If dNewYPos >= 0 AndAlso dNewYPos <= CurrentMachine.b3Tab.DimY Then + EgtMove(m_nStartMachId, New Point3d(ptReference.x, dNewYPos, ptReference.z) - ptReference) + EgtDraw() + Else + NotifyPropertyChanged(NameOf(sYPos)) + End If + End Set + End Property + + Public Property sZPos As String + Get + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Return LenToString(ptReference.z, 1) + End Get + Set(value As String) + Dim ptReference As New Point3d + EgtStartPoint(m_nStartMachId, GDB_ID.ROOT, ptReference) + Dim dNewZPos As Double = ptReference.z + StringToLen(value, dNewZPos) + If dNewZPos >= 0 Then + EgtMove(m_nStartMachId, New Point3d(ptReference.x, ptReference.y, dNewZPos) - ptReference) + EgtDraw() + Else + NotifyPropertyChanged(NameOf(sZPos)) + End If + End Set + End Property + + Private m_RotAxes() As Boolean = {False, False, True} + Public Property RotAxes As Boolean() + Get + Return m_RotAxes + End Get + Set(value As Boolean()) + m_RotAxes = value + End Set + End Property + + Public ReadOnly Property vtSelRotAxes As Vector3d + Get + If m_RotAxes(0) Then + Return Vector3d.X_AX + ElseIf m_RotAxes(1) Then + Return Vector3d.Y_AX + ElseIf m_RotAxes(2) Then + Return Vector3d.Z_AX + End If + End Get + End Property + + Private m_sRotAngle As String + Public Property sRotAngle As String + Get + Return m_sRotAngle + End Get + Set(value As String) + Dim dNewAngle As Double = 0 + If Not StringToLen(value, dNewAngle) Then + m_sRotAngle = 0 + NotifyPropertyChanged(NameOf(sRotAngle)) + Return + End If + Dim b3PrintSolid As New BBox3d + EgtGetBBoxGlob(Map.refTopPanelVM.SelPart.nPartId, GDB_BB.STANDARD, b3PrintSolid) + If EgtRotate(Map.refTopPanelVM.SelPart.nPartId, b3PrintSolid.Center, vtSelRotAxes, dNewAngle) Then + EgtDraw() + RefreshPos() + m_sRotAngle = 0 + NotifyPropertyChanged(NameOf(sRotAngle)) + Else + m_sRotAngle = value + End If + End Set + End Property + + Private m_bType_IsChecked As Boolean + Public Property bType_IsChecked As Boolean + Get + Return m_bType_IsChecked + End Get + Set(value As Boolean) + m_bType_IsChecked = value + If value Then + m_bEdit_IsChecked = False + m_bGrid_IsChecked = False + m_bMove_IsChecked = False + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + End If + End Set + End Property + + Private m_bEdit_IsChecked As Boolean + Public Property bEdit_IsChecked As Boolean + Get + Return m_bEdit_IsChecked + End Get + Set(value As Boolean) + m_bEdit_IsChecked = value + If value Then + m_bType_IsChecked = False + m_bGrid_IsChecked = False + m_bMove_IsChecked = False + NotifyPropertyChanged(NameOf(bType_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + End If + End Set + End Property + + Private m_bGrid_IsChecked As Boolean + Public Property bGrid_IsChecked As Boolean + Get + Return m_bGrid_IsChecked + End Get + Set(value As Boolean) + m_bGrid_IsChecked = value + If value Then + m_bType_IsChecked = False + m_bEdit_IsChecked = False + m_bMove_IsChecked = False + NotifyPropertyChanged(NameOf(bType_IsChecked)) + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bMove_IsChecked)) + End If + End Set + End Property + + Private m_bMove_IsChecked As Boolean + Public Property bMove_IsChecked As Boolean + Get + Return m_bMove_IsChecked + End Get + Set(value As Boolean) + m_bMove_IsChecked = value + If value Then + m_bType_IsChecked = False + m_bEdit_IsChecked = False + m_bGrid_IsChecked = False + NotifyPropertyChanged(NameOf(bType_IsChecked)) + NotifyPropertyChanged(NameOf(bEdit_IsChecked)) + NotifyPropertyChanged(NameOf(bGrid_IsChecked)) + End If + End Set + End Property + + ' Definizione comandi + Private m_cmdCPlaneTop As ICommand + Private m_cmdCPlaneFront As ICommand + Private m_cmdCPlaneRight As ICommand + Private m_cmdCPlaneBack As ICommand + Private m_cmdCPlaneLeft As ICommand + Private m_cmdCPlaneBottom As ICommand + Private m_cmdCPlaneView As ICommand + Private m_cmdCPlaneElevation As ICommand + Private m_cmdCPlaneOrigin As ICommand + Private m_cmdCPlaneRotate As ICommand + Private m_cmdCPlane3P As ICommand + Private m_cmdCPlanePerpObj As ICommand + Private m_cmdCPlaneObj As ICommand + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTORS" + + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map + Map.SetRefStartMachPanelVM(Me) + End Sub + +#End Region ' CONSTRUCTORS + +#Region "METHODS" + + Friend Sub Init() + ' recupero dati pezzo selezionato layer ed entita' + m_nPartId = Map.refTopPanelVM.SelPart.nPartId + m_nStartMachLayerId = Map.refTopPanelVM.SelPart.nMachStartLayerId + m_nStartMachId = Map.refTopPanelVM.SelPart.nMachStartId + ' verifico se punto o curva + Dim StartMachType As GDB_TY = EgtGetType(m_nStartMachId) + Select Case StartMachType + Case GDB_TY.GEO_POINT + SelType = StartMachTypes.POINT + Case GDB_TY.CRV_LINE, GDB_TY.CRV_ARC, GDB_TY.CRV_COMPO + SelType = StartMachTypes.COMPO + End Select + NotifyPropertyChanged(NameOf(TypeList)) + ' aggiorno campi di testo posizione + NotifyPropertyChanged(NameOf(sXPos)) + NotifyPropertyChanged(NameOf(sYPos)) + NotifyPropertyChanged(NameOf(sZPos)) + End Sub + + Friend Sub RefreshPos() + NotifyPropertyChanged(NameOf(sXPos)) + NotifyPropertyChanged(NameOf(sYPos)) + NotifyPropertyChanged(NameOf(sZPos)) + End Sub + +#End Region ' METHODS + +#Region "COMMANDS" + +#Region "CPlaneTop" + + ''' + ''' Returns a command that do CPlaneTop. + ''' + Public ReadOnly Property CPlaneTop_Command As ICommand + Get + If m_cmdCPlaneTop Is Nothing Then + m_cmdCPlaneTop = New Command(AddressOf CPlaneTop) + End If + Return m_cmdCPlaneTop + End Get + End Property + + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + Public Sub CPlaneTop(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.TOP) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneTop + +#Region "CPlaneFront" + + ''' + ''' Returns a command that do CPlaneFront. + ''' + Public ReadOnly Property CPlaneFront_Command As ICommand + Get + If m_cmdCPlaneFront Is Nothing Then + m_cmdCPlaneFront = New Command(AddressOf CPlaneFront) + End If + Return m_cmdCPlaneFront + End Get + End Property + + ''' + ''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand. + ''' + Public Sub CPlaneFront(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.FRONT) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneFront + +#Region "CPlaneRight" + + ''' + ''' Returns a command that do CPlaneRight. + ''' + Public ReadOnly Property CPlaneRight_Command As ICommand + Get + If m_cmdCPlaneRight Is Nothing Then + m_cmdCPlaneRight = New Command(AddressOf CPlaneRight) + End If + Return m_cmdCPlaneRight + End Get + End Property + + ''' + ''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand. + ''' + Public Sub CPlaneRight(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.RIGHT) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneRight + +#Region "CPlaneBack" + + ''' + ''' Returns a command that do CPlaneBack. + ''' + Public ReadOnly Property CPlaneBack_Command As ICommand + Get + If m_cmdCPlaneBack Is Nothing Then + m_cmdCPlaneBack = New Command(AddressOf CPlaneBack) + End If + Return m_cmdCPlaneBack + End Get + End Property + + ''' + ''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand. + ''' + Public Sub CPlaneBack(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BACK) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneBack + +#Region "CPlaneLeft" + + ''' + ''' Returns a command that do CPlaneLeft. + ''' + Public ReadOnly Property CPlaneLeft_Command As ICommand + Get + If m_cmdCPlaneLeft Is Nothing Then + m_cmdCPlaneLeft = New Command(AddressOf CPlaneLeft) + End If + Return m_cmdCPlaneLeft + End Get + End Property + + ''' + ''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand. + ''' + Public Sub CPlaneLeft(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.LEFT) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneLeft + +#Region "CPlaneBottom" + + ''' + ''' Returns a command that do CPlaneBottom. + ''' + Public ReadOnly Property CPlaneBottom_Command As ICommand + Get + If m_cmdCPlaneBottom Is Nothing Then + m_cmdCPlaneBottom = New Command(AddressOf CPlaneBottom) + End If + Return m_cmdCPlaneBottom + End Get + End Property + + ''' + ''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand. + ''' + Public Sub CPlaneBottom(ByVal param As Object) + Map.refSceneHostVM.MainController.SetLastInteger(Controller.GRID_TYPE.BOTTOM) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID) + End Sub + +#End Region ' CPlaneBottom + +#Region "CPlaneElevation" + + ''' + ''' Returns a command that do CPlaneElevation. + ''' + Public ReadOnly Property CPlaneElevation_Command As ICommand + Get + If m_cmdCPlaneElevation Is Nothing Then + m_cmdCPlaneElevation = New Command(AddressOf CPlaneElevation) + End If + Return m_cmdCPlaneElevation + End Get + End Property + + ''' + ''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand. + ''' + Public Sub CPlaneElevation(ByVal param As Object) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ELEVATION) + End Sub + +#End Region ' CPlaneElevation + +#Region "CPlaneOrigin" + + ''' + ''' Returns a command that do CPlaneOrigin. + ''' + Public ReadOnly Property CPlaneOrigin_Command As ICommand + Get + If m_cmdCPlaneOrigin Is Nothing Then + m_cmdCPlaneOrigin = New Command(AddressOf CPlaneOrigin) + End If + Return m_cmdCPlaneOrigin + End Get + End Property + + ''' + ''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand. + ''' + Public Sub CPlaneOrigin(ByVal param As Object) + Map.refSceneHostVM.MainController.ExecuteCommand(Controller.CMD.GRID_ORIGIN) + End Sub + +#End Region ' CPlaneOrigin + +#End Region ' COMMANDS + +End Class \ No newline at end of file diff --git a/3dPrintApp/TSFEditor/TFSEditorV.xaml b/3dPrintApp/TSFEditor/TFSEditorV.xaml new file mode 100644 index 0000000..e78c9f5 --- /dev/null +++ b/3dPrintApp/TSFEditor/TFSEditorV.xaml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/TSFEditor/TFSEditorV.xaml.vb b/3dPrintApp/TSFEditor/TFSEditorV.xaml.vb new file mode 100644 index 0000000..b5c1f3c --- /dev/null +++ b/3dPrintApp/TSFEditor/TFSEditorV.xaml.vb @@ -0,0 +1,3 @@ +Public Class TFSEditorV + +End Class diff --git a/3dPrintApp/TSFEditor/TFSEditorVM.vb b/3dPrintApp/TSFEditor/TFSEditorVM.vb new file mode 100644 index 0000000..c4dd797 --- /dev/null +++ b/3dPrintApp/TSFEditor/TFSEditorVM.vb @@ -0,0 +1,174 @@ +Imports System.Collections.ObjectModel +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class TFSEditorVM + Inherits VMBase + +#Region "FIELDS & PROPERTIES" + + Private m_LayerList As New ObservableCollection(Of TFSLayer) + Public ReadOnly Property LayerList As ObservableCollection(Of TFSLayer) + Get + Return m_LayerList + End Get + End Property + + Private m_SelLayer As TFSLayer + Public Property SelLayer As TFSLayer + Get + Return m_SelLayer + End Get + Set(value As TFSLayer) + m_SelLayer = value + End Set + End Property + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTORS" + + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map + Map.SetRefTFSEditorVM(Me) + End Sub + +#End Region ' CONSTRUCTORS + +#Region "METHODS" + + Friend Sub Refresh() + m_LayerList.Clear() + Dim nLayTFSCalcId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, LAY_TFSCALC) + Dim nTFSLayerId As Integer = EgtGetFirstInGroup(nLayTFSCalcId) + While nTFSLayerId <> GDB_ID.NULL + m_LayerList.Add(New TFSLayer(nTFSLayerId)) + nTFSLayerId = EgtGetNext(nTFSLayerId) + End While + End Sub + +#End Region ' METHODS + +End Class + +Public Class TFSLayer + + Private m_nId As Integer + Public ReadOnly Property nId As Integer + Get + Return m_nId + End Get + End Property + + Private m_nIndex As Integer + Public ReadOnly Property nIndex As Integer + Get + Return m_nIndex + End Get + End Property + + Private m_dLength As Double + Public ReadOnly Property dLength As Double + Get + Return LenToString(m_dLength, 2) + End Get + End Property + + Private m_dTMin As Double + Public ReadOnly Property dTMin As Double + Get + Return m_dTMin + End Get + End Property + + Private m_dTTrg As Double + Public ReadOnly Property dTTrg As Double + Get + Return m_dTTrg + End Get + End Property + + Private m_dTMax As Double + Public ReadOnly Property dTMax As Double + Get + Return m_dTMax + End Get + End Property + + Private m_dTCurr As Double + Public ReadOnly Property dTCurr As Double + Get + Return m_dTCurr + End Get + End Property + + Private m_dFMin As Double + Public ReadOnly Property dFMin As Double + Get + Return m_dFMin + End Get + End Property + + Private m_dFTrg As Double + Public ReadOnly Property dFTrg As Double + Get + Return m_dFTrg + End Get + End Property + + Private m_dFMax As Double + Public ReadOnly Property dFMax As Double + Get + Return m_dFMax + End Get + End Property + + Private m_dFCurr As Double + Public Property dFCurr As Double + Get + Return m_dFCurr + End Get + Set(value As Double) + m_dFCurr = value + End Set + End Property + + Private m_dSpeed As Double + Public ReadOnly Property dSpeed As Double + Get + Return m_dSpeed + End Get + End Property + + Sub New(nId As Integer) + Dim sIndex As String = "" + EgtGetName(nId, sIndex) + Integer.TryParse(sIndex, m_nIndex) + EgtGetInfo(nId, KEY_LENGTH, m_dLength) + EgtGetInfo(nId, KEY_TMIN, m_dTMin) + EgtGetInfo(nId, KEY_TTRG, m_dTTrg) + EgtGetInfo(nId, KEY_TMAX, m_dTMax) + EgtGetInfo(nId, KEY_TCUR, m_dTCurr) + EgtGetInfo(nId, KEY_FMIN, m_dFMin) + EgtGetInfo(nId, KEY_FTRG, m_dFTrg) + EgtGetInfo(nId, KEY_FMAX, m_dFMax) + EgtGetInfo(nId, KEY_FCUR, m_dFCurr) + EgtGetInfo(nId, KEY_SPEED, m_dSpeed) + + End Sub + + Sub New(nId As Integer, nIndex As Integer, dLength As Double, dTMin As Double, dTTrg As Double, dTMax As Double, dTCurr As Double, dFMin As Double, dFTrg As Double, dFMax As Double, dFCurr As Double, dSpeed As Double) + m_nId = nId + m_nIndex = nIndex + m_dLength = dLength + m_dTMin = dTMin + m_dTTrg = dTTrg + m_dTMax = dTMax + m_dTCurr = dTCurr + m_dFMin = dFMin + m_dFTrg = dFTrg + m_dFMax = dFMax + m_dFCurr = dFCurr + m_dSpeed = dSpeed + End Sub +End Class \ No newline at end of file diff --git a/3dPrintApp/TopPanel/TopPanelV.xaml b/3dPrintApp/TopPanel/TopPanelV.xaml index 0234b92..7f01c65 100644 --- a/3dPrintApp/TopPanel/TopPanelV.xaml +++ b/3dPrintApp/TopPanel/TopPanelV.xaml @@ -1,19 +1,23 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Height="50"> - - - - + + + + - - + + - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3dPrintApp/TopPanel/TopPanelVM.vb b/3dPrintApp/TopPanel/TopPanelVM.vb index 43953a1..719e0f1 100644 --- a/3dPrintApp/TopPanel/TopPanelVM.vb +++ b/3dPrintApp/TopPanel/TopPanelVM.vb @@ -1,6 +1,580 @@ -Imports EgtWPFLib5 +Imports System.Collections.ObjectModel +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 Public Class TopPanelVM Inherits VMBase +#Region "FIELDS & PROPERTIES" + +#Region "Pages & Modes" + + Private m_SelPage As Integer = -1 + Public Property SelPage As Integer + Get + Return m_SelPage + End Get + Set(value As Integer) + ' lancio selezione pagina con verifica file modificato + SetSelPage(value) + End Set + End Property + ' funzione che permette di cambiare pagina + ' bVerifyModification: se vero verifica modifiche su file e chiede di salvare + Friend Sub SetSelPage(Page As Pages, Optional bVerifyModification As Boolean = True) + Dim bOk As Boolean = True + ' Esco dallo stato corrente + Select Case m_SelPage + Case Pages.IMPORT + bOk = ExitIMPORT() + Case Pages.MODIFY + bOk = ExitMODIFY() + Case Pages.SLICE + bOk = ExitSLICE() + Case Pages.SIMULATION + bOk = ExitSIMULATION() + Case Pages.MATERIALDB + bOk = ExitMATERIALDB() + Case Pages.MACHININGDB + bOk = ExitMACHININGDB() + Case Pages.CURRMACHINING + bOk = ExitCURRMACHINING() + End Select + If bOk Then + ' Entro nel nuovo stato + m_SelPage = Page + Select Case m_SelPage + Case Pages.IMPORT + InitIMPORT() + Case Pages.MODIFY + InitMODIFY() + Case Pages.SLICE + InitSLICE() + Case Pages.SIMULATION + InitSIMULATION() + Case Pages.MATERIALDB + InitMATERIALDB() + Case Pages.MACHININGDB + InitMACHININGDB() + Case Pages.CURRMACHINING + InitCURRMACHINING() + Case Else + InitNULL() + End Select + End If + End Sub + + Private m_ModifyModeList As New List(Of ModifyModeButton)({New ModifyModeButton("Disposition", ModifyModes.DISPOSITION), + New ModifyModeButton("Reference", ModifyModes.REFERENCE), + New ModifyModeButton("StartMachining", ModifyModes.STARTMACH), + New ModifyModeButton("Ribs", ModifyModes.RIBS), + New ModifyModeButton("Shell Number", ModifyModes.SHELLNUMBER), + New ModifyModeButton("Aux Solids", ModifyModes.AUXSOLIDS)}) + Public ReadOnly Property ModifyModeList As List(Of ModifyModeButton) + Get + Return m_ModifyModeList + End Get + End Property + + Private m_SelModifyMode As ModifyModeButton + Public Property SelModifyMode As ModifyModeButton + Get + Return m_SelModifyMode + End Get + Set(value As ModifyModeButton) + m_SelModifyMode = value + Dim SelLeftPanel As LeftPanelVM.Panels = LeftPanelVM.Panels.NULL + Select Case value.ModifyMode + Case ModifyModes.DISPOSITION + SelLeftPanel = LeftPanelVM.Panels.DISPOSITION + Case ModifyModes.REFERENCE + SelLeftPanel = LeftPanelVM.Panels.REFERENCE + Case ModifyModes.STARTMACH + SelLeftPanel = LeftPanelVM.Panels.STARTMACH + Case ModifyModes.RIBS + SelLeftPanel = LeftPanelVM.Panels.RIBS + Case ModifyModes.SHELLNUMBER + SelLeftPanel = LeftPanelVM.Panels.SHELLNUMBER + Case ModifyModes.AUXSOLIDS + SelLeftPanel = LeftPanelVM.Panels.AUXSOLIDS + Case Else + SelLeftPanel = LeftPanelVM.Panels.NULL + End Select + Map.refLeftPanelVM.SetSelPanel(SelLeftPanel) + End Set + End Property + Friend Sub SetSelModifyMode(ModifyMode As ModifyModes) + SelModifyMode = m_ModifyModeList.FirstOrDefault(Function(x) x.ModifyMode = ModifyMode) + NotifyPropertyChanged(NameOf(SelModifyMode)) + End Sub + +#End Region ' Pages + +#Region "Parts Manager" + + 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 + If Not IsNothing(value) Then + ' Eseguo la selezione + EgtDeselectAll() + EgtSelectPartObjs(m_SelPart.nPartId) + EgtDraw() + ' imposto lavorazione del pezzo selezionato + Map.refCurrMachiningPanelVM.ReadMachParamFromSelPart() + SetSelMachining(MachiningList.FirstOrDefault(Function(x) x.sGUID = Map.refCurrMachiningPanelVM.CurrMachining.OrigMachining.sGUID)) + ' notifico posizione pezzo + Map.refDispositionPanelVM.RefreshPos() + End If + End Set + End Property + +#End Region ' Parts Manager + +#Region "Material" + + Private m_MaterialList As New List(Of MaterialIndex) + Public ReadOnly Property MaterialList As List(Of MaterialIndex) + Get + Return m_MaterialList + End Get + End Property + + Private m_SelMaterial As MaterialIndex + Public Property SelMaterial As MaterialIndex + Get + Return m_SelMaterial + End Get + Set(value As MaterialIndex) + m_SelMaterial = value + WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, value.sName) + ' ricarico lista lavorazioni valide per il materiale selezionato + InitMachiningsList() + End Set + End Property + +#End Region ' Material + +#Region "Machining" + + Private m_MachiningList As New ObservableCollection(Of MachiningIndex) + Public ReadOnly Property MachiningList As ObservableCollection(Of MachiningIndex) + Get + Return m_MachiningList + End Get + End Property + + Private m_SelMachining As MachiningIndex + Public Property SelMachining As MachiningIndex + Get + Return m_SelMachining + End Get + Set(value As MachiningIndex) + ' verifico se vecchia modificata e chiedo se salvare?? + + If Not IsNothing(m_SelMachining) Then WriteMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, value.sName) + ' imposto selezionata come corrente + If Not IsNothing(m_SelPart) AndAlso value.sGUID <> m_SelMachining.sGUID Then + Map.refCurrMachiningPanelVM.SetCurrMachining(New CurrMachining(value)) + 'm_CurrMachining.UpdateMachParam() + End If + m_SelMachining = value + '' riporto parametri nel pezzo selezionato + 'WriteMachParamOnSelPart() + ' aggiorno parametri mostrati nella barra + If Not IsNothing(CurrMachining) Then CurrMachining.UpdateMachParam() + End Set + End Property + Friend Sub SetSelMachining(SelMachining As MachiningIndex) + m_SelMachining = SelMachining + NotifyPropertyChanged(NameOf(SelMachining)) + End Sub + + 'Private m_CurrMachining As CurrMachining + Public ReadOnly Property CurrMachining As CurrMachining + Get + Return Map.refCurrMachiningPanelVM.CurrMachining + End Get + End Property + Friend Sub UpdateCurrMachining() + NotifyPropertyChanged(NameOf(CurrMachining)) + End Sub + 'Private Sub SetCurrMachining(CurrMachining As CurrMachining) + ' m_CurrMachining = CurrMachining + ' Map.refCurrMachiningPanelVM.SetCurrMachining(CurrMachining) + 'End Sub + +#End Region ' Machining + + ' Definizione comandi + Private m_cmdMachining As ICommand + Private m_cmdMaterialDb As ICommand + Private m_cmdPrintParamDb As ICommand + +#End Region ' FIELDS & PROPERTIES + +#Region "CONSTRUCTORS" + + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefTopPanelVM(Me) + ' carico lista materiali + InitMaterialList() + ' carico lista parametri di stampa + InitMachiningsList() + End Sub + +#End Region ' CONSTRUCTORS + +#Region "METHODS" + +#Region "Materials" + + Friend Sub InitMaterialList() + Dim nIndex As Integer = 1 + Dim sGUID As String = "" + Dim sName As String = "" + While GetPrivateProfileString(nIndex, MAT_GUID, "", sGUID, Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini") > 0 + ' leggo nome + GetPrivateProfileString(nIndex, MAT_NAME, "", sName, Map.refMainWindowVM.MainWindowM.sMaterialsDir & "/Materials.ini") + MaterialList.Add(New MaterialIndex(nIndex, sGUID, sName)) + nIndex += 1 + End While + Dim sCurrMaterial As String = "" + GetMainPrivateProfileString(S_PRINTING3D, K_CURRMATERIAL, "", sCurrMaterial) + m_SelMaterial = m_MaterialList.FirstOrDefault(Function(x) x.sName = sCurrMaterial) + End Sub + + Friend Function GetSelMaterialData() As Material + Return New Material(m_SelMaterial.nIndex, m_SelMaterial.sGUID, m_SelMaterial.sName) + End Function + +#End Region ' Materials + +#Region "Machining" + + Friend Sub InitMachiningsList() + MachiningList.Clear() + Dim nIndex As Integer = 1 + Dim sGUID As String = "" + Dim sName As String = "" + Dim sMaterials As String = "" + While GetPrivateProfileString(nIndex, MAC_GUID, "", sGUID, Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini") > 0 + GetPrivateProfileString(nIndex, MAC_NAME, "", sName, Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini") + ' leggo materiali che usa + GetPrivateProfileString(nIndex, MAC_MATERIALS, "", sMaterials, Map.refMainWindowVM.MainWindowM.sMachiningsDir & "/Machinings.ini") + Dim MacMaterials() As String = sMaterials.Split(";"c) + If MacMaterials.Contains(SelMaterial.sGUID) Then + MachiningList.Add(New MachiningIndex(nIndex, sGUID, sName)) + End If + nIndex += 1 + End While + Dim sCurrMachining As String = "" + GetMainPrivateProfileString(S_PRINTING3D, K_CURRMACHINING, "", sCurrMachining) + m_SelMachining = MachiningList.FirstOrDefault(Function(x) x.sName = sCurrMachining) + End Sub + + Friend Function GetSelMachining() As Machining + If IsNothing(m_SelMachining) Then Return Nothing + Return New Machining(m_SelMachining.nIndex, m_SelMachining.sGUID, m_SelMachining.sName) + End Function + + + 'Friend Sub WriteMachParamOnSelPart() + ' If IsNothing(m_SelPart) OrElse IsNothing(m_CurrMachining) Then Return + ' m_CurrMachining.WriteMachParamOnPart(m_SelPart.nPartId) + 'End Sub + +#End Region ' Machining + +#Region "Pages" + + Private Sub InitIMPORT() + Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.IMPORT) + Map.refImportPanelVM.Init() + End Sub + + Private Function ExitIMPORT() + Return True + End Function + + Private Sub InitMODIFY() + SetSelModifyMode(ModifyModes.DISPOSITION) + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL) + End Sub + + Private Function ExitMODIFY() + Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.NULL) + Return True + End Function + + Private Sub InitSLICE() + Map.refSliceManagerVM.UpdateState(True) + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.TFSEDITOR) + End Sub + + Private Function ExitSLICE() + Map.refSliceManagerVM.UpdateState(False) + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.NULL) + Return True + End Function + + Private Sub InitSIMULATION() + + End Sub + + Private Function ExitSIMULATION() + + Return True + End Function + + Private Sub InitMATERIALDB() + + End Sub + + Private Function ExitMATERIALDB() + + Return True + End Function + + Private Sub InitMACHININGDB() + End Sub + + Private Function ExitMACHININGDB() + + Return True + End Function + + Private Sub InitCURRMACHINING() + Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB) + End Sub + + Private Function ExitCURRMACHINING() + + Return True + End Function + + Private Sub InitNULL() + Map.refLeftPanelVM.SetSelPanel(LeftPanelVM.Panels.NULL) + End Sub + +#End Region ' Pages + +#Region "Parts Manager" + + 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, ORIGINAL_SOLID) + + '' Recupero o creo layer ausiliario + 'Dim nAuxId As Integer = EgtGetFirstNameInGroup(nPartId, LAY_AUX) + 'If Not nAuxId Then + ' nAuxId = EgtCreateGroup(nPartId) + ' EgtSetName(nAuxId, LAY_AUX) + 'End If + + ' Richiedo posizione origine e offset pezzo + Dim b3Part As New BBox3d + EgtGetBBoxGlob(nPartId, GDB_BB.EXACT, b3Part) + Dim nRefX As Integer = 1 + Dim nRefY As Integer = 1 + Dim dPosX As Double = CurrentMachine.b3Tab.DimX / 2 - b3Part.DimX / 2 + Dim dPosY As Double = CurrentMachine.b3Tab.DimY / 2 - b3Part.DimY / 2 + ' Dim Positions = EgtDialogBox( 'Part position on table:', { 'Reference', 'CB:Left,Center,Right'}, + ' { '', 'CB:Bottom,Middle,Top'}, + ' { 'X', EgtNumToString( EgtToUiUnits( dPosX), 1)}, + ' { 'Y', EgtNumToString( EgtToUiUnits( dPosY), 1)}) + + Dim ChooseReferenceWndVM As New ChooseReferenceWndVM + Dim ChooseReferenceWndV As New ChooseReferenceWndV(Application.Current.MainWindow, ChooseReferenceWndVM) + If Not ChooseReferenceWndV.ShowDialog() Then Return + + Dim gg = ChooseReferenceWndVM.SelReference + '' Aggiungo il box del solido + 'Dim nBoxId As Integer = EgtSurftmb(nAuxId, b3Solid, False, GDB_RT.GLOB) + + '' 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 SelLastPart() + If PartList.Count > 0 Then + SelPart = PartList.LastOrDefault() + NotifyPropertyChanged(NameOf(SelPart)) + End If + End Sub + + Friend Sub SelFirstPart() + If PartList.Count > 0 Then + SelPart = PartList.FirstOrDefault() + NotifyPropertyChanged(NameOf(SelPart)) + End If + End Sub + +#End Region ' Parts Manager + +#End Region ' METHODS + +#Region "COMMANDS" + +#Region "Machining" + + ''' + ''' Returns a command that do CPlaneTop. + ''' + Public ReadOnly Property Machining_Command As ICommand + Get + If m_cmdMachining Is Nothing Then + m_cmdMachining = New Command(AddressOf Machining) + End If + Return m_cmdMachining + End Get + End Property + + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + Public Sub Machining() + SelPage = Pages.CURRMACHINING + End Sub + +#End Region ' Machining + +#Region "PrintParamDb" + + ''' + ''' Returns a command that do CPlaneTop. + ''' + Public ReadOnly Property PrintParamDb_Command As ICommand + Get + If m_cmdPrintParamDb Is Nothing Then + m_cmdPrintParamDb = New Command(AddressOf PrintParamDb) + End If + Return m_cmdPrintParamDb + End Get + End Property + + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + Public Sub PrintParamDb() + 'Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB) + 'Map.refTopPanelVM.SelPage = Pages.SLICE + End Sub + +#End Region ' PrintParamDb + +#Region "MaterialDb" + + ''' + ''' Returns a command that do CPlaneTop. + ''' + Public ReadOnly Property MaterialDb_Command As ICommand + Get + If m_cmdMaterialDb Is Nothing Then + m_cmdMaterialDb = New Command(AddressOf MaterialDb) + End If + Return m_cmdMaterialDb + End Get + End Property + + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + Public Sub MaterialDb() + 'Map.refRightPanelVM.SetSelPanel(RightPanelVM.Panels.PRINTPARAMDB) + 'Map.refTopPanelVM.SelPage = Pages.SLICE + End Sub + +#End Region ' MaterialDb + +#End Region ' COMMANDS + +End Class + +Public Class ModifyModeButton + Inherits VMBase + + Private m_sName As String + Public ReadOnly Property sName As String + Get + Return m_sName + End Get + End Property + + Private m_ModifyMode As ModifyModes + Public ReadOnly Property ModifyMode As ModifyModes + Get + Return m_ModifyMode + End Get + End Property + + Sub New(sName As String, ModifyMode As ModifyModes) + m_sName = sName + m_ModifyMode = ModifyMode + End Sub + End Class diff --git a/3dPrintApp/Utility/Dictionary.xaml b/3dPrintApp/Utility/Dictionary.xaml index 515dfc6..c03dbf5 100644 --- a/3dPrintApp/Utility/Dictionary.xaml +++ b/3dPrintApp/Utility/Dictionary.xaml @@ -24,6 +24,16 @@ + + + + + + + + + + @@ -279,8 +312,8 @@ + + + + @@ -389,9 +455,14 @@ - + + @@ -835,7 +906,50 @@ - + + + + + + + + + + + + + + diff --git a/3dPrintApp/Utility/LuaExec.vb b/3dPrintApp/Utility/LuaExec.vb index 43df526..9b31dec 100644 --- a/3dPrintApp/Utility/LuaExec.vb +++ b/3dPrintApp/Utility/LuaExec.vb @@ -4,206 +4,48 @@ Imports EgtWPFLib5 Module LuaExec - Friend Function ExecBeam(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean) As Boolean - EgtOutLog("-- Start ExecBeam --") - ' Recupero lo script da eseguire - Dim sExecPath As String = "" - Dim sExecName As String = "" - GetMainPrivateProfileString(S_BEAM, K_BEAMBWEEXEC, "", sExecName) - sExecPath = (Map.refMainWindowVM.MainWindowM.sBeamRoot & "\" & sExecName).TrimEnd({"\"c}) + Friend Function ExecSlice(bSlice As Boolean, bCalcTFS As Boolean) As Boolean + EgtOutLog("-- Start ExecSlice --") + ' eseguo slice + If bSlice Then Map.refSceneHostVM.ExecScript(Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\Slicing.lua") + If Not bCalcTFS Then Return True + ' eseguo calcolo T,F,S da parametri materiale + Dim sExecPath As String = Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\LuaLibs\CalcMachParamFromSW.lua" If Not My.Computer.FileSystem.FileExists(sExecPath) Then - EgtOutLog("Not found BeamExec script " & sExecPath) + EgtOutLog("Not found 3DPrint script " & sExecPath) Return False End If ' Assegno i dati - EgtLuaCreateGlobTable("BEAM") - EgtLuaSetGlobStringVar("BEAM.BASEDIR", Map.refMainWindowVM.MainWindowM.sBeamRoot) - EgtLuaSetGlobStringVar("BEAM.FILE", sFile) - EgtLuaSetGlobStringVar("BEAM.MACHINE", sMachine) - EgtLuaSetGlobIntVar("BEAM.FLAG", nFlag) - ' Eseguo lo script - Dim bOk As Boolean = False - If EgtLuaExecFile(sExecPath) Then - ' Recupero i risultati - Dim nErr As Integer = 999 - EgtLuaGetGlobIntVar("BEAM.ERR", nErr) - bOk = (nErr <= 0) - If Not bOk Then EgtOutLog("BeamExec Err=" & nErr.ToString()) - Else - EgtOutLog("Error executing Beam Exec script " & sExecPath) - Return False - End If - ' Cancello tavola globale - EgtLuaResetGlobVar("BEAM") - Return bOk - End Function - - Friend Function ExecWall(sFile As String, sMachine As String, nFlag As Integer, bBtl As Boolean, bNestingCornerBL As Boolean) As Boolean - EgtOutLog("-- Start ExecWall --") - ' Recupero lo script da eseguire - Dim sExecPath As String = "" - Dim sExecName As String = "" - GetMainPrivateProfileString(S_WALL, K_WALLBWEEXEC, "", sExecName) - sExecPath = (Map.refMainWindowVM.MainWindowM.sWallRoot & "\" & sExecName).TrimEnd({"\"c}) - If Not My.Computer.FileSystem.FileExists(sExecPath) Then - EgtOutLog("Not found WallExec script " & sExecPath) - Return False - End If - ' Assegno i dati - EgtLuaCreateGlobTable("WALL") - EgtLuaSetGlobStringVar("WALL.BASEDIR", Map.refMainWindowVM.MainWindowM.sWallRoot) - EgtLuaSetGlobStringVar("WALL.FILE", sFile) - EgtLuaSetGlobStringVar("WALL.MACHINE", sMachine) - EgtLuaSetGlobIntVar("WALL.FLAG", nFlag) - EgtLuaSetGlobBoolVar("WALL.NESTINGCORNERBL", bNestingCornerBL) - ' Eseguo lo script - Dim bOk As Boolean = False - If EgtLuaExecFile(sExecPath) Then - ' Recupero i risultati - Dim nErr As Integer = 999 - EgtLuaGetGlobIntVar("WALL.ERR", nErr) - bOk = (nErr <= 0) - If Not bOk Then EgtOutLog("WallExec Err=" & nErr.ToString()) - Else - bOk = False - EgtOutLog("Error executing Wall Exec script " & sExecPath) - End If - ' Cancello tavola globale - EgtLuaResetGlobVar("WALL") - Return bOk - End Function - - Friend Function ExecNesting(sFile As String, sMachine As String, PartList As List(Of BTLPartM), SectionList As List(Of SParam), dStartOffset As Double, dOffset As Double, dKerf As Double, bLDIntersOther As Boolean, nMinScore As Integer, nNestTime As Integer) As Boolean - If PartList.Count = 0 Then - EgtOutLog("Exit nesting: no parts received!") - Return True - End If - EgtOutLog("-- Start ExecNest --") - ' Recupero lo script da eseguire - Dim sExecPath As String = "" - Dim sExecName As String = "" - GetMainPrivateProfileString(S_NEST, K_NESTEXEC, "", sExecName) - Dim sRoot As String = "" - If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then - sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot - ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then - sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot - End If - sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c}) - If Not My.Computer.FileSystem.FileExists(sExecPath) Then - EgtOutLog("Not found NestExec script " & sExecPath) - Return False - End If - ' Assegno i dati - EgtLuaCreateGlobTable("NEST") - EgtLuaSetGlobStringVar("NEST.BASEDIR", sRoot) - EgtLuaSetGlobStringVar("NEST.FILE", sFile) - EgtLuaSetGlobStringVar("NEST.MACHINE", sMachine) - 'EgtLuaSetGlobNumVar("NEST.LEN", dLength) - 'EgtLuaSetGlobNumVar("NEST.WIDTH", dWidth) - EgtLuaSetGlobNumVar("NEST.STARTOFFSET", dStartOffset) - EgtLuaSetGlobNumVar("NEST.OFFSET", dOffset) - EgtLuaSetGlobNumVar("NEST.KERF", dKerf) - EgtLuaSetGlobNumVar("NEST.DRILL_MACH_AREA", If(bLDIntersOther, 1, 0)) - EgtLuaSetGlobNumVar("NEST.MIN_ANGLE_PNT", nMinScore) - Dim nNestCorner As Integer - Select Case CurrentMachine.NestingCorner - Case MCH_CR.TL - nNestCorner = 1 - Case MCH_CR.TR - nNestCorner = 3 - Case MCH_CR.BL - nNestCorner = 0 - Case MCH_CR.BR - nNestCorner = 2 - End Select - EgtLuaSetGlobNumVar("NEST.CORNER", nNestCorner) - EgtLuaSetGlobStringVar("NEST.MATERIAL", PartList(0).sMATERIAL) - 'EgtLuaSetGlobNumVar("NEST.QTY", nQty) - EgtLuaSetGlobNumVar("NEST.TIME", nNestTime) - EgtLuaSetGlobNumVar("NEST.PRODID", Map.refProdManagerVM.CurrProd.nProdId) - EgtLuaCreateGlobTable("PART") - For PartIndex = 0 To PartList.Count - 1 - EgtLuaSetGlobIntVar("PART." & PartList(PartIndex).nPartId.ToString(), PartList(PartIndex).m_nCNT + PartList(PartIndex).m_nADDED - PartList(PartIndex).nINPROD) - Next - EgtLuaCreateGlobTable("LEN") - For SectionIndex = 0 To SectionList.Count - 1 - EgtLuaSetGlobNumVar("LEN." & SectionIndex + 1, SectionList(SectionIndex).dL) - Next - EgtLuaCreateGlobTable("WIDTH") - For SectionIndex = 0 To SectionList.Count - 1 - EgtLuaSetGlobNumVar("WIDTH." & SectionIndex + 1, SectionList(SectionIndex).dW) - Next - EgtLuaCreateGlobTable("QTY") - For SectionIndex = 0 To SectionList.Count - 1 - EgtLuaSetGlobNumVar("QTY." & SectionIndex + 1, SectionList(SectionIndex).nQuantity) - Next + Dim SelMaterialParam As Material = Map.refTopPanelVM.GetSelMaterialData() EgtLuaCreateGlobTable("MATERIAL") - For SectionIndex = 0 To SectionList.Count - 1 - EgtLuaSetGlobStringVar("MATERIAL." & SectionIndex + 1, SectionList(SectionIndex).SectXMat.sSectionXMaterial) - Next + EgtLuaSetGlobNumVar("MATERIAL.K", SelMaterialParam.dK) + EgtLuaSetGlobNumVar("MATERIAL.C1", SelMaterialParam.dC1) + EgtLuaSetGlobNumVar("MATERIAL.C2", SelMaterialParam.dC2) + EgtLuaSetGlobNumVar("MATERIAL.Density", SelMaterialParam.dDensity) + EgtLuaSetGlobNumVar("MATERIAL.AMax", SelMaterialParam.dAMax) + EgtLuaSetGlobNumVar("MATERIAL.ATrg", SelMaterialParam.dATrg) + EgtLuaSetGlobNumVar("MATERIAL.AMin", SelMaterialParam.dAMin) + EgtLuaSetGlobNumVar("MATERIAL.BMax", SelMaterialParam.dBMax) + EgtLuaSetGlobNumVar("MATERIAL.BTrg", SelMaterialParam.dBTrg) + EgtLuaSetGlobNumVar("MATERIAL.BMin", SelMaterialParam.dBMin) + EgtLuaSetGlobNumVar("MATERIAL.KW", SelMaterialParam.dKW) + EgtLuaSetGlobNumVar("MATERIAL.KZ", SelMaterialParam.dKZ) + EgtLuaSetGlobNumVar("MATERIAL.KN", SelMaterialParam.dKN) ' Eseguo lo script Dim bOk As Boolean = False If EgtLuaExecFile(sExecPath) Then ' Recupero i risultati Dim nErr As Integer = 999 - EgtLuaGetGlobIntVar("NEST.ERR", nErr) + EgtLuaGetGlobIntVar("MATERIAL.ERR", nErr) bOk = (nErr <= 0) - If Not bOk Then EgtOutLog("NestExec Err=" & nErr.ToString()) + If Not bOk Then EgtOutLog("ExecSlice Err=" & nErr.ToString()) Else - bOk = False - EgtOutLog("Error executing Nest Exec script " & sExecPath) + EgtOutLog("Error executing Slice Exec script " & sExecPath) + Return False End If ' Cancello tavola globale - EgtLuaResetGlobVar("NEST") - EgtLuaResetGlobVar("PART") - EgtLuaResetGlobVar("LEN") - EgtLuaResetGlobVar("WIDTH") - EgtLuaResetGlobVar("QTY") EgtLuaResetGlobVar("MATERIAL") Return bOk End Function - Friend Function ExecRotFlip(nPartId As Integer) As Boolean - If IsNothing(nPartId) OrElse nPartId = GDB_ID.NULL Then - EgtOutLog("Exit nesting: no parts received!") - Return True - End If - EgtOutLog("-- Start ExecFlipRot --") - ' Recupero lo script da eseguire - Dim sExecPath As String = "" - Dim sExecName As String = "" - GetMainPrivateProfileString(S_NEST, K_FLIPROT, "", sExecName) - Dim sRoot As String = "" - If Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.BEAM Then - sRoot = Map.refMainWindowVM.MainWindowM.sBeamRoot - ElseIf Map.refProjectVM.BTLStructureVM.nPROJTYPE = MachineType.WALL Then - sRoot = Map.refMainWindowVM.MainWindowM.sWallRoot - End If - sExecPath = (sRoot & "\" & sExecName).TrimEnd({"\"c}) - If Not My.Computer.FileSystem.FileExists(sExecPath) Then - EgtOutLog("Not found NestExec script " & sExecPath) - Return False - End If - ' Assegno i dati - EgtLuaCreateGlobTable("NFAR") - EgtLuaSetGlobStringVar("NFAR.BASEDIR", sRoot) - EgtLuaSetGlobStringVar("NFAR.PARTID", nPartId) - ' Eseguo lo script - Dim bOk As Boolean = False - If EgtLuaExecFile(sExecPath) Then - ' Recupero i risultati - Dim nErr As Integer = 999 - EgtLuaGetGlobIntVar("NFAR.ERR", nErr) - bOk = (nErr <= 0) - If Not bOk Then EgtOutLog("FlipRot Err=" & nErr.ToString()) - Else - bOk = False - EgtOutLog("Error executing Nest FlipRot script " & sExecPath) - End If - ' Cancello tavola globale - EgtLuaResetGlobVar("NFAR") - Return bOk - End Function - End Module diff --git a/3dPrintApp/Utility/Map.vb b/3dPrintApp/Utility/Map.vb index d3d0508..0454d82 100644 --- a/3dPrintApp/Utility/Map.vb +++ b/3dPrintApp/Utility/Map.vb @@ -12,7 +12,11 @@ Module Map 'Private m_refMainMenuVM As MainMenuVM Private m_refMachinePanelVM As MachinePanelVM ''Private m_refMyMachGroupPanelVM As MyMachGroupPanelVM - 'Private m_refLeftPanelVM As LeftPanelVM + Private m_refLeftPanelVM As LeftPanelVM + Private m_refRightPanelVM As RightPanelVM + Private m_refDispositionPanelVM As DispositionPanelVM + Private m_refStartMachPanelVM As StartMachPanelVM + Private m_refControllerInputPanelVM As ControllerInputPanelVM 'Private m_refBottomPanelVM As BottomPanelVM 'Private m_refShowBeamPanelVM As ShowBeamPanelVM 'Private m_refConfigurationPageVM As ConfigurationPageVM @@ -24,7 +28,7 @@ Module Map 'Private m_refFreeContourInputVM As FreeContourInputVM 'Private m_refPartManagerVM As PartManagerVM Private m_refInstrumentPanelVM As InstrumentPanelVM - 'Private m_refTopPanelVM As TopPanelVM + Private m_refTopPanelVM As TopPanelVM 'Private m_refOptimizePanelVM As OptimizePanelVM 'Private m_refCALCPanelVM As CALCPanelVM 'Private m_refPartListVM As BTLPartListVM @@ -42,6 +46,10 @@ Module Map 'Private m_refSplitModeVM As SplitModeVM 'Private m_refMoveRawModeVM As MoveRawModeVM 'Private m_refSimulTabVM As SimulTabVM + Private m_refImportPanelVM As ImportPanelVM + Private m_refSliceManagerVM As SliceManagerVM + Private m_refTFSEditorVM As TFSEditorVM + Private m_refCurrMachiningPanelVM As CurrMachiningPanelVM #Region "Get" @@ -104,11 +112,35 @@ Module Map End Get End Property - 'Public ReadOnly Property refLeftPanelVM As LeftPanelVM - ' Get - ' Return m_refLeftPanelVM - ' End Get - 'End Property + Public ReadOnly Property refLeftPanelVM As LeftPanelVM + Get + Return m_refLeftPanelVM + End Get + End Property + + Public ReadOnly Property refRightPanelVM As RightPanelVM + Get + Return m_refRightPanelVM + End Get + End Property + + Public ReadOnly Property refDispositionPanelVM As DispositionPanelVM + Get + Return m_refDispositionPanelVM + End Get + End Property + + Public ReadOnly Property refStartMachPanelVM As StartMachPanelVM + Get + Return m_refStartMachPanelVM + End Get + End Property + + Public ReadOnly Property refControllerInputPanelVM As ControllerInputPanelVM + Get + Return m_refControllerInputPanelVM + End Get + End Property 'Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM ' Get @@ -182,11 +214,11 @@ Module Map End Get End Property - 'Public ReadOnly Property refTopPanelVM As TopPanelVM - ' Get - ' Return m_refTopPanelVM - ' End Get - 'End Property + Public ReadOnly Property refTopPanelVM As TopPanelVM + Get + Return m_refTopPanelVM + End Get + End Property 'Public ReadOnly Property refOptimizePanelVM As OptimizePanelVM ' Get @@ -296,6 +328,30 @@ Module Map ' End Get 'End Property + Public ReadOnly Property refImportPanelVM As ImportPanelVM + Get + Return m_refImportPanelVM + End Get + End Property + + Public ReadOnly Property refSliceManagerVM As SliceManagerVM + Get + Return m_refSliceManagerVM + End Get + End Property + + Public ReadOnly Property refTFSEditorVM As TFSEditorVM + Get + Return m_refTFSEditorVM + End Get + End Property + + Public ReadOnly Property refCurrMachiningPanelVM As CurrMachiningPanelVM + Get + Return m_refCurrMachiningPanelVM + End Get + End Property + #End Region ' Get #Region "Set" @@ -349,10 +405,30 @@ Module Map Return Not IsNothing(m_refMachinePanelVM) End Function - 'Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean - ' m_refLeftPanelVM = LeftPanelVM - ' Return Not IsNothing(m_refLeftPanelVM) - 'End Function + Friend Function SetRefLeftPanelVM(LeftPanelVM As LeftPanelVM) As Boolean + m_refLeftPanelVM = LeftPanelVM + Return Not IsNothing(m_refLeftPanelVM) + End Function + + Friend Function SetRefRightPanelVM(RightPanelVM As RightPanelVM) As Boolean + m_refRightPanelVM = RightPanelVM + Return Not IsNothing(m_refRightPanelVM) + End Function + + Friend Function SetRefDispositionPanelVM(DispositionPanelVM As DispositionPanelVM) As Boolean + m_refDispositionPanelVM = DispositionPanelVM + Return Not IsNothing(m_refDispositionPanelVM) + End Function + + Friend Function SetRefStartMachPanelVM(StartMachPanelVM As StartMachPanelVM) As Boolean + m_refStartMachPanelVM = StartMachPanelVM + Return Not IsNothing(m_refStartMachPanelVM) + End Function + + Friend Function SetRefControllerInputPanelVM(ControllerInputPanelVM As ControllerInputPanelVM) As Boolean + m_refControllerInputPanelVM = ControllerInputPanelVM + Return Not IsNothing(m_refControllerInputPanelVM) + End Function 'Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean ' CoreMap.SetRefMachGroupPanelVM(MachGroupPanelVM) @@ -414,10 +490,10 @@ Module Map Return Not IsNothing(m_refInstrumentPanelVM) End Function - 'Friend Function SetRefTopPanelVM(TopPanelVM As TopPanelVM) As Boolean - ' m_refTopPanelVM = TopPanelVM - ' Return Not IsNothing(m_refTopPanelVM) - 'End Function + Friend Function SetRefTopPanelVM(TopPanelVM As TopPanelVM) As Boolean + m_refTopPanelVM = TopPanelVM + Return Not IsNothing(m_refTopPanelVM) + End Function 'Friend Function SetRefOptimizePanelVM(OptimizePanelVM As OptimizePanelVM) As Boolean ' m_refOptimizePanelVM = OptimizePanelVM @@ -509,6 +585,26 @@ Module Map ' Return Not IsNothing(m_refSimulTabVM) 'End Function + Friend Function SetRefImportPanelVM(ImportPanelVM As ImportPanelVM) As Boolean + m_refImportPanelVM = ImportPanelVM + Return Not IsNothing(m_refImportPanelVM) + End Function + + Friend Function SetRefSliceManagerVM(SliceManagerVM As SliceManagerVM) As Boolean + m_refSliceManagerVM = SliceManagerVM + Return Not IsNothing(m_refSliceManagerVM) + End Function + + Friend Function SetRefTFSEditorVM(TFSEditorVM As TFSEditorVM) As Boolean + m_refTFSEditorVM = TFSEditorVM + Return Not IsNothing(m_refTFSEditorVM) + End Function + + Friend Function SetRefCurrMachiningPanelVM(CurrMachiningPanelVM As CurrMachiningPanelVM) As Boolean + m_refCurrMachiningPanelVM = CurrMachiningPanelVM + Return Not IsNothing(m_refCurrMachiningPanelVM) + End Function + #End Region ' Set #Region "Init" diff --git a/3dPrintApp/ViewModel/Print3dPartVM.vb b/3dPrintApp/ViewModel/Print3dPartVM.vb index b489cb8..4f25e13 100644 --- a/3dPrintApp/ViewModel/Print3dPartVM.vb +++ b/3dPrintApp/ViewModel/Print3dPartVM.vb @@ -1,4 +1,5 @@ Imports System.Collections.ObjectModel +Imports EgtUILib Public Class Print3dPartVM @@ -9,14 +10,71 @@ Public Class Print3dPartVM End Get End Property - Private m_sImportedFileName As String - Public Property sImportedFileName As String + ' solido/superficie da stampare + Private m_nPrintSolidLayerId As Integer = GDB_ID.NULL + Public ReadOnly Property nPrintSolidLayerId As Integer Get - Return m_sImportedFileName + Return m_nPrintSolidLayerId + End Get + End Property + Private m_nPrintSolidId As Integer = GDB_ID.NULL + Public ReadOnly Property nPrintSolidId As Integer + Get + Return m_nPrintSolidId + End Get + End Property + + ' solido/superficie originale + Private m_nOriginalPartLayerId As Integer = GDB_ID.NULL + Public ReadOnly Property nOriginalPartLayerId As Integer + Get + Return m_nOriginalPartLayerId + End Get + End Property + + ' riferimento del solido/superficie di stampa + Private m_nReferenceId As Integer = GDB_ID.NULL + Public ReadOnly Property nReferenceId As Integer + Get + Return m_nReferenceId + End Get + End Property + + ' punto/curva di inizio stampa + Private m_nMachStartLayerId As Integer = GDB_ID.NULL + Public ReadOnly Property nMachStartLayerId As Integer + Get + Return m_nMachStartLayerId + End Get + End Property + Private m_nMachStartId As Integer = GDB_ID.NULL + Public ReadOnly Property nMachStartId As Integer + Get + Return m_nMachStartId + End Get + End Property + + ' solidi ausiliari + Private m_nAuxSolidsLayerId As Integer = GDB_ID.NULL + Public ReadOnly Property nAuxSolidsLayerId As Integer + Get + Return m_nAuxSolidsLayerId + End Get + End Property + + ' setti + Private m_nRibsLayerId As Integer = GDB_ID.NULL + Public ReadOnly Property nRibsLayerId As Integer + Get + Return m_nRibsLayerId + End Get + End Property + + Private m_sImportedFileName As String + Public ReadOnly Property sImportedFileName As String + Get + Return If(Not String.IsNullOrWhiteSpace(m_sImportedFilePath), IO.Path.GetFileName(m_sImportedFilePath), "") End Get - Set(value As String) - m_sImportedFileName = value - End Set End Property Private m_sImportedFilePath As String @@ -47,4 +105,18 @@ Public Class Print3dPartVM m_sImportedFileName = IO.Path.GetFileName(m_sImportedFilePath) End Sub + Sub New(nPartId As Integer, nPrintSolidLayerdId As Integer, nPrintSolidId As Integer, nOriginalPartLayerId As Integer, nReferenceId As Integer, nMachStartLayerId As Integer, + nMachStartId As Integer, nAuxSolidsLayerId As Integer, nRibsLayerId As Integer, sImportedFilePath As String) + m_nPartId = nPartId + m_nPrintSolidLayerId = nPrintSolidLayerdId + m_nPrintSolidId = nPrintSolidId + m_nOriginalPartLayerId = nOriginalPartLayerId + m_nReferenceId = nReferenceId + m_nMachStartLayerId = nMachStartLayerId + m_nMachStartId = nMachStartId + m_nAuxSolidsLayerId = nAuxSolidsLayerId + m_nRibsLayerId = nRibsLayerId + m_sImportedFilePath = sImportedFilePath + End Sub + End Class