OmagCUT :

- possibilità di avere valori assi sulla punta dell'utensile
- corretta creazione liste per combo in pagina Macchina
- spessore tavola addizionale ora gestito in CurrentMachine
- sistemazioni varie.
This commit is contained in:
Dario Sassi
2016-03-16 11:16:25 +00:00
parent ef24ce55ef
commit cbfe64775d
26 changed files with 366 additions and 229 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="768" d:DesignWidth="1280" Loaded="AlarmsPage_Loaded" Initialized="AlarmsPage_Initialized">
d:DesignHeight="768" d:DesignWidth="1280">
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
+22 -25
View File
@@ -17,7 +17,7 @@ Public Class AlarmsPageUC
Private m_bFirst As Boolean = True
'Lista che contiene le lame disponibili (per Combobox pagina Alarms)
Private m_SawList As New List(Of String)
Private m_SawList As New ObservableCollection(Of String)
Private m_DrillList As New ObservableCollection(Of String)
Private m_MillList As New ObservableCollection(Of String)
Private m_AuxToolTypeList As New List(Of StringIdCmBx)
@@ -25,7 +25,7 @@ Public Class AlarmsPageUC
' Costante per nessun utensile definito
Private Const NO_TOOL As String = "-----"
Private Sub AlarmsPage_Initialized(sender As Object, e As EventArgs)
Private Sub AlarmsPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
'Assegno liste a combobox
CurrSawCmBx.ItemsSource = m_SawList
@@ -58,7 +58,7 @@ Public Class AlarmsPageUC
SawGpBx.Header = EgtMsg(MSG_ALARMSPAGEUC + 25)
End Sub
Private Sub AlarmsPage_Loaded(sender As Object, e As RoutedEventArgs)
Private Sub AlarmsPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
If m_bFirst Then
@@ -97,18 +97,19 @@ Public Class AlarmsPageUC
Case CurrentMachine.MountedToolConfigs.SAW
' Non compio alcuna azione
Case CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL
m_AuxToolTypeList.Clear()
If m_CurrentMachine.bDrilling Then
m_AuxToolTypeList.Add(New StringIdCmBx(1, EgtMsg(MSG_ALARMSPAGEUC + 21)))
m_AuxToolTypeList.Add(New StringIdCmBx(1, EgtMsg(MSG_ALARMSPAGEUC + 21))) ' Foretto
If m_CurrentMachine.bMilling Then
m_AuxToolTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_ALARMSPAGEUC + 22)))
m_AuxToolTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_ALARMSPAGEUC + 22))) ' Fresa
End If
Else
If m_CurrentMachine.bMilling Then
m_AuxToolTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_ALARMSPAGEUC + 22)))
m_AuxToolTypeList.Add(New StringIdCmBx(2, EgtMsg(MSG_ALARMSPAGEUC + 22))) ' Fresa
End If
End If
' Aggiungo elemento nessuno in fondo alla lista
m_AuxToolTypeList.Add(New StringIdCmBx(0, EgtMsg(MSG_ALARMSPAGEUC + 20)))
m_AuxToolTypeList.Add(New StringIdCmBx(0, EgtMsg(MSG_ALARMSPAGEUC + 20))) ' Nessuno
AuxiliaryToolTxBl.Visibility = Windows.Visibility.Visible
AuxiliaryToolCmBx.Visibility = Windows.Visibility.Visible
@@ -118,10 +119,8 @@ Public Class AlarmsPageUC
CurrMillCmBx.Visibility = Windows.Visibility.Hidden
If m_CurrentMachine.sCurrDrill <> String.Empty Then
Dim sTempCurrDrill = m_CurrentMachine.sCurrDrill
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
m_DrillList.Add(NO_TOOL)
m_CurrentMachine.sCurrDrill = sTempCurrDrill
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(1, m_AuxToolTypeList)
CurrDrillTxBl.SetValue(Grid.RowProperty, 4)
@@ -129,10 +128,8 @@ Public Class AlarmsPageUC
CurrDrillTxBl.Visibility = Windows.Visibility.Visible
CurrDrillCmBx.Visibility = Windows.Visibility.Visible
ElseIf m_CurrentMachine.sCurrMill <> String.Empty Then
Dim sTempCurrMill = m_CurrentMachine.sCurrMill
CreateToolList(MCH_TF.MILL, m_MillList)
m_MillList.Add(NO_TOOL)
m_CurrentMachine.sCurrMill = sTempCurrMill
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
AuxiliaryToolCmBx.SelectedItem = StringIdCmBx.FromIdToStringIdCmBx(2, m_AuxToolTypeList)
CurrMillTxBl.Visibility = Windows.Visibility.Visible
@@ -191,10 +188,8 @@ Public Class AlarmsPageUC
m_CurrentMachine.sCurrDrill = String.Empty
m_CurrentMachine.sCurrMill = String.Empty
Case 1
Dim sTempCurrDrill = m_CurrentMachine.sCurrDrill
CreateToolList(MCH_TF.DRILLBIT, m_DrillList)
m_DrillList.Add(NO_TOOL)
m_CurrentMachine.sCurrDrill = sTempCurrDrill
CurrDrillCmBx.SelectedItem = m_CurrentMachine.sCurrDrill
CurrDrillTxBl.SetValue(Grid.RowProperty, 4)
CurrDrillCmBx.SetValue(Grid.RowProperty, 5)
@@ -209,10 +204,8 @@ Public Class AlarmsPageUC
CurrMillTxBl.Visibility = Windows.Visibility.Hidden
CurrMillCmBx.Visibility = Windows.Visibility.Hidden
Case 2
Dim sTempCurrMill = m_CurrentMachine.sCurrMill
CreateToolList(MCH_TF.MILL, m_MillList)
m_MillList.Add(NO_TOOL)
m_CurrentMachine.sCurrMill = sTempCurrMill
CurrMillCmBx.SelectedItem = m_CurrentMachine.sCurrMill
If m_CurrentMachine.sCurrMill = String.Empty Then
CurrMillCmBx.SelectedItem = NO_TOOL
@@ -239,6 +232,8 @@ Public Class AlarmsPageUC
String.Compare(sMchTool, m_CurrentMachine.sCurrSaw, True) <> 0 Then
m_CurrentMachine.sCurrSawing = String.Empty
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
End Sub
Private Sub CurrDrillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrDrillCmBx.SelectionChanged
@@ -263,6 +258,8 @@ Public Class AlarmsPageUC
m_CurrentMachine.sCurrDrilling = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
End Sub
Private Sub CurrMillCmBx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CurrMillCmBx.SelectionChanged
@@ -287,30 +284,30 @@ Public Class AlarmsPageUC
m_CurrentMachine.sCurrMilling = String.Empty
End If
End If
' Aggiorno utensili per lavoro in corso
m_MainWindow.m_WorkInProgressPageUC.UpdateTools()
End Sub
Private Overloads Sub CreateToolList(ToolType As Integer, ToolList As ObservableCollection(Of String))
ToolList.Clear()
Dim ToolName As String = String.Empty
Dim nType As Integer = MCH_TY.NONE
If EgtTdbGetFirstTool(ToolType, ToolName, nType) Then
Dim bFound As Boolean = EgtTdbGetFirstTool(ToolType, ToolName, nType)
While bFound
ToolList.Add(ToolName)
While EgtTdbGetNextTool(ToolType, ToolName, nType)
ToolList.Add(ToolName)
End While
End If
bFound = EgtTdbGetNextTool(ToolType, ToolName, nType)
End While
End Sub
Private Overloads Sub CreateToolList(ToolType As Integer, ToolList As List(Of String))
ToolList.Clear()
Dim ToolName As String = String.Empty
Dim nType As Integer = MCH_TY.NONE
If EgtTdbGetFirstTool(ToolType, ToolName, nType) Then
Dim bFound As Boolean = EgtTdbGetFirstTool(ToolType, ToolName, nType)
While bFound
ToolList.Add(ToolName)
While EgtTdbGetNextTool(ToolType, ToolName, nType)
ToolList.Add(ToolName)
End While
End If
bFound = EgtTdbGetNextTool(ToolType, ToolName, nType)
End While
End Sub
Private Sub SetUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles SetUpBtn.Click
+5 -3
View File
@@ -333,12 +333,14 @@ Public Class CNCommunication
bOk = bOk AndAlso (m_MainWindow.m_CNCommunication.m_CN.ActivateProgram(nNumProg) = 0)
' Modalità automatica
bOk = bOk AndAlso (m_MainWindow.m_CNCommunication.m_CN.DGeneralFunctions_WriteCncMode(0) = 0)
' Se errore, lo segnalo
If Not bOk Then
' Messaggio con risultato
If bOk Then
m_CurrProjPage.SetInfoMessage(EgtMsg(90317)) 'Programma CN trasmesso con successo
Else
m_CurrProjPage.SetErrorMessage(EgtMsg(90315)) 'Errore nella trasmissione del programma CN
End If
Else
m_CurrProjPage.SetWarningMessage(EgtMsg(90316)) 'Non connesso alla macchina
m_CurrProjPage.SetWarningMessage(EgtMsg(90316)) 'Non connesso alla macchina
End If
Return bOk
End Function
+12
View File
@@ -244,6 +244,8 @@ Public Class CadCutPageUC
m_CurrProjPage.SetErrorMessage(EgtMsg(90322) & " " & sMissingTools) 'Mancano gli utensili : ...
Return
End If
' Costringo ad aggiornare UI
UpdateUI()
' Se non c'è ordine delle lavorazioni, ne faccio uno automatico
If Not m_CurrProjPage.GetOrderMachiningFlag() Then
bOk = SortAllMachinings()
@@ -255,16 +257,24 @@ Public Class CadCutPageUC
End If
End If
End If
' Costringo ad aggiornare UI
UpdateUI()
' Disabilito impostazione modificato
EgtDisableModified()
' Aggiorno le lavorazioni
bOk = UpdateAllMachiningsToolpaths() And bOk
' Costringo ad aggiornare UI
UpdateUI()
' Salvo il progetto con le lavorazioni
Dim sMchPath As String = m_MainWindow.GetTempDir() & "\MachProj.nge"
m_MainWindow.m_CurrentProjectPageUC.SaveFile(sMchPath)
' Costringo ad aggiornare UI
UpdateUI()
' Genero file CNC (lancio anche se errore in precedenza)
Dim sCncPath As String = m_MainWindow.GetCncDir() & "\CadCut.xpi"
bOk = EgtGenerate(sCncPath, "OmagCut") And bOk
' Costringo ad aggiornare UI
UpdateUI()
' Ripristino come fase corrente quella iniziale
EgtSetCurrPhase(1)
' Nascondo tutte le lavorazioni
@@ -276,6 +286,8 @@ Public Class CadCutPageUC
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
Return
End If
' Costringo ad aggiornare UI
UpdateUI()
' Download programma (eventuali errori sono segnalati dalla funzione)
If m_MainWindow.m_CNCommunication.SendProgram(sCncPath, 900) Then
' copio il progetto corrente come progetto in lavorazione
+2 -4
View File
@@ -181,10 +181,8 @@ Public Class Camera
' Imposto ProgressBar
Dim nProgress As Integer = nThick * 100 / nMaxThick
m_MainWindow.m_CadCutPageUC.PhotoProgress.Value = nProgress
' Costringo ad aggiornare
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
New Action(Function() nDummy = 0))
' Costringo ad aggiornare UI
UpdateUI()
' Aspetto 100 ms
Thread.Sleep(100)
End If
+1
View File
@@ -32,6 +32,7 @@ Module ConstIni
Public Const K_CAMERALINK As String = "CameraLink"
Public Const K_CNLINK As String = "CNLink"
Public Const K_TESTINGPAGE As String = "TestingPage"
Public Const K_SHOWTIPAXES As String = "ShowTipAxes"
Public Const S_LANGUAGES As String = "Languages"
Public Const K_LANGUAGE As String = "Language"
+5 -2
View File
@@ -224,8 +224,8 @@ Public Class CurrentMachine
Return m_dAdditionalTable
End Get
Set(value As Double)
If WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, value, sMachIniFile) Then
m_sCurrMilling = value
If WritePrivateProfileString(S_TABLE, K_ADDITIONALTABLE, DoubleToString(value, 3), sMachIniFile) Then
m_dAdditionalTable = value
End If
End Set
End Property
@@ -449,6 +449,9 @@ Public Class CurrentMachine
m_ManualToolChanger.Add(New ToolChangerPos(Index, sName, sTool))
Next
' Leggo altezza sopratavola
m_dAdditionalTable = GetPrivateProfileDouble(S_TABLE, K_ADDITIONALTABLE, 0, sMachIniFile)
'Creo materiale di default e lo aggiungo alla lista
'm_Materials.Add(New Material(0, "Generico"))
' Leggo la lista dei materiali
+13 -12
View File
@@ -28,8 +28,6 @@ Public Class CurrentProjectPageUC
' Dati del grezzo
Friend m_nRawId As Integer = GDB_ID.NULL
Friend m_dRawHeight As Double
' Altezza della eventuale tavola aggiuntiva
Friend m_dAddTable As Double = 0
Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs)
@@ -60,9 +58,6 @@ Public Class CurrentProjectPageUC
ToolTxBl.Text = EgtMsg(MSG_CADCUTPAGEUC + 11) 'Tool - Utensile
MachiningTxBl.Text = EgtMsg(MSG_CADCUTPAGEUC + 12) 'Machining - Lavorazione
'Recupero altezza eventuale tavola aggiuntiva
m_dAddTable = GetPrivateProfileDouble(S_TABLE, K_ADDITIONALTABLE, 0, m_MainWindow.GetMachIniFile())
End Sub
Private Sub CurrentProjectPage_Loaded(sender As Object, e As RoutedEventArgs)
@@ -206,8 +201,10 @@ Public Class CurrentProjectPageUC
End Function
Private Function AddAdditionalTable() As Boolean
' Altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
' Se non esiste sovratavola, esco subito
If m_dAddTable < 10 * EPS_SMALL Then
If dAddTable < 10 * EPS_SMALL Then
Return True
End If
' Recupero box tavola
@@ -217,7 +214,7 @@ Public Class CurrentProjectPageUC
Const MACH_FIXT_GROUP As String = "Fixt"
ptMax.z -= DELTAZ_ADDTAB
ptMin.z = ptMax.z
ptMax.z += m_dAddTable
ptMax.z += dAddTable
Dim nMchId As Integer = EgtGetFirstMachGroup()
Dim nFixtId As Integer = EgtGetFirstNameInGroup(nMchId, MACH_FIXT_GROUP)
Dim nAddTabId As Integer = EgtCreateSurfTmBBox(nFixtId, ptMin, ptMax, GDB_RT.GLOB)
@@ -503,14 +500,16 @@ Public Class CurrentProjectPageUC
Catch ex As Exception
EgtOutLog("LoadPhoto Error on auxfile : " & sAuxPath)
End Try
' Altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
' Aggiusto dati per spessore grezzo
If Math.Abs(m_dRawHeight + m_dAddTable) > EPS_SMALL Then
If Math.Abs(m_dRawHeight + dAddTable) > EPS_SMALL Then
' Coefficiente di scalatura
Dim dFsca As Double = (ptCen.z - m_dRawHeight - m_dAddTable) / (ptCen.z - ptOri.z)
Dim dFsca As Double = (ptCen.z - m_dRawHeight - dAddTable) / (ptCen.z - ptOri.z)
dMMxPixel *= dFsca
ptOri.x = ptCen.x + (ptOri.x - ptCen.x) * dFsca
ptOri.y = ptCen.y + (ptOri.y - ptCen.y) * dFsca
ptOri.z = m_dRawHeight + m_dAddTable
ptOri.z = m_dRawHeight + dAddTable
End If
' Recupero origine della tavola e porto i punti in globale
Dim ptTab As Point3d
@@ -568,12 +567,14 @@ Public Class CurrentProjectPageUC
' Porto i punti in locale
ptOri.ToLoc(New Frame3d(ptTab))
ptCen.ToLoc(New Frame3d(ptTab))
' Altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
' Aggiusto dati per spessore grezzo (Coefficiente di scalatura)
Dim dFsca As Double = (ptCen.z - m_dRawHeight - m_dAddTable) / (ptCen.z - ptOri.z)
Dim dFsca As Double = (ptCen.z - m_dRawHeight - dAddTable) / (ptCen.z - ptOri.z)
dMMxPixel *= dFsca
ptOri.x = ptCen.x + (ptOri.x - ptCen.x) * dFsca
ptOri.y = ptCen.y + (ptOri.y - ptCen.y) * dFsca
ptOri.z = m_dRawHeight + m_dAddTable
ptOri.z = m_dRawHeight + dAddTable
' Porto i punti in globale
ptOri.ToGlob(New Frame3d(ptTab))
ptCen.ToGlob(New Frame3d(ptTab))
+14 -11
View File
@@ -63,6 +63,13 @@ Public Class DirectCutPageUC
Private Sub DirectCutPage_Loaded(sender As Object, e As RoutedEventArgs)
m_ActiveDirectCutPage = DirectCutPages.DirectCut
' Attivo le lavorazioni solo se esiste il grezzo
Dim bRawOk As Boolean = (GetRawHeight() > EPS_SMALL)
SingleCutBtn.IsEnabled = bRawOk
MultipleCutBtn.IsEnabled = bRawOk
GridCutBtn.IsEnabled = bRawOk
FlatteningCutBtn.IsEnabled = bRawOk
SawTestBtn.IsEnabled = bRawOk
End Sub
Private Sub ManualBtn_Click(sender As Object, e As RoutedEventArgs) Handles ManualBtn.Click
@@ -190,10 +197,8 @@ Public Class DirectCutPageUC
System.Threading.Thread.Sleep(1000)
' Incremento progressbar
MsgBoxStateInfo.LoadingPrBr_Value += 100 / 120
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
' Costringo ad aggiornare UI
UpdateUI()
Next
If bProbingOk Then
' Leggo spessore misurato
@@ -207,11 +212,10 @@ Public Class DirectCutPageUC
SawDiam = m_MainWindow.m_CNCommunication.m_CN.d_DReadELS_value
MsgBoxStateInfo.LoadingPrBr_Value = 100
MsgBoxStateInfo.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 43)
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
' Costringo ad aggiornare UI
UpdateUI()
System.Threading.Thread.Sleep(1500)
'Trasformo misura rilevata in mm
' Trasformo misura rilevata in mm
If m_MainWindow.m_CNCommunication.m_CN.Is_G71_active() Then
SawDiam *= ONEMM / 1000
Else
@@ -234,9 +238,8 @@ Public Class DirectCutPageUC
Else
MsgBoxStateInfo.Text = EgtMsg(MSG_DIRECTCUTPAGEUC + 44)
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
' Costringo ad aggiornare UI
UpdateUI()
System.Threading.Thread.Sleep(1500)
MsgBoxStateInfo.Close()
End If
+9 -9
View File
@@ -80,9 +80,6 @@ Public Class FlatteningCut
Private Sub FlatteningCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
' Reset punto acquisito
m_bPointP1Ok = False
' Inizializzo primo punto acquisito dal disegno come centro del grezzo
@@ -117,6 +114,9 @@ Public Class FlatteningCut
Point1Btn.IsChecked = False
' Disabilito registrazione progetto modificato
EgtDisableModified()
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
End Sub
Friend Sub MultipleCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
@@ -241,9 +241,9 @@ Public Class FlatteningCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
" Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
' " Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
@@ -362,9 +362,9 @@ Public Class FlatteningCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
" Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
' " Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angolo verticale da direzione utensile
Dim dTLen, dTAngV, dTAngO As Double
+9 -9
View File
@@ -77,9 +77,6 @@ Public Class GridCut
Private Sub GridCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
' Reset punto acquisito
m_bPointP1Ok = False
' Inizializzo primo punto acquisito dal disegno come centro del grezzo
@@ -112,6 +109,9 @@ Public Class GridCut
Point1Btn.IsChecked = False
' Disabilito registrazione progetto modificato
EgtDisableModified()
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
End Sub
Friend Sub GridCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
@@ -236,9 +236,9 @@ Public Class GridCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
" Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
' " Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
@@ -359,9 +359,9 @@ Public Class GridCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
" Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
' " Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angolo verticale da direzione utensile
Dim dTLen, dTAngV, dTAngO As Double
+14 -19
View File
@@ -156,7 +156,9 @@ Namespace Num
Dim Index As Integer = 0
Dim ConnectionWnd As New EgtMsgBox(Application.Current.MainWindow, "CONNESSIONE AL CN", "Connessione in corso...", True, EgtMsgBox.Icons.NULL, 1)
' CONNESSIONE AL CN Connessione in corso...
Dim ConnectionWnd As New EgtMsgBox(Application.Current.MainWindow, EgtMsg(MSG_EGTMSGBOX + 7),
EgtMsg(MSG_EGTMSGBOX + 8), True, EgtMsgBox.Icons.NULL, 1)
ConnectionWnd.LoadingPrBr_Value = 5
Dim ConnectionError As Integer = 0
@@ -165,32 +167,25 @@ Namespace Num
System.Threading.Thread.Sleep(500) ' 0.5 sec wait
ConnectionWnd.LoadingPrBr_Value += 5
Index += 1
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
' Costringo ad aggiornare UI
UpdateUI()
End While
If n_state < 2 Or m_ConnectionError5000 Then
ConnectionWnd.Text = "Connessione non riuscita"
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
System.Threading.Thread.Sleep(1500) ' 2 sec wait
ConnectionWnd.Text = EgtMsg(MSG_EGTMSGBOX + 9) ' Connessione non riuscita
' Costringo ad aggiornare UI
UpdateUI()
System.Threading.Thread.Sleep(1500) ' 1.5 sec wait
ConnectionWnd.Close()
Else
ConnectionWnd.Text = "Connessione riuscita"
ConnectionWnd.Text = EgtMsg(MSG_EGTMSGBOX + 10) ' Connessione riuscita
ConnectionWnd.LoadingPrBr_Value = 100
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
System.Threading.Thread.Sleep(1500) ' 2 sec wait
' Costringo ad aggiornare UI
UpdateUI()
System.Threading.Thread.Sleep(1500) ' 1.5 sec wait
ConnectionWnd.Close()
' lancio della lettura delle variabili PLC
' Lancio della lettura delle variabili PLC
set_Read_PLC_var()
End If
sz_versionRTS = objDRunTimeSystem.GetVersionRTS
+1 -1
View File
@@ -48,7 +48,7 @@ Public Class MachinePageUC
Private Sub MachinePage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
'Inizializzazione della pagina di apertura all'apertura della pagina MachinePage
' Inizializzazione della pagina di apertura all'apertura della pagina MachinePage
If Not m_MainWindow.m_MachineStatusUC.m_bIsClicked Then
AlarmsBtn.IsChecked = True
m_ActiveMachinePage = MachinePages.Alarms
+25 -8
View File
@@ -5,10 +5,12 @@ Public Class MachineStatusUC
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = Application.Current.MainWindow
Private m_MachinePage As MachinePageUC
' Flag che indica se è stato premuto questo controllo per chiamare la paginacon lista errori
' Flag che indica se è stato premuto questo controllo per chiamare la pagina con lista errori
Friend m_bIsClicked As Boolean = False
' Oggetto per comunicare con il CN
Friend m_CN As CN_generico
' Flag per tipo visualizzazione assi
Private m_bShowTipAxes As Boolean = False
Private Sub MachineStatus_Initialized(sender As Object, e As EventArgs)
@@ -16,6 +18,7 @@ Public Class MachineStatusUC
Private Sub MachineStatus_Loaded(sender As Object, e As RoutedEventArgs)
m_MachinePage = m_MainWindow.m_MachinePageUC
m_bShowTipAxes = GetPrivateProfileInt(S_GENERAL, K_SHOWTIPAXES, 0, m_MainWindow.GetIniFile()) <> 0
End Sub
Private Sub MachineStatus_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles Me.PreviewMouseDown
@@ -23,7 +26,7 @@ Public Class MachineStatusUC
End Sub
Sub MachinePageClick()
'Emulo il click della pagina Macchina
' Emulo il click della pagina Macchina
Select Case m_MainWindow.m_ActivePage
Case MainWindow.Pages.WorkInProgress
m_MainWindow.WorkInProgressBtn.IsChecked = False
@@ -90,11 +93,25 @@ Public Class MachineStatusUC
End Sub
Sub DisplayPosition(nL1 As Integer, nL2 As Integer, nL3 As Integer, nR1 As Integer, nR2 As Integer)
Axis1TxBx.Text = DoubleToString(m_CN.d_axis_position(nL1), -3)
Axis2TxBx.Text = DoubleToString(m_CN.d_axis_position(nL2), -3)
Axis3TxBx.Text = DoubleToString(m_CN.d_axis_position(nL3), -3)
Axis4TxBx.Text = DoubleToString(m_CN.d_axis_position(nR1), -3)
Axis5TxBx.Text = DoubleToString(m_CN.d_axis_position(nR2), -3)
' Recupero le posizioni macchina
Dim dL1 As Double = m_CN.d_axis_position(nL1)
Dim dL2 As Double = m_CN.d_axis_position(nL2)
Dim dL3 As Double = m_CN.d_axis_position(nL3)
Dim dR1 As Double = m_CN.d_axis_position(nR1)
Dim dR2 As Double = m_CN.d_axis_position(nR2)
' Se richiesto, le converto sul tip dell'utensile corrente rispetto allo Zero tavola
Dim ptTip As New Point3d
If m_bShowTipAxes AndAlso m_MainWindow.m_WorkInProgressPageUC.GetTipFromPositions(dL1, dL2, dL3, dR1, dR2, ptTip) Then
dL1 = ptTip.x
dL2 = ptTip.y
dL3 = ptTip.z
End If
' Visualizzazione
Axis1TxBx.Text = DoubleToString(dL1, -3)
Axis2TxBx.Text = DoubleToString(dL2, -3)
Axis3TxBx.Text = DoubleToString(dL3, -3)
Axis4TxBx.Text = DoubleToString(dR1, -3)
Axis5TxBx.Text = DoubleToString(dR2, -3)
End Sub
Sub DisplayPositionDelta(nL1 As Integer, nL2 As Integer, nL3 As Integer, nR1 As Integer, nR2 As Integer)
+9 -5
View File
@@ -286,11 +286,11 @@ Class MainWindow
m_MachinePageUC.SetValue(Grid.RowProperty, 1)
m_OptionsPageUC.SetValue(Grid.ColumnProperty, 0)
m_OptionsPageUC.SetValue(Grid.RowProperty, 1)
'Posizionemento nella griglia di pagine e usercontrol di utilità
' Posizionamento nella griglia di pagine e usercontrol di utilità
m_WorkInProgressPageUC.SetValue(Grid.ColumnProperty, 0)
m_WorkInProgressPageUC.SetValue(Grid.RowProperty, 1)
'Disabilita la possibilità di imitare il click del tasto destro del mouse tenendo premuto il dito sul touch
'NB: Se abilitato impedisce di utilizzare lo stato Pressed dei Button che quindi non si evidenziano quando premuti
' Disabilita la possibilità di imitare il click del tasto destro del mouse tenendo premuto il dito sul touch
' NB: Se abilitato impedisce di utilizzare lo stato Pressed dei Button che quindi non si evidenziano quando premuti
Stylus.SetIsPressAndHoldEnabled(Me, False)
' Imposto i messaggi letti dal file dei messaggi
@@ -339,10 +339,14 @@ Class MainWindow
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
'Aggiungo la MachineStatusBar alla MainWindow
' Aggiungo la MachineStatusBar alla MainWindow
MainWindowGrid.Children.Add(m_MachineStatusUC)
'Seleziono la Tab e la Page di apertura
' Preparo la macchina per la lavorazione in corso
m_WorkInProgressPageUC.Prepare()
m_WorkInProgressPageUC.UpdateTools()
' Seleziono la Tab e la Page di apertura
MainWindowGrid.Children.Add(m_CurrentProjectPageUC)
m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_CadCutPageUC)
m_ActivePage = Pages.CadCut
+1 -2
View File
@@ -5,8 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
mc:Ignorable="d"
d:DesignHeight="597.3" d:DesignWidth="256"
Initialized="ManualAxesMove_Initialized" Loaded="ManualAxesMove_Loaded">
d:DesignHeight="597.3" d:DesignWidth="256">
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
+6 -2
View File
@@ -13,11 +13,11 @@ Public Class ManualAxesMoveUC
' Timer per aggiornamento nomi assi
Private m_Timer As New DispatcherTimer
Private Sub ManualAxesMove_Initialized(sender As Object, e As EventArgs)
Private Sub ManualAxesMove_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
AddHandler m_Timer.Tick, AddressOf Timer_tick
End Sub
Private Sub ManualAxesMove_Loaded(sender As Object, e As RoutedEventArgs)
Private Sub ManualAxesMove_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Nomi feed e speed
FeedTxBl.Text = "F"
SpeedTxBl.Text = "S"
@@ -46,6 +46,10 @@ Public Class ManualAxesMoveUC
G0Btn.IsChecked = True
End Sub
Private Sub ManualAxesMove_UnLoaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
m_Timer.Stop()
End Sub
Private Sub UpdateAxesNames()
Dim sL1 As String = String.Empty
Dim sL2 As String = String.Empty
+9 -9
View File
@@ -78,9 +78,6 @@ Public Class MultipleCut
Private Sub MultipleCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
' Reset punto acquisito
m_bPointP1Ok = False
' Inizializzo primo punto acquisito dal disegno come centro del grezzo
@@ -114,6 +111,9 @@ Public Class MultipleCut
Point1Btn.IsChecked = False
' Disabilito registrazione progetto modificato
EgtDisableModified()
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
End Sub
Friend Sub MultipleCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
@@ -238,9 +238,9 @@ Public Class MultipleCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
" Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
' " Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
@@ -360,9 +360,9 @@ Public Class MultipleCut
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
" Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
'Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
' " Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angolo verticale da direzione utensile
Dim dTLen, dTAngV, dTAngO As Double
+2
View File
@@ -363,6 +363,8 @@ Public Class NestPageUC
Dim nNextId = EgtGetNextSelectedObj()
' Lo metto in tavola, se possibile
InsertOnePart(nId)
' Costringo ad aggiornare UI
UpdateUI()
' Passo al successivo selezionato
nId = nNextId
End While
+15 -12
View File
@@ -7,6 +7,7 @@ Public Class RawPartPageUC
' Riferimento alla MainWindow
Dim m_MainWindow As MainWindow = Application.Current.MainWindow
Dim WithEvents m_CurrProjPage As CurrentProjectPageUC
Dim m_CurrentMachine As CurrentMachine = m_MainWindow.m_CurrentMachine
' Definizione pagina di scelta della lavorazione corrente
Dim m_ChooseMachiningPage As ChooseMachining
' Flag di pagina attiva
@@ -81,7 +82,7 @@ Public Class RawPartPageUC
Private Sub RawPartPage_Initialized(sender As Object, e As EventArgs)
'Associazione della lista materiali alla combobox
MaterialsCmbx.ItemsSource = m_MainWindow.m_CurrentMachine.Materials
MaterialsCmbx.ItemsSource = m_CurrentMachine.Materials
'Associazione tag textbox e label per visualizzare nome nella calcolatrice
LengthTxBx.Tag = LengthTxBl
@@ -202,7 +203,7 @@ Public Class RawPartPageUC
UpdateRawPart(bHeightModified)
End If
' Imposto il materiale corrente nella combobox
MaterialsCmbx.SelectedItem = m_MainWindow.m_CurrentMachine.CurrMat
MaterialsCmbx.SelectedItem = m_CurrentMachine.CurrMat
End Sub
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene
@@ -423,7 +424,7 @@ Public Class RawPartPageUC
' Identifico il punto
Dim nU = CInt(m_dDragPar)
' Aggiusto Z punto movimentato (è in globale)
ptCurr.z = m_ptTableMin.z + m_CurrProjPage.m_dAddTable + m_RawHeight
ptCurr.z = m_ptTableMin.z + m_CurrentMachine.dAdditionalTable + m_RawHeight
' Sposto il punto
If Not EgtModifyCurveCompoJoint(nKerfId, nU, ptCurr, GDB_RT.GLOB) Then Return
' Aggiorno il grezzo
@@ -452,7 +453,7 @@ Public Class RawPartPageUC
' Identifico il punto
Dim nU = CInt(m_dDragPar)
' Aggiusto Z punto movimentato (è in globale)
ptCurr.z = m_ptTableMin.z + m_CurrProjPage.m_dAddTable + m_RawHeight
ptCurr.z = m_ptTableMin.z + m_CurrentMachine.dAdditionalTable + m_RawHeight
' Sposto il punto
If Not EgtModifyCurveCompoJoint(m_nSelDmg, nU, ptCurr, GDB_RT.GLOB) Then Return
' Aggiorno visualizzazione
@@ -470,10 +471,10 @@ Public Class RawPartPageUC
Private Sub MaterialsCmbx_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles MaterialsCmbx.SelectionChanged
If Not IsNothing(MaterialsCmbx.SelectedItem) Then
m_MainWindow.m_CurrentMachine.CurrMat = MaterialsCmbx.SelectedItem
m_CurrProjPage.MaterialTxBx.Text = m_MainWindow.m_CurrentMachine.CurrMat.sName
m_CurrentMachine.CurrMat = MaterialsCmbx.SelectedItem
m_CurrProjPage.MaterialTxBx.Text = m_CurrentMachine.CurrMat.sName
Else
m_MainWindow.m_CurrentMachine.CurrMat = Nothing
m_CurrentMachine.CurrMat = Nothing
m_CurrProjPage.MaterialTxBx.Text = "Non definito"
End If
End Sub
@@ -630,7 +631,7 @@ Public Class RawPartPageUC
If ptAcquired.x > m_dTableLength - m_RawKerf Then ptAcquired.x = m_dTableLength - m_RawKerf - SAFE_RAW_DIST
If ptAcquired.y > m_dTableWidth - m_RawKerf Then ptAcquired.y = m_dTableWidth - m_RawKerf - SAFE_RAW_DIST
' Aggiusto Z punto movimentato (è in locale al tavolo)
ptAcquired.z = m_CurrProjPage.m_dAddTable + m_RawHeight
ptAcquired.z = m_CurrentMachine.dAdditionalTable + m_RawHeight
'Porto il punto nel riferimento del grezzo
Dim frRaw As New Frame3d
EgtGetGroupGlobFrame(m_CurrProjPage.m_nRawId, frRaw)
@@ -760,7 +761,7 @@ Public Class RawPartPageUC
If m_RawHeight > EPS_SMALL Then
AdjustRawPartKerf()
' Sistemo la posizione
Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrProjPage.m_dAddTable)
Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrentMachine.dAdditionalTable)
If EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, ptRef, MCH_CR.BL) Then
OkBtn.IsEnabled = True
m_CurrProjPage.ClearMessage()
@@ -816,7 +817,7 @@ Public Class RawPartPageUC
If nKerfId <> GDB_ID.NULL Then
Dim ptStart As Point3d
EgtStartPoint(nKerfId, GDB_ID.ROOT, ptStart)
Dim dKerfHeight = ptStart.z - m_ptTableMin.z - m_CurrProjPage.m_dAddTable
Dim dKerfHeight = ptStart.z - m_ptTableMin.z - m_CurrentMachine.dAdditionalTable
EgtMove(nKerfId, New Vector3d(0, 0, m_RawHeight - dKerfHeight))
End If
End If
@@ -863,7 +864,7 @@ Public Class RawPartPageUC
OffsetYTxBx.Text = LenToString(m_RawOffsY, 2)
End If
' Aggiorno la posizione del grezzo
Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrProjPage.m_dAddTable)
Dim ptRef As New Point3d(m_RawOffsX - m_RawKerf, m_RawOffsY - m_RawKerf, m_CurrentMachine.dAdditionalTable)
If EgtMoveToCornerRawPart(m_CurrProjPage.m_nRawId, ptRef, MCH_CR.BL) Then
OkBtn.IsEnabled = True
m_CurrProjPage.ClearMessage()
@@ -1225,7 +1226,9 @@ Public Class RawPartPageUC
Private Sub AddNewDamagedArea()
' Creo triangolo che abbia il punto selezionato come centro (lato 100mm)
' calcolo punto in basso a sinistra
Dim ptBottomLeft As Point3d = New Point3d(m_ptPrev.x - 50, m_ptPrev.y - (100 / 6 * Math.Sqrt(3)), m_ptTableMin.z + m_CurrProjPage.m_dAddTable + m_RawHeight)
Dim ptBottomLeft As Point3d = New Point3d(m_ptPrev.x - 50,
m_ptPrev.y - (100 / 6 * Math.Sqrt(3)),
m_ptTableMin.z + m_CurrentMachine.dAdditionalTable + m_RawHeight)
Dim vtRight As Vector3d = New Vector3d(100, 0, 0)
' creo lato base
Dim nBaseId As Integer = EgtCreateLine(m_CurrProjPage.m_nRawId, ptBottomLeft, ptBottomLeft + vtRight, GDB_RT.GLOB)
+8 -8
View File
@@ -162,10 +162,10 @@ Public Class SawTestUC
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
" Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
SawTipTxBl.Text = sSawTip
'Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
' " Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP1.ToSpherical(dTLen, dTAngV, dTAngO)
@@ -246,10 +246,10 @@ Public Class SawTestUC
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
" Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
SawTipTxBl.Text = sSawTip
'Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
' " Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP2.ToSpherical(dTLen, dTAngV, dTAngO)
+9 -3
View File
@@ -46,6 +46,8 @@ Public Class SimulationPageUC
' Verifico l'attrezzaggio degli utensili utilizzati
Dim sMissingTools As String = String.Empty
Dim bSetup As Boolean = VerifySetup(sMissingTools)
' Costringo ad aggiornare UI
UpdateUI()
' Se non c'è ordine delle lavorazioni, ne faccio uno automatico
If Not m_CurrProjPage.GetOrderMachiningFlag() Then
bOk = SortAllMachinings()
@@ -57,6 +59,8 @@ Public Class SimulationPageUC
m_CurrProjPage.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
End If
End If
' Costringo ad aggiornare UI
UpdateUI()
' Disabilito impostazione modificato
EgtDisableModified()
' Aggiorno le lavorazioni
@@ -68,6 +72,8 @@ Public Class SimulationPageUC
ElseIf Not bOk Then
m_CurrProjPage.SetErrorMessage(EgtMsg(90314)) 'Errore nella generazione del programma CN
End If
' Costringo ad aggiornare UI
UpdateUI()
' Salvo il progetto con le lavorazioni
Dim sMchPath As String = m_MainWindow.GetTempDir() & "\" & "MachProj.nge"
m_CurrProjPage.SaveFile(sMchPath)
@@ -76,6 +82,8 @@ Public Class SimulationPageUC
' Imposto prima fase
EgtSetCurrPhase(1)
ShowAllCurrPhaseMachinings()
' Costringo ad aggiornare UI
UpdateUI()
' Visualizzo opportunamente la macchina
m_nMachLook = MCH_LOOK.ALL
EgtSetMachineLook(m_nMachLook)
@@ -213,9 +221,7 @@ Public Class SimulationPageUC
System.Threading.Thread.Sleep(1)
End If
' Costringo ad aggiornare UI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
New Action(Function() nDummy = 0))
UpdateUI()
End While
End Sub
+1 -1
View File
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:EgtWPFLib="clr-namespace:EgtWPFLib;assembly=EgtWPFLib"
mc:Ignorable="d"
d:DesignHeight="597.3" d:DesignWidth="256" Loaded="SingleCut_Loaded" Unloaded="SingleCut_Unloaded">
d:DesignHeight="597.3" d:DesignWidth="256">
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
+11 -11
View File
@@ -67,9 +67,6 @@ Public Class SingleCutUC
Private Sub SingleCut_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
' Reset punto acquisito
m_bPointP1Ok = False
SawTipTxBl.Text = String.Empty
@@ -104,6 +101,9 @@ Public Class SingleCutUC
Point1Btn.IsChecked = False
' Disabilito registrazione progetto modificato
EgtDisableModified()
' Creo layer temporaneo per crocette
m_nTempLay = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(m_nTempLay, GDB_LV.TEMP)
End Sub
Friend Sub SingleCut_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
@@ -228,10 +228,10 @@ Public Class SingleCutUC
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
" Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
SawTipTxBl.Text = sSawTip
'Dim sSawTip As String = "X" & LenToString(m_ptTipP1.x, 0) & " Y" & LenToString(m_ptTipP1.y, 0) &
' " Z" & LenToString(m_ptTipP1.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP1.ToSpherical(dTLen, dTAngV, dTAngO)
@@ -353,10 +353,10 @@ Public Class SingleCutUC
EgtSetAxisPos(sR1, dR1)
EgtSetAxisPos(sR2, dR2)
' Visualizzo quote
Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
" Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
" B" & DoubleToString(dR2, 0)
SawTipTxBl.Text = sSawTip
'Dim sSawTip As String = "X" & LenToString(m_ptTipP2.x, 0) & " Y" & LenToString(m_ptTipP2.y, 0) &
' " Z" & LenToString(m_ptTipP2.z, 0) & " C" & DoubleToString(dR1, 0) &
' " B" & DoubleToString(dR2, 0)
'SawTipTxBl.Text = sSawTip
' Assegno angoli
Dim dTLen, dTAngV, dTAngO As Double
m_vtToolP2.ToSpherical(dTLen, dTAngV, dTAngO)
+8
View File
@@ -3,6 +3,14 @@ Imports EgtUILib
Module Utility
'--------------------------------------------------------------------------------------------------
Friend Sub UpdateUI()
' Costringo ad aggiornare UI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
New Action(Function() nDummy = 0))
End Sub
'--------------------------------------------------------------------------------------------------
Friend Function DoubleToString(ByVal dVal As Double, ByVal nNumDec As Integer) As String
Dim sFormat As String = "F" + Math.Abs(nNumDec).ToString()
+154 -72
View File
@@ -9,7 +9,8 @@ Public Class WorkInProgressPageUC
Private m_MainWindow As MainWindow = Application.Current.MainWindow
' Properties
Private m_bFirst As Boolean = True
Private m_bPrepared As Boolean = True
Private m_bFirstShow As Boolean = True
Private m_bContinue As Boolean = True
Private m_bExecuting As Boolean = False
' Dichiarazione delle Page UserControl
@@ -22,7 +23,8 @@ Public Class WorkInProgressPageUC
Private m_StartTimer As New DispatcherTimer
' Stato di visualizzazione della macchina
Private m_nMachLook As Integer = MCH_LOOK.ALL
' Origine della tavola
Private m_ptTabOri As Point3d
Private Sub WorkInProgressPage_Initialized(sender As Object, e As EventArgs)
@@ -53,62 +55,18 @@ Public Class WorkInProgressPageUC
End Sub
Private Sub WorkInProgressPage_Loaded(sender As Object, e As RoutedEventArgs)
' Se primo caricamento
If m_bFirst Then
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
Dim BackBotColor As New Color3d(BackTopColor)
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
WorkInProgressScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
' inizializzo la scena (DB geometrico + visualizzazione) e verifico presenza chiave
If Not WorkInProgressScene.Init() Then
' Rimuovo l'host della scena perchè altrimenti rimarrebbe il buco!!
Me.WorkInProgressPageGrid.Children.Remove(WorkInProgressSceneHost)
Dim MissingKeyWnd As New EgtMsgBox(m_MainWindow, EgtMsg(MSG_MISSINGKEYWD + 1), EgtMsg(MSG_MISSINGKEYWD + 2) & " " & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
m_MainWindow.Close()
End If
' Inizializzo gestore lavorazioni
EgtInitMachMgr(m_MainWindow.GetMachinesRootDir())
' Carico macchina
If Not NewProject() Then
EgtOutLog("WorkInProgress : error loading machine")
End If
' Se già inizializzata
If Not Prepare() Then
' Imposto il giusto contesto
EgtSetCurrentContext(WorkInProgressScene.GetCtx())
End If
' Se prima visualizzazione
If m_bFirstShow Then
' Imposto visualizzazione
EgtSetView(VT.ISO_SW, False)
EgtZoom(ZM.ALL)
' Dichiaro eseguito primo caricamento
m_bFirst = False
m_bFirstShow = False
Else
' Imposto il giusto contesto
EgtSetCurrentContext(WorkInProgressScene.GetCtx())
' Aggiorno subito la visualizzazione
EgtDraw()
End If
@@ -118,19 +76,8 @@ Public Class WorkInProgressPageUC
If Not WorkProject() Then
EgtOutLog("WorkInProgress : Error loading WorkProject")
End If
' Imposto la lama corrente
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
If Not EgtSetCalcTool(sSaw, "H1", 1) Then
Return
End If
' Imposto eventuale secondo utensile montato
If m_MainWindow.m_CurrentMachine.MountedToolConfig = CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
Dim sTool As String = m_MainWindow.m_CurrentMachine.sCurrDrill
If String.IsNullOrEmpty(sTool) Then sTool = m_MainWindow.m_CurrentMachine.sCurrMill
If Not String.IsNullOrEmpty(sTool) AndAlso Not EgtLoadTool("H1", 2, sTool) Then
Return
End If
End If
' Imposto utensili correnti
If Not UpdateTools() Then Return
' Aggiorno stato di visualizzazione macchina
m_nMachLook = MCH_LOOK.ALL
EgtSetMachineLook(m_nMachLook)
@@ -174,8 +121,8 @@ Public Class WorkInProgressPageUC
End Function
Private Function AddAdditionalTable() As Boolean
'Recupero altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = GetPrivateProfileDouble(S_TABLE, K_ADDITIONALTABLE, 0, m_MainWindow.GetMachIniFile())
' Altezza eventuale tavola aggiuntiva
Dim dAddTable As Double = m_MainWindow.m_CurrentMachine.dAdditionalTable
' Se non esiste sovratavola, esco subito
If dAddTable < 10 * EPS_SMALL Then
Return True
@@ -260,9 +207,7 @@ Public Class WorkInProgressPageUC
System.Threading.Thread.Sleep(1)
End If
' Costringo ad aggiornare UI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, _
New Action(Function() nDummy = 0))
UpdateUI()
End While
m_bExecuting = False
Return True
@@ -289,4 +234,141 @@ Public Class WorkInProgressPageUC
EgtDraw()
End Sub
Friend Function Prepare() As Boolean
' Se già caricato
If Not m_bPrepared Then Return False
' Primo caricamento
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetDefaultMaterial(DefColor)
' imposto colori sfondo
Dim BackTopColor As New Color3d(192, 192, 192)
GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor, m_MainWindow.GetIniFile())
Dim BackBotColor As New Color3d(BackTopColor)
GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetViewBackground(BackTopColor, BackBotColor)
' imposto colore di evidenziazione
Dim MarkColor As New Color3d(255, 255, 0)
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetMarkMaterial(MarkColor)
' imposto colore per superfici selezionate
Dim SelSurfColor As New Color3d(255, 255, 192)
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetSelSurfMaterial(SelSurfColor)
' imposto tipo e colore del rettangolo di zoom
Dim bOutline As Boolean = True
Dim ZwColor As New Color3d(0, 0, 0)
GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetZoomWinAttribs(bOutline, ZwColor)
' imposto colore della linea di distanza
Dim DstLnColor As New Color3d(255, 0, 0)
GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor, m_MainWindow.GetIniFile())
WorkInProgressScene.SetDistLineMaterial(DstLnColor)
' imposto parametri OpenGL
Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3, m_MainWindow.GetIniFile())
Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1, m_MainWindow.GetIniFile()) <> 0)
Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32, m_MainWindow.GetIniFile())
Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32, m_MainWindow.GetIniFile())
WorkInProgressScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
' inizializzo la scena (DB geometrico + visualizzazione) e verifico presenza chiave
If Not WorkInProgressScene.Init() Then
' Rimuovo l'host della scena perchè altrimenti rimarrebbe il buco!!
Me.WorkInProgressPageGrid.Children.Remove(WorkInProgressSceneHost)
Dim MissingKeyWnd As New EgtMsgBox(m_MainWindow, EgtMsg(MSG_MISSINGKEYWD + 1), EgtMsg(MSG_MISSINGKEYWD + 2) & " " & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsgBox.Buttons.OK, EgtMsgBox.Icons.NULL)
m_MainWindow.Close()
End If
' Inizializzo gestore lavorazioni
EgtInitMachMgr(m_MainWindow.GetMachinesRootDir())
' Carico macchina
If Not NewProject() Then
EgtOutLog("WorkInProgress : error loading machine")
End If
' Recupero origine tavola
If Not EgtGetTableRef(1, m_ptTabOri) Then
EgtOutLog("WorkInProgress : error on TableRef1")
End If
' Dichiaro eseguito primo caricamento
m_bPrepared = False
Return True
End Function
Friend Function UpdateTools() As Boolean
' Verifico sia stata inizializzata
If m_bPrepared Then Return False
' Salvo il contesto corrente
Dim nOldCtx As Integer = EgtGetCurrentContext()
' Imposto il giusto contesto
Dim bOk As Boolean = EgtSetCurrentContext(WorkInProgressScene.GetCtx())
' Svuoto la testa
EgtResetHeadSet("H1")
' Imposto la lama corrente
Dim sSaw As String = GetFirstTool()
If bOk Then
If Not EgtSetCalcTool(sSaw, "H1", 1) Then bOk = False
End If
' Imposto eventuale secondo utensile montato
If bOk Then
Dim sTool As String = GetSecondTool()
If Not String.IsNullOrEmpty(sTool) AndAlso Not EgtLoadTool("H1", 2, sTool) Then
bOk = False
End If
End If
' Ripristino il contesto originale
EgtSetCurrentContext(nOldCtx)
Return bOk
End Function
Private Function GetFirstTool() As String
Return m_MainWindow.m_CurrentMachine.sCurrSaw
End Function
Private Function GetSecondTool() As String
' Se non previsto secondo utensile, non c'è
If m_MainWindow.m_CurrentMachine.MountedToolConfig <> CurrentMachine.MountedToolConfigs.SAWANDAUXTOOL Then
Return String.Empty
End If
' Cerco se foretto o fresa
Dim sTool As String = m_MainWindow.m_CurrentMachine.sCurrDrill
If String.IsNullOrEmpty(sTool) Then sTool = m_MainWindow.m_CurrentMachine.sCurrMill
Return sTool
End Function
Friend Function GetTipFromPositions(dL1 As Double, dL2 As Double, dL3 As Double, dR1 As Double, dR2 As Double,
ByRef ptTip As Point3d) As Boolean
' Verifico sia stata inizializzata
If m_bPrepared Then Return False
' Salvo il contesto corrente
Dim nOldCtx As Integer = EgtGetCurrentContext()
' Imposto il giusto contesto
Dim bOk As Boolean = EgtSetCurrentContext(WorkInProgressScene.GetCtx())
' Trasformo in posizione punta utensile in basso
If bOk Then
' Calcolo standard con utensile principale (lama)
If Not EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, ptTip) Then bOk = False
' Se testa verticale e presente altro utensile, rifaccio calcolo con questo
Dim vtTool As Vector3d
If EgtGetCalcToolDirFromAngles(dR1, dR2, vtTool) AndAlso (vtTool - Vector3d.Z_AX()).IsSmall() Then
Dim sTool As String = GetSecondTool()
If Not String.IsNullOrEmpty(sTool) AndAlso EgtSetCalcTool(sTool, "H1", 2) Then
' Calcolo secondo tip
Dim ptTip2 As Point3d
If EgtGetCalcTipFromPositions(dL1, dL2, dL3, dR1, dR2, True, ptTip2) Then
ptTip = ptTip2
End If
' Ripristino configurazione standard
UpdateTools()
End If
End If
End If
' Trasformo rispetto a Zero Tavola
If bOk Then
ptTip.ToLoc(New Frame3d(m_ptTabOri + New Vector3d(0, 0, m_MainWindow.m_CurrentMachine.dAdditionalTable)))
End If
' Ripristino il contesto originale
EgtSetCurrentContext(nOldCtx)
Return bOk
End Function
End Class