diff --git a/Icarus/Constants/Const3dPrint.vb b/Icarus/Constants/Const3dPrint.vb index 8bcbe8b..ed19fec 100644 --- a/Icarus/Constants/Const3dPrint.vb +++ b/Icarus/Constants/Const3dPrint.vb @@ -69,6 +69,7 @@ Public Const MAC_GUID = "GUID" Public Const MAC_NAME = "Name" Public Const MAC_SLICING45 = "Slicing45" + Public Const MAC_SLICINGTYPE = "SlicingType" Public Const MAC_SPIRALVASE = "SpiralVase" Public Const MAC_STRANDH = "StrandH" Public Const MAC_STRANDW = "StrandW" diff --git a/Icarus/Constants/ConstMachIni.vb b/Icarus/Constants/ConstMachIni.vb index 5ac543f..4291b72 100644 --- a/Icarus/Constants/ConstMachIni.vb +++ b/Icarus/Constants/ConstMachIni.vb @@ -32,6 +32,7 @@ Public Const K_MACH_EXITSCRIPT As String = "ExitScript" Public Const S_MACH_PRINTING3D As String = "3dPrinting" + Public Const K_HORIZONTAL_PRINT As String = "HorizontalPrint" Public Const K_SPEED_MIN As String = "SpeedMin" Public Const K_SPEED_MAX As String = "SpeedMax" diff --git a/Icarus/CurrMachiningPanel/CurrMachining.vb b/Icarus/CurrMachiningPanel/CurrMachining.vb index 2497233..3b9d78b 100644 --- a/Icarus/CurrMachiningPanel/CurrMachining.vb +++ b/Icarus/CurrMachiningPanel/CurrMachining.vb @@ -16,11 +16,21 @@ Public Class CurrMachining End Set End Property - Public ReadOnly Property bCurrSlicing45 As Boolean + Public ReadOnly Property dCurrSlicingType As Machining.MPAR_SLICINGTYPE Get - Dim Slicing45 As CurrCheckMachiningParam = m_CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.SLICING45) + Dim SlicingType As CurrComboMachiningParam = m_CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.SLICINGTYPE) + If Not IsNothing(SlicingType) Then + Return SlicingType.SelValue.Id + Else + Return 0 + End If + End Get + End Property + Public ReadOnly Property sCurrSlicingType As String + Get + Dim Slicing45 As CurrComboMachiningParam = m_CathegoryList.FirstOrDefault(Function(x) x.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(y) y.Type = MachiningParam.Params.SLICINGTYPE) If Not IsNothing(Slicing45) Then - Return Slicing45.bValue + Return Slicing45.SelValue.Name Else Return False End If @@ -143,7 +153,7 @@ Public Class CurrMachining Case NameOf(sender.dValue), NameOf(sender.sValue), NameOf(sender.bValue), NameOf(sender.SelValue) m_bIsModified = m_CathegoryList.Any(Function(x) x.MachiningParamList.Any(Function(y) y.bIsModified)) NotifyPropertyChanged(NameOf(ghName)) - NotifyPropertyChanged(NameOf(bCurrSlicing45)) + NotifyPropertyChanged(NameOf(sCurrSlicingType)) NotifyPropertyChanged(NameOf(sCurrStrandH)) NotifyPropertyChanged(NameOf(sCurrStrandW)) NotifyPropertyChanged(NameOf(sCurrStrandCount)) @@ -172,7 +182,7 @@ Public Class CurrMachiningCathegory Select Case m_Type Case Cathegories.GENERAL m_sName = "General" - m_MachiningParamList = New List(Of MachiningParam)({New CurrCheckMachiningParam(MachiningParam.Params.SLICING45, nPartId, nIndex, bForceFromDb), + m_MachiningParamList = New List(Of MachiningParam)({New CurrComboMachiningParam(MachiningParam.Params.SLICINGTYPE, nPartId, nIndex, bForceFromDb), New CurrCheckMachiningParam(MachiningParam.Params.SPIRALVASE, nPartId, nIndex, bForceFromDb), New CurrNumericMachiningParam(MachiningParam.Params.STRANDH, nPartId, nIndex, bForceFromDb), New CurrNumericMachiningParam(MachiningParam.Params.STRANDW, nPartId, nIndex, bForceFromDb), @@ -652,6 +662,21 @@ Public Class CurrComboMachiningParam MyBase.New(Type, nIndex) Dim bReadFromPart As Boolean = False Select Case Type + Case Params.SLICINGTYPE + Dim nHorizontalPrint As Integer = GetPrivateProfileInt(S_MACH_PRINTING3D, K_HORIZONTAL_PRINT, 0, CurrentMachine.sMachIniFile) + m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_SLICINGTYPE.VERTICAL, "Vertical"), + New IdNameStruct(Machining.MPAR_SLICINGTYPE.HORIZONTAL, "Horizontal")}) + If nHorizontalPrint > 0 Then + m_ValueList.Add(New IdNameStruct(Machining.MPAR_SLICINGTYPE.DEG45, "45°")) + End If + Dim nSelValue As Integer = 0 + bReadFromPart = EgtGetInfo(nPartId, MAC_SLICINGTYPE, nSelValue) + If Not bReadFromPart Then + Dim nSlicing45 As Integer = 0 + bReadFromPart = EgtGetInfo(nPartId, MAC_SLICING45, nSlicing45) + nSelValue = If(nSlicing45 = 0, Machining.MPAR_SLICINGTYPE.VERTICAL, Machining.MPAR_SLICINGTYPE.DEG45) + End If + m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue) Case Params.STRANDORDER m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_STRANDORDERS.OUTTOIN, "From Outside To Inside"), New IdNameStruct(Machining.MPAR_STRANDORDERS.INTOOUT, "From Inside To Outside")}) @@ -710,14 +735,10 @@ Public Class CurrComboMachiningParam If nIndex > 0 Then Dim DbMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.nIndex = nIndex) Select Case Type - Case Params.STRANDORDER, Params.DIRECTION + Case Params.SLICINGTYPE, Params.STRANDORDER, Params.DIRECTION m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) Case Params.LINKTYPE, Params.LEADIN, Params.LEADOUT m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.LINK).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) - 'Case Params.LEADIN - ' m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.LEADIN).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) - 'Case Params.LEADOUT - ' m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.LEADOUT).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) Case Params.AUXSOLIDSINFILL, Params.AUXSOLIDSSTRANDORDER, Params.AUXSOLIDSLINKTYPE m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.AUX_SOLID).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) End Select @@ -730,6 +751,8 @@ Public Class CurrComboMachiningParam Friend Overrides Sub WriteParamInPart(nPartId As Integer) Select Case Type + Case Params.SLICINGTYPE + EgtSetInfo(nPartId, MAC_SLICINGTYPE, m_SelValue.Id) Case Params.STRANDORDER EgtSetInfo(nPartId, MAC_STRANDORDER, m_SelValue.Id) Case Params.DIRECTION @@ -817,8 +840,6 @@ Public Class CurrCheckMachiningParam MyBase.New(Type, nIndex) Dim bReadFromPart As Boolean = False Select Case Type - Case Params.SLICING45 - bReadFromPart = EgtGetInfo(nPartId, MAC_SLICING45, m_bValue) Case Params.SPIRALVASE bReadFromPart = EgtGetInfo(nPartId, MAC_SPIRALVASE, m_bValue) Case Params.RIBSLINK @@ -836,7 +857,7 @@ Public Class CurrCheckMachiningParam If nIndex > 0 Then Dim DbMachining As Machining = Map.refMachiningDbVM.MachiningList.FirstOrDefault(Function(x) x.nIndex = nIndex) Select Case Type - Case Params.SLICING45, Params.SPIRALVASE + Case Params.SPIRALVASE m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.GENERAL).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) Case Params.RIBSLINK, Params.RIBSINVERTORDER, Params.RIBSINVERTDIRECTION, Params.RIBSLEADININVERT, Params.RIBSLEADOUTINVERT m_DbParam = DbMachining.CathegoryList.FirstOrDefault(Function(y) y.Type = MachiningCathegory.Cathegories.RIBS).MachiningParamList.FirstOrDefault(Function(z) z.Type = m_Type) @@ -850,8 +871,6 @@ Public Class CurrCheckMachiningParam Friend Overrides Sub WriteParamInPart(nPartId As Integer) Select Case Type - Case Params.SLICING45 - EgtSetInfo(nPartId, MAC_SLICING45, If(m_bValue, 1, 0)) Case Params.SPIRALVASE EgtSetInfo(nPartId, MAC_SPIRALVASE, If(m_bValue, 1, 0)) Case Params.RIBSLINK diff --git a/Icarus/MachiningDb/Machining.vb b/Icarus/MachiningDb/Machining.vb index 80b2252..5a0aad3 100644 --- a/Icarus/MachiningDb/Machining.vb +++ b/Icarus/MachiningDb/Machining.vb @@ -6,6 +6,12 @@ Imports EgtWPFLib5 Public Class Machining Inherits VMBase + Public Enum MPAR_SLICINGTYPE As Integer + VERTICAL = 1 + HORIZONTAL = 2 + DEG45 = 3 + End Enum + Public Enum MPAR_STRANDORDERS As Integer OUTTOIN = 1 INTOOUT = 2 @@ -279,7 +285,7 @@ Public Class MachiningCathegory Select Case m_Type Case Cathegories.GENERAL m_sName = "General" - m_MachiningParamList = New List(Of MachiningParam)({New CheckMachiningParam(MachiningParam.Params.SLICING45, nIndex), + m_MachiningParamList = New List(Of MachiningParam)({New ComboMachiningParam(MachiningParam.Params.SLICINGTYPE, nIndex), New CheckMachiningParam(MachiningParam.Params.SPIRALVASE, nIndex), New NumericMachiningParam(MachiningParam.Params.STRANDH, nIndex), New NumericMachiningParam(MachiningParam.Params.STRANDW, nIndex), @@ -380,7 +386,7 @@ Public MustInherit Class MachiningParam Public Enum Params As Integer NAME = 2 - SLICING45 = 3 + SLICINGTYPE = 3 STRANDH = 4 STRANDW = 5 STRANDCOUNT = 6 @@ -455,8 +461,8 @@ Public MustInherit Class MachiningParam Sub New(Type As Params) m_Type = Type Select Case m_Type - Case Params.SLICING45 - m_sName = "Slicing 45°" + Case Params.SLICINGTYPE + m_sName = "Slicing direction" Case Params.STRANDH m_sName = "Strand Height" Case Params.STRANDW @@ -935,6 +941,20 @@ Public Class ComboMachiningParam m_SelValue = Nothing Else Select Case Type + Case Params.SLICINGTYPE + Dim nHorizontalPrint As Integer = GetPrivateProfileInt(S_MACH_PRINTING3D, K_HORIZONTAL_PRINT, 0, CurrentMachine.sMachIniFile) + m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_SLICINGTYPE.VERTICAL, "Vertical"), + New IdNameStruct(Machining.MPAR_SLICINGTYPE.HORIZONTAL, "Horizontal")}) + If nHorizontalPrint > 0 Then + m_ValueList.Add(New IdNameStruct(Machining.MPAR_SLICINGTYPE.DEG45, "45°")) + End If + Dim nSelValue As Double = ReadMachiningParamDouble(nIndex, MAC_SLICINGTYPE, -1) + If nSelValue = -1 Then + Dim dSlicing45 As Double = 0 + dSlicing45 = ReadMachiningParamDouble(nIndex, MAC_SLICING45, 0) + nSelValue = If(dSlicing45 = 0, Machining.MPAR_SLICINGTYPE.VERTICAL, Machining.MPAR_SLICINGTYPE.DEG45) + End If + m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue) Case Params.STRANDORDER m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_STRANDORDERS.OUTTOIN, "From Outside To Inside"), New IdNameStruct(Machining.MPAR_STRANDORDERS.INTOOUT, "From Inside To Outside")}) @@ -979,6 +999,8 @@ Public Class ComboMachiningParam Friend Overrides Sub WriteParamOnDb(nIndex As Integer) Select Case Type + Case Params.SLICINGTYPE + WriteMachiningParam(nIndex, MAC_SLICING45, m_SelValue.Id) Case Params.STRANDORDER WriteMachiningParam(nIndex, MAC_STRANDORDER, m_SelValue.Id) Case Params.DIRECTION @@ -1042,8 +1064,6 @@ Public Class CheckMachiningParam m_bValue = 0 Else Select Case Type - Case Params.SLICING45 - m_bValue = ReadMachiningParamDouble(nIndex, MAC_SLICING45, 0) Case Params.SPIRALVASE m_bValue = ReadMachiningParamDouble(nIndex, MAC_SPIRALVASE, 0) Case Params.RIBSLINK @@ -1063,8 +1083,6 @@ Public Class CheckMachiningParam Friend Overrides Sub WriteParamOnDb(nIndex As Integer) Select Case Type - Case Params.SLICING45 - WriteMachiningParam(nIndex, MAC_SLICING45, If(m_bValue, 1, 0)) Case Params.SPIRALVASE WriteMachiningParam(nIndex, MAC_SPIRALVASE, If(m_bValue, 1, 0)) Case Params.RIBSLINK diff --git a/Icarus/SliderManager/SliderManagerVM.vb b/Icarus/SliderManager/SliderManagerVM.vb index 8706eaf..74a923a 100644 --- a/Icarus/SliderManager/SliderManagerVM.vb +++ b/Icarus/SliderManager/SliderManagerVM.vb @@ -123,7 +123,7 @@ Public Class SliderManagerVM Get Dim dH As Double = 0 If Not IsNothing(Map.refTopPanelVM.CurrMachining) Then - If Map.refTopPanelVM.CurrMachining.bCurrSlicing45 Then + If Map.refTopPanelVM.CurrMachining.dCurrSlicingType = Machining.MPAR_SLICINGTYPE.DEG45 Then Return m_nLayerIndex Else Return m_nLayerIndex & " (" & DoubleToString(m_nLayerIndex * Map.refTopPanelVM.CurrMachining.dCurrStrandH, 0) & "mm)" @@ -138,7 +138,7 @@ Public Class SliderManagerVM Get Dim dH As Double = 0 If Not IsNothing(Map.refTopPanelVM.CurrMachining) Then - If Map.refTopPanelVM.CurrMachining.bCurrSlicing45 Then + If Map.refTopPanelVM.CurrMachining.dCurrSlicingType = Machining.MPAR_SLICINGTYPE.DEG45 Then Return m_nLayerIndex_Maximum Else Return m_nLayerIndex_Maximum & " (" & DoubleToString(m_nLayerIndex_Maximum * Map.refTopPanelVM.CurrMachining.dCurrStrandH, 0) & "mm)" diff --git a/Icarus/TopPanel/TopPanelV.xaml b/Icarus/TopPanel/TopPanelV.xaml index 5b1b122..d0d18c2 100644 --- a/Icarus/TopPanel/TopPanelV.xaml +++ b/Icarus/TopPanel/TopPanelV.xaml @@ -159,10 +159,10 @@ -