diff --git a/LuaLibs/RunGcodeGenerate.lua b/LuaLibs/RunGcodeGenerate.lua index 72ad585..f0b257c 100644 --- a/LuaLibs/RunGcodeGenerate.lua +++ b/LuaLibs/RunGcodeGenerate.lua @@ -1,4 +1,4 @@ --- RunGcodeGenerate.lua by Egaltech s.r.l. 2022/04/11 +-- RunGcodeGenerate.lua by Egaltech s.r.l. 2022/05/19 -- Calcoli prima fase per Stampa 3d -- Tabella per definizione modulo @@ -68,9 +68,19 @@ function RunGcodeGenerate.Exec() return end - -- Aggiungo la lavorazione + -- Imposto gruppo di lavoro EgtSetCurrMachGroup() + -- Assegno il nome del file CN + local MchGrpId = EgtGetCurrMachGroup() + local sPath = EgtGetCurrFilePath() + local sDir, sName, sExt = EgtSplitPath( sPath) + EgtSetInfo( MchGrpId, 'NcName', sName..'.cnc') + + -- Rimuovo eventuali precedenti lavorazioni + EgtRemoveAllOperations() + + -- Aggiungo la lavorazione local nMchId = EgtAddMachining( 'Extrusion 1', 'Extrusion') if not nMchId then EgtOutBox( 'Error adding Extrusion', 'GcodeGenerate') @@ -86,6 +96,21 @@ function RunGcodeGenerate.Exec() EgtOutBox( 'Error applying Extrusion', 'GcodeGenerate') return end + + -- Salvo il progetto + EgtSaveFile() + + -- Genero il programma CN + local sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - ' .. sPath + local bGenOk = EgtGenerate( '', sInfo) + + EgtResetCurrMachGroup() + + if bGenOk then + EgtOutBox( 'Generation successful.', 'GcodeGeneration', 'INFO') + else + EgtOutBox( 'Generation failed.', 'GcodeGeneration', 'ERROR') + end end --------------------------------------------------------------------- diff --git a/LuaLibs/RunPartPositioning.lua b/LuaLibs/RunPartPositioning.lua index 81d30ff..4a2452a 100644 --- a/LuaLibs/RunPartPositioning.lua +++ b/LuaLibs/RunPartPositioning.lua @@ -1,4 +1,4 @@ --- RunPartPositioning.lua by Egaltech s.r.l. 2022/04/13 +-- RunPartPositioning.lua by Egaltech s.r.l. 2022/05/19 -- Gestione calcolo disposizione e lavorazioni per stampa 3d -- 2022/03/21 Creazione file @@ -102,16 +102,7 @@ function RunPartPositioning.Exec() local frPart = Frame3d( b3Part:getCenter() - 0.5 * b3Part:getDimZ() * Z_AX(), Z_AX()) nFrameId = EgtFrame( nPartId, frPart, GDB_RT.GLOB) if nFrameId then EgtSetName( nFrameId, FRAME_PART) end - - -- creo lo start point - local ptStart = b3Part:getCenter() - 0.6 * b3Part:getDimY() * Y_AX() - 0.5 * b3Part:getDimZ() * Z_AX() - nPtStartId = EgtPoint( nPartId, ptStart, GDB_RT.GLOB) - if nPtStartId then - EgtSetName( nPtStartId, KEY_START_POINT) - EgtSetColor( nPtStartId, EgtStdColor( "RED")) - end - - + EgtAddMachGroup( '3dPrint') EgtSetTable( 'Tab') @@ -120,6 +111,13 @@ function RunPartPositioning.Exec() EgtResetCurrMachGroup() + -- creo lo start point + local ptStart = b3Part:getCenter() - 0.6 * b3Part:getDimY() * Y_AX() - 0.5 * b3Part:getDimZ() * Z_AX() + nPtStartId = EgtPoint( nPartId, ptStart, GDB_RT.GLOB) + if nPtStartId then + EgtSetName( nPtStartId, KEY_START_POINT) + EgtSetColor( nPtStartId, EgtStdColor( "RED")) + end EgtSetView( SCE_VD.ISO_SW, false) EgtZoom( SCE_ZM.ALL)