Files
trimming/ResetSelect.lua
Riccardo Elitropi e5b1b4457f Trimming 3.1b1 :
- migliorata la gestione dei colori ( rimozione passaggi con esadecimali)
- aggiunta la funzione di Undo per le curve di sincronizzazione per interpolazione.
2026-02-23 15:57:20 +01:00

57 lines
2.1 KiB
Lua

-- ResetSelect.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_SELECTION = 'Error in Surf Selection : '
-- Recupero il Part e Layer di Trimming corrente
local nCurrPartId = EgtGetCurrPart()
local nCurrLayerId = EgtGetCurrLayer()
local nTrimmingLayer = GlobVar.GetTrimmingLayerRefId( nCurrLayerId)
if not nTrimmingLayer or nTrimmingLayer == GDB_ID.NULL then
EgtOutBox( ERROR_SELECTION .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
return
end
-- Chiedo all'Utente la conferma dell'operazione
local bRemove = EgtOutBox( 'Do you want to remove the last Selected Surface ?', 'Deleting', 'QUESTION', 'YESNO')
if not bRemove then return end
-- Rendo invisibili gli altri Layer di Trimmatura e tutti i Layer Temporanei
-- NB. Il focus va sul Layer corrente
EgtSetStatus( nTrimmingLayer, GDB_ST.ON)
local nId = EgtGetFirstInGroup( nCurrPartId)
while nId do
if nId ~= nTrimmingLayer and GlobVar.IsTrimmingLayer( nId) then EgtSetStatus( nId, GDB_ST.OFF) end
nId = EgtGetNext( nId)
end
-- Rimuovo Tutte le Entità ad Eccezione delle Superfici Selezionate ( nel caso Le rendo Visibili)
local vIdToErase = {}
nId = EgtGetFirstInGroup( nTrimmingLayer)
while nId do
local sName = EgtGetName( nId)
if sName ~= SELECTION_SURF_NAME then table.insert( vIdToErase, nId)
else EgtSetStatus( nId, GDB_ST.ON) end
nId = EgtGetNext( nId)
end
EgtErase( vIdToErase)
-- Se Esiste un Layer di Edit o di Stored, lo Rimuovo
-- [NB. La DeSelezione cancella tutti i risultati fatti fino ad adesso]
local nLayerSynEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nTrimmingLayer)
if nLayerSynEditId ~= nil and nLayerSynEditId ~= GDB_ID.NULL then EgtErase( nLayerEditId) end
-- Recupero l'ultima(le ultime) Supercicie(i) aggiunta(e) e la(e) elimino
local vLastSurfIds = EgtGetInfo( nTrimmingLayer, KEY_SELECTION_LAST_IDS, 'vi')
if vLastSurfIds ~= nil and #vLastSurfIds ~= 0 then EgtErase( vLastSurfIds) end
-- Aggiorno la grafica
EgtDraw()