Compare commits

..

25 Commits

Author SHA1 Message Date
Nicola Pievani 6863186e07 Aggiunto nuovo parametro per tastatura 2023-05-04 14:37:17 +02:00
Nicola Pievani b434f80030 Correzione gestione Z safe, cambio versione 2.5e1 2023-05-03 18:09:58 +02:00
Nicola Pievani 959fb2e44f Aggiornamento versione 2.5d3 2023-04-28 12:43:13 +02:00
Nicola Pievani 941e7837be Aggiunta variabile DripFeed al CN_generico per NumOld 2023-04-28 12:16:28 +02:00
Nicola Pievani 680505af10 Merge branch 'Features/CN_Fanuc' into develop 2023-04-19 16:44:38 +02:00
Nicola Pievani b0bfa67d2a Aggiornamento assi macchina in taglio singolo 2023-04-19 16:44:04 +02:00
Nicola Pievani 29d8c1e29b Nascondo pezzi in parcheggio dopo ripristino fase 1 2023-04-19 13:20:45 +02:00
Nicola Pievani e5d4f223f8 Gestione generazione CN durante simulazione 2023-04-18 18:08:03 +02:00
Nicola Pievani 3cfc7276c9 Gestione scrittura valore FeedHold letto da configurazione 2023-04-18 15:53:28 +02:00
Nicola Pievani 0c0233b27e Correzione generazione CN in simulazione 2023-04-18 15:12:07 +02:00
Nicola Pievani 4e8925515d Corretto il valore di ritorno di alcune funzioni 2023-04-18 12:37:42 +02:00
Nicola Pievani 3b552b2f4e Disabilito inversione tagli diretti 2023-04-17 18:27:38 +02:00
Nicola Pievani 0d4d853834 Salvataggio nelle info progetto C axes home 2023-04-13 15:13:08 +02:00
Nicola Pievani 37fcbe8240 Aggiornato disegno ToolChangerPos 2023-04-13 11:14:27 +02:00
Nicola Pievani 4393f282b7 Aggiornamento di versione 2.5d2 2023-04-12 12:09:23 +02:00
Nicola Pievani 6844a8c77c Merge branch 'Features/CN_Fanuc' into develop 2023-04-12 12:07:41 +02:00
Nicola Pievani 659405c52f Testato codice con controllo FANUC 2023-04-12 12:07:04 +02:00
Nicola Pievani 6905a8d6dc Aggiornamento versione 2023-04-07 10:01:07 +02:00
Nicola Pievani d8ba23894e Merge branch 'Features/CN_Fanuc' into develop 2023-04-07 09:55:49 +02:00
Nicola Pievani aba1572f95 Gestione comunicazione FANUC 2023-04-07 09:55:29 +02:00
Nicola Pievani fdb0ed598b Aggiunto commento 2023-03-27 18:51:22 +02:00
Nicola Pievani 4cb3518346 Gestione lettura variabili Vacuum 2023-03-27 18:50:33 +02:00
Nicola Pievani 56b8ee88d3 Inseriti commenti nella nuove classi Fanuc 2023-03-27 15:38:27 +02:00
Nicola Pievani d0439f2b05 Configurazione cn FANUC 2023-03-27 11:40:36 +02:00
Nicola Pievani 997e8c380d Migliorata gestione pulsantiera comandi diretti 2023-03-20 14:52:28 +01:00
32 changed files with 14585 additions and 87 deletions
+2
View File
@@ -189,6 +189,8 @@ Module ConstGen
Public Const INFO_TOPRODAREA As String = "ToProdArea"
' Info per nome progetti
Public Const INFO_PROJNAME As String = "ProjName"
' Info per parcheggio asse C
Public Const INFO_CAXESHOME As String = "CAxesHome"
' Nome layer delle regioni
Public Const NAME_REGION As String = "Region"
+1
View File
@@ -332,6 +332,7 @@ Module ConstIni
Public Const K_DC_TEST_OFFSET As String = "TestOffset"
Public Const K_DC_OFFSET_SQUARING As String = "OffsetSquaring"
Public Const K_DC_EXTRA_LEN_SQUARING As String = "ExtraLenSquaring"
Public Const K_ENABLEINVERT As String = "EnableInvert"
Public Const S_STATDATA As String = "StatData"
Public Const K_SD_DAY As String = "Day"
+10
View File
@@ -46,6 +46,13 @@
Public Const K_THREADSLEEP As String = "ThreadSleep"
Public Const K_PHOTODELEY As String = "PhotoDeley"
Public Const S_NCFANUC As String = "NcFanuc"
Public Const K_SETNCMODE As String = "SetNcMode"
Public Const K_BASEADDRINT As String = "BaseAddrInt"
Public Const K_BASEADDRBIT As String = "BaseAddrBit"
Public Const K_NUMVARINT As String = "NumVarInt"
Public Const K_NUMVARBIT As String = "NumVarBit"
Public Const S_EXECLUA As String = "ExecLua"
Public Const K_FILESCRIPT_LUA As String = "FileScript"
@@ -78,6 +85,7 @@
Public Const K_TABLEDOWN As String = "TableDown"
Public Const K_MANUAL As String = "Manual"
Public Const K_DOORCLOSED As String = "DoorClosed"
Public Const K_DOOROPENDED As String = "DoorOpened"
Public Const K_LIMITZ As String = "LimitZ"
Public Const K_POWEROVR As String = "PowerOvr"
Public Const K_PARKING As String = "Parking"
@@ -112,6 +120,7 @@
Public Const K_FEEDHOLD As String = "FeedHold"
Public Const K_SPOTLIGHT1 As String = "SpotLight1"
Public Const K_SPOTLIGHT2 As String = "SpotLight2"
Public Const K_NAXES As String = "nAxes"
' Nuove variabili
Public Const K_SPEEDHOLD As String = "SpeedHold"
Public Const K_XYJOG As String = "XYJog"
@@ -270,6 +279,7 @@
Public Const S_MACH_PROBING As String = "Probing"
Public Const K_PROBINGSTATEVAR As String = "ProbingStateVar"
Public Const K_SAWDIAMETER As String = "SawDiameter"
Public Const K_TOOLLENGTH As String = "ToolLength"
Public Const K_RAWTHICKNESS As String = "RawThickness"
Public Const K_ENABLERAWPROBE As String = "EnableRawProbe"
+5 -2
View File
@@ -140,8 +140,11 @@ Public Class ControlsDirectCutUC
Return
End If
' Caso standard
m_ActiveDirectCutPage = DirectCutPages.DirectCut
If m_MainWindow.m_DirectCutPageUC.m_ActiveControl <> DirectCutPageUC.Controls.MachineButtonUC Or
m_MainWindow.m_DirectCutPageUC.m_ActiveControl <> DirectCutPageUC.Controls.VacuumButtonUC Then
' Caso standard
m_ActiveDirectCutPage = DirectCutPages.DirectCut
End If
' Attivo le lavorazioni solo se esiste il grezzo e se presente testa H1
Dim bRawOk As Boolean = (GetRawHeight() > EPS_SMALL)
+70 -14
View File
@@ -76,6 +76,11 @@ Public Class ControlsMachineButtonUC
End If
End Sub
#Region "STATE CHANGED"
' ------------------------------------------------------------------------------
' i segeunti metodi notificano il cambiamento di stato di specifici bottoni
'-------------------------------------------------------------------------------
Friend Sub SpindleStateChanged(SpindleState As Boolean)
Dim SpindleButton As TwoStateButton = Nothing
For Each MachineButton As MachineButton In m_ButtonList
@@ -255,38 +260,34 @@ Public Class ControlsMachineButtonUC
Dim DoorOpenedButton As ThreeStateButton = Nothing
For Each MachineButton As MachineButton In m_ButtonList
If MachineButton.StateFlag = K_DOORCLOSED Then
'If TypeOf MachineButton Is NoStateButton Then
' DoorClosedButton = DirectCast(MachineButton, NoStateButton)
'ElseIf TypeOf MachineButton Is TwoStateButton Then
' DoorClosedButton = DirectCast(MachineButton, TwoStateButton)
'ElseIf TypeOf MachineButton Is ThreeStateButton Then
' DoorClosedButton = DirectCast(MachineButton, ThreeStateButton)
'ElseIf TypeOf MachineButton Is DoubleCommandButton Then
' DoorClosedButton = DirectCast(MachineButton, DoubleCommandButton)
'ElseIf TypeOf MachineButton Is PressedCommandButton Then
' DoorClosedButton = DirectCast(MachineButton, PressedCommandButton)
'End If
DoorClosedButton = MachineButton
End If
If MachineButton.StateFlag = "DoorOpened" Then
If MachineButton.StateFlag = K_DOOROPENDED Then
DoorOpenedButton = MachineButton
End If
Next
' Chiusura porte (gesrtione comando Three/Two state
If Not IsNothing(DoorClosedButton) Then
Select Case DoorClosedState
Case 0
' porta aperta
DoorClosedButton.Background = Application.Current.FindResource("OmagCut_Red")
Case 1, 2
' porta in movimento/aperta
DoorClosedButton.Background = Application.Current.FindResource("OmagCut_LightGray")
End Select
End If
' Chiusura porte (gesrtione comando Three/Two state
If Not IsNothing(DoorOpenedButton) Then
Select Case DoorClosedState
Case 0
' porta aperta
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_LightGray")
Case 1
' porta in movimento
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Yellow")
Case 2
' porta chiusa
DoorOpenedButton.Background = Application.Current.FindResource("OmagCut_Green")
End Select
End If
@@ -372,6 +373,7 @@ Public Class ControlsMachineButtonUC
'End If
End Sub
#End Region ' State Range
Public Function GetPrivateProfileMachineButtons(
ByVal lpAppName As String,
@@ -569,13 +571,64 @@ Public MustInherit Class MachineButton
EgtOutLog("dopo scrittura seconda variabile")
End If
Return
Case 4
' ------------------------------------ FANUC ------------------------------------
' eventuale scrittura di linea di comando MDI
If Not String.IsNullOrEmpty(CmdString) Then
' attivo mpdalità MDI
m_CN.DGeneralFunctions_WriteCncMode(2)
System.Threading.Thread.Sleep(100)
' salvo la stringa di comando ricevuta dal file lua
m_CN.sz_ManualDataInput = CmdString
' esguo la funzione che ha il compito di scrivere il comando MDI
m_CN.MDI_command()
End If
' attivo modalità AUTO
m_CN.DGeneralFunctions_WriteCncMode(7)
System.Threading.Thread.Sleep(100)
If String.IsNullOrEmpty(EValue) Then
' EActive: impulsivo "D#####"
m_CN.NC_pulse_bit(ENumber)
EgtOutLog("Fanuc_DNumber= " & ENumber)
Else
' EActive + EValue: scrittura comando invariabile Short oppure Bit
If ENumber.Contains(".") Then
' D#####.#
Dim bEValue As Boolean
If EValue.Trim = "1" Then bEValue = True
m_CN.NC_write_var_bit(ENumber, CBool(EValue))
Else
' D#####
m_CN.NC_write_var_short(ENumber, CShort(EValue))
End If
EgtOutLog("Fanuc_DNumber= " & ENumber & " DValue= " & EValue)
End If
' eventale caricamento seconda variabile
If String.IsNullOrEmpty(EValue2) Then
' EActive: impulsivo "D#####"
m_CN.NC_pulse_bit(ENumber2)
EgtOutLog("Fanuc_DNumber= " & ENumber2)
Else
' EActive + EValue: scrittura comando invariabile Short oppure Bit
If ENumber2.Contains(".") Then
' D#####.#
Dim bEValue2 As Boolean
If EValue2.Trim = "1" Then bEValue2 = True
m_CN.NC_write_var_bit(ENumber2, CBool(EValue2))
Else
' D#####
m_CN.NC_write_var_short(ENumber2, CShort(EValue2))
End If
EgtOutLog("Fanuc_DNumber2= " & ENumber2 & " DValue2= " & EValue2)
End If
Return
End Select
End If
'--------------------------------------------------------- MDI ---------------------------------------------------------
Dim nResult As Short
' assegno la modalità di funzionamento
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
Case 1, 2, 4
nResult = m_CN.DGeneralFunctions_WriteCncMode(2) ' Modalità MDI per controlli num
Case 3
'Per il siemens non devo fare nulla
@@ -599,7 +652,7 @@ Public MustInherit Class MachineButton
m_CN.DGeneralFunctions_CycleStart()
End If
System.Threading.Thread.Sleep(300)
' riprostino la modalità manuale
' ripristino la modalità manuale..?? siucuri ??
nResult = m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
End Sub
@@ -620,6 +673,7 @@ Public MustInherit Class MachineButton
EgtTdbGetCurrToolParam(MCH_TP.FEED, dFeed)
End If
EgtLuaSetGlobNumVar("CMD.F", dFeed)
Dim dSpeed As Double = 0
If Not String.IsNullOrWhiteSpace(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text) Then
StringToDouble(m_DirectCutPage.m_ManualAxesMove.SpeedTxBx.Text, dSpeed)
@@ -628,6 +682,7 @@ Public MustInherit Class MachineButton
EgtTdbGetCurrToolParam(MCH_TP.SPEED, dSpeed)
End If
EgtLuaSetGlobNumVar("CMD.S", dSpeed)
Dim dL1, dL2, dL3, dR1, dR2 As Double
m_MainWindow.m_CNCommunication.GetAxesPositions(dL1, dL2, dL3, dR1, dR2)
EgtLuaSetGlobNumVar("CMD.L1", dL1)
@@ -789,6 +844,7 @@ Public Class NoStateButton
ExecuteMDICommand(TLuaScriptName)
End If
Else
' FANUC, SIEMENS
ExecuteMDICommand(TLuaScriptName)
End If
End Sub
+7 -2
View File
@@ -219,7 +219,10 @@
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<!--<ColumnDefinition Width="1*"/>-->
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
@@ -263,9 +266,11 @@
Style="{DynamicResource OmagCut_GradientYellowIconToggleButton}">
<Image Source="{DynamicResource ParkingImg}" Style="{StaticResource OmagCut_ScaleButtonIcon}"/>
</ToggleButton>
<!--Comando Manula/MDI-->
<Button Name="ManualModeBtn" Grid.Column="8"
<Button Name="ManualModeBtn" Grid.Column="11"
Style="{DynamicResource OmagCut_YellowGradientYellowIconButton}">
<Image Source="{DynamicResource ManualImg}" Style="{StaticResource OmagCut_ScaleButtonIcon}"/>
</Button>
+21 -7
View File
@@ -53,7 +53,7 @@ Public Class DirectCutPageUC
'Posizionemento nella griglia delle Page UserControl
m_MachineButtons.SetValue(Grid.RowProperty, 2)
m_MachineButtons.SetValue(Grid.ColumnSpanProperty, 7)
m_MachineButtons.SetValue(Grid.ColumnSpanProperty, m_MachineButtons.nCountButton)
m_ManualAxesMove.SetValue(Grid.RowProperty, 1)
m_ControlsDirectCutUC.SetValue(Grid.RowProperty, 1)
@@ -64,12 +64,18 @@ Public Class DirectCutPageUC
' verifico che sia presente almeno uno dei bottoni della nuova console (SOLO PER MACCHINA CON paragrafo [ControlMachButtons])
Dim bCollapsedNewBottonsConsole As Boolean = Not m_ControlsMachineButton.GetPrivateProfileMachineButtons("JogButtons", "Button1", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, m_MainWindow.GetMachIniFile())
m_NewMachineButtonsType = m_ControlsMachineButton.GetPrivateProfileMachineButtons(S_CONTROLMACHBUTTONS, "Button1", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, m_MainWindow.GetMachIniFile())
' verifico che sia presente almeno uno dei bottoni della nuova console (SOLO PER MACCHINA CON paragrafo [VacuumMachButtons])
Dim bCollapsedVacuumButton As Boolean = Not m_ControlsMachineButton.GetPrivateProfileMachineButtons(S_VACUUMMACHBUTTONS, "Button1", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, m_MainWindow.GetMachIniFile())
If Not m_NewMachineButtonsType Then
'Assegno MachineButtons alla pagina
LowerButtonGrid.Children.Add(m_MachineButtons)
ControlsMachineBtn.Visibility = Windows.Visibility.Collapsed
VacuumMachineBtn.Visibility = Windows.Visibility.Collapsed
End If
' se non sono configurate le ventose allora nascondo il comando
If m_NewMachineButtonsType AndAlso bCollapsedVacuumButton Then
VacuumMachineBtn.Visibility = Windows.Visibility.Collapsed
End If
' nuovi bottoni 20/05/2021 - modifica specifiche 04/08/2021
' leggo il numero di assi attivi nella macchina
@@ -209,6 +215,7 @@ Public Class DirectCutPageUC
m_ControlsMachineButton.SetValue(Grid.RowProperty, 1)
m_NewMachineButtonsType = m_ControlsMachineButton.GetPrivateProfileMachineButtons(S_CONTROLMACHBUTTONS, "Button1", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, m_MainWindow.GetMachIniFile())
MachineButtonGrid.Children.Add(m_ControlsMachineButton)
m_ActiveControl = Controls.MachineButtonUC
If VacuumMachineBtn.IsChecked Then
MachineButtonGrid.Children.Remove(m_VacuumMachineButton)
VacuumMachineBtn.IsChecked = False
@@ -221,6 +228,7 @@ Public Class DirectCutPageUC
Private Sub VacuumMachineBtn_Click(sender As Object, e As RoutedEventArgs) Handles VacuumMachineBtn.Click
If VacuumMachineBtn.IsChecked Then
MachineButtonGrid.Children.Add(m_VacuumMachineButton)
m_ActiveControl = Controls.VacuumButtonUC
If ControlsMachineBtn.IsChecked Then
MachineButtonGrid.Children.Remove(m_ControlsMachineButton)
ControlsMachineBtn.IsChecked = False
@@ -417,12 +425,14 @@ Public Class DirectCutPageUC
If m_bShowMachine Then
' aggiorno lo stato
Select Case m_nMachLook
Case MCH_LOOK.ALL
m_nMachLook = MCH_LOOK.TAB_HEAD
Case MCH_LOOK.TAB_HEAD
m_nMachLook = MCH_LOOK.TAB_TOOL
Case Else
m_nMachLook = MCH_LOOK.ALL
Case MCH_LOOK.ALL
m_nMachLook = MCH_LOOK.TAB_HEAD
Case MCH_LOOK.TAB_HEAD
m_nMachLook = MCH_LOOK.TAB_TOOL
Case MCH_LOOK.TAB_TOOL
m_nMachLook = MCH_LOOK.TAB
Case Else
m_nMachLook = MCH_LOOK.ALL
End Select
' aggiorno lo stato della macchina e la sua visualizzazione
EgtSetMachineLook(m_nMachLook)
@@ -444,8 +454,12 @@ Public Class DirectCutPageUC
m_ControlsDirectCutUC1.DirectCutPage_Unloaded(Nothing, Nothing)
Case Controls.MachineButtonUC
MachineButtonGrid.Children.Remove(m_ControlsMachineButton)
MachineButtonGrid.Children.Remove(m_ControlsDirectCutUC)
MachineButtonGrid.Children.Remove(m_ControlsDirectCutUC1)
ControlsMachineBtn.IsChecked = False
Case Controls.VacuumButtonUC
MachineButtonGrid.Children.Remove(m_ControlsMachineButton)
MachineButtonGrid.Children.Remove(m_ControlsDirectCutUC)
MachineButtonGrid.Children.Remove(m_VacuumMachineButton)
VacuumMachineBtn.IsChecked = False
End Select
+4 -1
View File
@@ -186,7 +186,10 @@ Public Class FlatteningCut
WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_MACHTYPE, m_nMachType.ToString(), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_ROTLOCK, If( m_bRotLock, "1", "0"), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_POSX, DoubleToString( m_ptTipP1.x, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_FLATT_POSY, DoubleToString( m_ptTipP1.y, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_FLATT_POSY, DoubleToString(m_ptTipP1.y, 2), m_MainWindow.GetIniFile())
' imposto la Z di sicurezza corretta
EgtMdbSetGeneralParam(MCH_GP.SAFEZ, DirectCutPageUC.m_dZSafe)
EgtMdbSave()
' Se non vado in simulazione
If Not m_bSimul Then
' Dichiaro sottopagina da non riattivare
+60
View File
@@ -7,6 +7,8 @@ Public Class MachineButtonsUC
Private m_DirectCutPage As DirectCutPageUC
Friend m_CN As CN_generico
Public nCountButton As Integer = 11
Private m_bOnlyLaser As Boolean = False
Private m_bFirst As Boolean = True
@@ -76,6 +78,9 @@ Public Class MachineButtonsUC
GetToggleButton(nIndex + 1).Visibility = Windows.Visibility.Hidden
Next
' notifico nella variabile pubblica il numero di pulsanti inseriti nella barra
nCountButton = m_nCount
' Se variabile di stato "Nothing"/"DoorOpened"/"DoorClosed" imposto immagine fissa
For nIndex As Integer = 0 To m_nCount - 1
If StateFlagArray(nIndex) = BTN_STATE_NOTHING OrElse
@@ -267,9 +272,62 @@ Public Class MachineButtonsUC
End If
Return
End If
' CONTROLLO FANUC
Case 4
' ------------------------------------ FANUC ------------------------------------
' eventuale scrittura di linea di comando MDI
If Not String.IsNullOrEmpty(CmdString) Then
' attivo mpdalità MDI
m_CN.DGeneralFunctions_WriteCncMode(2)
System.Threading.Thread.Sleep(100)
' salvo la stringa di comando ricevuta dal file lua
m_CN.sz_ManualDataInput = CmdString
' esguo la funzione che ha il compito di scrivere il comando MDI
m_CN.MDI_command()
End If
' attivo modalità AUTO
m_CN.DGeneralFunctions_WriteCncMode(7)
System.Threading.Thread.Sleep(100)
If String.IsNullOrEmpty(EValue) Then
' EActive: impulsivo "D#####"
m_CN.NC_pulse_bit(ENumber)
EgtOutLog("Fanuc_DNumber= " & ENumber)
Else
' EActive + EValue: scrittura comando invariabile Short oppure Bit
If ENumber.Contains(".") Then
' D#####.#
Dim bEValue As Boolean
If EValue.Trim = "1" Then bEValue = True
m_CN.NC_write_var_bit(ENumber, CBool(EValue))
Else
' D#####
m_CN.NC_write_var_short(ENumber, CShort(EValue))
End If
EgtOutLog("Fanuc_DNumber= " & ENumber & " DValue= " & EValue)
End If
' eventale caricamento seconda variabile
If String.IsNullOrEmpty(EValue2) Then
' EActive: impulsivo "D#####"
m_CN.NC_pulse_bit(ENumber2)
EgtOutLog("Fanuc_DNumber= " & ENumber2)
Else
' EActive + EValue: scrittura comando invariabile Short oppure Bit
If ENumber2.Contains(".") Then
' D#####.#
Dim bEValue2 As Boolean
If EValue2.Trim = "1" Then bEValue2 = True
m_CN.NC_write_var_bit(ENumber2, CBool(EValue2))
Else
' D#####
m_CN.NC_write_var_short(ENumber2, CShort(EValue2))
End If
EgtOutLog("Fanuc_DNumber2= " & ENumber2 & " DValue2= " & EValue2)
End If
Return
End Select
End If
Dim nResult As Short
' Imposto modalità MDI per controlli num
Select Case m_MainWindow.m_CNCommunication.m_nNCType
@@ -286,6 +344,8 @@ Public Class MachineButtonsUC
m_CN.DGeneralFunctions_CycleStart()
Case 3
'Per il siemens non devo fare nulla
Case 4
' Nicola: 27/03/2023 attivazione della funzione M# indicata?
End Select
If b2Start Then
+1 -1
View File
@@ -209,7 +209,7 @@ Public Class ManualAxesMoveUC
System.Threading.Thread.Sleep(150)
m_CN.DGeneralFunctions_CycleStart()
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
' m_CN.DGeneralFunctions_WriteCncMode(7) ' Modalità manuale
m_MoveClicked = False
End Sub
+53 -20
View File
@@ -1,4 +1,5 @@
Imports EgtUILib
Imports System.Windows.Threading
Imports EgtUILib
Public Class SingleCutUC
@@ -43,6 +44,10 @@ Public Class SingleCutUC
Private Const MIN_CUT_LEN As Double = 10.0
Private Const MAX_SIDE_ANG As Double = 60.0
' Costanti che indicano la modalità di acquisizione dei punti
' Utilizzato per aggiornare la posizione della macchina
Private m_RefreshTimer As New DispatcherTimer
Private Enum PT_MODE As Integer
SAW = 0
LASER = 1
@@ -68,14 +73,14 @@ Public Class SingleCutUC
SimulBtn.ToolTip = EgtMsg(MSG_CADCUTPAGEUC + 1)
OkBtn.ToolTip = EgtMsg(MSG_DIRECTCUTPAGEUC + 30)
' Carico i dati dell'ultimo taglio
m_dDepth = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_DEPTH, m_dDepth, m_MainWindow.GetIniFile())
m_dLen = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_LENGTH, m_dLen, m_MainWindow.GetIniFile())
m_dAngO = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_ANGH, m_dAngO, m_MainWindow.GetIniFile())
m_dAngV = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_ANGV, m_dAngV, m_MainWindow.GetIniFile())
m_dDepth = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_DEPTH, m_dDepth, m_MainWindow.GetIniFile())
m_dLen = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_LENGTH, m_dLen, m_MainWindow.GetIniFile())
m_dAngO = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_ANGH, m_dAngO, m_MainWindow.GetIniFile())
m_dAngV = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_ANGV, m_dAngV, m_MainWindow.GetIniFile())
m_dOffset = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_OFFSET, m_dOffset, m_MainWindow.GetIniFile())
m_bSawTh = (GetPrivateProfileInt(S_DIRECTCUTS, K_DC_SING_SAWTH, 0, m_MainWindow.GetIniFile()) <> 0)
m_ptTipP1.x = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_POSX, m_ptTipP1.x, m_MainWindow.GetIniFile())
m_ptTipP1.y = GetPrivateProfileDouble( S_DIRECTCUTS, K_DC_SING_POSY, m_ptTipP1.y, m_MainWindow.GetIniFile())
m_ptTipP1.x = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_POSX, m_ptTipP1.x, m_MainWindow.GetIniFile())
m_ptTipP1.y = GetPrivateProfileDouble(S_DIRECTCUTS, K_DC_SING_POSY, m_ptTipP1.y, m_MainWindow.GetIniFile())
End Sub
Private Sub SingleCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
@@ -92,6 +97,10 @@ Public Class SingleCutUC
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
EgtDraw()
' riavvio il timer per visualizzare la poszione della macchina
If Not IsNothing(m_RefreshTimer) Then
m_RefreshTimer.Start()
End If
Return
End If
' Disabilito registrazione progetto modificato
@@ -114,7 +123,7 @@ Public Class SingleCutUC
m_bPointP1Ok = False
m_bPointP2Ok = False
' Inizializzo primo punto acquisito dal disegno
m_ptPrev = m_ptTipP1 + ( m_ptTabOri - Point3d.ORIG())
m_ptPrev = m_ptTipP1 + (m_ptTabOri - Point3d.ORIG())
m_ptPrev.z = m_ptRawMax.z
' Disegno crocetta che indica il punto acquisito
CreateCross(m_nTempLay, m_ptPrev)
@@ -138,21 +147,40 @@ Public Class SingleCutUC
' Deseleziono bottone primo punto
Point1Btn.IsChecked = False
' la visualizzazione dei comandi è gestira dalla DirectCutPageUC richiamando la funzione ReloadParam
' la visualizzazione dei comandi è gestita dalla DirectCutPageUC richiamando la funzione ReloadParam
' forzo la macchina ad essere visibile fin da subito
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
m_MainWindow.m_DirectCutPageUC.m_nMachLook = MCH_LOOK.TAB
' Creo il timer il timer per aggiornare il posizionamento della macchina
AddHandler m_RefreshTimer.Tick, AddressOf RefreshTimer_tick
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(1000)
' Aggiorno visualizzazione
EgtDraw()
' Avvi il timer
m_RefreshTimer.Start()
End Sub
Private Sub RefreshTimer_tick()
' se è impostata la visualizzazione della sola tavola allora non aggiorno il disegno
If m_MainWindow.m_DirectCutPageUC.m_nMachLook = MCH_LOOK.TAB Then Return
' Aggiorno visualizzazione
SetMachineInCurrPos()
' Aggiorno il disegno
EgtDraw()
End Sub
Friend Sub SingleCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
' Salvo i dati correnti
WritePrivateProfileString( S_DIRECTCUTS, K_DC_SING_DEPTH, DoubleToString( m_dDepth, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_SING_LENGTH, DoubleToString( m_dLen, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_SING_ANGH, DoubleToString( m_dAngO, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_SING_ANGV, DoubleToString( m_dAngV, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_DEPTH, DoubleToString(m_dDepth, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_LENGTH, DoubleToString(m_dLen, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_ANGH, DoubleToString(m_dAngO, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_ANGV, DoubleToString(m_dAngV, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_OFFSET, DoubleToString(m_dOffset, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_SAWTH, If(m_bSawTh, "1", "0"), m_MainWindow.GetIniFile())
WritePrivateProfileString( S_DIRECTCUTS, K_DC_SING_POSX, DoubleToString( m_ptTipP1.x, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_POSX, DoubleToString(m_ptTipP1.x, 2), m_MainWindow.GetIniFile())
WritePrivateProfileString(S_DIRECTCUTS, K_DC_SING_POSY, DoubleToString(m_ptTipP1.y, 2), m_MainWindow.GetIniFile())
' Se non vado in simulazione
If Not m_bSimul Then
@@ -171,6 +199,8 @@ Public Class SingleCutUC
EgtSetMachineLook(MCH_LOOK.TAB)
EgtDraw()
End If
' interrompo il Timer per aggiornare la visualizzazione del posizionamento macchina
m_RefreshTimer.Stop()
' Dichiaro pagina non attiva
m_bActive = False
End Sub
@@ -279,7 +309,7 @@ Public Class SingleCutUC
DirectionTxBx.Text = DoubleToString(m_dAngO - m_MainWindow.m_CurrentMachine.dDeltaC, 2)
SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
' Altrimenti punto da click di mouse
' Altrimenti punto da click di mouse
Else
' Assegno punto selezionato nel disegno a m_ptTipP1
m_ptTipP1 = m_ptPrev
@@ -298,6 +328,7 @@ Public Class SingleCutUC
m_MainWindow.m_DirectCutPageUC.m_bShowMachine = True
EgtSetMachineLook(m_MainWindow.m_DirectCutPageUC.m_nMachLook)
EgtDraw()
' Seleziono il bottone per indicare che il primo punto è stato acquisito
Point1Btn.IsChecked = True
' Abilito e deseleziono secondo punto
@@ -358,7 +389,7 @@ Public Class SingleCutUC
m_dAngV = 90 - dTAngV
SideAngleTxBx.Text = DoubleToString(m_dAngV, 2)
' Altrimenti punto da click di mouse
' Altrimenti punto da click di mouse
Else
' Assegno punto selezionato nel disegno a m_ptTipP2
m_ptTipP2 = m_ptPrev
@@ -476,7 +507,7 @@ Public Class SingleCutUC
EgtDraw()
End Sub
Private Sub SawThick_Click( sender As Object, e As RoutedEventArgs) Handles SawThChBx.Click
Private Sub SawThick_Click(sender As Object, e As RoutedEventArgs) Handles SawThChBx.Click
' Recupero lo stato di check
m_bSawTh = SawThChBx.IsChecked()
' Disegno il taglio
@@ -536,9 +567,9 @@ Public Class SingleCutUC
m_CurrProjPage.SetWarningMessage( "Trial Version")
#Else
' Verifico non sia versione Ufficio
If m_MainWindow.GetKeyOption( MainWindow.KEY_OPT.OFFICE_TYPE) Then
m_CurrProjPage.SetWarningMessage( "Office Version")
Return
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.OFFICE_TYPE) Then
m_CurrProjPage.SetWarningMessage("Office Version")
Return
End If
' Verifico ci sia un taglio valido
If Not m_bCutOk Then Return
@@ -610,6 +641,8 @@ Public Class SingleCutUC
' Imposto affondamento e angolo di fianco sul taglio
EgtSetInfo(nCutId, INFO_DEPTH, m_dDepth)
EgtSetInfo(nCutId, INFO_SIDE_ANGLE, m_dAngV)
' Imposto se disabilitare l'inversine di direzione del taglio
If Not m_MainWindow.m_CurrentMachine.bEnableInvert Then EgtSetInfo(nCutId, INFO_ENABLE_INVERT, 0)
' Creo layer per crocetta di riferimento
Dim nCrossLayerId = EgtCreateGroup(nPartId)
' Aggiungo crocetta/e
+23 -1
View File
@@ -1163,6 +1163,10 @@ Public Class AlarmsPageUC
Case 3
Dim nResult As Short = m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
Case 4
' FANUC - Manual:7, Edit:1
Dim nResult As Short = m_CN.DGeneralFunctions_WriteCncMode(7)
EgtOutLog("Impostata modalità manuale: esito " & nResult.ToString)
End Select
' Recupero file LUA
EgtLuaExecFile(m_CurrentMachine.sMachDir() & "\DirectCmd\SawProbing.lua")
@@ -1185,6 +1189,12 @@ Public Class AlarmsPageUC
EgtLuaSetGlobNumVar("CMD.THICK", dToolThick * 1000)
EgtTdbGetCurrToolParam(MCH_TP.LEN, dToolLen)
EgtLuaSetGlobNumVar("CMD.LENGTH", dToolLen * 1000)
' Nuova varibile per gestione tastatura utensili Frankfurt (Polishing)
Dim nType As Integer
EgtTdbGetCurrToolParam(MCH_TP.TYPE, nType)
If m_CurrentMachine.bPolishingWheel AndAlso nType = MCH_TY.MILL_POLISHING Then
EgtLuaSetGlobStringVar("CMD.POLISHING", "1")
End If
EgtLuaSetGlobBoolVar("CMD.INCHES", m_MainWindow.m_CNCommunication.GetMachineInInches())
EgtLuaCallFunction("CMD.CmdString")
' Leggo variabili
@@ -1228,6 +1238,11 @@ Public Class AlarmsPageUC
Return
End If
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
' Se fanuc passo in modalità AUTO e attivo
If m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
Dim nResult As Short = m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
End If
' Aspetto e lo avvio
System.Threading.Thread.Sleep(300)
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
@@ -1277,6 +1292,10 @@ Public Class AlarmsPageUC
Dim bRead As Boolean = False
Dim SawDiameterNameVar As String = String.Empty
GetPrivateProfileString(S_MACH_PROBING, K_SAWDIAMETER, "", SawDiameterNameVar, m_MainWindow.GetMachIniFile())
' Se utensile non lama, allora la variabile in cui leggo il dato potrebbe essere differente
If Not ToolForProbing.m_IsSaw Then
GetPrivateProfileString(S_MACH_PROBING, K_TOOLLENGTH, SawDiameterNameVar, SawDiameterNameVar, m_MainWindow.GetMachIniFile())
End If
m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 0
For I As Integer = 0 To 20
' Devo rileggere la variabile ad ogni ciclo
@@ -1285,7 +1304,10 @@ Public Class AlarmsPageUC
If m_MainWindow.m_CNCommunication.m_CN.n_DReadELS_handle = 3 Then
bRead = True
Dim dVal As Double = m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value
dVal = dVal / 1000
' Se fanuc il dato è in mm (NON MICRON)
If m_MainWindow.m_CNCommunication.m_nNCType <> 4 Then
dVal = dVal / 1000
End If
MsgBoxStateInfo.LoadingPrBr_Value = 100
' Tastatura conclusa con successo
Dim sOut As String = EgtMsg(MSG_DIRECTCUTPAGEUC + 43) & " : " & DoubleToString(dVal, 1)
+34
View File
@@ -77,6 +77,9 @@ Public Class CurrentMachine
Private m_bPolishingWheel As Boolean = False
Private m_bWaterJet As Boolean = False
' Flag che indica se gesire l'inversione del taglio nei tagli singoli
Private m_bEnableInvetrt As Boolean = True
' Abilitazione DB WaterJet
Private m_bFromDBWaterJet As Boolean = False
@@ -752,6 +755,12 @@ Public Class CurrentMachine
End Get
End Property
Friend ReadOnly Property bEnableInvert As Boolean
Get
Return m_bEnableInvetrt
End Get
End Property
Friend Property dAdditionalTable As Double
Get
Select Case GetCurrentTable()
@@ -1200,6 +1209,8 @@ Public Class CurrentMachine
m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.ENABLE_WJ)
' possibilità di definire attacco speciale per materiali ceramici
m_bSawingSpecialLeadIn = (GetPrivateProfileInt(S_MACHININGS, K_SAWINGSPECIALLEADIN, 0, sMachIniFile) > 0)
' mantengo la direzione del taglio definita nel taglio diretto
m_bEnableInvetrt = (GetPrivateProfileInt(S_DIRECTCUTS, K_ENABLEINVERT, 1, sMachIniFile) <> 0)
' Leggo utensili correnti
' lama
@@ -1351,6 +1362,29 @@ Public Class CurrentMachine
m_nEnableBarCodeReader = GetPrivateProfileInt(S_MACH_BARCODEREADER, K_ENABLEBCR, 0, sMachIniFile)
End Sub
' Per il controllo FANUC al momento dell'inizializzazione del CN devono essere lette alcune variabili
Public Sub InitFANUC(CN_Generic As CN_generico)
' Leggo ritardo tra reset e send per NUM
m_nResetSendDelay = GetPrivateProfileInt(S_NCFANUC, K_RESETSENDDELAY, 1000, sMachIniFile)
' Leggo ritardo tra reset e send per NUM
m_nThreadSleep = GetPrivateProfileInt(S_NCFANUC, K_THREADSLEEP, 150, sMachIniFile)
' Leggo i dati strettamente correlati alla comunicazione NC-PC
Dim CN As CN_generico = CN_Generic
' Leggo l'indirizzo in cui scrivere lo stato macchina
Dim dAddNcMode As String = CN.s_addr_set_nc_mode
GetPrivateProfileString(S_NCFANUC, K_SETNCMODE, CN.s_addr_set_nc_mode, CN.s_addr_set_nc_mode, sMachIniFile)
' Leggo primo indirizzo libero delle variabili di tipo intero
CN.n_Base_addr_int_vars = GetPrivateProfileInt(S_NCFANUC, K_BASEADDRINT, CN.n_Base_addr_int_vars, sMachIniFile)
' Leggo primo indirizzo libero delle variabili di tipo bit
CN.n_Base_addr_byte_for_bits_vars = GetPrivateProfileInt(S_NCFANUC, K_BASEADDRBIT, CN.n_Base_addr_byte_for_bits_vars, sMachIniFile)
' Leggo numero di variabili di tipo intero
CN.n_num_var_int_to_read = CShort(GetPrivateProfileInt(S_NCFANUC, K_NUMVARINT, CInt(CN.n_num_var_int_to_read), sMachIniFile))
' Leggo numero di varibili di tipo bit
CN.n_num_var_byte_for_bits_to_read = CShort(GetPrivateProfileInt(S_NCFANUC, K_NUMVARBIT, CInt(CN.n_num_var_byte_for_bits_to_read), sMachIniFile))
' Leggo variabile abilitata alla gestione di FeedHold
GetPrivateProfileString(S_NCFANUC, K_SETNCMODE, CN.s_addr_feedhold, CN.s_addr_feedhold, sMachIniFile)
End Sub
Public Sub LoadWJMaterial(Optional bIsStart As Boolean = False)
Dim TempCurrMat As Material = CurrMat
' Svuoto l'attuale lista di materiali
+1 -1
View File
@@ -62,7 +62,7 @@
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Button Name="StartBtn" Style="{DynamicResource OmagCut_RightGrayGradientYellowTextButton}"/>
<Button Name="StartBtn" Style="{DynamicResource OmagCut_RightGrayGradientYellowTextButton}"/>
<Button Name="StopBtn" Grid.Column="1"
Style="{DynamicResource OmagCut_RightGrayGradientYellowTextButton}"/>
<Button Name="ResetBtn" Grid.Column="2"
+2
View File
@@ -304,6 +304,8 @@ Public Class MachineStatusUC
If m_MainWindow.m_CNCommunication.m_nNCType = 3 AndAlso m_MainWindow.m_CNCommunication.m_CN.m_IsSiemensOne Then
dSpindlePower = m_CN.d_data(0)
dSpindleOvr = m_CN.d_data(1)
ElseIf m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
dSpindlePower = m_CN.d_spindle_power / 1000
Else
dSpindlePower = m_CN.d_spindle_power
dSpindleOvr = If(m_CN.bPowerOvr > 0, m_CN.d_spindle_power / m_CN.bPowerOvr * 100, 0)
+2 -2
View File
@@ -9,7 +9,7 @@
<!-- Definizione del ToolHolderUc -->
<Grid>
<Image Source="/Resources/ToolChangerPos.png"/>
<ToggleButton Name="Tool" Width="50" Height="50" Margin="22,40,26,8" Background="#7FB4B4B4">
<ToggleButton Name="Tool" Width="50" Height="50" Margin="62,10,16,10" Background="#7FB4B4B4">
<ToggleButton.Template>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
@@ -25,7 +25,7 @@
</ToggleButton.Template>
</ToggleButton>
<TextBlock Name="PositionNameTxBl" Height="22" Width="68" FontSize="16" Margin="12,16,41,61"/>
<TextBlock Name="PositionNameTxBl" Height="22" Width="50" FontSize="16" Margin="20,40,70,53"/>
</Grid>
</UserControl>
+2 -2
View File
@@ -328,8 +328,8 @@ Class MainWindow
' Verifico abilitazione nesting automatico
m_bAutoNest = Not String.IsNullOrWhiteSpace(sNestKey)
' Recupero opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2503, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2503, 1, m_nKeyOptions)
Dim bKey As Boolean = EgtGetKeyLevel(9423, 2505, 1, m_nKeyLevel) And
EgtGetKeyOptions(9423, 2505, 1, m_nKeyOptions)
' Verifico abilitazione prodotto
Dim bProd As Boolean = GetKeyOption(KEY_OPT.CUT_BASE)
' Inizializzazione generale di EgtInterface
+2 -2
View File
@@ -62,5 +62,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.5.3.1")>
<Assembly: AssemblyFileVersion("2.5.3.1")>
<Assembly: AssemblyVersion("2.5.5.1")>
<Assembly: AssemblyFileVersion("2.5.5.1")>
+272 -12
View File
@@ -2,7 +2,8 @@
Imports System.Globalization
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports OmagCUT.Num
Imports System.IO
Imports System.Text
Public Class CNCommunication
@@ -32,6 +33,7 @@ Public Class CNCommunication
Private m_bNewDeltaData As Boolean = True
Private m_bNewVarData As Boolean = False
Private m_bTimerBusy As Boolean = False
Private m_bTimerAxesBusy As Boolean = False
Private m_IsNewConsole As Boolean = False
@@ -40,6 +42,7 @@ Public Class CNCommunication
' Timer
Private m_RefreshTimer As New DispatcherTimer
Private m_RefreshAxesFanuc As New DispatcherTimer
' Nomi e indici degli assi macchina
Private m_bAxesOk As Boolean = False
@@ -102,6 +105,12 @@ Public Class CNCommunication
m_RefreshTimer.Interval = TimeSpan.FromMilliseconds(100)
m_RefreshTimer.Start()
End If
' solo per controllo FANUC creo un timer apposito solo per la lettura degli assi
If m_nNCType = 4 Then
AddHandler m_RefreshAxesFanuc.Tick, AddressOf RefreshAxesFanucTimer_tick
m_RefreshAxesFanuc.Interval = TimeSpan.FromMilliseconds(50)
m_RefreshAxesFanuc.Start()
End If
' Leggo dati sugli assi della macchina
ReadAxesData()
@@ -118,6 +127,8 @@ Public Class CNCommunication
If m_nNCType = 3 Then
RefreshNoEvents()
ElseIf m_nNCType = 4 Then
RefreshFANUC()
Else
Refresh()
End If
@@ -130,8 +141,22 @@ Public Class CNCommunication
End Sub
Private Sub RefreshAxesFanucTimer_tick()
If Not m_bTimerAxesBusy Then
m_bTimerAxesBusy = True
m_RefreshAxesFanuc.Stop()
RefreshAxesFANUC()
m_bTimerAxesBusy = False
m_RefreshAxesFanuc.Start()
Else
Dim nDummy As Integer = 10
End If
End Sub
Private Sub ReadAxesData()
' Nomi e indici degli assi macchina
' Nomi e indici degli assi macchina: definisco il nome degli assi da satampare nella pagina MachineStatusUC
m_bAxesOk = True
GetPrivateProfileString(S_AXES, K_L1NAME, "X", m_sA1, m_MainWindow.GetMachIniFile())
m_nA1 = GetPrivateProfileInt(S_AXES, K_L1ID, 0, m_MainWindow.GetMachIniFile())
@@ -223,6 +248,11 @@ Public Class CNCommunication
m_CN = New Num.NumNC
Case 3
m_CN = New CN_Siemens
Case 4
' Fanuc
m_CN = New Fanuc.Fanuc
' proveddo a sovrscrivere i datti di comunicazione PC-NC settati di default nella classe CN_Generico
m_MainWindow.m_CurrentMachine.InitFANUC(m_CN)
End Select
' Recupero la stringa di inizializzazione della comunicazione
@@ -355,6 +385,11 @@ Public Class CNCommunication
If Not String.IsNullOrEmpty(sVal) Then m_CN.SetCnDataVar(CN_generico.CnData.Remote, sVal)
End If
' Solo per controllo FANUNC
GetPrivateProfileString(S_NCDATA, K_NAXES, "", sVal, m_MainWindow.GetMachIniFile())
m_CN.SetCnDataVar(CN_generico.CnData.nAxes, sVal)
' Inizializzo la comunicazione
m_CN.Init()
@@ -419,6 +454,17 @@ Public Class CNCommunication
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Red")
End Try
End If
Case 4
If IsNothing(m_CN) OrElse m_CN.n_state < 2 Then
' Per evitare crash con azioni verso il controllo, avvio quello di debug
m_nNCType = 0
Me.m_CN = New CN_Debug
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_Red")
Else
' ATTENZIONE: durante l'inizializzazione della classe il vettore che contiene tutti gli indirizzi di memoria non è caricato
m_CN.b_axis_events_enable = True
m_MachineStatus.MachineStatusGrid.Background = Application.Current.FindResource("OmagCut_DarkGray")
End If
End Select
' Assegno riferimento al CN alle diverse pagine
@@ -465,6 +511,7 @@ Public Class CNCommunication
m_MachineStatus.DisplayPositionDelta()
End If
' ----- INIZIO: lettura diretta di specifiche vaiabili -----
If m_CN.b_feed_changed Then
m_CN.b_feed_changed = False
m_MachineStatus.DisplayFeed()
@@ -491,6 +538,7 @@ Public Class CNCommunication
'FrmMain.LblToolRad.Text = cn.Tools(0).radius.ToString
'FrmMain.LblToolComp.Text = cn.Tools(0).comp_num.ToString
End If
' ----- FINE : lettura diretta di specifiche vaiabili -----
Select Case m_nNCType
Case 1
@@ -532,6 +580,7 @@ Public Class CNCommunication
'End If
End If
' QUESTE VARIABILI NON SONO LETTE IN QUANTO NON SONO STATE CARICATE vedere come esempio il NUM che assegna queste variabili
' Flag e variabili per bottoni macchina, che verifico solo nelle pagine in cui ci sono
If m_MainWindow.m_ActivePage = MainWindow.Pages.DirectCut Then
If m_MainWindow.m_DirectCutPageUC.m_NewMachineButtonsType Then
@@ -570,8 +619,186 @@ Public Class CNCommunication
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.CloseAllChanged(m_CN.bCloseAllState)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Open123Changed(m_CN.bOpen123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Open456Changed(m_CN.bOpen456State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close123Changed(m_CN.bClose123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close456Changed(m_CN.bClose456State)
' in assenza della configurazione delle variabili Close123 e Close456
If Not String.IsNullOrEmpty(m_CN.m_szCnDataVar(CN_generico.CnData.Close123State)) Then
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close123Changed(m_CN.bClose123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close456Changed(m_CN.bClose456State)
Else
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close123Changed(Not m_CN.bOpen123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close456Changed(Not m_CN.bOpen456State)
End If
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.BlowChanged(m_CN.bBlowState)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumOnChanged(m_CN.bVacuumOn)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumOffChanged(m_CN.bVacuumOff)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.BypassChanged(m_CN.bBypassState)
' Nuovi bottoni (uso joystick)
If m_IsNewConsole Then
m_MainWindow.m_DirectCutPageUC.XYJogChanged(m_CN.bXYJog)
m_MainWindow.m_DirectCutPageUC.ZCJogChanged(m_CN.bZCJog)
m_MainWindow.m_DirectCutPageUC.ZBJogChanged(m_CN.bZBCJog)
m_MainWindow.m_DirectCutPageUC.RemoteChanged(m_CN.bRemote)
m_MainWindow.m_DirectCutPageUC.ParkingStateChanged(m_CN.bParkingState)
End If
Else
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.SpindleStateChanged(m_CN.bSpindleState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState OrElse m_CN.bInternalCoolantState OrElse m_CN.bExternCoolantState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.LaserTracStateChanged(m_CN.bLaserTracState)
If m_CN.Is_G24_active() Then
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ThreeAxisStateChanged(False)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.FiveAxisStateChanged(True)
Else
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ThreeAxisStateChanged(True)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.FiveAxisStateChanged(False)
End If
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.DoorStateChanged(m_CN.nDoorClosedState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ParkingStateChanged(m_CN.bParkingState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.EnableZoneStateChanged(m_CN.nEnableZone)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.EnablePcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.TableUpChanged(m_CN.bTableUpState)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.TableDownChanged(m_CN.bTableDownState)
' Nuovi bottoni (uso joystick) per Area4
If m_IsNewConsole Then
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.XYJogChanged(m_CN.bXYJog)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.ZJogChanged(m_CN.bZCJog)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.BCJogChanged(m_CN.bZBCJog)
m_MainWindow.m_DirectCutPageUC.m_MachineButtons.RemoteChanged(m_CN.bRemote)
m_MainWindow.m_DirectCutPageUC.ParkingStateChanged(m_CN.bParkingState)
End If
End If
End If
If m_MainWindow.m_ActivePage = MainWindow.Pages.RawPart Then
m_MainWindow.m_RawPartPage.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
End If
' Nuove bottoni (Power Macchina)
If m_MainWindow.m_ActivePage = MainWindow.Pages.Machine Then
If m_IsNewConsole Then
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.PowerONChanged(m_CN.bPowerON)
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.PowerOFFChanged(Not m_CN.bPowerON)
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.CncModeChange(m_CN.nMachineMode)
End If
m_MainWindow.m_MachinePageUC.m_MachineCNPageUC.CncModeChange(m_CN.nMachineMode)
End If
If m_MainWindow.m_ActivePage = MainWindow.Pages.WorkInProgress Then
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.SpindleStateChanged(m_CN.bSpindleState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.CoolantStateChanged(m_CN.bCoolantState OrElse m_CN.bInternalCoolantState OrElse m_CN.bExternCoolantState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.LaserTracStateChanged(m_CN.bLaserTracState)
If m_CN.Is_G24_active() Then
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.ThreeAxisStateChanged(False)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.FiveAxisStateChanged(True)
Else
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.ThreeAxisStateChanged(True)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.FiveAxisStateChanged(False)
End If
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.DoorStateChanged(m_CN.nDoorClosedState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.ParkingStateChanged(m_CN.bParkingState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.EnableZoneStateChanged(m_CN.nEnableZone)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.EnablePcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.TableUpChanged(m_CN.bTableUpState)
m_MainWindow.m_WorkInProgressPageUC.m_MachineButtons.TableDownChanged(m_CN.bTableDownState)
End If
End Sub
Private Sub RefreshAxesFANUC()
' ----- INIZIO: lettura diretta di specifiche vaiabili -----
' avvio lettura variabili da CN
m_CN.Geppo()
' notifico valori all'interfaccia
m_MachineStatus.DisplayPosition()
m_MachineStatus.DisplayPositionDelta()
m_MachineStatus.DisplayFeed()
m_MachineStatus.DisplaySpeed()
m_MachineStatus.DisplayPower()
End Sub
Private Sub RefreshFANUC()
' Copia della funzione Refresh
' ----- INIZIO: lettura diretta di specifiche vaiabili -----
'' avvio lettura variabili da CN
'm_CN.Geppo()
'' notifico valori all'interfaccia
'm_MachineStatus.DisplayPosition()
'm_MachineStatus.DisplayPositionDelta()
'm_MachineStatus.DisplayFeed()
'm_MachineStatus.DisplaySpeed()
'm_MachineStatus.DisplayPower()
' eventualmente carico messaggi di errore
ErrorList.Clear()
If m_CN.b_NC_error Then
ErrorList.Clear()
SyncLock m_CN
For Each Item As String In m_CN.sz_NC_error_messages
ErrorList.Add(Item)
Next
End SyncLock
End If
m_AlarmsPage.NcError()
' ----- FINE : lettura diretta di specifiche vaiabili -----
If m_CN.read_active_mode() <> CShort(m_nCurrMode) Then
m_nCurrMode = CInt(m_CN.read_active_mode())
m_MachineStatus.DisplayActiveMode(m_nCurrMode)
m_CN.nMachineMode = m_nCurrMode
End If
' QUESTE VARIABILI NON SONO LETTE IN QUANTO NON SONO STATE CARICATE vedere come esempio il NUM che assegna queste variabili
' Flag e variabili per bottoni macchina, che verifico solo nelle pagine in cui ci sono
If m_MainWindow.m_ActivePage = MainWindow.Pages.DirectCut Then
If m_MainWindow.m_DirectCutPageUC.m_NewMachineButtonsType Then
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.SpindleStateChanged(m_CN.bSpindleState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.LaserStateChanged(m_CN.bLaserState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.LaserTracStateChanged(m_CN.bLaserTracState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.CoolantStateChanged(m_CN.bCoolantState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.InternalCoolantStateChanged(m_CN.bInternalCoolantState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.ExternCoolantStateChanged(m_CN.bExternCoolantState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.CBAxesStateChanged(m_CN.bCBAxesState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.AirBlowStateChanged(m_CN.bAirBlowState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.HomeStateChanged(m_CN.bHomeState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.TableUpChanged(m_CN.bTableUpState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.TableDownChanged(m_CN.bTableDownState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.DoorClosedChanged(m_CN.nDoorClosedState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.LimitZChanged(m_CN.bLimitZState)
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.FiveAxisStateChanged(m_CN.Is_G24_active())
m_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.ParkingStateChanged(m_CN.bParkingState)
'm_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.ZoneStateChanged(m_CN.nEnableZone)
'm_MainWindow.m_DirectCutPageUC.m_ControlsMachineButton.PcStateChanged(m_CN.nEnablePc)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumUpChanged(m_CN.bVacuumUp)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumDownChanged(m_CN.bVacuumDown)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum2UpChanged(m_CN.bVacuum2Up)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum2DownChanged(m_CN.bVacuum2Down)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum0Changed(m_CN.bVacuum0)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum90Changed(m_CN.bVacuum90)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum1Changed(m_CN.bVacuum1State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum2Changed(m_CN.bVacuum2State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum3Changed(m_CN.bVacuum3State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum4Changed(m_CN.bVacuum4State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum5Changed(m_CN.bVacuum5State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum6Changed(m_CN.bVacuum6State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum135Changed(m_CN.bVacuum135State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Vacuum246Changed(m_CN.bVacuum246State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.OpenAllChanged(m_CN.bOpenAllState)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.CloseAllChanged(m_CN.bCloseAllState)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Open123Changed(m_CN.bOpen123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Open456Changed(m_CN.bOpen456State)
' in assenza della configurazione delle variabili Close123 e Close456
If Not String.IsNullOrEmpty(m_CN.m_szCnDataVar(CN_generico.CnData.Close123State)) Then
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close123Changed(m_CN.bClose123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close456Changed(m_CN.bClose456State)
Else
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close123Changed(Not m_CN.bOpen123State)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.Close456Changed(Not m_CN.bOpen456State)
End If
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.BlowChanged(m_CN.bBlowState)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumOnChanged(m_CN.bVacuumOn)
m_MainWindow.m_DirectCutPageUC.m_VacuumMachineButton.VacuumOffChanged(m_CN.bVacuumOff)
@@ -929,20 +1156,50 @@ Public Class CNCommunication
EgtOutLog(TimeSpanEnd())
' Attesa opportuna
System.Threading.Thread.Sleep(100)
ElseIf m_nNCType = 4 Then
' FANUC: imposto modalità EDIT
bOk = bOk AndAlso (m_CN.DGeneralFunctions_WriteCncMode(1) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
End If
EgtOutLog("Download_NC_prog(sCncPath, sNumProg)")
' -------------- START DOWNLOAD --------------
TimeSpanInit()
bOk = bOk AndAlso (m_CN.Download_NC_prog(sCncPath, sNumProg) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' FANUC: genero un file 901 vuoto da aspedire, attivare; poi rispedisco il file 900
If m_nNCType = 4 And Not bOk Then
bOk = True
Dim sCncPath1 As String = m_MainWindow.GetCncDir() & "\PlaceHolder" & m_MainWindow.m_CurrentMachine.sIsoFileExt
Dim fs As FileStream = File.Create(sCncPath1)
' Add text to the file.
Dim info As Byte() = New UTF8Encoding(True).GetBytes(vbLf & "(PlaceHolder)")
fs.Write(info, 0, info.Length)
fs.Close()
bOk = bOk AndAlso (m_CN.Download_NC_prog(sCncPath1, "901") = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
If bActivate Then
bOk = bOk AndAlso (m_CN.ActivateProgram("901") = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
End If
' riprovo ad eseguire il programma 900
bOk = True
bOk = bOk AndAlso (m_CN.Download_NC_prog(sCncPath, sNumProg) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(m_MainWindow.m_CurrentMachine.nThreadSleep)
End If
EgtOutLog("Nc Type : " & m_nNCType.ToString)
EgtOutLog("IsDripFeed : " & DirectCast(m_CN, NumNCOld).bIsDripFeed)
If m_nNCType = 1 AndAlso TypeOf m_CN Is NumNCOld AndAlso DirectCast(m_CN, NumNCOld).bIsDripFeed Then
' eventauli cambi di stato sono trattati all'interno della funzione
' AXIUM (NUM OLD): se DripFeed non esegluo attivazione programma)
If m_nNCType = 1 AndAlso m_CN.bIsDripFeed Then
' eventauli cambi di stato sono trattati all'interno della funzione DownLoad_NC_prog
Return True
End If
EgtOutLog(TimeSpanEnd())
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' -------------- END DOWNLOAD --------------
' -------------- START ACTIVATE --------------
' Se richiesta attivazione
If bActivate Then
' Attivazione programma
@@ -952,13 +1209,16 @@ Public Class CNCommunication
EgtOutLog(TimeSpanEnd())
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' Attivo la modalità AUTO prima per preparar il cyclo start
bOk = bOk AndAlso (m_CN.DGeneralFunctions_WriteCncMode(0) = 0)
' Attesa opportuna
System.Threading.Thread.Sleep(100)
' Modalità automatica
EgtOutLog("DGeneralFunctions_WriteCncMode(0)")
TimeSpanInit()
bOk = bOk AndAlso (m_CN.DGeneralFunctions_WriteCncMode(0) = 0)
EgtOutLog(TimeSpanEnd())
End If
' -------------- END ACTIVATE --------------
' Messaggio con risultato
If bOk Then
m_CurrProjPage.SetInfoMessage(EgtMsg(90317)) 'Programma CN trasmesso con successo
+63 -4
View File
@@ -8,7 +8,7 @@ Public MustInherit Class CN_generico
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 = 55 ' Numero di dati del CN (Speed,Feed,...)
Public Const NUM_DATA = 56 ' Numero di dati del CN (Speed,Feed,...)
Public m_NewVariable As Boolean = False ' per scrittura delle vairbaili Apllication del PLC
@@ -70,8 +70,18 @@ Public MustInherit Class CN_generico
Parking = 52
EnableZone = 53
EnablePC = 54
nAxes = 55
End Enum
Public Enum Type As Short
TBoolean = 0
TInteger = 1
TLong = 2
TDouble = 3
TString = 4
End Enum
#End Region
#Region " Struct"
@@ -218,10 +228,27 @@ Public MustInherit Class CN_generico
Public bRemote As Boolean
' Nuovi di bottoni -------------------------------------------
' solo per NumOld
Public bIsDripFeed As Boolean = False
' usato nel FANUC per leggere lo stato macchina se 5 assi attivo
Public b5AxesActive As Boolean
Public nMachineMode As Integer
Public m_szCnDataVar(NUM_DATA - 1) As String
'
' nuovi dal 29-III-2023 per Fanuc
'
Public n_Base_addr_int_vars As Integer = 59800
Public n_Base_addr_byte_for_bits_vars As Integer = 59820
Public n_num_var_int_to_read As Short = 10
Public n_num_var_byte_for_bits_to_read As Short = 30
Public s_addr_set_nc_mode As String = "D59825"
Public s_addr_feedhold As String = "D59850.6"
'
' Eventi
'
Public Event NewPositionData(ByVal sender As Object)
Public Event NewPosDeltaData(ByVal sender As Object)
Public Event NewVarChanged(ByVal sender As Object)
@@ -294,8 +321,8 @@ Public MustInherit Class CN_generico
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, _
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
@@ -341,4 +368,36 @@ Public MustInherit Class CN_generico
#End Region
#Region " Nuovi metodi pubblici"
Public Overridable Function NC_read_var_short(VarAddr As String, ByRef value As Short) As Boolean
Return False
End Function
Public Overridable Function NC_read_var_short_range(VarStartAddr As String, VarEndAddr As String, ByRef values() As Short) As Boolean
Return False
End Function
Public Overridable Function NC_write_var_short(VarAddr As String, ByRef value As Short) As Boolean
Return False
End Function
Public Overridable Function NC_read_var_bit(VarAddr As String, ByRef value As Boolean) As Boolean
Return False
End Function
Public Overridable Function NC_write_var_bit(VarAddr As String, ByRef value As Boolean) As Boolean
Return False
End Function
Public Overridable Function NC_pulse_bit(VarAddr As String) As Boolean
Return False
End Function
Public Overridable Function Geppo() As Boolean
Return False
End Function
#End Region
End Class
+1711
View File
File diff suppressed because it is too large Load Diff
+1351
View File
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -12,16 +12,13 @@ Imports EgtUILib
Imports System.IO
Imports System.Threading
Imports System.Windows.Threading
Imports System.Reflection.Emit
Imports System.Drawing.Text
Imports OmagCUT.CN_Siemens
Namespace Num
Public Class NumNCOld
Inherits CN_generico
Public bIsDripFeed As Boolean = False
'Public bIsDripFeed As Boolean = False
' costruisco il riferimento alla pagina principale
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
' costruisco il riferimento alla barra ProjectMng
+10794
View File
File diff suppressed because it is too large Load Diff
+13 -5
View File
@@ -122,11 +122,13 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\EgtProg\DllD32\EgtUILib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib">
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib.dll</HintPath>
<Reference Include="EgtWPFLib, Version=2.5.2.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\EgtProg\Dll32\EgtWPFLib.dll</HintPath>
</Reference>
<Reference Include="EgtWPFLib5">
<HintPath>..\..\EgtProg\OmagCUT\EgtWPFLib5.dll</HintPath>
<Reference Include="EgtWPFLib5, Version=2.5.2.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\EgtProg\Dll32\EgtWPFLib5.dll</HintPath>
</Reference>
<Reference Include="Interop.FXLib">
<HintPath>..\..\EgtProg\OmagCUT\Interop.FXLib.dll</HintPath>
@@ -225,6 +227,9 @@
<Compile Include="Machine\WaterJetPageUC.xaml.vb">
<DependentUpon>WaterJetPageUC.xaml</DependentUpon>
</Compile>
<Compile Include="NcComm\fwlib32.vb" />
<Compile Include="NcComm\M_Fanuc.vb" />
<Compile Include="NcComm\M_Fanuc_hi.vb" />
<Compile Include="Project\AddToDataBaseUC.xaml.vb">
<DependentUpon>AddToDataBaseUC.xaml</DependentUpon>
</Compile>
@@ -896,7 +901,7 @@
<Resource Include="Resources\MachineStatusImage\Single.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ToolChangerPos.png" />
<Resource Include="Resources\ToolChangerPos_OLD.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Manual.png" />
@@ -1322,6 +1327,9 @@
<ItemGroup>
<Resource Include="Resources\NewIcons\Quality.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\ToolChangerPos.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\OmagCUT\OmagCUTR32.exe
+20 -1
View File
@@ -412,6 +412,11 @@ Public Class CurrentProjectPageUC
SetTotalArea(dTotArea)
UpdateToProduceArea()
ShowAreas()
' Salvo info di C home
Dim dCHome As Double
EgtGetAxisHomePos("C", dCHome)
EgtSetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, DoubleToString(dCHome, 0))
EgtZoom(ZM.ALL)
' Dichiaro progetto non modificato
EgtResetModified()
Return True
@@ -522,7 +527,21 @@ Public Class CurrentProjectPageUC
m_MainWindow.m_CurrentMachine.dAdditionalTable = dValue
End If
' forzo visualizzazione eventuali dati su aree
SetAreasStatus( True)
SetAreasStatus(True)
' Recupero info C Home
Dim dCHomeCurrMach As Double
Dim dCHomeCurrproj As Double
EgtGetAxisHomePos("C", dCHomeCurrMach)
' Verifico che esista l'info del progetto
If EgtExistsInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME) Then
EgtGetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, dCHomeCurrproj)
' Se la macchina indicata ha C Home differente allora comunico un errore del progetto
If Math.Abs(dCHomeCurrproj - dCHomeCurrMach) > EPS_ANG_SMALL Then
EgtOutLog(" WARNING -> C axes home project is different from current machine, delta ang C home:" & DoubleToString(dCHomeCurrproj - dCHomeCurrMach, 2))
End If
Else
EgtSetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, DoubleToString(dCHomeCurrMach, 0))
End If
' Dichiaro progetto non modificato
EgtResetModified()
Return True
+4 -1
View File
@@ -101,7 +101,6 @@ Public Class ProjectMgrUC
m_CurrProjPage.NewProject(nTabInd, bRetainParkedParts)
' Gestione stato FastGrid
m_MainWindow.m_CadCutPageUC.m_FastGridSlabManager.OnPostNewProject()
EgtZoom(ZM.ALL)
End Sub
Friend Function ChooseTable() As Integer
@@ -264,6 +263,10 @@ Public Class ProjectMgrUC
Dim nWarn As Integer = 0
ResetAllMachinings(nWarn)
If nWarn = 1 Then m_CurrProjPage.SetWarningMessage(EgtMsg(MSG_SPLITPAGEUC + 11)) ' Lama troppo grande per utilizzo ventosa
' Aggiorno Info C Home
Dim dCHome As Double
EgtGetAxisHomePos("C", dCHome)
EgtSetInfo(EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK), INFO_CAXESHOME, DoubleToString(dCHome, 0))
' Aggiorno visualizzazione
EgtDraw()
End Sub
+21
View File
@@ -2052,6 +2052,18 @@ Public Class RawPartPageUC
' Recupero origine tavola rispetto allo 0 macchina
Dim TableRef As Point3d
EgtGetTableRef(1, TableRef)
' imposto modo automatico
Select Case m_MainWindow.m_CNCommunication.m_nNCType
Case 1, 2
' in attesa di verifica
Case 3
Dim nResult As Short = m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
Case 4
' FANUC - Manual:7, Edit:1
Dim nResult As Short = m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(7)
EgtOutLog("Impostata modalità manuale: esito " & nResult.ToString)
End Select
' Recupero file LUA
EgtLuaExecFile(m_CurrentMachine.sMachDir() & "\DirectCmd\RawProbing.lua")
' Imposto parametri
@@ -2089,6 +2101,11 @@ Public Class RawPartPageUC
End If
m_MainWindow.m_CurrentProjectPageUC.ClearMessage()
EgtOutLog("RawProbing : sent NC program")
' Se fanuc passo in modalità AUTO e attivo
If m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
Dim nResult As Short = m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(0)
EgtOutLog("Impostata modalità automatica: esito " & nResult.ToString)
End If
' Aspetto e lo avvio
System.Threading.Thread.Sleep(300)
m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_CycleStart()
@@ -2154,6 +2171,10 @@ Public Class RawPartPageUC
Else
RawThickness *= ONEMM / 1000
End If
' Se fanuc il dato è in mm (NON MICRON)
If m_MainWindow.m_CNCommunication.m_nNCType = 4 Then
RawThickness *= 1000
End If
' Sottraggo eventuale spessore sovratavola
RawThickness -= m_CurrentMachine.dAdditionalTable
' Imposto spessore misurato come altezza grezzo
Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

+30
View File
@@ -567,6 +567,16 @@ Public Class SimulationPageUC
End Sub
Private Sub GenerateXPIUC_Click(sender As Object, e As RoutedEventArgs)
' eventualmente fermo la simulazione
m_nStatus = MCH_SIM_ST.UI_STOP
m_bPlay = False
PlayPauseBtn_Click(Nothing, Nothing)
' se il bottone Shift è premuto apro il file CadCut1 nel programma NotePad
Dim IsPressedShiftKey As Boolean = False
If Keyboard.Modifiers And ModifierKeys.Shift Then
IsPressedShiftKey = True
End If
Dim bOk As Boolean = True
EgtSetCurrentContext(m_CurrProjPage.CurrentProjectScene.GetCtx())
' Elimino eventuale attrezzaggio da OmagOFFICE
@@ -669,6 +679,26 @@ Public Class SimulationPageUC
Else
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
End If
' procedo all'apertura del file CadCut1 apenna generato (solo se generazione corretta)
If bOk And IsPressedShiftKey Then
Try
Process.Start("Notepad.exe", sCncPath)
Catch ex As Exception
EgtOutLog(ex.ToString)
End Try
End If
' ricarico la pagina di simulazione
EgtSetCurrPhase(1)
' nascondo i pezzi in parcheggio
HideParkedParts(True)
' Avvio ambiente di simulazione
EgtSimInit()
EgtSimStart()
' Imposto stato corrente
SetStatus(MCH_SIM_ST.UI_STOP)
m_bPlay = True
' Costringo ad aggiornare UI
UpdateUI()
End Sub
Private Function ProcessEvents(nProg As Integer, nPause As Integer) As Integer
+5 -5
View File
@@ -20,12 +20,12 @@ Module Utility
Friend StopWatch As Stopwatch
Friend Sub TimeSpanInit()
StopWatch = New Stopwatch
StopWatch.Start()
End Sub
Friend Sub TimeSpanInit()
StopWatch = New Stopwatch
StopWatch.Start()
End Sub
Friend Function TimeSpanEnd()
Friend Function TimeSpanEnd()
Dim sTime As String = ""
If Not IsNothing(StopWatch) Then
StopWatch.Stop()