45cbfa745f
- Miglioramenti Db utensili.
1390 lines
49 KiB
VB.net
1390 lines
49 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Text.RegularExpressions
|
|
Imports EgtUILib
|
|
|
|
Public Class FamilyToolTreeViewItem
|
|
Inherits InheritableTreeViewItem
|
|
|
|
Public Overrides Property IsSelected As Boolean
|
|
Get
|
|
Return m_IsSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If (value <> m_IsSelected) Then
|
|
m_IsSelected = value
|
|
If value Then
|
|
' The function that I want to call When Parent item is selected in the tree
|
|
End If
|
|
NotifyPropertyChanged("IsSelected")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_ToolType As MCH_TF
|
|
''' <summary>
|
|
''' Property that determines the tool type of the family
|
|
''' </summary>
|
|
Public Property ToolType As MCH_TF
|
|
Get
|
|
Return m_ToolType
|
|
End Get
|
|
Set(value As MCH_TF)
|
|
m_ToolType = value
|
|
End Set
|
|
End Property
|
|
|
|
' Proprietà che permette di nascondere tutti i parametri utensile grazie al binding ed al converter
|
|
Public ReadOnly Property Type As Integer
|
|
Get
|
|
Return MCH_TY.NONE
|
|
End Get
|
|
End Property
|
|
|
|
Sub New(Name As String)
|
|
MyBase.New(Name)
|
|
Me.PictureString = "/Resources/TreeView/Folder.png"
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class ToolTreeViewItem
|
|
Inherits InheritableTreeViewItem
|
|
Implements IDataErrorInfo
|
|
|
|
' Variabile che indica quando non lanciare l'update del disegno utensile
|
|
' (utile per evitare di rifare il disegno più volte quando vengono caricati i parametri alla selezione di un utensile)
|
|
Private m_SuspendToolDrawUpdate As Boolean = False
|
|
|
|
Private m_ErrorOnTool As Boolean
|
|
Public Property ErrorOnTool As Boolean
|
|
Get
|
|
Return m_ErrorOnTool
|
|
End Get
|
|
Set(value As Boolean)
|
|
If IsValid Then
|
|
m_ErrorOnTool = False
|
|
Application.Msn.NotifyColleagues(Application.ERRORONTOOL, Nothing)
|
|
Else
|
|
m_ErrorOnTool = True
|
|
Application.Msn.NotifyColleagues(Application.ERRORONTOOL, Me)
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Variabile che indica se l'utensile è appena stato creato
|
|
Dim m_NewTool As Boolean = False
|
|
Public Property NewTool As Boolean
|
|
Get
|
|
Return m_NewTool
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_NewTool = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Overrides Property IsSelected As Boolean
|
|
Get
|
|
Return m_IsSelected
|
|
End Get
|
|
Set(value As Boolean)
|
|
If (value <> m_IsSelected) Then
|
|
m_IsSelected = value
|
|
If value Then
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbSetCurrTool(Me.Name)
|
|
ReadToolParam()
|
|
NotifyPropertyChanged("Type")
|
|
Else
|
|
WriteToolParam()
|
|
If EgtTdbIsCurrToolModified() Then ' And Me.IsValid) Or Me.NewTool Then
|
|
|
|
Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1))
|
|
Case MsgBoxResult.Yes
|
|
'm_NewTool = False
|
|
EgtTdbSaveCurrTool()
|
|
'SaveToolDraw()
|
|
EgtTdbSave()
|
|
Case MsgBoxResult.No
|
|
'If m_NewTool Then
|
|
' Application.Msn.NotifyColleagues(Application.REMOVETOOL, Me)
|
|
'End If
|
|
End Select
|
|
End If
|
|
|
|
End If
|
|
NotifyPropertyChanged("IsSelected")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(Name As String)
|
|
MyBase.New(Name)
|
|
Me.PictureString = "/Resources/TreeView/Folder.png"
|
|
End Sub
|
|
|
|
Private m_IsModifiedCorr As Boolean = False
|
|
Private m_Corr As Integer
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Corrector
|
|
''' </summary>
|
|
Public Property Corr As Integer
|
|
Get
|
|
Return m_Corr
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_Corr Then
|
|
m_Corr = value
|
|
Dim DbCorr As Integer = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.CORR, DbCorr)
|
|
m_IsModifiedCorr = If(value <> DbCorr, True, False)
|
|
NotifyPropertyChanged("Corr")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedExit As Boolean = False
|
|
Private m_Exit As Integer
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Exit
|
|
''' </summary>
|
|
Public Property ExitPar As Integer
|
|
Get
|
|
Return m_Exit
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_Exit Then
|
|
m_Exit = value
|
|
Dim DbExit As Integer = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, DbExit)
|
|
m_IsModifiedExit = If(value <> DbExit, True, False)
|
|
NotifyPropertyChanged("ExitPar")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Type As Integer
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Type
|
|
''' </summary>
|
|
Public Property Type As Integer
|
|
Get
|
|
Return m_Type
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_Type Then
|
|
m_Type = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedCoolant As Boolean = False
|
|
Private m_Coolant As Integer
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Coolant
|
|
''' </summary>
|
|
Public Property Coolant As Integer
|
|
Get
|
|
Return m_Coolant
|
|
End Get
|
|
Set(value As Integer)
|
|
If value <> m_Coolant Then
|
|
m_Coolant = value
|
|
Dim DbCoolant As Integer = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.COOLANT, DbCoolant)
|
|
m_IsModifiedCoolant = If(value <> DbCoolant, True, False)
|
|
NotifyPropertyChanged("Coolant")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedCornRad As Boolean = False
|
|
Private m_CornRad As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Corner Radius
|
|
''' </summary>
|
|
Public Property CornRad As String
|
|
Get
|
|
Return m_CornRad
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_CornRad Then
|
|
m_CornRad = value
|
|
Dim DbCornRad As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, DbCornRad)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedCornRad = If(dValue <> DbCornRad, True, False)
|
|
NotifyPropertyChanged("CornRad")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedDiam As Boolean = False
|
|
Private m_Diam As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Diameter
|
|
''' </summary>
|
|
Public Property Diam As String
|
|
Get
|
|
Return m_Diam
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_Diam Then
|
|
m_Diam = value
|
|
Dim DbDiam As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.DIAM, DbDiam)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedDiam = If(dValue <> DbDiam, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.DIAM)
|
|
End If
|
|
NotifyPropertyChanged("Diam")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedTotDiam As Boolean = False
|
|
Private m_TotDiam As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Total Diameter
|
|
''' </summary>
|
|
Public Property TotDiam As String
|
|
Get
|
|
Return m_TotDiam
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_TotDiam Then
|
|
m_TotDiam = value
|
|
Dim DbTotDiam As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, DbTotDiam)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedTotDiam = If(dValue <> DbTotDiam, True, False)
|
|
NotifyPropertyChanged("TotDiam")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedFeed As Boolean = False
|
|
Private m_Feed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Feed
|
|
''' </summary>
|
|
Public Property Feed As String
|
|
Get
|
|
Return m_Feed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_Feed Then
|
|
m_Feed = value
|
|
Dim DbFeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.FEED, DbFeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedFeed = If(dValue <> DbFeed, True, False)
|
|
NotifyPropertyChanged("Feed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedEndFeed As Boolean = False
|
|
Private m_EndFeed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the End Feed
|
|
''' </summary>
|
|
Public Property EndFeed As String
|
|
Get
|
|
Return m_EndFeed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_EndFeed Then
|
|
m_EndFeed = value
|
|
Dim DbEndFeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.ENDFEED, DbEndFeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedEndFeed = If(dValue <> DbEndFeed, True, False)
|
|
NotifyPropertyChanged("EndFeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedStartFeed As Boolean = False
|
|
Private m_StartFeed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Start Feed
|
|
''' </summary>
|
|
Public Property StartFeed As String
|
|
Get
|
|
Return m_StartFeed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_StartFeed Then
|
|
m_StartFeed = value
|
|
Dim DbStartFeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.STARTFEED, DbStartFeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedStartFeed = If(dValue <> DbStartFeed, True, False)
|
|
NotifyPropertyChanged("StartFeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedTipFeed As Boolean = False
|
|
Private m_TipFeed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Tip Feed
|
|
''' </summary>
|
|
Public Property TipFeed As String
|
|
Get
|
|
Return m_TipFeed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_TipFeed Then
|
|
m_TipFeed = value
|
|
Dim DbTipFeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TIPFEED, DbTipFeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedTipFeed = If(dValue <> DbTipFeed, True, False)
|
|
NotifyPropertyChanged("TipFeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedLen As Boolean = False
|
|
Private m_Len As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Len
|
|
''' </summary>
|
|
Public Property Len As String
|
|
Get
|
|
Return m_Len
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_Len Then
|
|
m_Len = value
|
|
Dim DbLen As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.LEN, DbLen)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedLen = If(dValue <> DbLen, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.LEN)
|
|
End If
|
|
NotifyPropertyChanged("Len")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedTotLen As Boolean = False
|
|
Private m_TotLen As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Total Len
|
|
''' </summary>
|
|
Public Property TotLen As String
|
|
Get
|
|
Return m_TotLen
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_TotLen Then
|
|
m_TotLen = value
|
|
Dim DbTotLen As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, DbTotLen)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedTotLen = If(dValue <> DbTotLen, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.TOTLEN)
|
|
End If
|
|
NotifyPropertyChanged("TotLen")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedMaxMat As Boolean = False
|
|
Private m_MaxMat As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Max Material
|
|
''' </summary>
|
|
Public Property MaxMat As String
|
|
Get
|
|
Return m_MaxMat
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_MaxMat Then
|
|
m_MaxMat = value
|
|
Dim DbMaxMat As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, DbMaxMat)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedMaxMat = If(dValue <> DbMaxMat, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.MAXMAT)
|
|
End If
|
|
NotifyPropertyChanged("MaxMat")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedLonOffset As Boolean = False
|
|
Private m_LonOffset As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Lon Offset
|
|
''' </summary>
|
|
Public Property LonOffset As String
|
|
Get
|
|
Return m_LonOffset
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_LonOffset Then
|
|
m_LonOffset = value
|
|
Dim DbLonOffset As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.LONOFFSET, DbLonOffset)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedLonOffset = If(dValue <> DbLonOffset, True, False)
|
|
NotifyPropertyChanged("LonOffset")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedRadOffset As Boolean = False
|
|
Private m_RadOffset As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Rad Offset
|
|
''' </summary>
|
|
Public Property RadOffset As String
|
|
Get
|
|
Return m_RadOffset
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_RadOffset Then
|
|
m_RadOffset = value
|
|
Dim DbRadOffset As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.RADOFFSET, DbRadOffset)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedRadOffset = If(dValue <> DbRadOffset, True, False)
|
|
NotifyPropertyChanged("RadOffset")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedSpeed As Boolean = False
|
|
Private m_Speed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Speed
|
|
''' </summary>
|
|
Public Property Speed As String
|
|
Get
|
|
Return m_Speed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_Speed Then
|
|
m_Speed = value
|
|
Dim DbSpeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.SPEED, DbSpeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedSpeed = If(dValue <> DbSpeed, True, False)
|
|
NotifyPropertyChanged("Speed")
|
|
NotifyPropertyChanged("MaxSpeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedSideAng As Boolean = False
|
|
Private m_SideAng As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Side Angle
|
|
''' </summary>
|
|
Public Property SideAng As String
|
|
Get
|
|
Return m_SideAng
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_SideAng Then
|
|
m_SideAng = value
|
|
Dim DbSideAng As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, DbSideAng)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedSideAng = If(dValue <> DbSideAng, True, False)
|
|
NotifyPropertyChanged("SideAng")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedMaxSpeed As Boolean = False
|
|
Private m_MaxSpeed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Max Speed
|
|
''' </summary>
|
|
Public Property MaxSpeed As String
|
|
Get
|
|
Return m_MaxSpeed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_MaxSpeed Then
|
|
m_MaxSpeed = value
|
|
Dim DbMaxSpeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXSPEED, DbMaxSpeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedMaxSpeed = If(dValue <> DbMaxSpeed, True, False)
|
|
NotifyPropertyChanged("Speed")
|
|
NotifyPropertyChanged("MaxSpeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedThick As Boolean = False
|
|
Private m_Thick As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Thick
|
|
''' </summary>
|
|
Public Property Thick As String
|
|
Get
|
|
Return m_Thick
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_Thick Then
|
|
m_Thick = value
|
|
Dim DbThick As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.THICK, DbThick)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedThick = If(dValue <> DbThick, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.THICK)
|
|
End If
|
|
NotifyPropertyChanged("Thick")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedMaxAbsorption As Boolean = False
|
|
Private m_MaxAbsorption As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Max Absorption
|
|
''' </summary>
|
|
Public Property MaxAbsorption As String
|
|
Get
|
|
Return m_MaxAbsorption
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_MaxAbsorption Then
|
|
m_MaxAbsorption = value
|
|
Dim DbMaxAbsorption As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXABSORPTION, DbMaxAbsorption)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedMaxAbsorption = If(dValue <> DbMaxAbsorption, True, False)
|
|
NotifyPropertyChanged("MaxAbsorption")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedMinFeed As Boolean = False
|
|
Private m_MinFeed As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Min Feed
|
|
''' </summary>
|
|
Public Property MinFeed As String
|
|
Get
|
|
Return m_MinFeed
|
|
End Get
|
|
Set(value As String)
|
|
If value <> m_MinFeed Then
|
|
m_MinFeed = value
|
|
Dim DbMinFeed As Double = 0
|
|
Dim dValue As Double = 0
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MINFEED, DbMinFeed)
|
|
StringToLen(value, dValue)
|
|
m_IsModifiedMinFeed = If(dValue <> DbMinFeed, True, False)
|
|
NotifyPropertyChanged("MinFeed")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedDraw As Boolean = False
|
|
Private m_Draw As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Draw
|
|
''' </summary>
|
|
Public Property Draw As String
|
|
Get
|
|
Return m_Draw
|
|
End Get
|
|
Set(value As String)
|
|
If value = String.Empty Or value <> m_Draw Then
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
If value = ToolDrawUUIDName Then
|
|
value = m_Draw
|
|
ElseIf value = ToolDrawUUIDName.Substring(0, ToolDrawUUIDName.Length - 1) Then
|
|
value = String.Empty
|
|
End If
|
|
m_Draw = value
|
|
Dim DbDraw As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.DRAW, DbDraw)
|
|
m_IsModifiedDraw = If(value <> DbDraw, True, False)
|
|
If Not m_SuspendToolDrawUpdate Then
|
|
UpdateSceneToolDraw(DrawUpdateSource.DRAW)
|
|
End If
|
|
NotifyPropertyChanged("Draw")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedHead As Boolean = False
|
|
Private m_Head As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Head
|
|
''' </summary>
|
|
Public Property Head As String
|
|
Get
|
|
Return m_Head
|
|
End Get
|
|
Set(value As String)
|
|
If value = String.Empty Or value <> m_Head Then
|
|
m_Head = value
|
|
Dim DbHead As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.HEAD, DbHead)
|
|
m_IsModifiedHead = If(value <> DbHead, True, False)
|
|
NotifyPropertyChanged("Head")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Variabile che indica se c'è un errore nel nome dell'utensile (ad esempio nome già utilizzato)
|
|
Dim bErrorToolName As Boolean = False
|
|
Private m_IsModifiedName As Boolean = False
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Name
|
|
''' </summary>
|
|
Public Property NamePar As String
|
|
Get
|
|
Return m_Name
|
|
End Get
|
|
Set(value As String)
|
|
If value = String.Empty Or value <> m_Name Then
|
|
bErrorToolName = False
|
|
m_Name = value
|
|
' Verifico che il nuovo nome sia valido
|
|
Dim sTempName As String = value
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetToolNewName(sTempName)
|
|
If Not value = sTempName Then
|
|
bErrorToolName = True
|
|
End If
|
|
Dim DbName As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName)
|
|
m_IsModifiedName = If(value <> DbName, True, False)
|
|
NotifyPropertyChanged("NamePar")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedUserNotes As Boolean = False
|
|
Private m_UserNotes As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the User Notes
|
|
''' </summary>
|
|
Public Property UserNotes As String
|
|
Get
|
|
Return m_UserNotes
|
|
End Get
|
|
Set(value As String)
|
|
If value = String.Empty Or value <> m_UserNotes Then
|
|
Dim DbUserNotes As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, DbUserNotes)
|
|
m_IsModifiedUserNotes = If(value <> DbUserNotes, True, False)
|
|
m_UserNotes = value
|
|
NotifyPropertyChanged("UserNotes")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsModifiedTcPos As Boolean = False
|
|
Private m_TcPos As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Tc Pos
|
|
''' </summary>
|
|
Public Property TcPos As String
|
|
Get
|
|
Return m_TcPos
|
|
End Get
|
|
Set(value As String)
|
|
If value = String.Empty Or value <> m_TcPos Then
|
|
Dim DbTcPos As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, DbTcPos)
|
|
m_IsModifiedTcPos = If(value <> DbTcPos, True, False)
|
|
m_TcPos = value
|
|
NotifyPropertyChanged("TcPos")
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Uuid As String
|
|
''' <summary>
|
|
''' Property that read and write to the tool's database the Uuid
|
|
''' </summary>
|
|
Public ReadOnly Property Uuid As String
|
|
Get
|
|
Return m_Uuid
|
|
End Get
|
|
End Property
|
|
|
|
Friend Sub ReadToolParam()
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
' sospendo l'aggiornamento del disegno per evitare di rifarlo al cambio di ogni parametro inerente
|
|
m_SuspendToolDrawUpdate = True
|
|
Dim nValue As Integer = 0
|
|
Dim dValue As Double = 0
|
|
Dim sValue As String = String.Empty
|
|
EgtTdbGetCurrToolParam(MCH_TP.CORR, nValue)
|
|
Corr = nValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue)
|
|
ExitPar = nValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nValue)
|
|
Type = nValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.COOLANT, nValue)
|
|
Coolant = nValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.CORNRAD, dValue)
|
|
CornRad = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.DIAM, dValue)
|
|
Diam = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TOTDIAM, dValue)
|
|
TotDiam = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.FEED, dValue)
|
|
Feed = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.ENDFEED, dValue)
|
|
EndFeed = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.STARTFEED, dValue)
|
|
StartFeed = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TIPFEED, dValue)
|
|
TipFeed = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.LEN, dValue)
|
|
Len = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.TOTLEN, dValue)
|
|
TotLen = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXMAT, dValue)
|
|
MaxMat = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.LONOFFSET, dValue)
|
|
LonOffset = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.RADOFFSET, dValue)
|
|
RadOffset = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dValue)
|
|
Speed = DoubleToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.SIDEANG, dValue)
|
|
SideAng = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXSPEED, dValue)
|
|
MaxSpeed = DoubleToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.THICK, dValue)
|
|
Thick = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MAXABSORPTION, dValue)
|
|
MaxAbsorption = DoubleToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.MINFEED, dValue)
|
|
MinFeed = LenToString(dValue, 4)
|
|
EgtTdbGetCurrToolParam(MCH_TP.DRAW, sValue)
|
|
Draw = sValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue)
|
|
Head = sValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.NAME, sValue)
|
|
NamePar = sValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.USERNOTES, sValue)
|
|
UserNotes = sValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue)
|
|
TcPos = sValue
|
|
EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue)
|
|
m_Uuid = sValue
|
|
' Ora che tutti i parametri sono aggiornati, aggiorno il disegno
|
|
m_SuspendToolDrawUpdate = False
|
|
UpdateSceneToolDraw(DrawUpdateSource.LEN)
|
|
NotifyPropertyChanged("Draw")
|
|
NotifyPropertyChanged("MaxMat")
|
|
NotifyPropertyChanged("Thick")
|
|
NotifyPropertyChanged("Diam")
|
|
NotifyPropertyChanged("Len")
|
|
NotifyPropertyChanged("TotLen")
|
|
End Sub
|
|
|
|
Friend Sub WriteToolParam()
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
Dim dValue As Double = 0
|
|
EgtTdbSetCurrToolParam(MCH_TP.CORR, Corr)
|
|
EgtTdbSetCurrToolParam(MCH_TP.EXIT_, ExitPar)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TYPE, Type)
|
|
EgtTdbSetCurrToolParam(MCH_TP.COOLANT, Coolant)
|
|
StringToLen(CornRad, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.CORNRAD, dValue)
|
|
StringToLen(Diam, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.DIAM, dValue)
|
|
StringToLen(TotDiam, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TOTDIAM, dValue)
|
|
StringToLen(Feed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.FEED, dValue)
|
|
StringToLen(EndFeed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.ENDFEED, dValue)
|
|
StringToLen(StartFeed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.STARTFEED, dValue)
|
|
StringToLen(TipFeed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TIPFEED, dValue)
|
|
StringToLen(Len, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.LEN, dValue)
|
|
StringToLen(TotLen, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TOTLEN, dValue)
|
|
StringToLen(MaxMat, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXMAT, dValue)
|
|
StringToLen(LonOffset, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.LONOFFSET, dValue)
|
|
StringToLen(RadOffset, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.RADOFFSET, dValue)
|
|
StringToDouble(Speed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.SPEED, dValue)
|
|
StringToLen(SideAng, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.SIDEANG, dValue)
|
|
StringToDouble(MaxSpeed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXSPEED, dValue)
|
|
StringToLen(Thick, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.THICK, dValue)
|
|
StringToDouble(MaxAbsorption, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MAXABSORPTION, dValue)
|
|
StringToLen(MinFeed, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.MINFEED, dValue)
|
|
EgtTdbSetCurrToolParam(MCH_TP.DRAW, Draw)
|
|
EgtTdbSetCurrToolParam(MCH_TP.HEAD, Head)
|
|
EgtTdbSetCurrToolParam(MCH_TP.NAME, NamePar)
|
|
EgtTdbSetCurrToolParam(MCH_TP.USERNOTES, UserNotes)
|
|
EgtTdbSetCurrToolParam(MCH_TP.TCPOS, TcPos)
|
|
End Sub
|
|
|
|
#Region "ToolSceneUpdate"
|
|
|
|
' Enum che indica le proprietà di disegno dell'utensile
|
|
Friend Enum DrawUpdateSource
|
|
DIAM = 0
|
|
LEN = 1
|
|
MAXMAT = 2
|
|
THICK = 3
|
|
DRAW = 4
|
|
TOTLEN = 5
|
|
End Enum
|
|
|
|
' Variabili che segnalano errori nel disegno dell'utensile
|
|
Dim bToolMakerError As Boolean = False
|
|
Dim bDrawNameExistError As Boolean = False
|
|
Dim bDrawNameError As Boolean = False
|
|
Dim bDrawingError As Boolean = False
|
|
|
|
Private Sub UpdateSceneToolDraw(UpdateSource As DrawUpdateSource)
|
|
' Azzero errori
|
|
bToolMakerError = False
|
|
bDrawNameError = False
|
|
bDrawNameExistError = False
|
|
bDrawingError = False
|
|
|
|
' Verifico proprietà draw
|
|
If m_Draw = String.Empty OrElse IsUUID(Path.GetFileNameWithoutExtension(m_Draw)) Then
|
|
CreateToolDraw(UpdateSource)
|
|
Else
|
|
EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
If IsNgeFile(m_Draw) Then
|
|
If EgtOpenFile(IniFile.m_sTdbCurrMachToolsDirPath & "\" & m_Draw) Then
|
|
EgtSetView(VT.TOP, False)
|
|
EgtZoom(ZM.ALL)
|
|
Else
|
|
' Errore
|
|
bDrawNameExistError = True
|
|
EgtNewFile()
|
|
EgtSetView(VT.TOP, False)
|
|
EgtZoom(ZM.ALL)
|
|
End If
|
|
Else
|
|
' Errore
|
|
bDrawNameError = True
|
|
EgtNewFile()
|
|
EgtSetView(VT.TOP, False)
|
|
EgtZoom(ZM.ALL)
|
|
End If
|
|
End If
|
|
NotifyPropertyChanged("Draw")
|
|
If UpdateSource = DrawUpdateSource.TOTLEN Or UpdateSource = DrawUpdateSource.LEN Or UpdateSource = DrawUpdateSource.MAXMAT Then
|
|
NotifyPropertyChanged("TotLen")
|
|
NotifyPropertyChanged("Len")
|
|
NotifyPropertyChanged("MaxMat")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CreateToolDraw(UpdateSource As DrawUpdateSource)
|
|
' Carico il relativo ToolHolder
|
|
Dim ToolHolder As String = String.Empty
|
|
ToolHolder = LoadToolHolder()
|
|
If Not LoadToolMaker() OrElse Not CreateToolDraw(ToolHolder, UpdateSource) Then
|
|
EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
EgtNewFile()
|
|
End If
|
|
EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
' Aggiorno visualizzazione
|
|
EgtSetView(VT.TOP, False)
|
|
EgtZoom(ZM.ALL)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Mathod that load the toolholder for the current tool (based on his head), or return an empty string
|
|
''' </summary>
|
|
Private Function LoadToolHolder() As String
|
|
Dim sHolder As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(S_TOOLHOLDER, Head & "." & ExitPar.ToString(), "", sHolder, IniFile.m_sDbsCurrMachIniFilePath)
|
|
If String.IsNullOrWhiteSpace(sHolder) Then
|
|
Return String.Empty
|
|
Else
|
|
Dim sHolderPath As String = String.Empty
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbGetToolHolderDir(sHolderPath)
|
|
sHolderPath += "\" & sHolder
|
|
Return sHolderPath
|
|
End If
|
|
End Function
|
|
|
|
Private Function LoadToolMaker() As Boolean
|
|
Dim sMaker As String = String.Empty
|
|
EgtUILib.GetPrivateProfileString(S_TOOLS, ConvertTypeToString(Type), "", sMaker, IniFile.m_sDbsCurrMachIniFilePath)
|
|
If String.IsNullOrWhiteSpace(sMaker) Then bToolMakerError = True
|
|
' Acquisisce solo il file lua, ma meglio impostare contesto disegno utensili (se ci sono chiamate...)
|
|
EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
Return EgtLuaExecFile(IniFile.m_sToolMakersDir & "\" & sMaker)
|
|
End Function
|
|
|
|
Private Function ConvertTypeToString(Type As Integer) As String
|
|
Select Case Type
|
|
Case MCH_TY.DRILL_STD, MCH_TY.DRILL_LONG
|
|
Return "StandardDrillMaker"
|
|
Case MCH_TY.SAW_STD, MCH_TY.SAW_FLAT
|
|
Return "StandardSawMaker"
|
|
Case MCH_TY.MILL_STD, MCH_TY.MILL_NOTIP
|
|
Return "StandardMillMaker"
|
|
Case MCH_TY.MORTISE_STD
|
|
Return "StandardMortiseMaker"
|
|
Case MCH_TY.COMPO
|
|
Return "StandardCompoMaker"
|
|
End Select
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function CreateToolDraw(ToolHolder As String, UpdateSource As DrawUpdateSource) As Boolean
|
|
Dim dTotLen As Double = 0
|
|
Dim dLen As Double = 0
|
|
Dim dDiam As Double = 0
|
|
Dim dThick As Double = 0
|
|
Dim dMaxMat As Double = 0
|
|
StringToLen(m_TotLen, dTotLen)
|
|
StringToLen(m_Len, dLen)
|
|
StringToLen(m_Diam, dDiam)
|
|
StringToLen(m_Thick, dThick)
|
|
StringToLen(m_MaxMat, dMaxMat)
|
|
Select Case Type
|
|
Case MCH_TY.DRILL_STD
|
|
' imposto dati utensile
|
|
EgtLuaSetGlobStringVar("TOOL.TOOLHOLDER", ToolHolder)
|
|
EgtLuaSetGlobNumVar("TOOL.TOTLEN", dTotLen)
|
|
EgtLuaSetGlobNumVar("TOOL.LEN", dLen)
|
|
EgtLuaSetGlobNumVar("TOOL.DIAM", dDiam)
|
|
EgtLuaSetGlobNumVar("TOOL.MAXMAT", dMaxMat)
|
|
Case MCH_TY.SAW_STD
|
|
' imposto dati utensile
|
|
EgtLuaSetGlobStringVar("TOOL.TOOLHOLDER", ToolHolder)
|
|
EgtLuaSetGlobNumVar("TOOL.LEN", dLen)
|
|
EgtLuaSetGlobNumVar("TOOL.DIAM", dDiam)
|
|
Dim dCore As Double = If(dLen >= dThick, dThick - 1, 2 * dLen - dThick)
|
|
EgtLuaSetGlobNumVar("TOOL.CORE", dCore)
|
|
EgtLuaSetGlobNumVar("TOOL.THICK", dThick)
|
|
EgtLuaSetGlobNumVar("TOOL.MAXMAT", dMaxMat)
|
|
Case MCH_TY.MILL_STD
|
|
' imposto dati utensile
|
|
EgtLuaSetGlobStringVar("TOOL.TOOLHOLDER", ToolHolder)
|
|
EgtLuaSetGlobNumVar("TOOL.LEN", dLen)
|
|
EgtLuaSetGlobNumVar("TOOL.DIAM", dDiam)
|
|
EgtLuaSetGlobNumVar("TOOL.MAXMAT", dMaxMat)
|
|
Case Else
|
|
bDrawingError = True
|
|
Draw = String.Empty
|
|
Return False
|
|
End Select
|
|
' passo all'ambiente di disegno dell'utensile
|
|
EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
' eseguo creazione utensile
|
|
EgtLuaExecLine("CreateTool()")
|
|
' recupero errore
|
|
Dim nErr As Integer = 999
|
|
EgtLuaGetGlobIntVar("TOOL.ERR", nErr)
|
|
bDrawingError = Not (nErr = 0)
|
|
If bDrawingError And UpdateSource <> DrawUpdateSource.DRAW Then Draw = String.Empty
|
|
If Not bDrawingError Then m_Draw = m_Uuid & ".nge"
|
|
Return (nErr = 0)
|
|
End Function
|
|
|
|
Private Function SaveToolDraw() As Boolean
|
|
If m_Type = MCH_TY.DRILL_STD Or m_Type = MCH_TY.SAW_STD Or m_Type = MCH_TY.MILL_STD Then
|
|
Dim x = EgtGetCurrentContext()
|
|
' nome e direttorio del file da salvare
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
Dim sDrawName As String = Uuid
|
|
sDrawName = sDrawName & ".nge"
|
|
Dim sPath As String = String.Empty
|
|
EgtTdbGetToolDir(sPath)
|
|
sPath = sPath & "\" & sDrawName
|
|
' passo all'ambiente di disegno dell'utensile
|
|
Dim r = EgtSetCurrentContext(IniFile.m_ToolsDbSceneContext)
|
|
Dim y = EgtGetCurrentContext()
|
|
' nascondo layer ausiliario
|
|
Dim nAuxId As Integer = GDB_ID.NULL
|
|
nAuxId = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT), "AUX")
|
|
EgtSetStatus(nAuxId, GDB_ST.OFF)
|
|
' se lama devo ruotare -90 deg attorno a Z+
|
|
If m_Type = MCH_TY.SAW_STD Then
|
|
EgtRotate(EgtGetFirstGroupInGroup(GDB_ID.ROOT), Point3d.ORIG(), Vector3d.Z_AX(), -90, GDB_RT.GLOB)
|
|
End If
|
|
' salvo il modello
|
|
Dim z = EgtGetCurrentContext()
|
|
Dim bOk As Boolean = EgtSaveFile(sPath, NGE.CMPTEXT)
|
|
Dim e = EgtGetCurrentContext()
|
|
' eseguo controrotazione per lama
|
|
If m_Type = MCH_TY.SAW_STD Then
|
|
EgtRotate(EgtGetFirstGroupInGroup(GDB_ID.ROOT), Point3d.ORIG(), Vector3d.Z_AX(), 90, GDB_RT.GLOB)
|
|
End If
|
|
' ripristino visualizzazione layer aux
|
|
EgtSetStatus(nAuxId, GDB_ST.ON_)
|
|
' salvo nome del disegno utensile
|
|
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
|
|
EgtTdbSetCurrToolParam(MCH_TP.DRAW, sDrawName)
|
|
EgtTdbSaveCurrTool()
|
|
Return bOk
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
#End Region ' ToolSceneUpdate
|
|
|
|
#Region "IDataErrorInfo Members"
|
|
|
|
Private ReadOnly Property IDataErrorInfo_Error() As String Implements IDataErrorInfo.Error
|
|
Get
|
|
Return Nothing
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property IDataErrorInfo_Item(ByVal propertyName As String) As String Implements IDataErrorInfo.Item
|
|
Get
|
|
ErrorOnTool = True
|
|
Return Me.GetValidationError(propertyName)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' IDataErrorInfo Members
|
|
|
|
#Region "Validation"
|
|
|
|
''' <summary>
|
|
''' Returns true if this object has no validation errors.
|
|
''' </summary>
|
|
Public ReadOnly Property IsValid() As Boolean
|
|
Get
|
|
For Each [property] As String In ValidatedProperties
|
|
If GetValidationError([property]) IsNot Nothing Then
|
|
Return False
|
|
End If
|
|
Next [property]
|
|
|
|
Return True
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property IsModified() As Boolean
|
|
Get
|
|
Return m_IsModifiedCorr OrElse m_IsModifiedExit OrElse m_IsModifiedCornRad OrElse m_IsModifiedDiam OrElse m_IsModifiedFeed OrElse m_IsModifiedEndFeed _
|
|
OrElse m_IsModifiedStartFeed OrElse m_IsModifiedTipFeed OrElse m_IsModifiedLen OrElse m_IsModifiedTotLen OrElse m_IsModifiedMaxMat OrElse m_IsModifiedLonOffset _
|
|
OrElse m_IsModifiedRadOffset OrElse m_IsModifiedSpeed OrElse m_IsModifiedSideAng OrElse m_IsModifiedMaxSpeed OrElse m_IsModifiedThick OrElse m_IsModifiedMaxAbsorption _
|
|
OrElse m_IsModifiedMinFeed OrElse m_IsModifiedDraw OrElse m_IsModifiedHead OrElse m_IsModifiedName OrElse m_IsModifiedUserNotes OrElse m_IsModifiedTcPos
|
|
End Get
|
|
End Property
|
|
|
|
Private Shared ReadOnly ValidatedProperties() As String = {"Draw", "MaxMat", "Thick", "Diam", "Len", "TotLen", "Speed", "NamePar"}
|
|
|
|
Private Function GetValidationError(ByVal propertyName As String) As String
|
|
If Array.IndexOf(ValidatedProperties, propertyName) < 0 Then
|
|
Return Nothing
|
|
End If
|
|
|
|
Dim [error] As String = Nothing
|
|
|
|
Select Case propertyName
|
|
Case "Draw"
|
|
[error] = Me.ValidateDraw()
|
|
Case "MaxMat"
|
|
[error] = Me.ValidateMaxMat()
|
|
Case "Diam"
|
|
[error] = Me.ValidateDiam()
|
|
Case "Thick"
|
|
[error] = Me.ValidateThick()
|
|
Case "Len"
|
|
[error] = Me.ValidateLen()
|
|
Case "TotLen"
|
|
[error] = Me.ValidateTotLen()
|
|
Case "Speed"
|
|
[error] = Me.ValidateSpeed()
|
|
Case "NamePar"
|
|
[error] = Me.ValidateName()
|
|
|
|
Case Else
|
|
'Debug.Fail("Unexpected property being validated on Tool: " & propertyName)
|
|
End Select
|
|
Return [error]
|
|
End Function
|
|
|
|
Private Function ValidateDraw() As String
|
|
If bDrawNameError Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 2)
|
|
End If
|
|
If bDrawNameExistError Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 3)
|
|
End If
|
|
If bToolMakerError Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 4)
|
|
End If
|
|
If bDrawingError Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 5)
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateMaxMat() As String
|
|
If Not IsNothing(m_MaxMat) Then
|
|
Dim dMaxMat As Double = 0
|
|
StringToLen(m_MaxMat, dMaxMat)
|
|
If dMaxMat < EPS_SMALL Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 6)
|
|
End If
|
|
If Not IsNothing(m_Len) Then
|
|
Dim dLen As Double = 0
|
|
StringToLen(m_Len, dLen)
|
|
If dMaxMat > dLen + EPS_SMALL Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 7)
|
|
End If
|
|
End If
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateThick() As String
|
|
If Not IsNothing(m_Thick) Then
|
|
Dim dThick As Double = 0
|
|
StringToLen(m_Thick, dThick)
|
|
If (m_Type = MCH_TY.SAW_FLAT Or m_Type = MCH_TY.SAW_STD Or m_Type = MCH_TY.MORTISE_STD) And dThick < EPS_SMALL Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 8)
|
|
End If
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateDiam() As String
|
|
If Not IsNothing(m_Diam) Then
|
|
Dim dDiam As Double = 0
|
|
StringToLen(m_Diam, dDiam)
|
|
If dDiam < EPS_SMALL Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 9)
|
|
End If
|
|
If Not IsNothing(m_TotDiam) Then
|
|
Dim dTotDiam As Double = 0
|
|
StringToLen(m_TotDiam, dTotDiam)
|
|
If dDiam > dTotDiam + EPS_SMALL Then
|
|
Return "Il diametro non può essere maggiore del diametro totale"
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateTotDiam() As String
|
|
If Not IsNothing(m_TotDiam) Then
|
|
Dim dTotDiam As Double = 0
|
|
StringToLen(m_TotDiam, dTotDiam)
|
|
If dTotDiam < EPS_SMALL Then
|
|
Return "Il diametro totale deve essere maggiore di zero"
|
|
End If
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateLen() As String
|
|
If Not IsNothing(m_Len) Then
|
|
Dim dLen As Double = 0
|
|
StringToLen(m_Len, dLen)
|
|
If dLen < EPS_SMALL Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 10)
|
|
End If
|
|
If Not IsNothing(m_TotLen) Then
|
|
Dim dTotLen As Double = 0
|
|
StringToLen(m_TotLen, dTotLen)
|
|
If dLen > dTotLen + EPS_SMALL Then
|
|
Return "La lunghezza non può essere maggiore della lunghezza totale"
|
|
End If
|
|
End If
|
|
If Not IsNothing(m_MaxMat) Then
|
|
Dim dMaxMat As Double = 0
|
|
StringToLen(m_MaxMat, dMaxMat)
|
|
If dLen < dMaxMat Then
|
|
Return "La lunghezza non può essere minore del massimo materiale"
|
|
End If
|
|
End If
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateTotLen() As String
|
|
If Not IsNothing(m_TotLen) Then
|
|
Dim dTotLen As Double = 0
|
|
StringToLen(m_TotLen, dTotLen)
|
|
If dTotLen < EPS_SMALL Then
|
|
Return "La lunghezza totale deve essere maggiore di zero"
|
|
End If
|
|
If Not IsNothing(m_Len) Then
|
|
Dim dLen As Double = 0
|
|
StringToLen(m_Len, dLen)
|
|
If dTotLen < dLen - EPS_SMALL Then
|
|
Return "La lunghezza totale non può essere minore della lunghezza"
|
|
End If
|
|
End If
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateSpeed() As String
|
|
If Not IsNothing(m_Speed) And Not IsNothing(m_MaxSpeed) Then
|
|
Dim dSpeed As Double = 0
|
|
StringToDouble(m_Speed, dSpeed)
|
|
Dim dMaxSpeed As Double = 0
|
|
StringToDouble(m_MaxSpeed, dMaxSpeed)
|
|
If Math.Abs(dSpeed) > dMaxSpeed + EPS_ZERO Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 11)
|
|
End If
|
|
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Function ValidateName() As String
|
|
If bErrorToolName Then
|
|
Return EgtMsg(MSG_TOOLSERRORS + 12)
|
|
End If
|
|
Return Nothing
|
|
End Function
|
|
|
|
Private Shared Function IsStringMissing(ByVal value As String) As Boolean
|
|
Return String.IsNullOrEmpty(value) OrElse value.Trim() = String.Empty
|
|
End Function
|
|
|
|
Private Shared Function IsNgeFile(FileName As String) As Boolean
|
|
If IsStringMissing(FileName) Then
|
|
Return False
|
|
End If
|
|
|
|
Dim pattern As String = "^.+\.(?:[nN][gG][eE])$"
|
|
|
|
Return Regex.IsMatch(FileName, pattern, RegexOptions.IgnoreCase)
|
|
End Function
|
|
|
|
#End Region ' Validation
|
|
|
|
End Class
|
|
|
|
''' <summary>
|
|
''' Class that represent a Converter that use tool type and param type, to set the visibility state of the param type.
|
|
''' </summary>
|
|
Public Class ToolParamVisibilityConverter
|
|
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_TY.NONE
|
|
Return Visibility.Hidden
|
|
Case MCH_TY.DRILL_STD
|
|
Return SharedFieldsClass.Drill_Std(CInt(parameter))
|
|
Case MCH_TY.DRILL_LONG
|
|
Return SharedFieldsClass.Drill_Long(CInt(parameter))
|
|
Case MCH_TY.SAW_STD
|
|
Return SharedFieldsClass.Saw_Std(CInt(parameter))
|
|
Case MCH_TY.SAW_FLAT
|
|
Return SharedFieldsClass.Saw_Flat(CInt(parameter))
|
|
Case MCH_TY.MILL_STD
|
|
Return SharedFieldsClass.Mill_Std(CInt(parameter))
|
|
Case MCH_TY.MILL_NOTIP
|
|
Return SharedFieldsClass.Mill_NoTip(CInt(parameter))
|
|
Case MCH_TY.MORTISE_STD
|
|
Return SharedFieldsClass.Mortise_Std(CInt(parameter))
|
|
Case MCH_TY.COMPO
|
|
Return SharedFieldsClass.Compo(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 UUID to ***** in Draw param
|
|
''' </summary>
|
|
Public Class ToolDrawUUIDConverter
|
|
Implements IValueConverter
|
|
|
|
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
|
|
If IsUUID(Path.GetFileNameWithoutExtension(value.ToString)) Then
|
|
Return ToolDrawUUIDName
|
|
Else
|
|
Return value.ToString
|
|
End If
|
|
End If
|
|
End Function
|
|
|
|
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
|
|
Return value.ToString
|
|
End Function
|
|
End Class
|