dfa187838b
- aggiunta memorizzazione dell'ulltimo tipo selezionato nella modalità selezione - se le superfici di selezione generano più di 2 curve di bordo allora vengono definiti degli altri layer di trimming - semplificazione gestione dei layer di sincronizzazione delle curve - aggiunta funzionalità di rimozione delle superfici di Bezier in un layer di trimmatura - miglioramento nella selezione delle curve di sincronizzazione nel caso di curve di bordo chiuse o aperte.
57 lines
2.1 KiB
Lua
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, nCurrLayerId)
|
|
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()
|