OmagVIE 1.8b1 :

- aggiunta stampa.
This commit is contained in:
Dario Sassi
2017-02-15 08:14:18 +00:00
parent bffc4fd968
commit b31c3e1dfc
6 changed files with 108 additions and 17 deletions
+4
View File
@@ -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"
+1 -1
View File
@@ -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
+15 -12
View File
@@ -52,24 +52,27 @@
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Button Name="OkAllBtn" Grid.Row="0" Style="{StaticResource OmagCut_GreenTextButton}"
FontSize="36"/>
FontSize="32"/>
<Button Name="OkPartBtn" Grid.Row="1" Style="{StaticResource OmagCut_GreenTextButton}"
FontSize="36"/>
FontSize="32"/>
<Button Name="RuinedPartBtn" Grid.Row="2" Style="{StaticResource OmagCut_RedTextButton}"
FontSize="36"/>
<Button Name="LabelBtn" Grid.Row="3" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="36"/>
<Button Name="ConfirmBtn" Grid.Row="4" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="36"/>
FontSize="32"/>
<Button Name="PrintBtn" Grid.Row="3" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="32"/>
<Button Name="LabelBtn" Grid.Row="4" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="32"/>
<Button Name="ConfirmBtn" Grid.Row="5" Style="{StaticResource OmagCut_BlueTextButton}"
FontSize="32"/>
</Grid>
</Grid>
+85 -2
View File
@@ -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
+2 -2
View File
@@ -55,5 +55,5 @@ Imports System.Windows
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.6.23.4")>
<Assembly: AssemblyFileVersion("1.6.23.4")>
<Assembly: AssemblyVersion("1.8.2.1")>
<Assembly: AssemblyFileVersion("1.8.2.1")>
+1
View File
@@ -71,6 +71,7 @@
<Reference Include="EgtWPFLib">
<HintPath>..\..\EgtProg\DllD32\EgtWPFLib.dll</HintPath>
</Reference>
<Reference Include="ReachFramework" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />