Files
OmagCUT/CN_generico.vb
T
Emmanuele Sassi 83f761d713 OmagCUT :
- correzioni e miglioramenti a pagine ControlsMachineButtonUC e VacuumMachineButtonUC.
2019-06-11 17:00:26 +00:00

257 lines
7.6 KiB
VB.net

Imports System.Collections.ObjectModel
Public MustInherit Class CN_generico
#Region " Constants"
Public Const MAX_AXES As Short = 10
Public Const MAX_VAR As Short = 100
Public Const MAX_VALUES As Short = 9 ' Max. index to read the data from the FXServer array
Public Const MAX_TOOLS As Short = 100
Public Const NUM_DATA = 36 ' Numero di dati del CN (Speed,Feed,...)
Public Enum CnData
Mode = 0
JogIncr = 1
Feed = 2
FeedOvr = 3
Speed = 4
SpeedOvr = 5
Power = 6
Spindle = 7
Coolant = 8
Laser = 9
PowerOvr = 10
Comm = 11
Refresh = 12
InternalCoolant = 13
ExternCoolant = 14
CBAxes = 15
AirBlow = 16
Home = 17
TableUp = 18
TableDown = 19
DoorClosed = 20
LimitZ = 21
VacuumUp = 22
VacuumDown = 23
Vacuum3State = 24
Vacuum4State = 25
Vacuum135State = 26
Vacuum246State = 27
OpenAllState = 28
CloseAllState = 29
BlowState = 30
VacuumOn = 31
BypassState = 32
Vacuum0 = 33
Vacuum90 = 34
VacuumOff = 35
End Enum
#End Region
#Region " Struct"
Public Structure ToolStructure
Public type As Char
Public lenght As Double
Public radius As Double
Public tip As Double
Public D_lenght As Double
Public D_radius As Double
Public nose_dir As String
Public comp_num As Short
End Structure
#End Region
#Region " Interface"
Public IsFlexiumPlus As Boolean = False
Public sz_CncFxIdentifier As String = ""
Public d_LinearAxisPrecision As Double
Public d_RotaryAxisPrecision As Double
Public sz_ServerInitStatus As String
Public sz_ServerReinitStatus As String
Public sz_ManualDataInput As String
Public sz_versionRTS As String
Public sz_ConnectionAddress As String
Public sz_AffaireNumber As String
Public n_state As Short = 0
Public n_validaxes As Short
Public b_axis_events_enable As Boolean = False
Public d_axis_position(MAX_AXES) As Double
Public d_axis_delta(MAX_AXES) As Double
Public b_axis_valid(MAX_AXES) As Boolean
Public d_DReadELS_value As Double
Public n_DReadELS_handle As Short
Public d_Dvariable_values(MAX_VAR) As Double
Public b_Dvariable_changed As Boolean = False
Public d_DInterpo_values(MAX_AXES) As Double
Public d_DInterpo_Prog_Feed As Double
Public d_DInterpo_Feed_override As Double
Public l_channel_override(MAX_VALUES) As Long
Public b_feed_changed As Boolean = False
Public n_activate_error_code As Short
Public d_spindle_prog(MAX_VALUES) As Double
Public d_spindle_eff(MAX_VALUES) As Double
Public n_spindle_override(MAX_VALUES) As Short
Public b_spindle_data_changed As Boolean = False
Public d_spindle_power As Double
Public b_spindle_power_changed As Boolean = False
Public Tools(MAX_TOOLS) As ToolStructure
Public b_Tool_data_changed As Boolean = False
Public sz_PLC_error_messages As String
Public sz_NC_error_messages As List(Of String)
Public b_PLC_error As Boolean
Public b_NC_error As Boolean
Public bIsErrorMessage As Boolean = True
Public bSpindleState As Boolean
Public bLaserState As Boolean
Public bCoolantState As Boolean
Public bInternalCoolantState As Boolean
Public bExternCoolantState As Boolean
Public bCBAxesState As Boolean
Public bAirBlowState As Boolean
Public bHomeState As Boolean
Public bTableUpState As Boolean
Public bTableDownState As Boolean
Public nDoorClosedState As Integer
Public bLimitZState As Boolean
Public bPowerOvr As Double
Public bVacuumUp As Boolean
Public bVacuumDown As Boolean
Public bVacuum0 As Boolean
Public bVacuum90 As Boolean
Public bVacuum3State As Boolean
Public bVacuum4State As Boolean
Public bVacuum135State As Boolean
Public bVacuum246State As Boolean
Public bOpenAllState As Boolean
Public bCloseAllState As Boolean
Public bBlowState As Boolean
Public bVacuumOn As Boolean
Public bVacuumOff As Boolean
Public bBypassState As Boolean
Public nMachineMode As Integer
Public m_szCnDataVar(NUM_DATA - 1) As String
Public Event NewPositionData(ByVal sender As Object)
Public Event NewPosDeltaData(ByVal sender As Object)
Public Event NewVarChanged(ByVal sender As Object)
Protected Overridable Sub OnNewPositionData()
RaiseEvent NewPositionData(0)
End Sub
Protected Overridable Sub OnNewPosDeltaData()
RaiseEvent NewPosDeltaData(0)
End Sub
Protected Overridable Sub OnNewVarChanged()
RaiseEvent NewVarChanged(0)
End Sub
#End Region
#Region " Metodi pubblici"
Public MustOverride Function Init() As Boolean
Public MustOverride Function Stop_Connection() As Boolean
Public MustOverride Sub ReadEls_Add_Parameter(sz_var As String, n_par As Short)
Public MustOverride Sub DVariables_WriteVariables(sz_parameters As String, sz_values As String)
Public MustOverride Sub DVariables_WriteVariables2(sz_parameters As String, sz_values As String)
Public MustOverride Function MDI_command() As Short
Public MustOverride Function ActivateProgram(n_part_program As Integer) As Int16
Public MustOverride Sub set_OP_OM(n As Short)
Public MustOverride Function DPOsition_ReadOnce() As Short
Public MustOverride Function DGeneralFunctions_CycleStart() As Int16
Public MustOverride Function DGeneralFunctions_FeedHold() As Int16
Public MustOverride Function DGeneralFunctions_Reset() As Int16
Public MustOverride Function DGeneralFunctions_WriteCncMode(nmode As Short) As Int16
Public MustOverride Function Write_var_1(sz_par As String, lvalue As Long) As Int16
Public MustOverride Function Download_NC_prog(sz_PC_filename As String, sz_NC_filename As String) As Int16
Public MustOverride Function Upload_NC_prog(sz_PC_filename As String, sz_NC_filename As String) As Int16
Public MustOverride Function Delete_NC_prog(sz_NC_filename As String) As Int16
Public MustOverride Function DTool_set_read_range(n_start As Short, n_stop As Short) As Short
Public MustOverride Function DTool_write_tool(n_tool_number As Short, Length_X As Double, Radius As Double, TipRadius_Z As Double, _
DLength_X As Double, DTipRadius_Z As Double, _
nDirection As Short, nType As Short, nH As Integer) As Short
Public Overridable Function SetProgramMainOrSub(bMain As Boolean) As Boolean
Return True
End Function
Public Overridable Function get_free_memory(n_zone As Int16) As Long
Return 0
End Function
Public Overridable Function read_active_mode() As Int16
Return 0
End Function
Public Overridable Function get_program_status() As Int16
Return 0
End Function
Public Overridable Function get_plc_messages() As Int16
Return 0
End Function
Public Overridable Function Is_G24_active() As Boolean
Return False
End Function
Public Overridable Function Is_G26_active() As Boolean
Return False
End Function
Public Overridable Function Is_G71_active() As Boolean
Return False
End Function
Public Overridable Function VerifyAxis(ByRef nAx As Integer) As Boolean
Return (nAx >= 0 And nAx <= MAX_AXES)
End Function
Public Function SetCnDataVar(nId As CnData, sVal As String) As Boolean
m_szCnDataVar(nId) = sVal
Return True
End Function
#End Region
End Class