OmagCUT 1.6o3 :

- aggiunta gestione cornici (per ora solo disegno)
- migliorie varie.
This commit is contained in:
Dario Sassi
2016-03-29 09:10:43 +00:00
parent bff95d7eb2
commit a8cd99ebb4
29 changed files with 955 additions and 332 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
<Window x:Class="AboutBoxWD"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="AboutBoxWD" Height="426.5" Width="511.8" WindowStyle="None" ResizeMode="NoResize"
Title="AboutBoxWD" Height="469.15" Width="511.8" WindowStyle="None" ResizeMode="NoResize"
AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False">
<!-- Definizione dell'AboutBox -->
@@ -20,6 +20,7 @@
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.5*"/>
@@ -41,9 +42,11 @@
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="MachineLbl" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="CopyrightLbl" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Center"
<TextBlock Name="ProjectLbl" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="18"/>
<TextBlock Name="CopyrightLbl" Grid.Column="1" Grid.Row="7" HorizontalAlignment="Center"
VerticalAlignment="Center" FontSize="15" />
<Button Name="ExitBtn" Grid.Column="1" Grid.Row="8" IsCancel="True"
<Button Name="ExitBtn" Grid.Column="1" Grid.Row="9" IsCancel="True"
Style="{StaticResource OmagCut_WindowGrayTextButton}"/>
</Grid>
+1
View File
@@ -23,6 +23,7 @@ Public Class AboutBoxWD
VersionLbl.Text = "Version : " & My.Application.Info.Version.ToString()
CopyrightLbl.Text = My.Application.Info.Copyright.ToString()
MachineLbl.Text = "Machine : " & m_MainWindow.m_CurrentMachine.sMachineName
ProjectLbl.Text = "Project : " & m_MainWindow.m_CurrentProjectPageUC.GetCurrentProjectName()
ExitBtn.Content = EgtMsg(MSG_MISSINGKEYWD + 4) 'Ok
End Sub
+2 -4
View File
@@ -52,9 +52,7 @@
</Grid>
<ProgressBar Name="PhotoProgress" Grid.Row="2" Width="220" Height="50" Minimum="0" Maximum="100"/>
<!-- Definizione della Grid inferiore -->
<!-- Definizione della Grid inferiore --><!--
<Grid Name="LowerButtonGrid" Grid.Column="1" Grid.Row="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
@@ -78,7 +76,7 @@
<Button Name="SimulateBtn" Grid.Column="5" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
<Button Name="WorkBtn" Grid.Column="6" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
</Grid>
</Grid>-->
</Grid>
+9 -159
View File
@@ -13,9 +13,10 @@ Public Class CadCutPageUC
Friend WithEvents m_NestPage As NestPageUC
Friend m_SplitPage As SplitPageUC
Friend m_MoveRawPartPage As MoveRawPartPage
Friend m_ProjectMgr As ProjectMgrUC
' Riferimento alla finestra di salvataggio con nome
Friend m_SaveNameWD As SaveNameWD
'' Riferimento alla finestra di salvataggio con nome
'Friend m_SaveNameWD As SaveNameWD
' Variabile che indica la modalità
Friend m_MovePartPage As MovePartsPages
@@ -36,6 +37,7 @@ Public Class CadCutPageUC
m_NestPage = New NestPageUC
m_SplitPage = New SplitPageUC
m_MoveRawPartPage = New MoveRawPartPage
m_ProjectMgr = New ProjectMgrUC
' Posizionamento nella griglia delle Page UserControl
m_NestPage.SetValue(Grid.RowSpanProperty, 3)
@@ -44,17 +46,11 @@ Public Class CadCutPageUC
m_SplitPage.SetValue(Grid.ColumnSpanProperty, 3)
m_MoveRawPartPage.SetValue(Grid.RowSpanProperty, 3)
m_MoveRawPartPage.SetValue(Grid.ColumnSpanProperty, 3)
m_ProjectMgr.SetValue(Grid.RowProperty, 2)
m_ProjectMgr.SetValue(Grid.ColumnProperty, 1)
' Nascondo progress e label per messaggi
PhotoProgress.Visibility = Windows.Visibility.Hidden
' Imposto i messaggi letti dal file dei messaggi
SimulateBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 1) 'Simulate - Simula
WorkBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 2) 'Work - Lavora
NewBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 3)
LoadBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 4)
SaveBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 5)
SaveNameBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 6)
' Assegno UC a questa pagina
CadCutPageGrid.Children.Add(m_ProjectMgr)
End Sub
Private Sub CadCutPage_Loaded(sender As Object, e As RoutedEventArgs)
@@ -113,6 +109,7 @@ Public Class CadCutPageUC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_ImportPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.Import
m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut
End Sub
Private Sub CadCutPage_Unloaded(sender As Object, e As RoutedEventArgs)
@@ -149,151 +146,4 @@ Public Class CadCutPageUC
End Select
End Sub
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
' Se progetto modificato, chiedo se salvarlo
If EgtGetModified() Then
Dim SaveCurrProj As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 1), EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL)
Select Case SaveCurrProj.DialogResult
Case 0 ' Annulla
Return
Case 1 ' Si
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
Case 2 ' No
' Non devo fare alcunchè
End Select
End If
' Cancello progetto salvato con nome da file ini
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", m_MainWindow.GetIniFile())
m_MainWindow.m_CurrentProjectPageUC.NewProject()
EgtZoom(ZM.ALL)
End Sub
Private Sub LoadBtn_Click(sender As Object, e As RoutedEventArgs) Handles LoadBtn.Click
' Se progetto modificato, chiedo se salvarlo
If EgtGetModified() Then
Dim SaveCurrProj As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 1), EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL)
Select Case SaveCurrProj.DialogResult
Case 0 ' Annulla
Return
Case 1 ' Si
m_MainWindow.m_CurrentProjectPageUC.SaveNameProject()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
Case 2 ' No
' Non devo fare alcunchè
End Select
End If
' Passo alla pagina di apertura con preview
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_OpenPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.Open
End Sub
Friend Sub PostLoad(ByVal sCurrDir As String, sCurrFile As String)
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
If Not m_MainWindow.m_CurrentProjectPageUC.LoadProject(sCurrDir & "\" & sCurrFile) Then
m_MainWindow.m_CurrentProjectPageUC.NewProject()
Else
' Verifico se file salvato con nome guardando il nome della cartella in cui si trova
Dim sSaveNameDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_SAVENAMEDIR, "", sSaveNameDir, m_MainWindow.GetIniFile())
If sCurrDir = sSaveNameDir Then
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, sCurrFile.Substring(0, sCurrFile.Length - 4), m_MainWindow.GetIniFile())
' Salvo equivalente con indice
m_MainWindow.m_CurrentProjectPageUC.SetNextProjectIndex()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
Else
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, String.Empty, m_MainWindow.GetIniFile())
End If
End If
EgtZoom(ZM.ALL)
End Sub
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
' Recupero nome corrente
Dim sCurrNameProj As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", sCurrNameProj, m_MainWindow.GetIniFile())
' Se vuoto vado alla salva con nome
If String.IsNullOrEmpty(sCurrNameProj) Then
SaveNameBtn_Click(sender, e)
Return
End If
' Salvataggio con nome
m_MainWindow.m_CurrentProjectPageUC.SaveNameProject()
' Slvataggio con numero ciclico
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
EgtDraw()
End Sub
Private Sub SaveNameBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveNameBtn.Click
m_SaveNameWD = New SaveNameWD(m_MainWindow)
m_SaveNameWD.ShowDialog()
End Sub
Private Sub SimulateBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulateBtn.Click
m_MainWindow.m_CurrentProjectPageUC.CurrProjGrid.Visibility = Windows.Visibility.Hidden
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_SimulationPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.Simulation
End Sub
Private Sub WorkBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkBtn.Click
Dim bOk As Boolean = True
' Verifico l'attrezzaggio degli utensili utilizzati
Dim sMissingTools As String = String.Empty
If Not VerifySetup(sMissingTools) Then
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()
If bOk Then
m_CurrProjPage.SetOrderMachiningFlag()
Dim bModif As Boolean = TestAllMachiningsForStrict()
If bModif Then
m_CurrProjPage.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
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
HideAllMachinings()
' Abilito impostazione modificato
EgtEnableModified()
' Se errore in generazione, segnalo l'errore ed esco
If Not bOk Then
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
Dim sWrkPath As String = m_MainWindow.GetTempDir() & "\" & "WorkProj.nge"
My.Computer.FileSystem.CopyFile(sMchPath, sWrkPath, True)
End If
End Sub
End Class
+11 -4
View File
@@ -381,10 +381,8 @@ Public Module CamAuto
End Function
Private Function SetLuaStandardCamParams() As Boolean
Dim sSawMch As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING, "", sSawMch, m_MainWindow.GetMachIniFile())
Dim sDrillMch As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRDRILLING, "", sDrillMch, m_MainWindow.GetMachIniFile())
Dim sSawMch As String = m_MainWindow.m_CurrentMachine.sCurrSawing
Dim sDrillMch As String = m_MainWindow.m_CurrentMachine.sCurrDrilling
Dim dReducedDepth As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_REDUCEDDEPTH, 1, m_MainWindow.GetMachIniFile())
Dim dHolesOffset As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OFFSET, 0, m_MainWindow.GetMachIniFile())
Dim dHolesOverlap As Double = GetPrivateProfileDouble(S_MACH_NEST, K_MACH_HOLES_OVERLAP, 0, m_MainWindow.GetMachIniFile())
@@ -403,6 +401,15 @@ Public Module CamAuto
Return GetRawBox(EgtGetFirstRawPart(), ptRawMin, ptRawMax)
End Function
Friend Function GetRawBox(ByRef b3RawBox As BBox3d) As Boolean
b3RawBox.Setup()
Dim ptRawMin, ptRawMax As Point3d
If Not GetRawBox(EgtGetFirstRawPart(), ptRawMin, ptRawMax) Then Return False
b3RawBox.Add(ptRawMin)
b3RawBox.Add(ptRawMax)
Return True
End Function
Friend Function GetRawBox(nRawId As Integer, ByRef ptRawMin As Point3d, ByRef ptRawMax As Point3d) As Boolean
' Recupero identificativo del grezzo e del suo solido
Dim nSolidRawId As Integer = EgtGetFirstNameInGroup(nRawId, NAME_RAW_SOLID)
+4 -4
View File
@@ -127,8 +127,8 @@ Public Class Camera
End If
' Visualizzo progressbar
m_bBusy = True
m_MainWindow.m_CadCutPageUC.PhotoProgress.Visibility = Visibility.Visible
m_MainWindow.m_CadCutPageUC.PhotoProgress.Value = 1
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Visible
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = 1
' Cancellazione eventuali vecchi file rimasti
Try
If My.Computer.FileSystem.FileExists(m_sResult) Then
@@ -151,7 +151,7 @@ Public Class Camera
bOk = False
End Try
' Nascondo progressbar
m_MainWindow.m_CadCutPageUC.PhotoProgress.Visibility = Visibility.Hidden
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Visibility = Visibility.Hidden
m_bBusy = False
Return bOk
End Function
@@ -180,7 +180,7 @@ Public Class Camera
Else
' Imposto ProgressBar
Dim nProgress As Integer = nThick * 100 / nMaxThick
m_MainWindow.m_CadCutPageUC.PhotoProgress.Value = nProgress
m_MainWindow.m_CurrentProjectPageUC.PhotoProgress.Value = nProgress
' Costringo ad aggiornare UI
UpdateUI()
' Aspetto 100 ms
+14
View File
@@ -116,6 +116,15 @@ Module ConstGen
' Info in lavorazione taglio per uscita originale
Public Const INFO_MCH_ORILEADOUT As String = "OriLO"
' Nome di pezzo che è una cornice
Public Const NAME_FRAME As String = "Frame"
' Nome del layer con la sezione della cornice
Public Const NAME_SECT As String = "Sect"
' Nome del layer con la superficie della cornice
Public Const NAME_SURF As String = "Surf"
' Info con direzione della cornice (0=lungoX,1=lungoY)
Public Const INFO_FRAME_DIR As String = "Dir"
' Costante per flag di BBox
Public Const BBFLAG As Integer = GDB_BB.ONLY_VISIBLE + GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM
@@ -136,4 +145,9 @@ Module ConstGen
Return New Color3d(255, 0, 0)
End Function
' Colore superficie di cornice
Public Function COL_FRAME() As Color3d
Return New Color3d(96, 128, 128)
End Function
End Module
+2
View File
@@ -76,6 +76,8 @@
</Border>
<ProgressBar Name="PhotoProgress" Grid.Row="2" Width="220" Height="50" Minimum="0" Maximum="100"/>
<Border Name="OutMessageBrd" Grid.Row="2" >
<TextBlock Name="OutMessageTxBl" Width="240" TextAlignment="Center"
Style="{StaticResource OmagCut_LowerCaseCharacterTextBlock}"/>
+64 -19
View File
@@ -3,32 +3,32 @@ Imports EgtWPFLib
Imports System.IO
Public Class CurrentProjectPageUC
' Dichiarazione eventi
Friend Event OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
Friend Event OnMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
Friend Event OnMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs)
' Riferimento alla MainWindow
Private m_MainWindow As MainWindow = Application.Current.MainWindow
' Dichiarazione delle Page UserControl
Friend m_SceneButtons As SceneButtonsUC
' Properties
Private m_bFirst As Boolean = True
' Dichiarazione Scene
Friend WithEvents CurrentProjectScene As New Scene
Private CurrentProjectSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
' Identificativo progetto corrente
Private m_nCurrProj As Integer = 0
' Dati del grezzo
Friend m_nRawId As Integer = GDB_ID.NULL
Friend m_dRawHeight As Double
' Costanti tipo progetto
Friend Enum PRJ_TYPE As Integer
EMPTY = 0
FLATS = 1
FRAMES = 2
End Enum
Private Sub CurrentProjectPage_Initialized(sender As Object, e As EventArgs)
'Creazione delle Page UserControl
@@ -119,12 +119,18 @@ Public Class CurrentProjectPageUC
m_nCurrProj = GetPrivateProfileInt(S_GENERAL, K_LASTPROJ, 0, m_MainWindow.GetIniFile())
NewProject()
End If
' Imposto utensile e lavorazione correnti
Dim sCurrSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sCurrSaw, m_MainWindow.GetMachIniFile())
ToolTxBx.Text = sCurrSaw
' Nascondo progress per fotografia
PhotoProgress.Visibility = Windows.Visibility.Hidden
' Carico sottopagina opportuna
If GetProjectType() <> PRJ_TYPE.FRAMES Then
CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
m_MainWindow.CadCutBtn.IsChecked = True
Else
CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
m_MainWindow.FrameCutBtn.IsChecked = True
End If
Else
EgtSetCurrentContext(CurrentProjectScene.GetCtx())
End If
@@ -134,12 +140,11 @@ Public Class CurrentProjectPageUC
If Not IsNothing(m_MainWindow.m_CurrentMachine.CurrMat) Then
MaterialTxBx.Text = m_MainWindow.m_CurrentMachine.CurrMat.sName
Else
MaterialTxBx.Text = "Non definito"
MaterialTxBx.Text = "-----"
End If
Dim sCurrMach As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING, "", sCurrMach, m_MainWindow.GetMachIniFile())
MachiningTxBx.Text = sCurrMach
' Visualizzo lama e lavorazione correnti
ToolTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSaw
MachiningTxBx.Text = m_MainWindow.m_CurrentMachine.sCurrSawing
End Sub
@@ -355,7 +360,7 @@ Public Class CurrentProjectPageUC
Return bOk
End Function
Friend Function SaveNameProject() As Boolean
Friend Function SaveNamedProject() As Boolean
' Determino nome del progetto
Dim CurrProjName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", CurrProjName, m_MainWindow.GetIniFile())
@@ -394,6 +399,46 @@ Public Class CurrentProjectPageUC
Return True
End Function
Friend Function GetCurrentProjectName() As String
Dim CurrProjName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", CurrProjName, m_MainWindow.GetIniFile())
If String.IsNullOrEmpty(CurrProjName) Then
CurrProjName = Math.Abs(m_nCurrProj).ToString("D4")
End If
Return CurrProjName & ".nge"
End Function
Private Function GetProjectType() As Integer
' Se non c'è grezzo, è vuoto
Dim nRawId As Integer = EgtGetFirstRawPart()
If nRawId = GDB_ID.NULL Then Return PRJ_TYPE.EMPTY
' Cerco un pezzo parcheggiato o nel grezzo
Dim nPartId As Integer = EgtGetFirstPart()
If nPartId = GDB_ID.NULL Then nPartId = EgtGetFirstPartInRawPart(nRawId)
' Se non ci sono pezzi, è vuoto
If nPartId = GDB_ID.NULL Then Return PRJ_TYPE.EMPTY
' Verifico il tipo di pezzo
Dim sName As String = String.Empty
If EgtGetName(nPartId, sName) AndAlso sName = NAME_FRAME Then
Return PRJ_TYPE.FRAMES
Else
Return PRJ_TYPE.FLATS
End If
End Function
Friend Function GetCurrentProjectType() As Integer
' Imposto contesto del progetto corrente
Dim nOldCtx As Integer = EgtGetCurrentContext()
Dim nNewCtx As Integer = CurrentProjectScene.GetCtx()
If nOldCtx <> nNewCtx Then EgtSetCurrentContext(nNewCtx)
' Recupero il tipo di progetto
Dim nPrjType As Integer = GetProjectType()
' Reimposto contesto originale
If nOldCtx <> nNewCtx Then EgtSetCurrentContext(nOldCtx)
' Restituisco il risultato
Return nPrjType
End Function
Friend Function RemovePreviewFromParts() As Boolean
' Processo i sottogruppi, se di livello System li rimuovo
Dim nGrpId As Integer = EgtGetFirstGroupInGroup(GDB_ID.ROOT)
+2 -4
View File
@@ -193,8 +193,7 @@ Public Class FlatteningCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
@@ -314,8 +313,7 @@ Public Class FlatteningCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
+77 -34
View File
@@ -1,43 +1,86 @@
<UserControl x:Class="FrameCutPageUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="853.3" d:DesignWidth="1280">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="853.3" d:DesignWidth="1280">
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
<ResourceDictionary Source="OmagCutDictionary.xaml"/>
</UserControl.Resources>
<!-- Definizione della FrameCutPage -->
<Grid Name="FrameCutPageGrid" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="12*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="8*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!-- Definizione della Grid superiore -->
<Grid Grid.Column="1" Grid.Row="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Button Name="PhotoBtn" Grid.Column="0" Style="{StaticResource OmagCut_RightGrayGradientYellowButton}">
<Image Source="Resources/Photo.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="RawPartBtn" Grid.Column="1" Style="{StaticResource OmagCut_RightGrayGradientYellowButton}">
<Image Source="Resources/RawPart.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
<Button Name="ImportBtn" Grid.Column="3" Style="{StaticResource OmagCut_RightGrayGradientYellowButton}">
<Image Source="Resources/Import.png" Style="{StaticResource OmagCut_ButtonIcon}"/>
</Button>
</Grid>
<!-- Chiamata al Dictionary -->
<UserControl.Resources>
<ResourceDictionary Source="OmagCutDictionary.xaml"/>
</UserControl.Resources>
<!-- Definizione della FrameCutPage -->
<Grid Name="FrameCutPageGrid" >
<Grid.RowDefinitions>
<Grid Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!-- Definizione della Grid superiore -->
<Grid Grid.Column="0" Grid.Row="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<ComboBox Name="AlongAxCmBx" Grid.Row="1" Grid.ColumnSpan="3" Height="40" Width="200"
MaxDropDownHeight="300">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding}" FontSize="20" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Name="RemovePartBtn" Grid.ColumnSpan="3" Grid.Row="2"
Style="{StaticResource OmagCut_YellowTextButton}"/>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>
+346 -1
View File
@@ -1,3 +1,348 @@
Public Class FrameCutPageUC
Imports EgtUILib
Public Class FrameCutPageUC
' Riferimenti a pagine
Private m_MainWindow As MainWindow = Application.Current.MainWindow
Private WithEvents m_CurrProjPage As CurrentProjectPageUC
Friend m_ProjectMgr As ProjectMgrUC
' Flag di pagina attiva
Private m_bActive As Boolean = False
' Dati del grezzo
Private m_nRawId As Integer = GDB_ID.NULL
Private m_RawBox As New BBox3d
' Array per combo direzioni
Private m_AlongAx(1) As String
' Direzione corrente
Private m_CurrAx As Integer = 0
' Oggetto di gestione della macchina fotografica
Friend m_Camera As New Camera
Private Sub FrameCutPage_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Creazione delle Page UserControl
m_ProjectMgr = New ProjectMgrUC
' Posizionamento nella griglia delle Page UserControl
m_ProjectMgr.SetValue(Grid.RowProperty, 2)
m_ProjectMgr.SetValue(Grid.ColumnProperty, 1)
' Assegno UC a questa pagina
FrameCutPageGrid.Children.Add(m_ProjectMgr)
' Imposto i messaggi letti dal file dei messaggi
m_AlongAx(0) = "Lungo X"
m_AlongAx(1) = "Lungo Y"
AlongAxCmBx.ItemsSource = m_AlongAx
RemovePartBtn.Content = "Rimuovi cornice"
End Sub
Private Sub FrameCutPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
m_bActive = True
' recupero dimensioni del grezzo
m_nRawId = EgtGetFirstRawPart()
GetRawBox(m_RawBox)
' Imposto direzione cornici
UpdateAlongAxCmbBx()
' Se macchina fotografica abilitata
If m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.MAN_PHOTO) Then
PhotoBtn.IsEnabled = True
' Inizializzo gestore macchina fotografica
m_Camera.Init()
Else
PhotoBtn.IsEnabled = False
End If
' Se provengo da grezzo, sistemo eventuali cornici
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.RawPart Then
Dim nId As Integer = EgtGetFirstPart()
While nId <> GDB_ID.NULL
If Not UpdateFrame(nId) Then
EgtErase(nId)
End If
nId = EgtGetFirstPart()
End While
End If
EgtZoom(ZM.ALL)
End Sub
Private Sub UpdateAlongAxCmbBx()
' Se già presenti cornici, visualizzo direzione senza poterla modificare
Dim nPartId As Integer = EgtGetFirstPartInRawPart(m_nRawId)
If nPartId <> GDB_ID.NULL Then
Dim nDir As Integer
If EgtGetInfo(nPartId, INFO_FRAME_DIR, nDir) Then m_CurrAx = nDir
AlongAxCmBx.SelectedIndex = m_CurrAx
AlongAxCmBx.IsEnabled = False
' Altrimenti, abilito cambio direzione
Else
AlongAxCmBx.SelectedIndex = m_CurrAx
AlongAxCmBx.IsEnabled = True
End If
End Sub
Private Sub FrameCutPage_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
m_bActive = False
End Sub
Private Sub OnMyMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_CurrProjPage.OnMouseDownScene
' Verifico di essere il gestore attivo
If Not m_bActive Then
Return
End If
' Si può selezionare solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or
Not m_CurrProjPage.CurrentProjectScene.IsStatusNull() Then
Return
End If
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelect(True, True, True, True, True)
Dim nSel As Integer
EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel)
Dim nId As Integer = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
' Recupero l'identificativo del pezzo cui appartiene
Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId))
Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = m_nRawId)
If bPartInTable Then
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nPartId, nStat)
EgtSetStatus(nPartId, If(nStat = GDB_ST.SEL, GDB_ST.ON_, GDB_ST.SEL))
EgtDraw()
Exit While
End If
nId = EgtGetNextObjInSelWin()
End While
End Sub
Private Sub RemovePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemovePartBtn.Click
' Ciclo di cancellazione dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Recupero indice del successivo
Dim nNextId = EgtGetNextSelectedObj()
' Cancello il pezzo
If EgtRemovePartFromRawPart(nId) Then
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
EgtErase(nId)
End If
' Passo al successivo selezionato
nId = nNextId
End While
' Aggiusto posizione dei rimanenti pezzi nel grezzo
nId = EgtGetFirstPartInRawPart(m_nRawId)
While nId <> GDB_ID.NULL
EgtRemovePartFromRawPart(nId)
nId = EgtGetFirstPartInRawPart(m_nRawId)
End While
nId = EgtGetFirstPart()
While nId <> GDB_ID.NULL
InsertPartInRawPart(nId)
nId = EgtGetFirstPart()
End While
' Aggiorno vista
EgtDraw()
' Aggiorno combo per direzioni
UpdateAlongAxCmbBx()
End Sub
Private Sub PhotoBtn_Click(sender As Object, e As RoutedEventArgs) Handles PhotoBtn.Click
' Se macchina fotografica abilitata, faccio una foto
If m_Camera.GetCameraLink() Then
If Not m_Camera.CameraClick() Then
m_CurrProjPage.SetErrorMessage(EgtMsg(90313)) 'Fotografia non riuscita
End If
' Altrimenti lancio browser di immagini
Else
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_PhotoPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.Photo
m_MainWindow.m_PrevActivePage = MainWindow.Pages.FrameCut
End If
End Sub
Private Sub RawPartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RawPartBtn.Click
m_MainWindow.m_CurrentProjectPageUC.CurrProjGrid.Visibility = Windows.Visibility.Hidden
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(Me)
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_RawPartPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.RawPart
m_MainWindow.m_PrevActivePage = MainWindow.Pages.FrameCut
End Sub
Private Sub ImportBtn_Click(sender As Object, e As RoutedEventArgs) Handles ImportBtn.Click
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_ImportPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.Import
m_MainWindow.m_PrevActivePage = MainWindow.Pages.FrameCut
End Sub
Friend Function CreateFrame(nPartId As Integer) As Boolean
' Aggiorno direzione corrente
m_CurrAx = AlongAxCmBx.SelectedIndex
' Sistemo la sezione della cornice
If Not AdjustSection(nPartId) Then Return False
' Recupero layer e curva della sezione
Dim nSectLayId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_SECT)
Dim nCrvId As Integer = EgtGetFirstInGroup(nSectLayId)
If nCrvId = GDB_ID.NULL Then Return False
' Porto la sezione nel piano opportuno e calcolo il vettore di estrusione
Dim vtExtr As Vector3d
If m_CurrAx = 0 Then
' Se lungo X nel piano YZ
EgtChangeGroupFrame(nSectLayId, New Frame3d(Point3d.ORIG, Frame3d.TYPE.LEFT))
vtExtr = New Vector3d(m_RawBox.DimX(), 0, 0)
Else
' Se lungo Y nel piano XZ
EgtChangeGroupFrame(nSectLayId, New Frame3d(Point3d.ORIG, Frame3d.TYPE.FRONT))
vtExtr = New Vector3d(0, m_RawBox.DimY(), 0)
End If
' Creo layer per la superficie
Dim nSurfLayId As Integer = EgtCreateGroup(nPartId, New Frame3d())
EgtSetName(nSurfLayId, NAME_SURF)
' Creo la superficie di estrusione
Dim nSectIds(0) As Integer
nSectIds(0) = nCrvId
Dim nSurfId As Integer = EgtCreateSurfTmByRegionExtrusion(nSurfLayId, 1, nSectIds, vtExtr, GDB_RT.GLOB)
EgtSetColor(nSurfId, COL_FRAME())
' Assegno nome e direzione a pezzo
EgtSetName(nPartId, NAME_FRAME)
EgtSetInfo(nPartId, INFO_FRAME_DIR, m_CurrAx)
' Inserisco il pezzo nel grezzo
Return InsertPartInRawPart(nPartId)
End Function
Friend Function UpdateFrame(nPartId As Integer) As Boolean
' Aggiorno direzione corrente
m_CurrAx = AlongAxCmBx.SelectedIndex
' Recupero layer e curva della sezione
Dim nSectLayId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_SECT)
Dim nCrvId As Integer = EgtGetFirstInGroup(nSectLayId)
If nCrvId = GDB_ID.NULL Then Return False
' Porto la sezione nel piano opportuno e calcolo il vettore di estrusione
Dim vtExtr As Vector3d
If m_CurrAx = 0 Then
' Se lungo X nel piano YZ
EgtChangeGroupFrame(nSectLayId, New Frame3d(Point3d.ORIG, Frame3d.TYPE.LEFT))
vtExtr = New Vector3d(m_RawBox.DimX(), 0, 0)
Else
' Se lungo Y nel piano XZ
EgtChangeGroupFrame(nSectLayId, New Frame3d(Point3d.ORIG, Frame3d.TYPE.FRONT))
vtExtr = New Vector3d(0, m_RawBox.DimY(), 0)
End If
' Recupero layer per la superficie
Dim nSurfLayId As Integer = EgtGetFirstNameInGroup(nPartId, NAME_SURF)
If nSurfLayId = GDB_ID.NULL Then Return False
EgtEmptyGroup(nSurfLayId)
' Creo la superficie di estrusione
Dim nSectIds(0) As Integer
nSectIds(0) = nCrvId
Dim nSurfId As Integer = EgtCreateSurfTmByRegionExtrusion(nSurfLayId, 1, nSectIds, vtExtr, GDB_RT.GLOB)
EgtSetColor(nSurfId, COL_FRAME())
' Assegno nome e direzione a pezzo
EgtSetName(nPartId, NAME_FRAME)
EgtSetInfo(nPartId, INFO_FRAME_DIR, m_CurrAx)
' Inserisco il pezzo nel grezzo
Return InsertPartInRawPart(nPartId)
End Function
Private Function AdjustSection(nPartId As Integer) As Boolean
' Recupero identificativo del primo layer
Dim nLayerId As Integer = EgtGetFirstLayer(nPartId)
' Concateno le curve del primo layer
EgtSelectLayerObjs(nLayerId)
Dim nCrvIds(0) As Integer
nCrvIds(0) = GDB_ID.SEL
Dim nCrvId As Integer = EgtCreateCurveCompoByChain(nLayerId, 1, nCrvIds, New Point3d(), True)
If nCrvId = GDB_ID.NULL Then Return False
' Elimino eventuali curve oltre la prima
Dim nId As Integer = EgtGetNext(nCrvId)
While nId <> GDB_ID.NULL
Dim nNextId = EgtGetNext(nId)
EgtErase(nId)
nId = nNextId
End While
' Verifico se curva piana e ne recupero il piano medio
Dim vtN As Vector3d
Dim dDist As Double
If Not EgtCurveIsFlat(nCrvId, vtN, dDist) Then
EgtProjectCurveOnPlane(nCrvId, Point3d.ORIG + dDist * vtN, vtN)
End If
' Creo layer sezione con riferimento OCS del piano
Dim frPlane As New Frame3d
frPlane.Setup(Point3d.ORIG, vtN.Glob(nLayerId))
Dim nSectLayId As Integer = EgtCreateGroup(nPartId, frPlane, GDB_RT.GLOB)
EgtSetName(nSectLayId, NAME_SECT)
EgtRelocateGlob(nCrvId, nSectLayId)
' Elimino vecchio layer
EgtErase(nLayerId)
' Verifico chiusura sezione
If Not EgtCurveIsClosed(nCrvId) Then
' Recupero ingombro locale
Dim b3Box As New BBox3d
EgtGetBBox(nCrvId, GDB_BB.STANDARD, b3Box)
' Recupero estremi
Dim ptStart, ptEnd As Point3d
EgtStartPoint(nCrvId, ptStart)
EgtEndPoint(nCrvId, ptEnd)
' Deve andare da dx a sn
If ptStart.x < ptEnd.x Then
EgtInvertCurve(nCrvId)
Dim ptTmp As Point3d = New Point3d(ptEnd)
ptEnd = ptStart
ptStart = ptTmp
End If
' Eseguo chiusura
If ptEnd.y > b3Box.Min().y Then
EgtAddCurveCompoLine(nCrvId, b3Box.Min())
End If
EgtAddCurveCompoLine(nCrvId, New Point3d(b3Box.Max().x, b3Box.Min().y, b3Box.Min().z))
EgtCloseCurveCompo(nCrvId)
End If
Return True
End Function
Private Function InsertPartInRawPart(nPartId As Integer) As Boolean
' Determino ingombro di eventuali pezzi già presenti
Dim OtherBox As New BBox3d
Dim nId2 As Integer = EgtGetFirstPartInRawPart(m_nRawId)
While nId2 <> GDB_ID.NULL
Dim TmpBox As New BBox3d
If EgtGetBBoxGlob(nId2, GDB_BB.IGNORE_TEXT + GDB_BB.IGNORE_DIM, TmpBox) Then
OtherBox.Add(TmpBox)
End If
nId2 = EgtGetNextPartInRawPart(nId2)
End While
' Determino distanza da spessore lama
Dim dMinDist As Double = 0
Dim dSawThick As Double = 0
If EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw) AndAlso
EgtTdbGetCurrToolParam(MCH_TP.THICK, dSawThick) Then
dMinDist = dSawThick + 10 * EPS_SMALL
Else
EgtOutLog("Not found current saw for frames mindist")
dMinDist = 0
End If
' Determino kerf
Dim dKerf As Double = 0
EgtGetInfo(m_nRawId, KEY_KERF, dKerf)
' Inserisco il pezzo nel grezzo
Dim ptIns As Point3d
If OtherBox.IsEmpty() Then
If m_CurrAx = 0 Then
ptIns.y = dKerf
Else
ptIns.x = dKerf
End If
Else
If m_CurrAx = 0 Then
ptIns.y = OtherBox.Max().y - m_RawBox.Min().y + dMinDist
Else
ptIns.x = OtherBox.Max().x - m_RawBox.Min().x + dMinDist
End If
End If
Return EgtAddPartToRawPart(nPartId, ptIns, EgtGetFirstRawPart())
End Function
End Class
+2 -4
View File
@@ -188,8 +188,7 @@ Public Class GridCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
@@ -311,8 +310,7 @@ Public Class GridCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
+78 -15
View File
@@ -127,6 +127,21 @@ Public Class ImportPageUC
' inibisco selezione diretta da Scene
ImportScene.SetStatusNull()
' visualizzazione bottoni
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
UseLayerBtn.Visibility = Windows.Visibility.Visible
UseRegionBtn.Visibility = Windows.Visibility.Visible
UseClosedCurveBtn.Visibility = Windows.Visibility.Visible
ResetBtn.Visibility = Windows.Visibility.Visible
SideAngleBtn.Visibility = Windows.Visibility.Visible
Else
UseLayerBtn.Visibility = Windows.Visibility.Hidden
UseRegionBtn.Visibility = Windows.Visibility.Hidden
UseClosedCurveBtn.Visibility = Windows.Visibility.Hidden
ResetBtn.Visibility = Windows.Visibility.Hidden
SideAngleBtn.Visibility = Windows.Visibility.Hidden
End If
' imposto misura
m_bMM = EgtUiUnitsAreMM()
If m_bMM Then
@@ -134,6 +149,8 @@ Public Class ImportPageUC
Else
inchBtn.IsChecked = True
End If
' disabilito ok
OkBtn.IsEnabled = False
End Sub
@@ -261,6 +278,7 @@ Public Class ImportPageUC
UseClosedCurveBtn.IsEnabled = False
UseRegionBtn.IsEnabled = False
ResetBtn.IsEnabled = False
SideAngleBtn.IsEnabled = False
Return True
End Function
@@ -287,20 +305,27 @@ Public Class ImportPageUC
End If
' Eseguo zoom
ImportScene.ZoomAll()
' abilito bottoni UseLayer, UseClosedCurve e UseRegion, disabilito Reset e Insert
UseLayerBtn.IsEnabled = True
UseClosedCurveBtn.IsEnabled = True
UseRegionBtn.IsEnabled = True
ResetBtn.IsEnabled = False
OkBtn.IsEnabled = False
' Se import per pezzi piatti
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
' abilito bottoni UseLayer, UseClosedCurve e UseRegion, disabilito Reset e Insert
UseLayerBtn.IsEnabled = True
UseClosedCurveBtn.IsEnabled = True
UseRegionBtn.IsEnabled = True
ResetBtn.IsEnabled = False
OkBtn.IsEnabled = False
SideAngleBtn.IsEnabled = False
' altrimenti import per cornici
Else
OkBtn.IsEnabled = True
End If
Return bOk
End Function
Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ImportScene.OnMouseDownScene
' Si può selezionare solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or Not ImportScene.IsStatusNull() Then
Return
End If
' Solo se in modalità angoli su lati esterni
If Not SideAngleBtn.IsChecked Then Return
' Solo con il tasto sinistro e se stato NULL
If e.Button <> Windows.Forms.MouseButtons.Left Or Not ImportScene.IsStatusNull() Then Return
' Verifico se selezionato indicativo di pezzo
EgtSetObjFilterForSelect(True, True, True, True, True)
Dim nSel As Integer
@@ -349,6 +374,8 @@ Public Class ImportPageUC
UseRegionBtn.IsEnabled = False
ResetBtn.IsEnabled = True
OkBtn.IsEnabled = True
' abilito bottone angoli su lati esterni
SideAngleBtn.IsEnabled = True
End Sub
Private Sub UseClosedCurveBtn_Click(sender As Object, e As RoutedEventArgs) Handles UseClosedCurveBtn.Click
@@ -364,6 +391,8 @@ Public Class ImportPageUC
UseRegionBtn.IsEnabled = False
ResetBtn.IsEnabled = True
OkBtn.IsEnabled = True
' abilito bottone angoli su lati esterni
SideAngleBtn.IsEnabled = True
End Sub
Private Sub UseRegionBtn_Click(sender As Object, e As RoutedEventArgs) Handles UseRegionBtn.Click
@@ -379,6 +408,8 @@ Public Class ImportPageUC
UseRegionBtn.IsEnabled = False
ResetBtn.IsEnabled = True
OkBtn.IsEnabled = True
' abilito bottone angoli su lati esterni
SideAngleBtn.IsEnabled = True
End Sub
Private Function FilterNge() As Boolean
@@ -447,6 +478,20 @@ Public Class ImportPageUC
End Sub
Private Sub OkBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
' Se import per pezzi piatti
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
LoadFlatParts()
' altrimenti import per cornici
Else
LoadFrame()
End If
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_ImportPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.m_ActivePage = m_MainWindow.m_PrevActivePage
End Sub
Private Sub LoadFlatParts()
' Ricavo nome pezzo selezionato per cancellarne i testi
Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_nSelectedPart
EgtErase(EgtGetFirstNameInGroup(Part1, SideAngleUC.SIDE_ANGLE_LAYER))
@@ -494,17 +539,31 @@ Public Class ImportPageUC
Next
' Aggiorno ambiente principale
EgtZoom(ZM.ALL)
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_ImportPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
End Sub
Private Sub LoadFrame()
' recupero il primo layer del primo pezzo
Dim nLayerId As Integer = EgtGetFirstLayer(EgtGetFirstPart())
If nLayerId = GDB_ID.NULL Then Return
' Lo esporto in un file temporaneo
Dim sTmpFile As String = m_MainWindow.GetTempDir() & "\Frame" & nLayerId & ".Nge"
If Not EgtSaveObjToFile(nLayerId, sTmpFile, NGE.BIN) Then Return
' Passo al contesto principale
EgtSetCurrentContext(m_MainWindow.m_CurrentProjectPageUC.CurrentProjectScene.GetCtx())
' Inserisco il pezzo
If Not My.Computer.FileSystem.FileExists(sTmpFile) Then Return
EgtInsertFile(sTmpFile)
' Ne recupero l'Id
Dim nPartId As Integer = EgtGetLastPart()
' Creo la cornice
m_MainWindow.m_FrameCutPageUC.CreateFrame(nPartId)
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
'Istruzioni per chiudere ImportPageUC e aprire CadCutPageUC
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_ImportPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
m_MainWindow.m_ActivePage = m_MainWindow.m_PrevActivePage
End Sub
Private Sub ImportPage_Unloaded(sender As Object, e As RoutedEventArgs)
@@ -524,6 +583,8 @@ Public Class ImportPageUC
LeftGrid.Children.Add(m_SideAngleUC)
FilePathTxBl.Visibility = Windows.Visibility.Hidden
FileListBox.Visibility = Windows.Visibility.Hidden
' Disabilito bottone reset
ResetBtn.IsEnabled = False
Else
FilePathTxBl.Visibility = Windows.Visibility.Visible
FileListBox.Visibility = Windows.Visibility.Visible
@@ -531,6 +592,8 @@ Public Class ImportPageUC
' Ricavo nome pezzo selezionato
Dim Part1 As Integer = m_MainWindow.m_ImportPageUC.m_nSelectedPart
EgtErase(EgtGetFirstNameInGroup(Part1, SideAngleUC.SIDE_ANGLE_LAYER))
' Riabilito bottone reset
ResetBtn.IsEnabled = True
End If
End Sub
+1 -2
View File
@@ -4,8 +4,7 @@
xmlns:local="clr-namespace:OmagCUT"
Title="MainWindow" Height="1024" Width="1280" ResizeMode="NoResize" WindowStyle="None"
FontFamily="./Resources/Fonts/#Century Gothic"
Initialized="Window_Initialized" Loaded="Window_Loaded" ContentRendered="Window_ContentRendered"
PreviewMouseDown="MainWindow_PreviewMouseDown" KeyDown="MainWindow_KeyDown" Unloaded="MainWindow_Unloaded" Icon="Resources/LogoOmag.jpg">
Icon="Resources/LogoOmag.jpg">
<!-- Chiamata al Dictionary -->
<Window.Resources>
+25 -12
View File
@@ -77,6 +77,10 @@ Class MainWindow
Friend m_ActivePage As Pages
Friend m_PrevActivePage As Pages ' Funziona solo per tornare indietro da grezzo e foto !!
' Timer per aggiornamento interfaccia
Private m_IdleTimer As New DispatcherTimer(DispatcherPriority.ApplicationIdle)
Friend Enum Pages
WorkInProgress
DirectCut
@@ -137,7 +141,7 @@ Class MainWindow
Return m_nKeyOptions And nKeyOpt
End Function
Private Sub Window_Initialized(sender As Object, e As EventArgs)
Private Sub MainWindow_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
' Verifico sia l'unica istanza
ManageSingleIstance()
' Impostazione path radice per i dati
@@ -293,14 +297,14 @@ Class MainWindow
' 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
WorkInProgressBtn.Content = EgtMsg(MSG_GENERAL + 1)
DirectCutBtn.Content = EgtMsg(MSG_GENERAL + 2)
CadCutBtn.Content = EgtMsg(MSG_GENERAL + 3)
FrameCutBtn.Content = EgtMsg(MSG_GENERAL + 4)
MachineBtn.Content = EgtMsg(MSG_GENERAL + 5)
' Imposto OnIdle
AddHandler m_IdleTimer.Tick, AddressOf OnIdle
End Sub
Private Sub ManageSingleIstance()
@@ -338,7 +342,7 @@ Class MainWindow
End If
End Sub
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles Me.Loaded
' Aggiungo la MachineStatusBar alla MainWindow
MainWindowGrid.Children.Add(m_MachineStatusUC)
@@ -347,12 +351,12 @@ Class MainWindow
m_WorkInProgressPageUC.Prepare()
m_WorkInProgressPageUC.UpdateTools()
' Seleziono la Tab e la Page di apertura
' Seleziono la Page di apertura
MainWindowGrid.Children.Add(m_CurrentProjectPageUC)
m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_CadCutPageUC)
m_ActivePage = Pages.CadCut
CadCutBtn.IsChecked = True
' Lancio timer per aggiornamento interfaccia
m_IdleTimer.Interval = TimeSpan.FromMilliseconds(100)
m_IdleTimer.Start()
End Sub
Private Sub WorkInProgressBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkInProgressBtn.Click
@@ -694,7 +698,7 @@ Class MainWindow
Return True
End Function
Private Sub MainWindow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)
Private Sub MainWindow_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs) Handles Me.PreviewMouseDown
' Se sto fotografando, impedisco tutte le operazioni
If m_CadCutPageUC.m_Camera.m_bBusy And Not m_CurrentProjectPageUC.m_SceneButtons.IsMouseOver Then
e.Handled = True
@@ -715,7 +719,7 @@ Class MainWindow
End If
End Sub
Private Sub MainWindow_KeyDown(sender As Object, e As KeyEventArgs)
Private Sub MainWindow_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
'If (m_NumericKeyboardWD.IsVisible And e.Key = Key.Enter) Then
' m_NumericKeyboardWD.Visibility = Windows.Visibility.Hidden
'End If
@@ -757,7 +761,7 @@ Class MainWindow
Me.Close()
End Sub
Private Sub MainWindow_Unloaded(sender As Object, e As RoutedEventArgs)
Private Sub MainWindow_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
' Chiudo il gestore della macchina fotografica
m_CadCutPageUC.m_Camera.Close()
' Terminazione generale di EgtInterface
@@ -766,7 +770,7 @@ Class MainWindow
m_objMutex.Close()
End Sub
Private Sub Window_ContentRendered(sender As Object, e As EventArgs)
Private Sub MainWindow_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
' Verifico presenza del collegamento al CN
m_bNCLink = (GetPrivateProfileInt(S_GENERAL, K_CNLINK, 0, m_sIniFile) <> 0)
m_CNCommunication.CNCommunication_Initialization()
@@ -794,6 +798,15 @@ Class MainWindow
End Sub
' OnIdle
Private Sub OnIdle()
' Recupero il tipo di progetto
Dim nPrjType As Integer = m_CurrentProjectPageUC.GetCurrentProjectType()
' Aggiorno interfaccia
CadCutBtn.IsEnabled = (nPrjType <> CurrentProjectPageUC.PRJ_TYPE.FRAMES)
FrameCutBtn.IsEnabled = (nPrjType <> CurrentProjectPageUC.PRJ_TYPE.FLATS)
End Sub
' Evento che apre AboutBox quando viene clickato il logo
Private Sub LogoBrd_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles LogoBrd.MouseDown
Dim AboutBox As New AboutBoxWD(Me)
+1 -1
View File
@@ -42,7 +42,7 @@ Public Class ManualAxesMoveUC
' Lancio timer per aggiornamento interfaccia
m_Timer.Interval = TimeSpan.FromMilliseconds(200)
m_Timer.Start()
'Imposto movimenti in rapido
' Imposto movimenti in rapido
G0Btn.IsChecked = True
End Sub
+2 -4
View File
@@ -190,8 +190,7 @@ Public Class MultipleCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
@@ -312,8 +311,7 @@ Public Class MultipleCut
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)
+2 -2
View File
@@ -60,5 +60,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.15.2")>
<Assembly: AssemblyFileVersion("1.6.15.2")>
<Assembly: AssemblyVersion("1.6.15.3")>
<Assembly: AssemblyFileVersion("1.6.15.3")>
+29 -29
View File
@@ -55,10 +55,8 @@ Public Class NestPageUC
' recupero dimensioni del grezzo e kerf
CalcRawPart()
' calcolo valore di minima distanza (da spessore lama corrente)
Dim sSawTool As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSawTool, m_MainWindow.GetMachIniFile())
Dim dSawThick As Double = 0
If EgtTdbSetCurrTool(sSawTool) AndAlso
If EgtTdbSetCurrTool(m_MainWindow.m_CurrentMachine.sCurrSaw) AndAlso
EgtTdbGetCurrToolParam(MCH_TP.THICK, dSawThick) Then
m_dMinDist = dSawThick
Else
@@ -472,33 +470,33 @@ Public Class NestPageUC
End Function
Private Sub RemovePartBtn_Click(sender As Object, e As RoutedEventArgs) Handles RemovePartBtn.Click
' Ciclo di cancellazione dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Recupero indice del successivo
Dim nNextId = EgtGetNextSelectedObj()
' Se pezzo in parcheggio cancello direttamente
If EgtIsPart(nId) Then
' Ciclo di cancellazione dei pezzi selezionati
Dim nId As Integer = EgtGetFirstSelectedObj()
While nId <> GDB_ID.NULL
' Recupero indice del successivo
Dim nNextId = EgtGetNextSelectedObj()
' Se pezzo in parcheggio cancello direttamente
If EgtIsPart(nId) Then
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
EgtErase(nId)
' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = m_nRawId Then
If EgtRemovePartFromRawPart(nId) Then
' Rimuovo le lavorazioni
EraseMachinings(nId)
' Cancello
'Cancello
EgtErase(nId)
' Altrimenti pezzo nel grezzo
ElseIf EgtGetParent(nId) = m_nRawId Then
If EgtRemovePartFromRawPart(nId) Then
' Rimuovo le lavorazioni
EraseMachinings(nId)
'Cancello
EgtErase(nId)
End If
End If
' Passo al successivo selezionato
nId = nNextId
End While
' Imposto flag posizione pezzi
m_nPartPos = PART_POS.NONE_TABLE
' Aggiorno vista
EgtZoom(ZM.ALL)
End If
' Passo al successivo selezionato
nId = nNextId
End While
' Imposto flag posizione pezzi
m_nPartPos = PART_POS.NONE_TABLE
' Aggiorno vista
EgtZoom(ZM.ALL)
End Sub
Private Sub SelectAllBtn_Click(sender As Object, e As RoutedEventArgs) Handles SelectAllBtn.Click
@@ -601,13 +599,15 @@ Public Class NestPageUC
End Function
Friend Function RemoveNestRegions() As Boolean
' Può essere chiamata prima di loaded
Dim nRawId As Integer = m_MainWindow.m_CurrentProjectPageUC.m_nRawId
' Cancello eventuale vecchia regione fuori kerf per nesting
EgtErase(EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_OUTKERF))
EgtErase(EgtGetFirstNameInGroup(nRawId, NAME_OUTKERF))
' Cancello eventuali vecchie regioni aree rovinate per nesting
Dim nId As Integer = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_DAMAGED_REG)
Dim nId As Integer = EgtGetFirstNameInGroup(nRawId, NAME_DAMAGED_REG)
While nId <> GDB_ID.NULL
EgtErase(nId)
nId = EgtGetFirstNameInGroup(m_CurrProjPage.m_nRawId, NAME_DAMAGED_REG)
nId = EgtGetFirstNameInGroup(nRawId, NAME_DAMAGED_REG)
End While
Return True
End Function
+7
View File
@@ -191,6 +191,9 @@
<Compile Include="PhotoPageUC.xaml.vb">
<DependentUpon>PhotoPageUC.xaml</DependentUpon>
</Compile>
<Compile Include="ProjectMgrUC.xaml.vb">
<DependentUpon>ProjectMgrUC.xaml</DependentUpon>
</Compile>
<Compile Include="RawPartPageUC.xaml.vb">
<DependentUpon>RawPartPageUC.xaml</DependentUpon>
</Compile>
@@ -335,6 +338,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProjectMgrUC.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="RawPartPageUC.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
+6 -9
View File
@@ -41,7 +41,6 @@ Public Class OpenPageUC
End Sub
Private Sub OpenPage_Loaded(sender As Object, e As RoutedEventArgs)
If m_bFirst Then
' imposto colore di default
Dim DefColor As New Color3d(0, 0, 0)
@@ -92,7 +91,8 @@ Public Class OpenPageUC
ClearView()
' inibisco selezione diretta da Scene
OpenScene.SetStatusNull()
' disabilito ok
OkBtn.IsEnabled = False
End Sub
Private Function LoadCurrDir() As Boolean
@@ -274,21 +274,18 @@ Public Class OpenPageUC
End Sub
Private Sub ConfirmBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
' Lancio caricamento nuovo progetto corrente
If m_bFileOk Then
m_MainWindow.m_CadCutPageUC.PostLoad(m_sCurrDir, m_sCurrFile)
End If
' Istruzioni per chiudere OpenPageUC e aprire currentproject e cadcut page
If Not m_bFileOk Then Return
' Istruzioni per chiudere OpenPageUC e aprire currentproject
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OpenPage)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
' Lancio caricamento nuovo progetto corrente
m_MainWindow.m_CadCutPageUC.m_ProjectMgr.PostLoad(m_sCurrDir, m_sCurrFile)
End Sub
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
' Istruzioni per chiudere OpenPageUC e aprire currentproject e cadcut page
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_OpenPage)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
' Non modifico progetto corrente
End Sub
+35
View File
@@ -0,0 +1,35 @@
<UserControl x:Class="ProjectMgrUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<!-- Definizione della Grid inferiore -->
<Grid Name="LowerButtonGrid" Grid.Column="1" Grid.Row="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Button Name="NewBtn" Grid.Column="0"
Style="{StaticResource OmagCut_YellowGradientYellowTextButton}"/>
<Button Name="LoadBtn" Grid.Column="1"
Style="{StaticResource OmagCut_YellowGradientYellowTextButton}"/>
<Button Name="SaveBtn" Grid.Column="2"
Style="{StaticResource OmagCut_YellowGradientYellowTextButton}"/>
<Button Name="SaveNameBtn" Grid.Column="3"
Style="{StaticResource OmagCut_YellowGradientYellowTextButton}"/>
<Button Name="SimulateBtn" Grid.Column="5" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
<Button Name="WorkBtn" Grid.Column="6" Style="{StaticResource OmagCut_GradientBlueTextButton}"/>
</Grid>
</UserControl>
+203
View File
@@ -0,0 +1,203 @@
Imports EgtUILib
Imports EgtWPFLib
Public Class ProjectMgrUC
' Riferimenti a pagine
Private m_MainWindow As MainWindow = Application.Current.MainWindow
Private m_CurrProjPage As CurrentProjectPageUC
' Riferimento alla finestra di salvataggio con nome
Friend m_SaveNameWD As SaveNameWD
Private Sub ProjectMgrUC_Initialized(sender As Object, e As EventArgs) Handles Me.Loaded
' Imposto i messaggi letti dal file dei messaggi
SimulateBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 1) 'Simulate - Simula
WorkBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 2) 'Work - Lavora
NewBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 3)
LoadBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 4)
SaveBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 5)
SaveNameBtn.Content = EgtMsg(MSG_CADCUTPAGEUC + 6)
End Sub
Private Sub ProjectMgrUC_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
m_CurrProjPage = m_MainWindow.m_CurrentProjectPageUC
End Sub
Private Sub NewBtn_Click(sender As Object, e As RoutedEventArgs) Handles NewBtn.Click
' Se progetto modificato, chiedo se salvarlo
If EgtGetModified() Then
Dim SaveCurrProj As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 1), EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL)
Select Case SaveCurrProj.DialogResult
Case 0 ' Annulla
Return
Case 1 ' Si
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
Case 2 ' No
' Non devo fare alcunchè
End Select
End If
' Cancello progetto salvato con nome da file ini
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", m_MainWindow.GetIniFile())
m_MainWindow.m_CurrentProjectPageUC.NewProject()
EgtZoom(ZM.ALL)
End Sub
Private Sub LoadBtn_Click(sender As Object, e As RoutedEventArgs) Handles LoadBtn.Click
' Se progetto modificato, chiedo se salvarlo
If EgtGetModified() Then
Dim SaveCurrProj As New EgtMsgBox(m_MainWindow, "", EgtMsg(MSG_EGTMSGBOX + 1), EgtMsgBox.Buttons.YES_NO_CANCEL, EgtMsgBox.Icons.NULL)
Select Case SaveCurrProj.DialogResult
Case 0 ' Annulla
Return
Case 1 ' Si
m_MainWindow.m_CurrentProjectPageUC.SaveNamedProject()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
Case 2 ' No
' Non devo fare alcunchè
End Select
End If
' Imposto la pagina attualmente attiva come Previous
m_MainWindow.m_PrevActivePage = m_MainWindow.m_ActivePage
' Passo alla pagina di apertura con preview
m_MainWindow.MainWindowGrid.Children.Remove(m_MainWindow.m_CurrentProjectPageUC)
m_MainWindow.MainWindowGrid.Children.Add(m_MainWindow.m_OpenPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.Open
End Sub
Friend Sub PostLoad(ByVal sCurrDir As String, sCurrFile As String)
Dim CurrentProjectPageUC As CurrentProjectPageUC = m_MainWindow.m_CurrentProjectPageUC
EgtSetCurrentContext(CurrentProjectPageUC.CurrentProjectScene.GetCtx())
If Not CurrentProjectPageUC.LoadProject(sCurrDir & "\" & sCurrFile) Then
CurrentProjectPageUC.NewProject()
Else
' Verifico se file salvato con nome guardando il nome della cartella in cui si trova
Dim sSaveNameDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_SAVENAMEDIR, "", sSaveNameDir, m_MainWindow.GetIniFile())
If sCurrDir = sSaveNameDir Then
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, sCurrFile.Substring(0, sCurrFile.Length - 4), m_MainWindow.GetIniFile())
' Salvo equivalente con indice
CurrentProjectPageUC.SetNextProjectIndex()
CurrentProjectPageUC.SaveProject()
Else
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, String.Empty, m_MainWindow.GetIniFile())
End If
End If
' Verifico se andare nel CadCut o nel FrameCut
Dim nPrjType As Integer = CurrentProjectPageUC.GetCurrentProjectType()
If nPrjType = CurrentProjectPageUC.PRJ_TYPE.FLATS And
m_MainWindow.m_PrevActivePage <> MainWindow.Pages.CadCut Then
CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_FrameCutPageUC)
CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
m_MainWindow.FrameCutBtn.IsChecked = False
m_MainWindow.CadCutBtn.IsChecked = True
ElseIf nPrjType = CurrentProjectPageUC.PRJ_TYPE.FRAMES And
m_MainWindow.m_PrevActivePage <> MainWindow.Pages.FrameCut Then
CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC)
CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
m_MainWindow.CadCutBtn.IsChecked = False
m_MainWindow.FrameCutBtn.IsChecked = True
Else
m_MainWindow.m_ActivePage = m_MainWindow.m_PrevActivePage
End If
EgtZoom(ZM.ALL)
End Sub
Private Sub SaveBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveBtn.Click
' Recupero nome corrente
Dim sCurrNameProj As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", sCurrNameProj, m_MainWindow.GetIniFile())
' Se vuoto vado alla salva con nome
If String.IsNullOrEmpty(sCurrNameProj) Then
SaveNameBtn_Click(sender, e)
Return
End If
' Salvataggio con nome
m_MainWindow.m_CurrentProjectPageUC.SaveNamedProject()
' Slvataggio con numero ciclico
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
EgtDraw()
End Sub
Private Sub SaveNameBtn_Click(sender As Object, e As RoutedEventArgs) Handles SaveNameBtn.Click
m_SaveNameWD = New SaveNameWD(m_MainWindow)
m_SaveNameWD.ShowDialog()
End Sub
Private Sub SimulateBtn_Click(sender As Object, e As RoutedEventArgs) Handles SimulateBtn.Click
m_MainWindow.m_CurrentProjectPageUC.CurrProjGrid.Visibility = Windows.Visibility.Hidden
If m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut Then
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut
Else
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_PrevActivePage = MainWindow.Pages.FrameCut
End If
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_SimulationPage)
m_MainWindow.m_ActivePage = MainWindow.Pages.Simulation
End Sub
Private Sub WorkBtn_Click(sender As Object, e As RoutedEventArgs) Handles WorkBtn.Click
Dim bOk As Boolean = True
' Verifico l'attrezzaggio degli utensili utilizzati
Dim sMissingTools As String = String.Empty
If Not VerifySetup(sMissingTools) Then
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()
If bOk Then
m_CurrProjPage.SetOrderMachiningFlag()
Dim bModif As Boolean = TestAllMachiningsForStrict()
If bModif Then
m_CurrProjPage.SetWarningMessage(EgtMsg(90321)) 'Ridotte alcune lavorazioni per evitare interferenze
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
HideAllMachinings()
' Abilito impostazione modificato
EgtEnableModified()
' Se errore in generazione, segnalo l'errore ed esco
If Not bOk Then
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
Dim sWrkPath As String = m_MainWindow.GetTempDir() & "\" & "WorkProj.nge"
My.Computer.FileSystem.CopyFile(sMchPath, sWrkPath, True)
End If
End Sub
End Class
+12 -12
View File
@@ -512,10 +512,14 @@ Public Class RawPartPageUC
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
Else
ElseIf m_MainWindow.m_PrevActivePage = MainWindow.Pages.DirectCut Then
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_DirectCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.DirectCut
ElseIf m_MainWindow.m_PrevActivePage = MainWindow.Pages.FrameCut Then
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
End If
m_MainWindow.m_PrevActivePage = MainWindow.Pages.RawPart
End If
End Sub
@@ -675,8 +679,7 @@ Public Class RawPartPageUC
Return False
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Imposto come testa corrente il laser (senza utensile ovviamente)
If Not EgtSetCalcTool("", "H3", 1) Then
Return False
@@ -750,11 +753,11 @@ Public Class RawPartPageUC
If nRawId = GDB_ID.NULL And m_RawHeight > EPS_SMALL Then
m_CurrProjPage.m_nRawId = EgtAddRawPart(Point3d.ORIG(), m_RawLength + 2 * m_RawKerf,
m_RawWidth + 2 * m_RawKerf, m_RawHeight, Col)
' se esiste e da cancellare
' se esiste e da cancellare
ElseIf m_RawHeight < EPS_SMALL Then
EgtRemoveRawPart(nRawId)
m_CurrProjPage.m_nRawId = GDB_ID.NULL
' Altrimenti lo modifico
' Altrimenti lo modifico
Else
m_CurrProjPage.m_nRawId = nRawId
EgtModifyRawPart(nRawId, Point3d.ORIG(), m_RawLength + 2 * m_RawKerf,
@@ -1098,8 +1101,7 @@ Public Class RawPartPageUC
' 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))
UpdateUI()
Next
If bProbingOk Then
' Leggo spessore misurato
@@ -1114,8 +1116,7 @@ Public Class RawPartPageUC
MsgBoxStateInfo.LoadingPrBr_Value = 100
MsgBoxStateInfo.Text = EgtMsg(MSG_RAWPARTPAGEUC + 27)
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
UpdateUI()
System.Threading.Thread.Sleep(1500)
'Trasformo misura rilevata in mm
If m_MainWindow.m_CNCommunication.m_CN.Is_G71_active() Then
@@ -1147,8 +1148,7 @@ Public Class RawPartPageUC
Else
MsgBoxStateInfo.Text = EgtMsg(MSG_RAWPARTPAGEUC + 28)
' Costringo ad aggiornare GUI
Dim nDummy As Integer
Application.Current.Dispatcher.Invoke(Windows.Threading.DispatcherPriority.Background, New Action(Function() nDummy = 0))
UpdateUI()
System.Threading.Thread.Sleep(1500)
MsgBoxStateInfo.Close()
End If
@@ -1191,7 +1191,7 @@ Public Class RawPartPageUC
EgtDraw()
End Sub
Private Sub CloseBtn_Checked(sender As Object, e As RoutedEventArgs) Handles CloseBtn.Click
Private Sub CloseBtn_Click(sender As Object, e As RoutedEventArgs) Handles CloseBtn.Click
CloseRawByLaser()
End Sub
+2 -2
View File
@@ -15,7 +15,7 @@ Public Class SaveNameWD
Private Sub SaveNameWD_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
Me.Top = Owner.Top + Owner.Height / 2 - Me.Height / 2
Me.Left = Owner.Left + Owner.Width / 2 - Me.Width / 2
SaveNameTxbl.Text = "Nome del progetto da salvare"
SaveNameTxbl.Text = EgtMsg(MSG_CADCUTPAGEUC + 7) 'Nuovo nome del progetto
GetPrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, "", SaveNameTxBx.Text, m_MainWindow.GetIniFile())
End Sub
@@ -34,7 +34,7 @@ Public Class SaveNameWD
' Aggiorno file Ini
WritePrivateProfileString(S_GENERAL, K_LASTNAMEPROJ, SaveNameTxBx.Text, m_MainWindow.GetIniFile())
' Eseguo salvataggio
m_MainWindow.m_CurrentProjectPageUC.SaveNameProject()
m_MainWindow.m_CurrentProjectPageUC.SaveNamedProject()
m_MainWindow.m_CurrentProjectPageUC.SaveProject()
EgtDraw()
Close()
+2 -2
View File
@@ -64,10 +64,10 @@ Public Class SawTestUC
EgtOutLog("Error on RawBox")
End If
' Dati lama corrente
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", m_sSaw, m_MainWindow.GetMachIniFile())
m_sSaw = m_MainWindow.m_CurrentMachine.sCurrSaw
EgtTdbSetCurrTool(m_sSaw)
' Dati lavorazione con lama corrente
GetPrivateProfileString(S_MACH_MACH, K_CURRSAWING, "", m_sSawing, m_MainWindow.GetMachIniFile())
m_sSawing = m_MainWindow.m_CurrentMachine.sCurrSawing
EgtMdbSetCurrMachining(m_sSawing)
' Reset taglio e disabilito bottone esecuzione
m_bCutOk = False
+9 -4
View File
@@ -288,8 +288,7 @@ Public Class SimulationPageUC
Private Function LoadCurrTools() As Boolean
' Imposto la lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
If Not EgtLoadTool("H1", 1, sSaw) Then
Return False
End If
@@ -334,8 +333,14 @@ Public Class SimulationPageUC
' Esco dalla pagina
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Remove(Me)
m_CurrProjPage.CurrProjGrid.Visibility = Windows.Visibility.Visible
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
If m_MainWindow.m_PrevActivePage = MainWindow.Pages.CadCut Then
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_CadCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.CadCut
Else
m_MainWindow.m_CurrentProjectPageUC.CurrentProjectPageGrid.Children.Add(m_MainWindow.m_FrameCutPageUC)
m_MainWindow.m_ActivePage = MainWindow.Pages.FrameCut
End If
End Sub
End Class
+1 -2
View File
@@ -305,8 +305,7 @@ Public Class SingleCutUC
Return
End If
' Ricavo dati lama corrente
Dim sSaw As String = String.Empty
GetPrivateProfileString(S_MACH_MACH, K_CURRSAW, "", sSaw, m_MainWindow.GetMachIniFile())
Dim sSaw As String = m_MainWindow.m_CurrentMachine.sCurrSaw
' Se punto da laser
If PointModeCmBx.SelectedIndex = PT_MODE.LASER Then
' Imposto come testa corrente il laser (senza utensile ovviamente)