- Aggiunta gestione colori dei solidi

This commit is contained in:
Emmanuele Sassi
2022-04-12 19:34:16 +02:00
parent 124eeecbab
commit 75a472f45b
8 changed files with 134 additions and 4 deletions
+3 -2
View File
@@ -8,8 +8,9 @@ Button4=GcodeGenerate.lua,Images\GcodeGenerate.png,Genera codice CN
Button5=ShowManager.lua,Images\ShowManager.png,Gestore visualizzazione
Button6=ViewManager.lua,Images\ViewManager.png,Nascondi Visualizza strato
Button7=SliceAdvancement.lua,Images\SliceAdvancement.png,Mostra avanzamento strato
Button8=MachiningParamEdit.lua,Images\MachiningParamEdit.png,Edita i parametri di stampa
Button9=MaterialParamEdit.lua,Images\MaterialParamEdit.png,Edita i parametri del materiale
Button8=SlicePalette.lua,Images\SlicePalette.png,Gestore colori strato
Button9=MachiningParamEdit.lua,Images\MachiningParamEdit.png,Edita i parametri di stampa
Button10=MaterialParamEdit.lua,Images\MaterialParamEdit.png,Edita i parametri del materiale
ParamFile=C:\EgtData\3dPrinting\Machinings\Params.ini
ResultReadProg="C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
MachiningEditProg="C:\Windows\System32\notepad.exe"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

+13
View File
@@ -90,5 +90,18 @@ VIEWPARAMS = 'ViewParams'
IMPORTED_SOLID = 'ImportedSolid'
RESULT_READ_PROG = 'ResultReadProg'
KEY_RESULT = 'Result'
KEY_PALETTE = 'Palette'
RESULT = {
OK = 0,
KO_MINUS = 1,
KO_PLUS = 2,
}
PALETTE_TYPE = {
IN_OUT = 0,
RESULTS = 1,
}
---------------------------------------------------------------------
return AddManData
+11 -2
View File
@@ -127,13 +127,16 @@ function RunMachiningParamCalc.Exec()
EgtSetInfo( nToolPathId, KEY_SPEED, dSpeed)
nCrvId = EgtGetNext( nCrvId)
end
-- riporto valori calcolati in tabella per csv
-- salvo e riporto valori calcolati in tabella per csv
local sStatus = ''
if dEsteemedTime < dMinTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.KO_MINUS)
sStatus = 'KO(-)'
elseif dEsteemedTime > dMinTime and dEsteemedTime < dMaxTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.OK)
sStatus = 'OK'
elseif dEsteemedTime > dMaxTime then
EgtSetInfo( nLayerId, KEY_RESULT, RESULT.KO_PLUS)
sStatus = 'KO(+)'
end
--table.insert( CSVOutTable, { Index = nLayerIndex, EsteemedTime = dEsteemedTime, Feed = dLayerFeed, Speed = dSpeed})
@@ -144,7 +147,13 @@ function RunMachiningParamCalc.Exec()
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
-- aggiorno palette
local nPaletteType = EgtGetInfo( nParamsGrp, KEY_PALETTE, 'i')
if nPaletteType == PALETTE_TYPE.RESULTS then
local RSP = require( 'RunSlicePalette')
RSP.UpdateColors( nPaletteType)
end
-- scrivo nuovo file csv di risultato
local file = io.open( sResultFile, "w")
if file then
+89
View File
@@ -0,0 +1,89 @@
-- RunSlicePalette.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Tabella per definizione modulo
local RunSlicePalette = {}
-- Intestazioni
require( 'EgtBase')
EgtOutLog( ' RunSlicePalette started', 1)
-- Costanti generali
local AMD = require( 'AddManData')
function RunSlicePalette.UpdateColors( nPaletteType)
-- ciclo sui pezzi
local nPartIndex = 1
local nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
while nPartId do
-- ciclo sui layer per dis/attivare il resto
local nLayerIndex = 1
local nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
while nLayerId do
local nCrvId = EgtGetFirstGroupInGroup( nLayerId)
while nCrvId do
local nSolidId = EgtGetFirstNameInGroup( nCrvId, SOLID_GRP)
local nSurfId = EgtGetFirstInGroup( nSolidId)
local nOldType = 0
while nSurfId do
local Color = EgtStdColor( 'GRAY')
if nPaletteType == PALETTE_TYPE.IN_OUT then
local nType = EgtGetInfo( nSurfId, KEY_TYPE, 'i')
if not nType or ( nType ~= 0 and nType ~= 1) then nType = nOldType end
nOldType = nType
-- scelta del colore
if nType == TYPE.OUTER_SHELL then
Color = EgtStdColor( 'ORANGE')
elseif nType == TYPE.INNER_SHELL or nType == TYPE.LINK then
Color = EgtStdColor( 'TEAL')
elseif nType == TYPE.INFILL then
Color = EgtStdColor( 'YELLOW')
end
else
local nResult = EgtGetInfo( nLayerId, KEY_RESULT, 'i')
if nResult == RESULT.OK then
Color = EgtStdColor( 'GREEN')
elseif nResult == RESULT.KO_MINUS then
Color = EgtStdColor( 'ORANGE')
elseif nResult == RESULT.KO_PLUS then
Color = EgtStdColor( 'RED')
end
end
EgtSetColor( nSurfId, Color)
nSurfId = EgtGetNext( nSurfId)
end
nCrvId = EgtGetNext( nCrvId)
end
nLayerIndex = nLayerIndex + 1
nLayerId = EgtGetFirstNameInGroup( nPartId, SLICE_LAYER .. nLayerIndex)
end
nPartIndex = nPartIndex + 1
nPartId = EgtGetFirstNameInGroup( GDB_ID.ROOT, PART .. nPartIndex)
end
EgtDraw()
end
function RunSlicePalette.Exec()
local nParamsGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, PARAMS_GRP) or GDB_ID.NULL
local nOldPaletteType = EgtGetInfo( nParamsGrp, KEY_PALETTE, 'i')
local sCombo = EgtIf( not nOldPaletteType or nOldPaletteType == 0, 'CB:*In/Out,Results', 'CB:In/Out,*Results')
ViewValues = EgtDialogBox( 'Slice Palette', { 'Type', sCombo})
if not ViewValues or #ViewValues < 1 then return end
local nPaletteType = PALETTE_TYPE.IN_OUT -- 1 = In/Out, 2 = Results
if ViewValues[1] == 'In/Out' then
nPaletteType = PALETTE_TYPE.IN_OUT
elseif ViewValues[1] == 'Results' then
nPaletteType = PALETTE_TYPE.RESULTS
end
EgtSetInfo( nParamsGrp, KEY_PALETTE, nPaletteType)
RunSlicePalette.UpdateColors( nPaletteType)
end
---------------------------------------------------------------------
return RunSlicePalette
+18
View File
@@ -0,0 +1,18 @@
-- SlicePalette.lua by Egaltech s.r.l. 2022/04/05
-- Gestione visualizzazione per Stampa 3d
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Stampa 3d
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Librerie
_G.package.loaded.RunSlicePalette = nil
local RSP = require( 'RunSlicePalette')
-- Calcolo
RSP.Exec()