diff --git a/ConstGen.vb b/ConstGen.vb
index 218a5b9..d238c0b 100644
--- a/ConstGen.vb
+++ b/ConstGen.vb
@@ -49,6 +49,10 @@ Module ConstGen
' Nome della superficie del grezzo
Public Const NAME_RAW_SOLID As String = "RawSolid"
+ ' Nome della regione fuori kerf nel grezzo
+ Public Const NAME_OUTKERF_REG As String = "SheetOut"
+ ' Nome della regione di riferimento nel grezzo
+ Public Const NAME_REF_REG As String = "RefReg"
' Contrassegno di progetto OmagCut
Public Const NAME_PROJMARK As String = "OmagCut"
diff --git a/ConstMsg.vb b/ConstMsg.vb
index 52f6ce5..9ecb722 100644
--- a/ConstMsg.vb
+++ b/ConstMsg.vb
@@ -26,7 +26,7 @@
Public Const MSG_COMBOBOXPARAM As Integer = MSG_OMAGCUT + 800
Public Const MSG_ALARMSPAGEUC As Integer = MSG_OMAGCUT + 900
Public Const MSG_MACHINECNPAGEUC As Integer = MSG_OMAGCUT + 930
- Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 950
+ Public Const MSG_OPTIONSPAGEUC As Integer = MSG_OMAGCUT + 980
Public Const MSG_EGTMSGBOX As Integer = MSG_OMAGCUT + 1100
Public Const MSG_CSVPAGEUC As Integer = MSG_OMAGCUT + 1200
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 5bc9e93..df1eccf 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -52,24 +52,27 @@
-
-
-
-
-
+
+
+
+
+
+
+ FontSize="32"/>
+ FontSize="32"/>
-
-
+ FontSize="32"/>
+
+
+
diff --git a/MainWindow.xaml.vb b/MainWindow.xaml.vb
index 3d60fd5..4d1b0f8 100644
--- a/MainWindow.xaml.vb
+++ b/MainWindow.xaml.vb
@@ -186,6 +186,7 @@ Class MainWindow
OkAllBtn.Content = EgtMsg(91301) 'Pezzi Tutti Validi
OkPartBtn.Content = EgtMsg(91302) 'Pezzo Valido
RuinedPartBtn.Content = EgtMsg(91303) 'Pezzo Rovinato
+ PrintBtn.Content = EgtMsg(91306) 'Stampa
LabelBtn.Content = EgtMsg(91304) 'Stampa Etichetta
ConfirmBtn.Content = EgtMsg(91305) 'Conferma
' Abilitazione stampa etichetta
@@ -385,9 +386,9 @@ Class MainWindow
While nId <> GDB_ID.NULL
If EgtGetType(nId) = GDB_TY.SRF_FRGN Then
If bOk Then
- EgtSetColor(nId, New Color3d(0, 255, 0, 80))
+ EgtSetColor(nId, New Color3d(0, 255, 0, 80)) ' Verde
Else
- EgtSetColor(nId, New Color3d(255, 0, 0, 80))
+ EgtSetColor(nId, New Color3d(255, 0, 0, 80)) ' Rosso
End If
Exit While
End If
@@ -400,6 +401,67 @@ Class MainWindow
Return True
End Function
+ Private Sub PrintBtn_Click(sender As Object, e As RoutedEventArgs) Handles PrintBtn.Click
+
+ Dim printDlg As New PrintDialog
+
+ If printDlg.ShowDialog() Then
+
+ ' Recupero le dimensioni dell'area di stampa
+ Dim dW As Double = printDlg.PrintableAreaWidth
+ Dim dH As Double = printDlg.PrintableAreaHeight
+
+ ' Nascondo la tavola ed eseguo zoom su quello che rimane
+ Dim nTabId As Integer = EgtGetTableId(MAIN_TAB)
+ EgtSetStatus(nTabId, GDB_ST.OFF)
+ EgtZoom(ZM.ALL, True)
+
+ ' Prendo l'immagine per la stampa
+ Dim colWhite As New Color3d(255, 255, 255)
+ Dim nImgW As Integer = 4000
+ Dim nImgH As Integer = 2400
+ Dim sPath As String = m_sTempDir & "\Image.png"
+ If Not EgtGetImage(SM.HIDDENLINE, colWhite, colWhite, nImgW, nImgH, sPath) Then
+ EgtOutLog("Errore creazione immagine di stampa")
+ Return
+ End If
+
+ ' Ripristino la visualizzazione della tavola
+ EgtSetStatus(nTabId, GDB_ST.ON_)
+ EgtZoom(ZM.ALL)
+ Thread.Sleep(10)
+
+ Try
+ ' Metodo complesso di stampa che permette di rilasciare il file :
+ ' carico la bitmap e la metto in uno stream in memoria
+ Dim stream As System.IO.Stream = New System.IO.MemoryStream()
+ Dim bitmap As System.Drawing.Bitmap = New System.Drawing.Bitmap(sPath)
+ bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png)
+ bitmap.Dispose()
+ ' la sposto in una BitmapImage
+ Dim bitImage As New System.Windows.Media.Imaging.BitmapImage()
+ bitImage.BeginInit()
+ bitImage.StreamSource = stream
+ bitImage.EndInit()
+ ' la sposto in un Visual Control
+ Dim tmpImg As New Image
+ tmpImg.BeginInit()
+ tmpImg.Source = bitImage
+ tmpImg.Margin = New Thickness(30)
+ ' ruoto a seconda dell'aspetto della pagina
+ If (dH > dW And nImgH < nImgW) Or (dH < dW And nImgH > nImgW) Then
+ tmpImg.LayoutTransform = New RotateTransform(-90)
+ End If
+ tmpImg.EndInit()
+ ' eseguo la stampa
+ printDlg.PrintVisual(tmpImg, "Parts Layout")
+ Catch
+ EgtOutLog("Errore esecuzione stampa")
+ End Try
+ End If
+
+ End Sub
+
Private Sub UpdateConfirmBtn()
' Verifico esistano pezzi e siano stati tutti settati
Dim bConfirm As Boolean = (m_vParts.Count() > 0)
@@ -554,6 +616,12 @@ Class MainWindow
HideAllMachinings()
' Recupero elenco dei pezzi attivi nella fase
MakePartList()
+ ' Nascondo parti ausiliarie per nesting
+ Dim nRawId = EgtGetFirstRawPart()
+ Dim nSoId = EgtGetFirstNameInGroup(nRawId, NAME_OUTKERF_REG)
+ EgtSetStatus(nSoId, GDB_ST.OFF)
+ Dim nRrId = EgtGetFirstNameInGroup(nRawId, NAME_REF_REG)
+ EgtSetStatus(nRrId, GDB_ST.OFF)
' Nascondo preview lavorazioni nei pezzi
For Each nPartId As Integer In m_vParts
Dim nPV = EgtGetFirstNameInGroup(nPartId, NAME_PREVIEW)
@@ -561,6 +629,21 @@ Class MainWindow
EgtSetStatus(nPV, GDB_ST.OFF)
End If
Next
+ ' Assegno colore blu ai pezzi
+ For Each nPartId As Integer In m_vParts
+ ' Cerco layer regione
+ Dim nRegId = EgtGetFirstNameInGroup(nPartId, NAME_REGION)
+ If nRegId = GDB_ID.NULL Then Return False
+ ' Cerco prima regione nel layer
+ Dim nId = EgtGetFirstInGroup(nRegId)
+ While nId <> GDB_ID.NULL
+ If EgtGetType(nId) = GDB_TY.SRF_FRGN Then
+ EgtSetColor(nId, New Color3d(0, 255, 255, 80)) ' Aqua
+ Exit While
+ End If
+ nId = EgtGetNext(nId)
+ End While
+ Next
Return True
End Function
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index 806c2ac..2675163 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/OmagVIEW.vbproj b/OmagVIEW.vbproj
index d3ab1f8..fd8416d 100644
--- a/OmagVIEW.vbproj
+++ b/OmagVIEW.vbproj
@@ -71,6 +71,7 @@
..\..\EgtProg\DllD32\EgtWPFLib.dll
+