Files
EgtCAM5/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb
T
Dario Sassi aae55781ae EgtCAM5 :
- modifiche per movimento grezzi contro riferimenti
- corretto seconda selezione su albero
- migliorata gestione parametri lavorazioni.
2016-11-09 14:04:43 +00:00

1272 lines
43 KiB
VB.net

Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class MachiningParameterExpanderViewModel
Implements INotifyPropertyChanged
Private m_bUpdating As Boolean = True
Friend m_Type As Integer
Public ReadOnly Property Type As Integer
Get
EgtGetMachiningParam(MCH_MP.TYPE, m_Type)
Return m_Type
End Get
End Property
Private m_Tool As String
Public ReadOnly Property Tool As String
Get
EgtGetMachiningParam(MCH_MP.TOOL, m_Tool)
Return m_Tool
End Get
End Property
Public Property Invert As Boolean
Get
Dim bInvert As Boolean = False
EgtGetMachiningParam(MCH_MP.INVERT, bInvert)
Return bInvert
End Get
Set(value As Boolean)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.INVERT, value)
End Set
End Property
Public Property Depth As String
Get
Dim sDepth As String = String.Empty
EgtGetMachiningParam(MCH_MP.DEPTH_STR, sDepth)
Return sDepth
End Get
Set(value As String)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.DEPTH_STR, value)
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox WorkSide
Private m_HeadSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_HS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), New IdNameStruct(MCH_SAW_HS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))})
Public ReadOnly Property HeadSideList As ObservableCollection(Of IdNameStruct)
Get
Return m_HeadSideList
End Get
End Property
' Proprietà che indica il WorkSide (MCH_SAW_WS)
Public Property SelectedHeadSide As Integer
Get
Dim nHeadSide As Integer = 0
EgtGetMachiningParam(MCH_MP.HEADSIDE, nHeadSide)
Return IdNameStruct.SearchToId(nHeadSide, HeadSideList)
End Get
Set(value As Integer)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.HEADSIDE, IdNameStruct.SearchFromId(value, HeadSideList))
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox WorkSide
Private m_WorkSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_WS.CENTER, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), New IdNameStruct(MCH_SAW_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))})
Public ReadOnly Property WorkSideList As ObservableCollection(Of IdNameStruct)
Get
Return m_WorkSideList
End Get
End Property
' Proprietà che indica il WorkSide (MCH_SAW_WS)
Public Property SelectedWorkSide As Integer
Get
Dim nWorkSide As Integer = 0
EgtGetMachiningParam(MCH_MP.WORKSIDE, nWorkSide)
Return IdNameStruct.SearchToId(nWorkSide, WorkSideList)
End Get
Set(value As Integer)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.WORKSIDE, IdNameStruct.SearchFromId(value, WorkSideList))
End Set
End Property
Public Property UserNotes As String
Get
Dim sUserNotes As String = String.Empty
Dim x = EgtGetMachiningParam(MCH_MP.USERNOTES, sUserNotes)
Return sUserNotes
End Get
Set(value As String)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.USERNOTES, value)
End Set
End Property
Public Property StartPos As String
Get
Dim dStartPos As Double = 0
EgtGetMachiningParam(MCH_MP.STARTPOS, dStartPos)
Return LenToString(dStartPos, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStartPos As Double = 0
StringToLen(value, dStartPos)
EgtSetMachiningParam(MCH_MP.STARTPOS, dStartPos)
End Set
End Property
Public Property ReturnPos As String
Get
Dim dReturnPos As Double = 0
EgtGetMachiningParam(MCH_MP.RETURNPOS, dReturnPos)
Return LenToString(dReturnPos, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dReturnPos As Double = 0
StringToLen(value, dReturnPos)
EgtSetMachiningParam(MCH_MP.RETURNPOS, dReturnPos)
End Set
End Property
Public Property OverLap As String
Get
Dim dOverLap As Double = 0
EgtGetMachiningParam(MCH_MP.OVERL, dOverLap)
Return LenToString(dOverLap, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dOverLap As Double = 0
StringToLen(value, dOverLap)
EgtSetMachiningParam(MCH_MP.OVERL, dOverLap)
End Set
End Property
Public Property ThrouAddLen As String
Get
Dim dThrouAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen)
Return LenToString(dThrouAddLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dThrouAddLen As Double = 0
StringToLen(value, dThrouAddLen)
EgtSetMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen)
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox StepType
Private m_StepTypeList As ObservableCollection(Of IdNameStruct)
Public ReadOnly Property StepTypeList As ObservableCollection(Of IdNameStruct)
Get
Select Case m_Type
Case MCH_MY.SAWING
m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_SAW_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), New IdNameStruct(MCH_SAW_ST.TOANDFROM, EgtMsg(MSG_MACHININGSDBPAGE + 145))})
Case MCH_MY.MILLING
m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_MIL_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), New IdNameStruct(MCH_MIL_ST.SPIRAL, EgtMsg(MSG_MACHININGSDBPAGE + 144))})
Case MCH_MY.SAWROUGHING, MCH_MY.SAWFINISHING
m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_SAWROU_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))})
Case Else
m_StepTypeList = Nothing
End Select
Return m_StepTypeList
End Get
End Property
Private m_StepTypeGetError As Boolean = False
' Proprietà che indica il StepType
Public Property SelectedStepType As Integer
Get
If Not IsNothing(m_StepTypeList) Then
Dim nStepType As Integer = 0
If EgtGetMachiningParam(MCH_MP.STEPTYPE, nStepType) Then
m_StepTypeGetError = True
Else
m_StepTypeGetError = False
End If
Return IdNameStruct.SearchToId(nStepType, m_StepTypeList)
Else
Return 0
End If
End Get
Set(value As Integer)
If m_bUpdating Then Return
If Not IsNothing(m_StepTypeList) Then
If m_StepTypeGetError Then
EgtSetMachiningParam(MCH_MP.STEPTYPE, IdNameStruct.SearchFromId(value, m_StepTypeList))
End If
End If
End Set
End Property
Public Property StepPar As String
Get
Dim dStepPar As Double = 0
EgtGetMachiningParam(MCH_MP.STEP_, dStepPar)
Return LenToString(dStepPar, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStepPar As Double = 0
StringToLen(value, dStepPar)
EgtSetMachiningParam(MCH_MP.STEP_, dStepPar)
End Set
End Property
Public Property StartSlowLen As String
Get
Dim dStartSlowLen As Double = 0
EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen)
Return LenToString(dStartSlowLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStartSlowLen As Double = 0
StringToLen(value, dStartSlowLen)
EgtSetMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen)
End Set
End Property
Public Property EndSlowLen As String
Get
Dim dEndSlowLen As Double = 0
EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen)
Return LenToString(dEndSlowLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dEndSlowLen As Double = 0
StringToLen(value, dEndSlowLen)
EgtSetMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen)
End Set
End Property
Public Property SideAngle As String
Get
Dim dSideAngle As Double = 0
EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAngle)
Return LenToString(dSideAngle, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dSideAngle As Double = 0
StringToLen(value, dSideAngle)
EgtSetMachiningParam(MCH_MP.SIDEANGLE, dSideAngle)
End Set
End Property
Public Property OffsetSr As String
Get
Dim dOffsetSr As Double = 0
EgtGetMachiningParam(MCH_MP.OFFSR, dOffsetSr)
Return LenToString(dOffsetSr, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dOffsetSr As Double = 0
StringToLen(value, dOffsetSr)
EgtSetMachiningParam(MCH_MP.OFFSR, dOffsetSr)
End Set
End Property
Public Property OffsetSl As String
Get
Dim dOffsetSl As Double = 0
EgtGetMachiningParam(MCH_MP.OFFSL, dOffsetSl)
Return LenToString(dOffsetSl, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dOffsetSl As Double = 0
StringToLen(value, dOffsetSl)
EgtSetMachiningParam(MCH_MP.OFFSL, dOffsetSl)
End Set
End Property
Public Property LeaveTab As Boolean
Get
Dim bLeaveTab As Boolean = False
EgtGetMachiningParam(MCH_MP.LEAVETAB, bLeaveTab)
Return bLeaveTab
End Get
Set(value As Boolean)
If m_bUpdating Then Return
EgtSetMachiningParam(MCH_MP.LEAVETAB, value)
End Set
End Property
Public Property TabLen As String
Get
Dim dTabLen As Double = 0
EgtGetMachiningParam(MCH_MP.TABLEN, dTabLen)
Return LenToString(dTabLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dTabLen As Double = 0
StringToLen(value, dTabLen)
EgtSetMachiningParam(MCH_MP.TABLEN, dTabLen)
End Set
End Property
Public Property TabHeight As String
Get
Dim dTabHeight As Double = 0
EgtGetMachiningParam(MCH_MP.TABHEIGHT, dTabHeight)
Return LenToString(dTabHeight, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dTabHeight As Double = 0
StringToLen(value, dTabHeight)
EgtSetMachiningParam(MCH_MP.TABHEIGHT, dTabHeight)
End Set
End Property
Public Property TabAngle As String
Get
Dim dTabAngle As Double = 0
EgtGetMachiningParam(MCH_MP.TABANGLE, dTabAngle)
Return LenToString(dTabAngle, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dTabAngle As Double = 0
StringToLen(value, dTabAngle)
EgtSetMachiningParam(MCH_MP.TABANGLE, dTabAngle)
End Set
End Property
Public Property TabDist As String
Get
Dim dTabDist As Double = 0
EgtGetMachiningParam(MCH_MP.TABDIST, dTabDist)
Return LenToString(dTabDist, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dTabDist As Double = 0
StringToLen(value, dTabDist)
EgtSetMachiningParam(MCH_MP.TABDIST, dTabDist)
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox LeadInType
Private m_LeadInTypeList As ObservableCollection(Of IdNameStruct)
Public ReadOnly Property LeadInTypeList As ObservableCollection(Of IdNameStruct)
Get
Select Case m_Type
Case MCH_MY.SAWING
m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_LI.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_LI.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), New IdNameStruct(MCH_SAW_LI.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), New IdNameStruct(MCH_SAW_LI.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), New IdNameStruct(MCH_SAW_LI.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))})
Case MCH_MY.MILLING
m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), New IdNameStruct(MCH_MIL_LI.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), New IdNameStruct(MCH_MIL_LI.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), New IdNameStruct(MCH_MIL_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), New IdNameStruct(MCH_MIL_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_MIL_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))})
Case Else
m_LeadInTypeList = Nothing
End Select
Return m_LeadInTypeList
End Get
End Property
Private m_LeadInTypeGetError As Boolean = False
' Proprietà che indica il LeadInType
Public Property SelectedLeadInType As Integer
Get
If Not IsNothing(m_LeadInTypeList) Then
Dim nLeadInType As Integer = 0
If EgtGetMachiningParam(MCH_MP.LEADINTYPE, nLeadInType) Then
m_LeadInTypeGetError = True
Else
m_LeadInTypeGetError = False
End If
Return IdNameStruct.SearchToId(nLeadInType, m_LeadInTypeList)
Else
Return 0
End If
End Get
Set(value As Integer)
If m_bUpdating Then Return
If Not IsNothing(m_LeadInTypeList) Then
If m_LeadInTypeGetError Then
EgtSetMachiningParam(MCH_MP.LEADINTYPE, IdNameStruct.SearchFromId(value, m_LeadInTypeList))
End If
End If
End Set
End Property
Public Property StartAddLen As String
Get
Dim dStartAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen)
Return LenToString(dStartAddLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStartAddLen As Double = 0
StringToLen(value, dStartAddLen)
EgtSetMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen)
End Set
End Property
Public Property LiTang As String
Get
Dim dLiTang As Double = 0
EgtGetMachiningParam(MCH_MP.LITANG, dLiTang)
Return LenToString(dLiTang, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLiTang As Double = 0
StringToLen(value, dLiTang)
EgtSetMachiningParam(MCH_MP.LITANG, dLiTang)
End Set
End Property
Public Property LiPerp As String
Get
Dim dLiPerp As Double = 0
EgtGetMachiningParam(MCH_MP.LIPERP, dLiPerp)
Return LenToString(dLiPerp, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLiPerp As Double = 0
StringToLen(value, dLiPerp)
EgtSetMachiningParam(MCH_MP.LIPERP, dLiPerp)
End Set
End Property
Public Property LiElev As String
Get
Dim dLiElev As Double = 0
EgtGetMachiningParam(MCH_MP.LIELEV, dLiElev)
Return LenToString(dLiElev, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLiElev As Double = 0
StringToLen(value, dLiElev)
EgtSetMachiningParam(MCH_MP.LIELEV, dLiElev)
End Set
End Property
Public Property LiCompLen As String
Get
Dim dLiCompLen As Double = 0
EgtGetMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen)
Return LenToString(dLiCompLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLiCompLen As Double = 0
StringToLen(value, dLiCompLen)
EgtSetMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen)
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox LeadOutType
Private m_LeadOutTypeList As ObservableCollection(Of IdNameStruct)
Public ReadOnly Property LeadOutTypeList As ObservableCollection(Of IdNameStruct)
Get
Select Case m_Type
Case MCH_MY.SAWING
m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_LO.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_LO.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), New IdNameStruct(MCH_SAW_LO.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))})
Case MCH_MY.MILLING
m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), New IdNameStruct(MCH_MIL_LO.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), New IdNameStruct(MCH_MIL_LO.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), New IdNameStruct(MCH_MIL_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), New IdNameStruct(MCH_MIL_LO.AS_LI, EgtMsg(MSG_MACHININGSDBPAGE + 137))})
Case Else
m_LeadOutTypeList = Nothing
End Select
Return m_LeadOutTypeList
End Get
End Property
Private m_LeadOutTypeGetError As Boolean = False
' Proprietà che indica il LeadOutType
Public Property SelectedLeadOutType As Integer
Get
If Not IsNothing(m_LeadOutTypeList) Then
Dim nLeadOutType As Integer = 0
If EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, nLeadOutType) Then
m_LeadOutTypeGetError = True
Else
m_LeadOutTypeGetError = False
End If
Return IdNameStruct.SearchToId(nLeadOutType, m_LeadOutTypeList)
Else
Return 0
End If
End Get
Set(value As Integer)
If m_bUpdating Then Return
If Not IsNothing(m_LeadOutTypeList) Then
If m_LeadOutTypeGetError Then
EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, IdNameStruct.SearchFromId(value, m_LeadOutTypeList))
End If
End If
End Set
End Property
Public Property EndAddLen As String
Get
Dim dEndAddLen As Double = 0
EgtGetMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen)
Return LenToString(dEndAddLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dEndAddLen As Double = 0
StringToLen(value, dEndAddLen)
EgtSetMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen)
End Set
End Property
Public Property LoTang As String
Get
Dim dLoTang As Double = 0
EgtGetMachiningParam(MCH_MP.LOTANG, dLoTang)
Return LenToString(dLoTang, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLoTang As Double = 0
StringToLen(value, dLoTang)
EgtSetMachiningParam(MCH_MP.LOTANG, dLoTang)
End Set
End Property
Public Property LoPerp As String
Get
Dim dLoPerp As Double = 0
EgtGetMachiningParam(MCH_MP.LOPERP, dLoPerp)
Return LenToString(dLoPerp, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLoPerp As Double = 0
StringToLen(value, dLoPerp)
EgtSetMachiningParam(MCH_MP.LOPERP, dLoPerp)
End Set
End Property
Public Property LoElev As String
Get
Dim dLoElev As Double = 0
EgtGetMachiningParam(MCH_MP.LOELEV, dLoElev)
Return LenToString(dLoElev, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLoElev As Double = 0
StringToLen(value, dLoElev)
EgtSetMachiningParam(MCH_MP.LOELEV, dLoElev)
End Set
End Property
Public Property LoCompLen As String
Get
Dim dLoCompLen As Double = 0
EgtGetMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen)
Return LenToString(dLoCompLen, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dLoCompLen As Double = 0
StringToLen(value, dLoCompLen)
EgtSetMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen)
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox ExtLinkType
Private m_ExtLinkTypeList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_EL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_EL.EXT_PREV, EgtMsg(MSG_MACHININGSDBPAGE + 134)), New IdNameStruct(MCH_SAW_EL.EXT_NEXT, EgtMsg(MSG_MACHININGSDBPAGE + 135)), New IdNameStruct(MCH_SAW_EL.EXT_BOTH, EgtMsg(MSG_MACHININGSDBPAGE + 136))})
Public ReadOnly Property ExtLinkTypeList As ObservableCollection(Of IdNameStruct)
Get
Return m_ExtLinkTypeList
End Get
End Property
Private m_ExtLinkTypeGetError As Boolean = False
' Proprietà che indica il ExtLinkType (MCH_SAW_EL)
Public Property SelectedExtLinkType As Integer
Get
If Not IsNothing(m_ExtLinkTypeList) Then
Dim nExtLinkType As Integer = 0
If EgtGetMachiningParam(MCH_MP.EXTLINKTYPE, nExtLinkType) Then
m_ExtLinkTypeGetError = True
Else
m_ExtLinkTypeGetError = False
End If
Return IdNameStruct.SearchToId(nExtLinkType, m_ExtLinkTypeList)
Else
Return 0
End If
End Get
Set(value As Integer)
If m_bUpdating Then Return
If Not IsNothing(m_ExtLinkTypeList) Then
If m_ExtLinkTypeGetError Then
EgtSetMachiningParam(MCH_MP.EXTLINKTYPE, IdNameStruct.SearchFromId(value, m_ExtLinkTypeList))
End If
End If
End Set
End Property
'ObservableCollection che contiene le variabili per il combobox CurveUse
Private m_CurveUseList As New ObservableCollection(Of IdNameStruct)
Public ReadOnly Property CurveUseList As ObservableCollection(Of IdNameStruct)
Get
If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWINGONARCS, 0, IniFile.m_sCurrMachIniFilePath) <> 0 Then
m_CurveUseList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140)), New IdNameStruct(MCH_SAW_CU.KEEP, EgtMsg(MSG_MACHININGSDBPAGE + 141))})
Else
m_CurveUseList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140))})
End If
Return m_CurveUseList
End Get
End Property
Private m_CurveUseGetError As Boolean = False
' Proprietà che indica il ExtLinkType (MCH_SAW_EL)
Public Property SelectedCurveUse As Integer
Get
If Not IsNothing(m_CurveUseList) Then
Dim nCurveUse As Integer = 0
If EgtGetMachiningParam(MCH_MP.CURVEUSE, nCurveUse) Then
m_CurveUseGetError = True
Else
m_CurveUseGetError = False
End If
Return IdNameStruct.SearchToId(nCurveUse, m_CurveUseList)
Else
Return 0
End If
End Get
Set(value As Integer)
If m_bUpdating Then Return
If Not IsNothing(m_CurveUseList) Then
If m_CurveUseGetError Then
EgtSetMachiningParam(MCH_MP.CURVEUSE, IdNameStruct.SearchFromId(value, m_CurveUseList))
End If
End If
End Set
End Property
Public Property Approx As String
Get
Dim dApprox As Double = 0
EgtGetMachiningParam(MCH_MP.APPROX, dApprox)
Return LenToString(dApprox, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dApprox As Double = 0
StringToLen(value, dApprox)
EgtSetMachiningParam(MCH_MP.APPROX, dApprox)
End Set
End Property
Public Property StepExtArc As String
Get
Dim dStepExtArc As Double = 0
EgtGetMachiningParam(MCH_MP.STEPEXTARC, dStepExtArc)
Return LenToString(dStepExtArc, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStepExtArc As Double = 0
StringToLen(value, dStepExtArc)
EgtSetMachiningParam(MCH_MP.STEPEXTARC, dStepExtArc)
End Set
End Property
Public Property StepIntArc As String
Get
Dim dStepIntArc As Double = 0
EgtGetMachiningParam(MCH_MP.STEPINTARC, dStepIntArc)
Return LenToString(dStepIntArc, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStepIntArc As Double = 0
StringToLen(value, dStepIntArc)
EgtSetMachiningParam(MCH_MP.STEPINTARC, dStepIntArc)
End Set
End Property
Public Property Speed As String
Get
Dim dSpeed As Double = 0
EgtGetMachiningParam(MCH_MP.SPEED, dSpeed)
Return LenToString(dSpeed, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dSpeed As Double = 0
StringToLen(value, dSpeed)
EgtSetMachiningParam(MCH_MP.SPEED, dSpeed)
End Set
End Property
Public Property Feed As String
Get
Dim dFeed As Double = 0
EgtGetMachiningParam(MCH_MP.FEED, dFeed)
Return LenToString(dFeed, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dFeed As Double = 0
StringToLen(value, dFeed)
EgtSetMachiningParam(MCH_MP.FEED, dFeed)
End Set
End Property
Public Property TipFeed As String
Get
Dim dTipFeed As Double = 0
EgtGetMachiningParam(MCH_MP.TIPFEED, dTipFeed)
Return LenToString(dTipFeed, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dTipFeed As Double = 0
StringToLen(value, dTipFeed)
EgtSetMachiningParam(MCH_MP.TIPFEED, dTipFeed)
End Set
End Property
Public Property StartFeed As String
Get
Dim dStartFeed As Double = 0
EgtGetMachiningParam(MCH_MP.STARTFEED, dStartFeed)
Return LenToString(dStartFeed, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dStartFeed As Double = 0
StringToLen(value, dStartFeed)
EgtSetMachiningParam(MCH_MP.STARTFEED, dStartFeed)
End Set
End Property
Public Property EndFeed As String
Get
Dim dEndFeed As Double = 0
EgtGetMachiningParam(MCH_MP.ENDFEED, dEndFeed)
Return LenToString(dEndFeed, 4)
End Get
Set(value As String)
If m_bUpdating Then Return
Dim dEndFeed As Double = 0
StringToLen(value, dEndFeed)
EgtSetMachiningParam(MCH_MP.ENDFEED, dEndFeed)
End Set
End Property
#Region "Messages"
Public ReadOnly Property InvertMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 51)
End Get
End Property
Public ReadOnly Property DepthMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 99)
End Get
End Property
Public ReadOnly Property HeadSideMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 55)
End Get
End Property
Public ReadOnly Property WorkSideMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 54)
End Get
End Property
Public ReadOnly Property UserNotesMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 100)
End Get
End Property
Private m_UserNotesTooltip As String
Public ReadOnly Property UserNotesTooltip As String
Get
Return UserNotes
End Get
End Property
Public ReadOnly Property StartPosMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 73)
End Get
End Property
Public ReadOnly Property ReturnPosMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 78)
End Get
End Property
Public ReadOnly Property OverLapMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 101)
End Get
End Property
Public ReadOnly Property ThrouAddLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 76)
End Get
End Property
Public ReadOnly Property StepTypeMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 60)
End Get
End Property
Public ReadOnly Property StepParMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 77)
End Get
End Property
Public ReadOnly Property StartSlowLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 74)
End Get
End Property
Public ReadOnly Property EndSlowLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 75)
End Get
End Property
Public ReadOnly Property SideAngleMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 71)
End Get
End Property
Public ReadOnly Property OffsetSrMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 68)
End Get
End Property
Public ReadOnly Property OffsetSlMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 69)
End Get
End Property
Public ReadOnly Property LeadInTypeMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 56)
End Get
End Property
Public ReadOnly Property StartAddLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 91)
End Get
End Property
Public ReadOnly Property LiTangMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 83)
End Get
End Property
Public ReadOnly Property LiPerpMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 84)
End Get
End Property
Public ReadOnly Property LiElevMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 85)
End Get
End Property
Public ReadOnly Property LiCompLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 86)
End Get
End Property
Public ReadOnly Property LeadOutTypeMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 58)
End Get
End Property
Public ReadOnly Property EndAddLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 92)
End Get
End Property
Public ReadOnly Property LoTangMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 87)
End Get
End Property
Public ReadOnly Property LoPerpMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 88)
End Get
End Property
Public ReadOnly Property LoElevMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 89)
End Get
End Property
Public ReadOnly Property LoCompLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 90)
End Get
End Property
Public ReadOnly Property ExtLinkTypeMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 57)
End Get
End Property
Public ReadOnly Property LeaveTabMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 52)
End Get
End Property
Public ReadOnly Property TabLenMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 79)
End Get
End Property
Public ReadOnly Property TabHeightMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 80)
End Get
End Property
Public ReadOnly Property TabAngleMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 81)
End Get
End Property
Public ReadOnly Property TabDistMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 82)
End Get
End Property
Public ReadOnly Property CurveUseMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 59)
End Get
End Property
Public ReadOnly Property ApproxMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 72)
End Get
End Property
Public ReadOnly Property StepExtArcMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 93)
End Get
End Property
Public ReadOnly Property StepIntArcMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 94)
End Get
End Property
Public ReadOnly Property SpeedMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 63)
End Get
End Property
Public ReadOnly Property FeedMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 64)
End Get
End Property
Public ReadOnly Property TipFeedMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 67)
End Get
End Property
Public ReadOnly Property StartFeedMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 65)
End Get
End Property
Public ReadOnly Property EndFeedMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 66)
End Get
End Property
Public ReadOnly Property OperationListHeader As String
Get
Return EgtMsg(MSG_OPERATION + 1)
End Get
End Property
Public ReadOnly Property ApplyMachiningBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 3)
End Get
End Property
Public ReadOnly Property GenericExpanderHeader As String
Get
Return EgtMsg(MSG_OPERATION + 7)
End Get
End Property
Public ReadOnly Property ToolExpanderHeader As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 98) & " " & m_Tool
End Get
End Property
#End Region
Private Sub UpdateParamValues()
m_bUpdating = True
NotifyPropertyChanged("Type")
NotifyPropertyChanged("Tool")
NotifyPropertyChanged("Invert")
NotifyPropertyChanged("Depth")
NotifyPropertyChanged("SelectedHeadSide")
NotifyPropertyChanged("SelectedWorkSide")
NotifyPropertyChanged("UserNotes")
NotifyPropertyChanged("StartPos")
NotifyPropertyChanged("ReturnPos")
NotifyPropertyChanged("OverLap")
NotifyPropertyChanged("ThrouAddLen")
NotifyPropertyChanged("StepTypeList")
NotifyPropertyChanged("SelectedStepType")
NotifyPropertyChanged("StepPar")
NotifyPropertyChanged("StartSlowLen")
NotifyPropertyChanged("EndSlowLen")
NotifyPropertyChanged("SideAngle")
NotifyPropertyChanged("OffsetSr")
NotifyPropertyChanged("OffsetSl")
NotifyPropertyChanged("LeaveTab")
NotifyPropertyChanged("TabLen")
NotifyPropertyChanged("TabHeight")
NotifyPropertyChanged("TabAngle")
NotifyPropertyChanged("TabDist")
NotifyPropertyChanged("LeadInTypeList")
NotifyPropertyChanged("SelectedLeadInType")
NotifyPropertyChanged("StartAddLen")
NotifyPropertyChanged("LiTang")
NotifyPropertyChanged("LiPerp")
NotifyPropertyChanged("LiElev")
NotifyPropertyChanged("LiCompLen")
NotifyPropertyChanged("LeadOutTypeList")
NotifyPropertyChanged("SelectedLeadOutType")
NotifyPropertyChanged("EndAddLen")
NotifyPropertyChanged("LoTang")
NotifyPropertyChanged("LoPerp")
NotifyPropertyChanged("LoElev")
NotifyPropertyChanged("LoCompLen")
NotifyPropertyChanged("SelectedExtLinkType")
NotifyPropertyChanged("CurveUseList")
NotifyPropertyChanged("SelectedCurveUse")
NotifyPropertyChanged("Approx")
NotifyPropertyChanged("StepExtArc")
NotifyPropertyChanged("StepIntArc")
NotifyPropertyChanged("Speed")
NotifyPropertyChanged("Feed")
NotifyPropertyChanged("TipFeed")
NotifyPropertyChanged("StartFeed")
NotifyPropertyChanged("EndFeed")
m_bUpdating = False
End Sub
' Definizione comando
Private m_cmdReloadMachining As ICommand
Sub New(ByRef m_UpdateParamValues As Action)
m_UpdateParamValues = AddressOf UpdateParamValues
End Sub
Private Function ConvertTypeToImage(Type As Integer) As String
Select Case Type
Case MCH_OY.DISP
Return ""
Case MCH_OY.DRILLING
Return ""
Case MCH_OY.SAWING
Return ""
Case MCH_OY.MILLING
Return ""
Case MCH_OY.POCKETING
Return ""
Case MCH_OY.MORTISING
Return ""
Case MCH_OY.SAWROUGHING
Return ""
Case MCH_OY.SAWFINISHING
Return ""
Case Else
Return String.Empty
End Select
End Function
#Region "ReloadMachiningCommand"
''' <summary>
''' Restituisce funzione per ricalcolo lavorazione.
''' </summary>
Public ReadOnly Property ReloadMachiningCommand As ICommand
Get
If m_cmdReloadMachining Is Nothing Then
m_cmdReloadMachining = New RelayCommand(AddressOf ReloadMachining, AddressOf CanReloadMachining)
End If
Return m_cmdReloadMachining
End Get
End Property
''' <summary>
''' Ricalcola una lavorazione.
''' </summary>
Public Sub ReloadMachining(ByVal param As Object)
' Aggiorno valore depth
NotifyPropertyChanged("Depth")
' Carico tutta la geometria selezionata in una lista
Dim SelectedGeometry As New List(Of Integer)
Dim EntityIndex As Integer = EgtGetFirstSelectedObj()
While EntityIndex <> GDB_ID.NULL
SelectedGeometry.Add(EntityIndex)
EntityIndex = EgtGetNextSelectedObj()
End While
' Verifico se la geometria è cambiata, confrontando selezione attuale con geometria di lavorazione
Dim ModifiedGeometry As Boolean = False
Dim CountIndex As Integer = 0
EntityIndex = 0
Dim SubEntityIndex As Integer = 0 ' Sottocomponente, per ora non usato ma necessario
While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex)
If SubEntityIndex = GDB_ID.NULL And CountIndex < SelectedGeometry.Count() Then
If SelectedGeometry(CountIndex) <> EntityIndex Then
ModifiedGeometry = True
Exit While
End If
Else
ModifiedGeometry = True
Exit While
End If
CountIndex += 1
End While
If SelectedGeometry.Count <> CountIndex Then
ModifiedGeometry = True
End If
' Imposto geometria selezionata come geometria di lavorazione
If ModifiedGeometry Then EgtSetMachiningGeometry(SelectedGeometry.ToArray)
' Se necessario ricalcolo la lavorazione
EgtApplyMachining(ModifiedGeometry)
EgtDraw()
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanReloadMachining(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' ReloadMachiningCommand
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
End Namespace
''' <summary>
''' Class that represent a Converter that use machining type and param type, to set the visibility state of the param type.
''' </summary>
Public Class OperationParamVisibilityConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Select Case CInt(value)
Case MCH_OY.NONE
Return Visibility.Hidden
Case MCH_OY.DISP
Return SharedFieldsClass.OperationDisposition(CInt(parameter))
Case MCH_OY.DRILLING
Return SharedFieldsClass.Drilling(CInt(parameter))
Case MCH_OY.SAWING
Return SharedFieldsClass.Sawing(CInt(parameter))
Case MCH_OY.MILLING
Return SharedFieldsClass.Milling(CInt(parameter))
Case MCH_OY.POCKETING
Return SharedFieldsClass.Pocketing(CInt(parameter))
Case MCH_OY.MORTISING
Return SharedFieldsClass.Mortising(CInt(parameter))
Case MCH_OY.SAWROUGHING
Return SharedFieldsClass.Sawroughing(CInt(parameter))
Case MCH_OY.SAWFINISHING
Return SharedFieldsClass.Sawfinishing(CInt(parameter))
Case Else
Return Visibility.Hidden
End Select
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
''' <summary>
''' Class that represent a Converter that convert mm in inch if necessary for the param depth.
''' </summary>
Public Class DepthUnitConverter
Implements IValueConverter
Friend Const INCHTOMM As String = "*25.4"
Friend Const INCHSYMBOL As String = """"
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
If Not IsNothing(value) Then
value = CStr(value).Replace(INCHTOMM, INCHSYMBOL)
End If
Return value
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
If Not IsNothing(value) Then
value = CStr(value).Replace(INCHSYMBOL, INCHTOMM)
End If
Return value
End Function
End Class