2421a0085f
- modifiche per gestire acquisizione fino a 10 assi anche con CN Siemens.
208 lines
5.5 KiB
VB.net
208 lines
5.5 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Text
|
|
Imports EgtUILib
|
|
|
|
Public Class CN_Siemens
|
|
|
|
Inherits CN_generico
|
|
|
|
#Region "ENUM States and Local Constants"
|
|
|
|
Enum eCnMode As Short
|
|
AutoM = 0
|
|
SingleM = 1
|
|
MDI = 2
|
|
Manual = 7
|
|
End Enum
|
|
|
|
Const RETURN_OK As Short = 0
|
|
Const RETURN_BAD As Short = 1
|
|
|
|
#End Region
|
|
|
|
'---------------------------------------------------------------------------------------------
|
|
|
|
Sub New()
|
|
|
|
sz_NC_error_messages = New List(Of String)
|
|
|
|
End Sub
|
|
|
|
Public Overrides Function Init() As Boolean
|
|
|
|
Call M_MMFiles.init()
|
|
|
|
Return True
|
|
|
|
End Function
|
|
|
|
Public Overrides Function Stop_Connection() As Boolean
|
|
|
|
Return M_MMFiles.Stop_Connection
|
|
|
|
End Function
|
|
|
|
Public Overrides Function ActivateProgram(n_part_program As Integer) As Short
|
|
|
|
Return M_MMFiles.ActivateProgram(n_part_program.ToString())
|
|
|
|
End Function
|
|
|
|
Public Overrides Function Delete_NC_prog(ByVal sz_filename As String) As Short
|
|
|
|
Return M_MMFiles.Delete_NC_prog(sz_filename)
|
|
|
|
End Function
|
|
|
|
Public Overrides Function DGeneralFunctions_CycleStart() As Short
|
|
|
|
Return M_MMFiles.CycleStart()
|
|
|
|
End Function
|
|
|
|
Public Overrides Function DGeneralFunctions_FeedHold() As Short
|
|
|
|
Return M_MMFiles.FeedHold()
|
|
|
|
End Function
|
|
|
|
Public Overrides Function DGeneralFunctions_Reset() As Short
|
|
|
|
Return M_MMFiles.Reset()
|
|
|
|
End Function
|
|
|
|
Public Overrides Function DGeneralFunctions_WriteCncMode(ByVal nmode As Short) As Short
|
|
|
|
Return M_MMFiles.WriteCncMode(nmode)
|
|
|
|
End Function
|
|
|
|
Public Overrides Function Download_NC_prog(ByVal sz_Pc_file_name As String, ByVal sz_NC_filen As String) As Short
|
|
|
|
Return M_MMFiles.Download_NC_prog(sz_Pc_file_name, sz_NC_filen)
|
|
|
|
End Function
|
|
|
|
Public Overrides Function SetProgramMainOrSub(bMain As Boolean) As Boolean
|
|
|
|
Dim szProgExt As String = If(bMain, "mpf", "spf")
|
|
Return M_MMFiles.SetProgramExt(szProgExt)
|
|
|
|
End Function
|
|
|
|
Public Overrides Function DPOsition_ReadOnce() As Short
|
|
|
|
Return RETURN_OK
|
|
|
|
End Function
|
|
|
|
Public Overrides Function MDI_command() As Short
|
|
|
|
Return M_MMFiles.MDI_command(sz_ManualDataInput)
|
|
|
|
End Function
|
|
|
|
Public Overrides Sub set_OP_OM(ByVal n As Short)
|
|
|
|
Call M_MMFiles.set_OP_OM(n)
|
|
|
|
End Sub
|
|
|
|
Public Overrides Function read_active_mode() As Int16
|
|
'EgtOutLog("Modo attivo: " & M_MMFiles.SiemensRet.n_param2)
|
|
'Return M_MMFiles.read_active_mode()
|
|
Return CShort(M_MMFiles.SiemensRet.n_param2)
|
|
End Function
|
|
|
|
Public Overrides Function Is_G24_active() As Boolean
|
|
|
|
Return M_MMFiles.SiemensRet.b_interf_G24
|
|
|
|
End Function
|
|
|
|
Public Overrides Function Is_G71_active() As Boolean
|
|
|
|
Return M_MMFiles.SiemensRet.b_interf_G71
|
|
|
|
End Function
|
|
|
|
Public Overrides Sub ReadEls_Add_Parameter(ByVal sz_var As String, ByVal n_par As Short)
|
|
|
|
Dim n_var As Short
|
|
If Not Short.TryParse(sz_var, n_var) Then Return
|
|
|
|
Dim n_ret As Short = M_MMFiles.Read_Nc_var(n_var)
|
|
If n_ret = RETURN_OK Then
|
|
n_DReadELS_handle = n_par
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Overrides Sub DVariables_WriteVariables(ByVal sz_parameters As String, ByVal sz_values As String)
|
|
End Sub
|
|
|
|
Public Overrides Sub DVariables_WriteVariables2(ByVal sz_parameters As String, ByVal sz_values As String)
|
|
|
|
Dim n_var As Short
|
|
If Not Short.TryParse(sz_parameters, n_var) Then Return
|
|
Dim n_value As Short
|
|
If Not Short.TryParse(sz_values, n_value) Then Return
|
|
|
|
Dim n_ret As Short = Write_Nc_var(n_var, n_value)
|
|
|
|
End Sub
|
|
'
|
|
'---------------------------------------------------------------------------------------------
|
|
' non necessarie....adesso .....
|
|
'
|
|
Public Overrides Function Write_var_1(ByVal sz_par As String, ByVal lvalue As Long) As Short
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function DTool_set_read_range(ByVal n_start As Short, ByVal n_stop As Short) As Short
|
|
' non necessaria
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function DTool_write_tool(ByVal n_tool_number As Short, ByVal Length_X As Double, ByVal Radius As Double, ByVal TipRadius_Z As Double, ByVal DLength_X As Double, ByVal DTipRadius_Z As Double, ByVal nDirection As Short, ByVal nType As Short, ByVal nH As Integer) As Short
|
|
' non necessaria
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function Upload_NC_prog(ByVal sz_PC_filename As String, ByVal sz_NC_filename As String) As Short
|
|
' non necessaria
|
|
Return 0
|
|
End Function
|
|
|
|
Public Overrides Function Is_G26_active() As Boolean
|
|
' non necessaria
|
|
Return False
|
|
End Function
|
|
|
|
Public Overrides Function get_free_memory(ByVal n_zone As Int16) As Long
|
|
' non necessaria
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function get_program_status() As Int16
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function get_plc_messages() As Int16
|
|
Return RETURN_OK
|
|
End Function
|
|
|
|
Public Overrides Function VerifyAxis(ByRef nAx As Integer) As Boolean
|
|
' Identificativo deve essere nei limiti previsti
|
|
If nAx < 0 Or nAx > M_MMFiles.MAX_AXIS_ID Then Return False
|
|
' Numero assi non deve superare il massimo
|
|
If M_MMFiles.m_Axes_Id.Count() > MAX_AXES Then Return False
|
|
' Assegno i dati
|
|
M_MMFiles.m_Axes_Id.Add(nAx)
|
|
nAx = M_MMFiles.m_Axes_Id.Count() - 1
|
|
Return True
|
|
End Function
|
|
|
|
End Class
|