EgtCAM5 :

- aggiunto comando stampa.
This commit is contained in:
DarioS
2023-02-13 08:20:56 +01:00
parent 82a8ee2230
commit e72d30c392
6 changed files with 91 additions and 8 deletions
+3
View File
@@ -959,6 +959,9 @@
<ItemGroup>
<Resource Include="Resources\DrawPanel\ApproxSurf.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\TopCommandBar\Print.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\EgtCAM5\EgtCAM5R32.exe
Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

+1 -1
View File
@@ -136,7 +136,7 @@ Public Class ButtonItem
If m_sLuaCmdPath = BeamPanelVM.BEAM_MACHININGS Then
Beam.BeamMachDb()
Return
' se altrimenti per pareti
' se altrimenti per pareti
ElseIf m_sLuaCmdPath = WallPanelVM.WALL_MACHININGS Then
Wall.WallMachDb()
Return
+8 -4
View File
@@ -44,11 +44,15 @@
IsEnabled="{Binding DrawIsChecked}">
<Image Source="/Resources/TopCommandBar/Export.png" Stretch="Uniform"/>
</Button>
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}"
<Button Command="{Binding PrintCommand}" ToolTip="{Binding PrintToolTip}"
IsEnabled="True">
<Image Source="/Resources/TopCommandBar/Print.png" Height="22" />
</Button>
<Button Command="{Binding OptionsCommand}" ToolTip="{Binding OptionsToolTip}"
IsEnabled="{Binding SaveIsEnabled}">
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}" ToolTip="{Binding SendFeedbackToolTip}"
<Image Source="/Resources/TopCommandBar/Options.png" Height="22" />
</Button>
<Button Command="{Binding SendFeedbackCommand}" ToolTip="{Binding SendFeedbackToolTip}"
IsEnabled="{Binding SaveIsEnabled}">
<Image Source="/Resources/TopCommandBar/Send.png" Height="22" Margin="3,0,3,0" />
</Button>
+79 -2
View File
@@ -24,6 +24,7 @@ Public Class TopCommandBarVM
Private m_cmdInsert As ICommand
Private m_cmdImport As ICommand
Private m_cmdExport As ICommand
Private m_cmdPrint As ICommand
Private m_cmdOptions As ICommand
Private m_cmdSendFeedback As ICommand
@@ -80,6 +81,11 @@ Public Class TopCommandBarVM
Return EgtMsg(MSG_TOPCOMMANDBAR + 7)
End Get
End Property
Public ReadOnly Property PrintToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 15)
End Get
End Property
Public ReadOnly Property OptionsToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 9)
@@ -479,10 +485,81 @@ Public Class TopCommandBarVM
#End Region ' ExportCommand
#Region "PrintCommand"
''' <summary>
''' Returns a command that do Print.
''' </summary>
Public ReadOnly Property PrintCommand As ICommand
Get
If m_cmdPrint Is Nothing Then
m_cmdPrint = New RelayCommand(AddressOf Print)
End If
Return m_cmdPrint
End Get
End Property
''' <summary>
''' Execute the Print. This method is invoked by the PrintCommand.
''' </summary>
Public Sub Print(ByVal param As Object)
Dim printDlg As New PrintDialog
Dim sPath = IniFile.m_sTempDir & "\Image.png"
If printDlg.ShowDialog() Then
' Recupero le dimensioni dell'area di stampa
Dim dW As Double = printDlg.PrintableAreaWidth
Dim dH As Double = printDlg.PrintableAreaHeight
Try
'Prendo l'immagine per la stampa
Dim colWhite As New Color3d(255, 255, 255)
Dim nImgW As Integer = 3000
Dim nImgH As Integer = 2000
' recupero lo stile di visualizzazione
Dim SM_Select As SM = CType(EgtGetShowMode(), SM)
If SM_Select <> SM.SHADING Then EgtSetLineAttribs(3)
' eseguo cattura immagine
Dim bOk As Boolean = EgtGetImage(SM_Select, colWhite, colWhite, nImgW, nImgH, sPath)
' ripristino spessore linee
Dim nLineWidth As Integer = GetPrivateProfileInt(S_SCENE, K_LINEWIDTH, 1)
EgtSetLineAttribs(nLineWidth)
' in caso di errore
If Not bOk Then
' Error in creating the print image
EgtOutLog(EgtMsg(50181))
Return
End If
'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.Stretch = Stretch.Uniform
tmpImg.EndInit()
' eseguo la stampa
printDlg.PrintVisual(tmpImg, "Parts Layout")
Catch
' Error in executing print
EgtOutLog(EgtMsg(50182))
End Try
End If
End Sub
#End Region ' PrintCommand
#Region "OptionsCommand"
''' <summary>
''' Returns a command that do Export.
''' Returns a command that display Options.
''' </summary>
Public ReadOnly Property OptionsCommand As ICommand
Get
@@ -494,7 +571,7 @@ Public Class TopCommandBarVM
End Property
''' <summary>
''' Execute the Export. This method is invoked by the ExportCommand.
''' Execute the display Options. This method is invoked by the OptionsCommand.
''' </summary>
Public Sub Options(ByVal param As Object)
Dim OptionsWindow As New OptionWindowV
-1
View File
@@ -146,7 +146,6 @@ Module Map
Return m_refDoorPanelVM
End Get
End Property
Public ReadOnly Property refSpecialPanelVM As SpecialPanelVM
Get
Return m_refSpecialPanelVM