From 12081cec286176e5b9067a1fa81cf6eb1c57a0b6 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Tue, 19 Dec 2023 14:57:46 +0100 Subject: [PATCH] - modifiche per export del 3dm per la macchina --- Icarus/SceneHost/MySceneHostVM.vb | 13 +++++++++++++ Icarus/SliceManager/SliceManagerVM.vb | 20 ++++++++++++++++---- Icarus/Utility/LuaExec.vb | 14 ++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Icarus/SceneHost/MySceneHostVM.vb b/Icarus/SceneHost/MySceneHostVM.vb index 92881d4..ac3500e 100644 --- a/Icarus/SceneHost/MySceneHostVM.vb +++ b/Icarus/SceneHost/MySceneHostVM.vb @@ -688,6 +688,19 @@ Public Class MySceneHostVM MainController.SetDefaultFilterForExport(EEX_FLT.MODE_HIDDEN + EEX_FLT.MODE_STD + EEX_FLT.STAT_ON + EEX_FLT.STAT_OFF + EEX_FLT.LEV_TEMP) Return MainController.ExportGeomId(Map.refTopPanelVM.SelPart.nPartId, sFilePath, False) End Function + Public Function ExportProjectForMachine(sDirPath As String, b3dm As Boolean, ByRef sFilePath As String) As Boolean + sFilePath = sDirPath & "\ProjectSlice" & If(b3dm, ".3dm", ".3mf") + ' Reset controller e scena + MainController.ResetStatus() + MainController.SetDefaultFilterForExport(EEX_FLT.MODE_HIDDEN + EEX_FLT.MODE_STD + EEX_FLT.STAT_ON + EEX_FLT.STAT_OFF + EEX_FLT.LEV_TEMP) + Dim nExportGeomId As Integer = 0 + If b3dm Then + If Not ExecPrepare3dmExport(nExportGeomId) Then Return False + Else + nExportGeomId = Map.refTopPanelVM.SelPart.nPartId + End If + Return MainController.ExportGeomId(nExportGeomId, sFilePath, False) + End Function Public Overrides Function ExecScript(sFilePath As String) As Boolean Dim bOk As Boolean = False diff --git a/Icarus/SliceManager/SliceManagerVM.vb b/Icarus/SliceManager/SliceManagerVM.vb index 1a1e51c..7df29b0 100644 --- a/Icarus/SliceManager/SliceManagerVM.vb +++ b/Icarus/SliceManager/SliceManagerVM.vb @@ -775,12 +775,24 @@ Public Class SliceManagerVM If IsNothing(SolidCheck.bIsVisible) OrElse Not SolidCheck.bIsVisible Then SolidCheck.bIsVisible = True End If - ' esporto file 3mf - Dim s3mfPath As String = sExportTempFolderPath & "\ProjectSlice.3mf" - If Not Map.refSceneHostVM.ExportProjectForMachine(s3mfPath) Then + ' esporto file progetto + Dim sFileExtension As String + If True Then + sFileExtension = ".3dm" + Else + sFileExtension = ".3mf" + End If + Dim s3dFilePath As String = "" + If Not Map.refSceneHostVM.ExportProjectForMachine(sExportTempFolderPath, True, s3dFilePath) Then EgtOutLog("Error! Impossible exporting 3mf file!") Return False End If + '' esporto file 3mf + 'Dim s3mfPath As String = sExportTempFolderPath & "\ProjectSlice.3mf" + 'If Not Map.refSceneHostVM.ExportProjectForMachine(s3mfPath) Then + ' EgtOutLog("Error! Impossible exporting 3mf file!") + ' Return False + 'End If ' creo file json Dim sProjName As String = "" EgtGetCurrFilePath(sProjName) @@ -812,7 +824,7 @@ Public Class SliceManagerVM ' aggiungo file Iso zip.AddItem(sIsoFilePath, "").FileName = "ProjectSlice" & Path.GetExtension(sIsoFilePath) ' aggiungo file 3mf - zip.AddItem(s3mfPath, "") + zip.AddItem(s3dFilePath, "") ' aggiungo json zip.AddItem(sJsonPath, "") ' aggiungo immagine preview diff --git a/Icarus/Utility/LuaExec.vb b/Icarus/Utility/LuaExec.vb index 59f41e2..7b3c583 100644 --- a/Icarus/Utility/LuaExec.vb +++ b/Icarus/Utility/LuaExec.vb @@ -115,4 +115,18 @@ Module LuaExec Return bOk End Function + Friend Function ExecPrepare3dmExport(ByRef nExportGeomId As Integer) As Boolean + Dim bOk As Boolean = True + EgtLuaCreateGlobTable("PRINT") + EgtLuaSetGlobStringVar("PRINT.BASEDIR", Map.refMainWindowVM.MainWindowM.s3dPrintingDir) + bOk = EgtLuaExecFile(Map.refMainWindowVM.MainWindowM.s3dPrintingDir & "\PrepareExport.lua") + If bOk Then + EgtLuaGetGlobIntVar("PRINT.EXPORTLAYER", nExportGeomId) + End If + ' Cancello tavola globale + EgtLuaResetGlobVar("PRINT") + Return bOk + End Function + + End Module