- Correzioni e migliorie su pezzo di esempio

- Gestione avvio script solo quando eseguiti precedenti
- Correzioni varie
This commit is contained in:
Emmanuele Sassi
2022-04-13 15:35:05 +02:00
parent 4cdade69e4
commit 261aec363d
12 changed files with 417 additions and 239 deletions
+30 -5
View File
@@ -13,6 +13,15 @@ EgtOutLog( ' RunGcodeGenerate started', 1)
_G.package.loaded.AddManData = nil
local AMD = require( 'AddManData')
---------------------------------------------------------------------
local function GetLayerParamsForGcodeGenerate()
local nParamsGrp = EgtGetFirstNameInGroup( GDB_ID.ROOT, PARAMS_GRP)
local LayerParams = {}
LayerParams.LinkZup = EgtGetInfo( nParamsGrp, KEY_LINK_ZUP, 'd')
return LayerParams
end
---------------------------------------------------------------------
function RunGcodeGenerate.Exec()
-- Recupero il pezzo (per ora primo e unico)
local nPartIndex = 1
@@ -25,10 +34,13 @@ function RunGcodeGenerate.Exec()
-- Recupero i layer da processare
local vLayIds = EgtGetNameInGroup( nPartId, SLICE_LAYER.."*")
if not vLayIds then
EgtOutBox( 'Error missing slices', 'ToolPathCalc')
EgtOutBox( 'Error missing slices', 'GcodeGenerate')
return
end
-- Recupero i parametri relativi al layer
local LayerParams = GetLayerParamsForGcodeGenerate()
-- Ciclo sui layer
local vEntId = {}
for nIdx = 1, #vLayIds do
@@ -38,7 +50,7 @@ function RunGcodeGenerate.Exec()
-- recupero il gruppo dei percorsi utensile
local nTpathGrpId = EgtGetFirstNameInGroup( nCrvGrpId, TOOLPATH_GRP)
if not nTpathGrpId then
EgtOutBox( 'Error missing toolpaths', 'ToolPathCalc')
EgtOutBox( 'Error missing toolpaths', 'GcodeGenerate')
return
end
-- recupero le entità nel gruppo
@@ -52,15 +64,28 @@ function RunGcodeGenerate.Exec()
end
end
if #vEntId == 0 then
EgtOutBox( 'Error missing entities', 'ToolPathCalc')
EgtOutBox( 'Error missing entities', 'GcodeGenerate')
return
end
-- Aggiungo la lavorazione
EgtSetCurrMachGroup()
EgtAddMachining( 'Extrusion 1', 'ExtrusionA')
local nMchId = EgtAddMachining( 'Extrusion 1', 'ExtrusionA')
if not nMchId then
EgtOutBox( 'Error adding Extrusion', 'GcodeGenerate')
return
end
EgtSetMachiningGeometry( vEntId)
EgtApplyMachining()
local sNotes = EgtAdjustNotes( '', 'LinkZup', LayerParams.LinkZup)
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
if not EgtApplyMachining() then
EgtOutBox( 'Error applying Extrusion', 'GcodeGenerate')
return
end
end
---------------------------------------------------------------------