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.
68 lines
2.3 KiB
Lua
68 lines
2.3 KiB
Lua
-- EndEditBezierBorders.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_EDIT_CURVE = 'Error in Edit Borders : '
|
|
|
|
-- Recupero Part, Layer di Edit e di Trimming corrente
|
|
local nCurrPartId = EgtGetCurrPart()
|
|
local nTmpLayerId = EgtGetCurrLayer()
|
|
if not nTmpLayerId or nTmpLayerId == GDB_ID.NULL then
|
|
EgtOutBox( ERROR_EDIT_CURVE .. 'Not a valid Current Editing Layer', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
local nCurrLayerId = nil
|
|
if GlobVar.IsTrimmingLayer( nTmpLayerId) then nCurrLayerId = nTmpLayerId
|
|
else nCurrLayerId = GlobVar.GetTrimmingLayerRefId( nTmpLayerId) end
|
|
if not nCurrLayerId or nCurrLayerId == GDB_ID.NULL then
|
|
EgtOutBox( ERROR_EDIT_CURVE .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Recupero il Layer di Edit delle Curve, se non esiste allora errore
|
|
local nLayerEditId = GlobVar.GetCurrentEditLayer( nCurrPartId)
|
|
if not nLayerEditId or nLayerEditId == GDB_ID.NULL then
|
|
EgtOutBox( ERROR_EDIT_CURVE .. 'Not a valid Trimming Edit Layer', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Chiedo Conferma dell'Operazione
|
|
local bDelete = EgtOutBox( 'Do you want to confirm and ending the Editing mode ?', 'Confirm', 'QUESTION', 'YESNO')
|
|
if not bDelete then EgtSetCurrPartLayer( nCurrPartId, nLayerEditId) return end
|
|
|
|
-- Elimino tutte le curve di Bordo dal Layer di Trimming corrente
|
|
local nId = EgtGetFirstInGroup( nCurrLayerId)
|
|
local vIdToErase = {}
|
|
while nId do
|
|
if EgtGetName( nId) == EDGES_NAME then table.insert( vIdToErase, nId) end
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
EgtErase( vIdToErase)
|
|
|
|
-- Inserisco tutte le curve del Layer di Edit nel Layer di Trimming corrente
|
|
nId = EgtGetFirstInGroup( nLayerEditId)
|
|
local vIdToRelocate = {}
|
|
while nId do
|
|
EgtSetName( nId, EDGES_NAME)
|
|
table.insert( vIdToRelocate, nId)
|
|
nId = EgtGetNext( nId)
|
|
end
|
|
for i = 1, #vIdToRelocate do
|
|
EgtRelocate( vIdToRelocate[i], nCurrLayerId)
|
|
EgtSetStatus( vIdToRelocate[i], GDB_ST.ON)
|
|
end
|
|
|
|
-- Cancello il Layer di Edit e rendo quello di Trimming come corrente
|
|
EgtErase( nLayerEditId)
|
|
EgtSetCurrPartLayer( nCurrPartId, nCurrLayerId)
|
|
EgtSetStatus( nCurrLayerId, GDB_ST.ON)
|
|
|
|
-- Aggiorno la Grafica
|
|
EgtDraw()
|