ae87d890cb
- piccole migliorie/correzioni.
40 lines
1.6 KiB
Lua
40 lines
1.6 KiB
Lua
-- DeleteTrimming.lua by Egalware s.r.l. 2026/01/05
|
|
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
-- Carico le costanti di Trimming
|
|
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
|
local GlobVar = require( 'TrimmingLib')
|
|
-- Costante di Errore
|
|
local ERROR_DELETING_TRIMMING = 'Error in Deleting New Trimming : '
|
|
|
|
-- Recupero il Part e il Layer corrente di Trimming
|
|
local nCurrPartId = EgtGetCurrPart()
|
|
local nCurrLayerId = EgtGetCurrLayer()
|
|
|
|
local nTrimmingLayerId = nil
|
|
-- Se il Layer corrente è di Trimming, memorizzo il suo Id
|
|
if GlobVar.IsTrimmingLayer( nCurrLayerId) then nTrimmingLayerId = nCurrLayerId
|
|
-- Se invece è un altro Layer, recupero il Layer di Trimmatura a cui si riferisce
|
|
else nTrimmingLayerId = GlobVar.GetTrimmingLayerRefId( nCurrLayerId) end
|
|
if nTrimmingLayerId == nil or nTrimmingLayerId == GDB_ID.NULL then
|
|
EgtOutBox( ERROR_DELETING_TRIMMING.. 'No Trimming Machinining Layer Found', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Chiedo all'Utente la conferma per eliminare il Layer di Trimming corrente ed eventuali gruppi temporanei
|
|
local bDelete = EgtOutBox( 'Do you want to delete the current Trimming machining ?', 'Deleting', 'QUESTION', 'YESNO')
|
|
if not bDelete then return end
|
|
|
|
-- Recupero ed eventualmente elimino il Layer delle curve di Sincronizzazione associato
|
|
local nLayerSyncEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nTrimmingLayerId)
|
|
if nLayerSyncEditId ~= nil and nLayerSyncEditId ~= GDB_ID.NULL then EgtErase( nLayerSyncEditId) end
|
|
|
|
-- Elimino il Layer di Trimming corrente
|
|
EgtErase( nTrimmingLayerId)
|
|
|
|
-- Aggiorno la Grafica
|
|
EgtDraw()
|