551dd86eaa
- spostate le costanti in EgtConst nella tabella MCH_TRIMMING.
46 lines
1.9 KiB
Lua
46 lines
1.9 KiB
Lua
-- ResetInterpSyncLines.lua by Egalware s.r.l. 2026/02/23
|
|
|
|
require( 'EgtBase')
|
|
_ENV = EgtProtectGlobal()
|
|
EgtEnableDebug( false)
|
|
|
|
-- Carico le costanti di Trimming
|
|
EgtAddToPackagePath( EgtGetSourceDir() .. '?.lua')
|
|
local GlobVar = require( 'TrimmingLib')
|
|
-- Costante di Errore
|
|
local ERROR_EDIT_SYNC_CURVES = 'Error in Edit Sync Curves : '
|
|
|
|
-- 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_EDIT_SYNC_CURVES .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Recupero il Layer di Edit
|
|
local nLayerEditId = GlobVar.GetCurrentEditSyncCurvesLayer( nCurrPartId, nTrimmingLayer)
|
|
if ( not nLayerEditId or nLayerEditId == GDB_ID.NULL) then
|
|
EgtOutBox( ERROR_EDIT_SYNC_CURVES .. 'Not a valid Edit mode created', 'Error', 'ERROR', 'OK')
|
|
return
|
|
end
|
|
|
|
-- Chiedo all'Utente la conferma dell'operazione
|
|
local bRemove = EgtOutBox( 'Do you want to remove the last Interpolated Sync Lines ?', 'Deleting', 'QUESTION', 'YESNO')
|
|
if not bRemove then return end
|
|
|
|
-- resetto il colore delle linee di sync che identificavano l'area di interpolazione
|
|
local vBoundarySyncIds = EgtGetInfo( nLayerEditId, MCH_TRIMMING.KEY_BOUND_LINES_INTERPOLATION_IDS, 'vi')
|
|
if vBoundarySyncIds ~= nil and #vBoundarySyncIds ~= 0 then EgtSetColor( vBoundarySyncIds, SYNC_LINE_COLOR) end
|
|
|
|
-- Recupero le ultime Linee di Sincronizzazione aggiunte e le elimino
|
|
local vLastInterpSyncIds = EgtGetInfo( nLayerEditId, MCH_TRIMMING.KEY_SYNC_LINES_INTERPOLATION_IDS, 'vi')
|
|
if vLastInterpSyncIds ~= nil and #vLastInterpSyncIds ~= 0 then EgtErase( vLastInterpSyncIds) end
|
|
|
|
-- Metto il focus sul Layer di Edit delle curve di Sincronizzazione
|
|
EgtSetCurrPartLayer( nCurrPartId, nLayerEditId)
|
|
|
|
-- Aggiorno la grafica
|
|
EgtDraw()
|