Optimizer 2.7.10.2

-aggiunta modifica su egtobjsavefile
-sistemato parametri generali su pezzo
This commit is contained in:
Demetrio Cassarino
2025-10-30 12:15:38 +01:00
parent 300403e0ea
commit 58ce34a857
7 changed files with 42 additions and 61 deletions
@@ -342,7 +342,7 @@ Public Module CalcIntegration
Dim nPDN As Integer = 0
EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
Dim sPartFilePath As String = sProjDirPath & "\" & nPDN.ToString() & ".bwe"
bOk = EgtSaveObjToFile(nPartId, sPartFilePath, NGE.CMPTEXT)
bOk = EgtSaveObjToFile({nPartId, EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO), EgtGetFirstNameInGroup(GDB_ID.ROOT, PROJECTINFO)}, sPartFilePath, NGE.CMPTEXT)
' Ripristino visibilita' pezzo
EgtSetMode(nPartId, nOldPartMode)
@@ -177,6 +177,13 @@ Public Class BTLPartManagerVM
End Sub
Private Sub GetGeneralParameters()
' leggo cartella dei setup delle strategie
Dim AISetupDirPath As String = Map.refMainWindowVM.MainWindowM.GetAISetupDirPath(ProjectManagerVM.CurrProd.nType, True)
Dim AISetupPaths As String() = Directory.GetFiles(AISetupDirPath)
For Each AiSetup In AISetupPaths
Map.refProjectVM.StrategySetupList.Add(Path.GetFileNameWithoutExtension(AiSetup))
Next
Dim sStrategiesDirPath As String = Map.refMainWindowVM.MainWindowM.GetStrategiesDirPath(Map.refStrategyManagerVM.SelStrategyType.Id)
Dim sGeneralParametersFilePath As String = sStrategiesDirPath & "\" & GENERALPARAMETERS_FILE & ".json"
If File.Exists(sGeneralParametersFilePath) Then
@@ -200,6 +207,11 @@ Public Class BTLPartManagerVM
' Leggo info se presenti
Dim sInfo As String = String.Empty
EgtGetInfo(Map.refProjectVM.BTLStructureVM.SelBTLPart.BTLPartM.nPartId, "AISETUP", Map.refProjectVM.SelStrategySetup)
If Not IsNothing(Map.refProjectVM.SelStrategySetup) Then
Dim nBTLInfoLayerId As Integer = EgtGetFirstNameInGroup(GDB_ID.ROOT, BTLINFO)
EgtGetInfo(nBTLInfoLayerId, "AISETUP", Map.refProjectVM.SelStrategySetup)
End If
For Each GeneralParameter In Map.refProjectVM.GeneralParametersList
Select Case GeneralParameter.GetType()
Case GetType(BooleanGenericParameter)
@@ -67,5 +67,5 @@ Imports System.Windows
' Revision
'
<Assembly: AssemblyVersion("2.7.10.1")>
<Assembly: AssemblyFileVersion("2.7.10.1")>
<Assembly: AssemblyVersion("2.7.10.2")>
<Assembly: AssemblyFileVersion("2.7.10.2")>
@@ -352,6 +352,24 @@ Public Class ProjectVM
NotifyPropertyChanged(NameOf(GeneralParametersIsEnable))
End Sub
Private m_StrategySetupList As New ObservableCollection(Of String)
Public ReadOnly Property StrategySetupList As ObservableCollection(Of String)
Get
Return m_StrategySetupList
End Get
End Property
Private m_SelStrategySetup As String
Public Property SelStrategySetup As String
Get
Return m_SelStrategySetup
End Get
Set(value As String)
m_SelStrategySetup = value
NotifyPropertyChanged(NameOf(SelStrategySetup))
End Set
End Property
#Region "Messages"
Public ReadOnly Property Statistics_Msg As String
@@ -323,46 +323,6 @@ Public Class StatisticsVM
End Select
End Sub
Public Sub CreatePrintPDF(ActivePage As Integer, bPreview As Boolean)
LoadingWndHelper.OpenLoadingWnd(ActiveIds.CREATINGPDF, 1, "Creating PDF", "", 100)
Try
' creo documento MigraDoc
Dim document As Document = PDFHelper.CreateStatReport(ActivePage, bPreview)
Dim documentPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\MigraDoc.mdddl"
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, documentPath)
Dim renderer As New PdfDocumentRenderer(True) With {
.Document = document
}
renderer.RenderDocument()
' salvo il documento
Dim sFileName As String = ""
If ActivePage = Pages.VIEW AndAlso Not bPreview Then
sFileName = ProjectManagerVM.CurrProd.sProjDirPath & "\" & "Statistics.pdf"
ElseIf ActivePage = Pages.VIEW AndAlso bPreview Then
sFileName = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics.pdf" ' Se la pagina e' 0 e' bPreview e' True creo PDF Visualization
ElseIf ActivePage = Pages.MACHINING AndAlso Not bPreview Then
sFileName = ProjectManagerVM.CurrProd.sProdDirPath & "\" & ProjectManagerVM.CurrProd.sProdId & " - " & "Statistics.pdf"
ElseIf ActivePage = Pages.MACHINING AndAlso bPreview Then ' Se la pagina e' 1 e' bPreview e' True creo PDF Optimizer
sFileName = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics.pdf"
End If
' avvio il visualizzatore
renderer.PdfDocument.Save(sFileName)
' cancello file MigraDoc
File.Delete(documentPath)
If bPreview Then
Else
Process.Start(sFileName)
End If
Catch ex As Exception
EgtOutLog("Error genereting pdf: " & ex.ToString())
End Try
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CREATINGPDF)
End Sub
#End Region ' PrintPDF
#Region "COMMANDS"
+9 -18
View File
@@ -24,8 +24,10 @@ Module Configuration
Try
' creo documento MigraDoc
Dim document As Document = PDFHelper.CreateStatReport(ActivePage, bPreview)
#If DEBUG Then
Dim documentPath As String = Map.refMainWindowVM.MainWindowM.sTempDir & "\MigraDoc.mdddl"
MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, documentPath)
#End If
' salvo il documento
Dim sFileName As String = ""
@@ -39,27 +41,16 @@ Module Configuration
sFileName = Map.refMainWindowVM.MainWindowM.sTempDir & "\Statistics.pdf"
PrevSelect()
End If
Dim ExecThread As New Thread(Sub()
Dim renderer As New PdfDocumentRenderer(True) With {
.Document = document
}
renderer.RenderDocument()
renderer.PdfDocument.Save(sFileName)
End Sub)
ExecThread.Start()
' avvio il visualizzatore
' cancello file MigraDoc
System.IO.File.Delete(documentPath)
If bPreview Then
Else
Process.Start(sFileName)
End If
Dim renderer As New PdfDocumentRenderer() With {
.Document = document}
renderer.RenderDocument()
renderer.PdfDocument.Save(sFileName)
If Not bPreview Then Process.Start(sFileName)
Catch ex As Exception
EgtOutLog("Error genereting pdf: " & ex.ToString())
Finally
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CREATINGPDF)
End Try
LoadingWndHelper.CloseLoadingWnd(ActiveIds.CREATINGPDF)
End Sub
Private Sub PrevSelect()
Binary file not shown.