9af856f50d
- modifiche per parametro aggiunto a EgtInitMachMgr - disegno utensili in DB utensili spostato nelle librerie di base.
476 lines
21 KiB
VB.net
476 lines
21 KiB
VB.net
Imports System.IO
|
|
Imports EgtUILib
|
|
|
|
Public Class OpenPageUC
|
|
|
|
'Riferimento alla MainWindow
|
|
Private m_MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
|
|
|
|
'Dichiarazione dello UserControl SceneButtons
|
|
Private m_SceneButtons As SceneButtonsUC
|
|
|
|
' Properties
|
|
Private m_sCurrDir As String = String.Empty
|
|
Private m_sCurrFile As String = String.Empty
|
|
Private m_bFirst As Boolean = True
|
|
Private m_bFileOk As Boolean = False
|
|
Private m_bEnableSlabDxf As Boolean = False
|
|
Private m_sSlabLayer As String = String.Empty
|
|
Private m_sPartsLayer As String = String.Empty
|
|
Private m_sScrapLayer As String = String.Empty
|
|
Private m_dSlabThick As Double = 0
|
|
|
|
' Dichiarazione Scene
|
|
Friend WithEvents OpenScene As New Scene
|
|
Dim OpenSceneHost As New System.Windows.Forms.Integration.WindowsFormsHost
|
|
|
|
Private Sub OpenPage_Initialized(sender As Object, e As EventArgs)
|
|
|
|
' Creazione dello UserControl SceneButtons
|
|
m_SceneButtons = New SceneButtonsUC
|
|
|
|
' Posizionemento nella griglia del UserControl SceneButtons
|
|
m_SceneButtons.SetValue(Grid.ColumnProperty, 1)
|
|
UpperButtonsGrid.Children.Add(m_SceneButtons)
|
|
|
|
' Assegnazione scena all'host e posizionamento nella OpenPageGrid
|
|
OpenSceneHost.Child = OpenScene
|
|
OpenSceneHost.SetValue(Grid.ColumnProperty, 1)
|
|
OpenSceneHost.SetValue(Grid.RowProperty, 2)
|
|
' OpenSceneHost.SetValue(Grid.RowSpanProperty, 1)
|
|
Me.OpenPageGrid.Children.Add(OpenSceneHost)
|
|
|
|
' Definizione del collegamento tra ItemList e ListBox1
|
|
FileListBox.ItemsSource = m_MainWindow.m_OpenItemList
|
|
|
|
' Nascondo bottone lettura codice a barre se non attivato da file .ini
|
|
BarCodeBtn.Visibility = If(m_MainWindow.m_CurrentMachine.bHasOpenBarCodeReader, Windows.Visibility.Visible, Windows.Visibility.Collapsed)
|
|
|
|
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)
|
|
GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor, m_MainWindow.GetIniFile())
|
|
OpenScene.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())
|
|
OpenScene.SetViewBackground(BackTopColor, BackBotColor)
|
|
' imposto colore di evidenziazione
|
|
Dim MarkColor As New Color3d(255, 255, 0)
|
|
GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor, m_MainWindow.GetIniFile())
|
|
OpenScene.SetMarkMaterial(MarkColor)
|
|
' imposto colore per superfici selezionate
|
|
Dim SelSurfColor As New Color3d(255, 255, 192)
|
|
GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor, m_MainWindow.GetIniFile())
|
|
OpenScene.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())
|
|
OpenScene.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())
|
|
OpenScene.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())
|
|
OpenScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits)
|
|
' Inizializzazione delle viste
|
|
OpenScene.Init()
|
|
' dimensione lineare max in pixel delle textures
|
|
Dim nTxrMaxLinPix As Integer = GetPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096, m_MainWindow.GetIniFile())
|
|
EgtSetTextureMaxLinPixels(nTxrMaxLinPix)
|
|
' inizializzo gestore lavorazioni
|
|
EgtInitMachMgr(m_MainWindow.GetMachinesRootDir(), m_MainWindow.GetToolMakersDir())
|
|
' verifico abilitazione carico SlabDxf e ne carico la configurazione
|
|
m_bEnableSlabDxf = m_MainWindow.GetKeyOption(MainWindow.KEY_OPT.IMPORT_SLABDXF) And
|
|
(GetPrivateProfileInt(S_SLABDXF, K_IMPORTSLABDXF, 0, m_MainWindow.GetIniFile()) <> 0)
|
|
GetPrivateProfileString(S_SLABDXF, K_SLABLAYER, "SlabBoundary", m_sSlabLayer, m_MainWindow.GetIniFile())
|
|
GetPrivateProfileString(S_SLABDXF, K_PARTSLAYER, "Counters", m_sPartsLayer, m_MainWindow.GetIniFile())
|
|
GetPrivateProfileString(S_SLABDXF, K_SCRAPLAYER, "ReservedAreaBoundary", m_sScrapLayer, m_MainWindow.GetIniFile())
|
|
m_dSlabThick = GetPrivateProfileDouble(S_SLABDXF, K_STDTHICK, 20, m_MainWindow.GetIniFile())
|
|
' leggo direttorio corrente
|
|
GetPrivateProfileString(S_GENERAL, K_SAVENAMEDIR, "", m_sCurrDir, m_MainWindow.GetIniFile())
|
|
' lo carico
|
|
LoadCurrDir()
|
|
m_bFirst = False
|
|
Else
|
|
EgtSetCurrentContext(OpenScene.GetCtx())
|
|
End If
|
|
' Pulisco tutto
|
|
ClearView()
|
|
' inibisco selezione diretta da Scene
|
|
OpenScene.SetStatusNull()
|
|
' disabilito ok
|
|
OkBtn.IsEnabled = False
|
|
End Sub
|
|
|
|
Private Function LoadCurrDir() As Boolean
|
|
' se direttorio corrente non valido, carico l'elenco dei dischi
|
|
If String.IsNullOrWhiteSpace(m_sCurrDir) OrElse Not IO.Directory.Exists(m_sCurrDir) Then
|
|
Return LoadDisks()
|
|
End If
|
|
Dim TempPath As New Text.StringBuilder(260)
|
|
PathCompactPathEx(TempPath, m_sCurrDir, 22, 0)
|
|
' lo visualizzo
|
|
FilePathTxBl.Text = TempPath.ToString
|
|
' pulisco la lista
|
|
m_MainWindow.m_OpenItemList.Clear()
|
|
' per risalire al direttorio padre
|
|
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem("..", 0))
|
|
' elenco dei sottodirettori
|
|
Dim DirInfo As New DirectoryInfo(m_sCurrDir)
|
|
Dim vDirI As DirectoryInfo() = DirInfo.GetDirectories("*")
|
|
Dim DirI As DirectoryInfo
|
|
For Each DirI In vDirI
|
|
' per saltare i link, troppo complessi da gestire
|
|
If (DirI.Attributes And FileAttributes.Hidden) <> FileAttributes.Hidden Or
|
|
(DirI.Attributes And FileAttributes.System) <> FileAttributes.System Then
|
|
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DirI.Name, 2))
|
|
End If
|
|
Next
|
|
' elenco dei file
|
|
Dim vFileI As FileInfo() = DirInfo.GetFiles()
|
|
Dim FileI As FileInfo
|
|
For Each FileI In vFileI
|
|
Dim sExt As String = Path.GetExtension(FileI.Name).ToUpper()
|
|
If sExt = ".NGE" Or (m_bEnableSlabDxf And sExt = ".DXF") Then
|
|
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(FileI.Name, 3))
|
|
End If
|
|
Next
|
|
' pulisco la vista
|
|
ClearView()
|
|
Return True
|
|
End Function
|
|
|
|
Private Function LoadDisks() As Boolean
|
|
' dir corrente vuoto
|
|
m_sCurrDir = ""
|
|
' lo visualizzo
|
|
FilePathTxBl.Text = m_sCurrDir
|
|
' pulisco la lista
|
|
m_MainWindow.m_OpenItemList.Clear()
|
|
' elenco dei dischi
|
|
Dim vDriI As DriveInfo() = DriveInfo.GetDrives()
|
|
Dim DriI As DriveInfo
|
|
For Each DriI In vDriI
|
|
m_MainWindow.m_OpenItemList.Add(New IconListBoxItem(DriI.Name, 1))
|
|
Next
|
|
' pulisco la vista
|
|
ClearView()
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub FileListBox_PreviewMouseUp(sender As Object, e As MouseButtonEventArgs) Handles FileListBox.PreviewMouseUp
|
|
' Recupero item selezionato
|
|
If FileListBox.SelectedItems.Count() = 0 Then Return
|
|
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
|
' A seconda del tipo
|
|
Select Case vItems.PictureID
|
|
Case 0 ' Vai nel direttorio padre
|
|
m_sCurrDir = IO.Path.GetDirectoryName(m_sCurrDir)
|
|
m_sCurrFile = ""
|
|
LoadCurrDir()
|
|
Case 1 ' Vai nella radice del disco
|
|
m_sCurrDir = vItems.Name
|
|
m_sCurrFile = ""
|
|
LoadCurrDir()
|
|
Case 2 ' Vai nel sottodirettorio
|
|
m_sCurrDir = IO.Path.Combine(m_sCurrDir, vItems.Name)
|
|
m_sCurrFile = ""
|
|
LoadCurrDir()
|
|
Case 3 ' File
|
|
If vItems.Name <> m_sCurrFile Then
|
|
m_sCurrFile = vItems.Name
|
|
LoadCurrFile()
|
|
End If
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
Private Sub FileListBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles FileListBox.SelectionChanged
|
|
' Recupero item selezionato
|
|
If FileListBox.SelectedItems.Count() = 0 Then Return
|
|
Dim vItems As IconListBoxItem = FileListBox.SelectedItems(0)
|
|
' Gestisco solo aggiornamento visualizzazione file
|
|
If vItems.PictureID = 3 Then
|
|
m_sCurrFile = vItems.Name
|
|
LoadCurrFile()
|
|
End If
|
|
End Sub
|
|
|
|
Private Function ClearView() As Boolean
|
|
' Pulisco il DB geometrico locale
|
|
EgtNewFile()
|
|
' Eseguo zoom
|
|
OpenScene.ZoomAll()
|
|
' Cancello messaggio
|
|
MessageTxBx.Text = ""
|
|
MessageBrd.Background = Brushes.Transparent
|
|
OkBtn.IsEnabled = False
|
|
m_bFileOk = False
|
|
Return True
|
|
End Function
|
|
|
|
Private Function LoadCurrFile() As Boolean
|
|
' Costruisco path completa del file
|
|
Dim sPath = IO.Path.Combine(m_sCurrDir, m_sCurrFile)
|
|
' Riconoscimento tipo
|
|
Dim nFileType As Integer = EgtGetFileType(sPath)
|
|
If nFileType = FT.NGE Then
|
|
Return LoadCurrNgeFile(sPath)
|
|
ElseIf nFileType = FT.DXF Then
|
|
Return LoadCurrDxfFile(sPath)
|
|
Else
|
|
' Formato sconosciuto
|
|
EgtNewFile()
|
|
OpenScene.ZoomAll()
|
|
Return False
|
|
End If
|
|
End Function
|
|
|
|
Private Function LoadCurrNgeFile(sPath As String) As Boolean
|
|
' Pulisco il DB geometrico locale
|
|
Dim bOk As Boolean = EgtNewFile()
|
|
' Carico Nge
|
|
bOk = bOk AndAlso EgtOpenFile(sPath)
|
|
' attivo il gruppo di lavoro corrente
|
|
Dim nMachGrpId As Integer = EgtGetFirstMachGroup()
|
|
EgtSetCurrMachGroup(nMachGrpId)
|
|
EgtShowOnlyTable(True)
|
|
' visualizzo anche eventuali pezzi parcheggiati
|
|
ShowParkedParts()
|
|
' Cerco contrassegno di progetto OmagCut e flag di tagli ridotti
|
|
Dim nMarkId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, NAME_PROJMARK)
|
|
Dim bMarkOk = (nMarkId <> GDB_ID.NULL)
|
|
Dim nFileReducedCut As Integer = 1
|
|
EgtGetInfo(nMarkId, INFO_REDUCEDCUT, nFileReducedCut)
|
|
Dim nReducedCut As Integer = GetPrivateProfileInt(S_MACH_NEST, K_MACH_REDUCEDCUT, 0, m_MainWindow.GetMachIniFile())
|
|
Dim bReducedCutOk = (nFileReducedCut = 0) OrElse
|
|
(nFileReducedCut <> 0 And nReducedCut <> 0) OrElse
|
|
VerifyPartsNesting(False)
|
|
m_bFileOk = bOk And bMarkOk And bReducedCutOk
|
|
If m_bFileOk Then
|
|
MessageTxBx.Text = ""
|
|
MessageBrd.Background = Brushes.Transparent
|
|
OkBtn.IsEnabled = True
|
|
ElseIf Not bMarkOk Then
|
|
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
|
|
MessageBrd.Background = Brushes.Tomato
|
|
OkBtn.IsEnabled = False
|
|
Else
|
|
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 2) 'Progetto con interferenze. Per caricarlo disabilita rispetto tagli completi.
|
|
MessageBrd.Background = Brushes.Tomato
|
|
OkBtn.IsEnabled = False
|
|
End If
|
|
' Eseguo zoom
|
|
OpenScene.ZoomAll()
|
|
Return bOk
|
|
End Function
|
|
|
|
Private Function LoadCurrDxfFile(sPath As String) As Boolean
|
|
' Pulisco il DB geometrico locale
|
|
Dim bOk As Boolean = EgtNewFile()
|
|
' Carico Dxf
|
|
Dim dScale As Double = EgtFromUiUnits(1)
|
|
bOk = bOk AndAlso EgtImportDxf(sPath, dScale)
|
|
' Verifico presenza layer contorno lastra e layer rimanenze
|
|
Dim bRawOk As Boolean = False
|
|
Dim nLayId As Integer = EgtGetFirstGroupInGroup(EgtGetFirstGroupInGroup(GDB_ID.ROOT))
|
|
While nLayId <> GDB_ID.NULL
|
|
Dim nNextLayId = EgtGetNextGroup(nLayId)
|
|
Dim sName As String = ""
|
|
If EgtGetName(nLayId, sName) Then
|
|
If sName.EndsWith(m_sSlabLayer, StringComparison.InvariantCultureIgnoreCase) Then
|
|
bRawOk = True
|
|
EgtErase(nLayId)
|
|
ElseIf sName.EndsWith(m_sScrapLayer, StringComparison.InvariantCultureIgnoreCase) Then
|
|
EgtErase(nLayId)
|
|
End If
|
|
End If
|
|
nLayId = nNextLayId
|
|
End While
|
|
bOk = bOk And bRawOk
|
|
' Sistemo i pezzi
|
|
Dim dToler As Double = GetPrivateProfileDouble(S_FLATPARTS, K_FLPTOLERANCE, 0.1, m_MainWindow.GetIniFile())
|
|
EgtCreateAdjustFlatParts(FPC_TYPE.REGION, dToler)
|
|
' Se prevista gestione colore->angolo di fianco
|
|
If GetPrivateProfileInt(S_COLORTOSIDEANG, K_CTSA_ENABLE, 0, m_MainWindow.GetIniFile()) <> 0 Then
|
|
SideAngle.ColorToSideAngle(OpenScene.GetCtx())
|
|
End If
|
|
' Ricarico contorno lastra
|
|
Dim bRawFound = False
|
|
bOk = bOk AndAlso EgtImportDxf(sPath, dScale)
|
|
If bOk Then
|
|
Dim nLastGroupId As Integer = EgtGetLastGroupInGroup(GDB_ID.ROOT)
|
|
Dim nLay2Id As Integer = EgtGetFirstGroupInGroup(nLastGroupId)
|
|
While nLay2Id <> GDB_ID.NULL
|
|
Dim nNextLayId = EgtGetNextGroup(nLay2Id)
|
|
Dim sName As String = ""
|
|
' Se layer del grezzo con una sola curva chiusa
|
|
If Not bRawFound AndAlso EgtGetName(nLay2Id, sName) AndAlso
|
|
sName.EndsWith(m_sSlabLayer, StringComparison.InvariantCultureIgnoreCase) AndAlso
|
|
EgtGetGroupObjs(nLay2Id) = 1 AndAlso EgtCurveIsClosed(EgtGetFirstInGroup(nLay2Id)) Then
|
|
' Recupero la curva e la semplifico
|
|
Dim nCrvId As Integer = EgtGetFirstInGroup(nLay2Id)
|
|
EgtApproxCurve(nCrvId, APP_TYPE.LINES, 1.0)
|
|
' Creo la regione del grezzo
|
|
Dim nRegId As Integer = EgtCreateSurfFlatRegion(nLay2Id, nCrvId)
|
|
If nRegId <> GDB_ID.NULL Then
|
|
bRawFound = True
|
|
EgtSetName(nCrvId, NAME_RAW_OUTLINE)
|
|
EgtSetColor(nCrvId, New Color3d(0, 0, 0))
|
|
EgtSetName(nRegId, NAME_RAW_REGION)
|
|
EgtSetColor(nRegId, New Color3d(64, 192, 255, 20))
|
|
End If
|
|
Else
|
|
EgtErase(nLay2Id)
|
|
End If
|
|
nLay2Id = nNextLayId
|
|
End While
|
|
End If
|
|
' Stato
|
|
m_bFileOk = bOk And bRawFound
|
|
If m_bFileOk Then
|
|
MessageTxBx.Text = ""
|
|
MessageBrd.Background = Brushes.Transparent
|
|
OkBtn.IsEnabled = True
|
|
Else
|
|
MessageTxBx.Text = EgtMsg(MSG_OPENPAGEUC + 1) 'Progetto non valido
|
|
MessageBrd.Background = Brushes.Tomato
|
|
OkBtn.IsEnabled = False
|
|
End If
|
|
' Eseguo zoom
|
|
OpenScene.ZoomAll()
|
|
Return bOk
|
|
End Function
|
|
|
|
Private Function AdjustSlabDxf() As Boolean
|
|
' Creo un gruppo di lavoro e carico la macchina corrente
|
|
If EgtAddMachGroup(MACH_GROUP, m_MainWindow.GetCurrMachine()) = GDB_ID.NULL Then Return False
|
|
' Scelta tavola della macchina
|
|
Dim nTabInd As Integer = m_MainWindow.m_CadCutPageUC.m_ProjectMgr.ChooseTable()
|
|
' Imposto la tavola corrente
|
|
If Not EgtSetTable(GetTableName(nTabInd)) Then Return False
|
|
EgtShowOnlyTable(True)
|
|
' Aggiungo eventuale sovratavola
|
|
m_MainWindow.m_CurrentProjectPageUC.AddAdditionalTable()
|
|
' Visualizzo anche eventuali pezzi parcheggiati
|
|
ShowParkedParts()
|
|
' Creo il grezzo
|
|
Dim nRawPrtId As Integer = EgtGetLastGroupInGroup(GDB_ID.ROOT)
|
|
Dim nRawCrvId As Integer = EgtGetFirstNameInGroup(EgtGetFirstGroupInGroup(nRawPrtId), NAME_RAW_OUTLINE)
|
|
Dim b3Raw As New BBox3d
|
|
EgtGetBBoxGlob(nRawCrvId, GDB_BB.STANDARD, b3Raw)
|
|
Dim RawCol As New Color3d(64, 192, 255, 40)
|
|
Dim nRawId As Integer = EgtAddRawPart(Point3d.ORIG(), b3Raw.DimX(), b3Raw.DimY(), m_dSlabThick, RawCol)
|
|
EgtModifyRawPart(nRawId, nRawCrvId, 0, 0, m_dSlabThick, RawCol)
|
|
Dim ptRef As New Point3d(10, 10, m_MainWindow.m_CurrentMachine.dAdditionalTable)
|
|
EgtMoveToCornerRawPart(nRawId, ptRef, MCH_CR.BL)
|
|
EgtErase(nRawPrtId)
|
|
' Sistemo il kerf
|
|
Dim nOutlineId = EgtGetFirstNameInGroup(nRawId, NAME_RAW_OUTLINE)
|
|
Dim nKerfId As Integer = EgtCopyGlob(nOutlineId, nOutlineId, GDB_POS.AFTER)
|
|
EgtSetStatus(nOutlineId, GDB_ST.OFF)
|
|
EgtSetName(nKerfId, NAME_KERF)
|
|
EgtSetColor(nKerfId, New Color3d(255, 0, 0, 100))
|
|
EgtSetInfo(nRawId, KEY_KERF, 0)
|
|
EgtSetInfo(nRawId, KEY_RAWBYPOINTS, 1)
|
|
' Inserisco i pezzi nel grezzo
|
|
Dim nPartId As Integer = EgtGetFirstPart()
|
|
While nPartId <> GDB_ID.NULL
|
|
Dim nNextPartId As Integer = EgtGetNextPart(nPartId)
|
|
Dim b3Part As New BBox3d
|
|
EgtGetBBoxGlob(nPartId, GDB_BB.STANDARD, b3Part)
|
|
Dim ptMove As Point3d = Point3d.ORIG() + (b3Part.Min() - b3Raw.Min()) + Vector3d.Z_AX() * m_dSlabThick
|
|
EgtAddPartToRawPart(nPartId, ptMove, nRawId)
|
|
nPartId = nNextPartId
|
|
End While
|
|
' Inserisco contrassegno di progetto OmagCut valido
|
|
m_MainWindow.m_CurrentProjectPageUC.AddProjectMark()
|
|
' Salvo il progetto
|
|
m_sCurrFile = Path.ChangeExtension(m_sCurrFile, ".nge")
|
|
Return EgtSaveFile(m_sCurrDir & "\" & m_sCurrFile, NGE.BIN)
|
|
End Function
|
|
|
|
Private Function VerifyPartsNesting(bReducedCut As Boolean) As Boolean
|
|
' Recupero il grezzo
|
|
Dim nRawId As Integer = EgtGetFirstRawPart()
|
|
' Aggiorno regioni per nesting
|
|
m_MainWindow.m_CadCutPageUC.m_NestPage.UpdateNestRegions()
|
|
' Ciclo su tutti i pezzi in tavola
|
|
Dim nPartId As Integer = EgtGetFirstGroupInGroup(nRawId)
|
|
While nPartId <> GDB_ID.NULL
|
|
If Not EgtVerifyPart(nPartId, bReducedCut) Then
|
|
Return False
|
|
End If
|
|
nPartId = EgtGetNextGroup(nPartId)
|
|
End While
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub OnMouseDownScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles OpenScene.OnMouseDownScene
|
|
End Sub
|
|
|
|
Private Sub OnShowDistanceVector(sender As Object, vtDist As Vector3d) Handles OpenScene.OnShowDistanceVector
|
|
MessageTxBx.Text = DistToString(vtDist)
|
|
MessageBrd.Background = Application.Current.FindResource("OmagCut_Green")
|
|
End Sub
|
|
|
|
Private Sub BarCodeBtn_Click(sender As Object, e As RoutedEventArgs) Handles BarCodeBtn.Click
|
|
Dim BarCodeWindow As New BarCodeWD(m_MainWindow)
|
|
If BarCodeWindow.ShowDialog() Then
|
|
Dim sBarCode As String = BarCodeWindow.GetBarCode()
|
|
sBarCode = Path.GetFileNameWithoutExtension(sBarCode) & ".nge"
|
|
Dim ItSel As IconListBoxItem = m_MainWindow.m_OpenItemList.First(Function(x) String.Compare(x.Name, sBarCode, True) = 0)
|
|
If Not IsNothing(ItSel) Then
|
|
FileListBox.SelectedItem = ItSel
|
|
FileListBox.ScrollIntoView(FileListBox.SelectedItem)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ConfirmBtn_Click(sender As Object, e As RoutedEventArgs) Handles OkBtn.Click
|
|
If Not m_bFileOk Then Return
|
|
m_SceneButtons.MeasureBtn.IsChecked = False
|
|
' Se file dxf devo processarlo opportunamente
|
|
Dim bFileDxf As Boolean = (EgtGetFileType(m_sCurrFile) = FT.DXF)
|
|
If bFileDxf Then AdjustSlabDxf()
|
|
' 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)
|
|
' Lancio caricamento nuovo progetto corrente
|
|
m_MainWindow.m_CadCutPageUC.m_ProjectMgr.PostLoad(m_sCurrDir, m_sCurrFile)
|
|
' Se file dxf
|
|
If bFileDxf Then
|
|
' Applico le lavorazioni
|
|
ResetAllMachinings()
|
|
' Sposto il file nel direttorio temporaneo con nome standard
|
|
Dim sSouPath As String = m_sCurrDir & "\" & m_sCurrFile
|
|
Dim sDestPath As String = m_MainWindow.GetTempDir() & "\" & "SlabDxf.nge"
|
|
My.Computer.FileSystem.MoveFile(sSouPath, sDestPath, True)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ExitBtn_Click(sender As Object, e As RoutedEventArgs) Handles ExitBtn.Click
|
|
m_SceneButtons.MeasureBtn.IsChecked = False
|
|
' 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)
|
|
' Non modifico progetto corrente
|
|
m_MainWindow.m_ActivePage = m_MainWindow.m_PrevActivePage
|
|
End Sub
|
|
|
|
Private Sub OpenPage_Unloaded(sender As Object, e As RoutedEventArgs)
|
|
End Sub
|
|
|
|
End Class
|