Files
trimming/ResetEditBezierBorders.lua
T
Daniele Bariletti 551dd86eaa Trimming 3.1h2 :
- spostate le costanti in EgtConst nella tabella MCH_TRIMMING.
2026-08-26 12:12:39 +02:00

53 lines
1.9 KiB
Lua

-- ResetEditBezierBorders.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 end the Editing mode ?', 'Deleting', 'QUESTION', 'YESNO')
if not bDelete then EgtSetCurrPartLayer( nCurrPartId, nLayerEditId) return end
-- Cancello il Layer di Edit e rendo quello di Trimming come corrente
EgtErase( nLayerEditId)
EgtSetCurrPartLayer( nCurrPartId, nCurrLayerId)
EgtSetStatus( nCurrLayerId, GDB_ST.ON)
-- Imposto le Curve di Bordo come visibili
local nId = EgtGetFirstInGroup( nCurrLayerId)
while nId do
if EgtGetName( nId) == MCH_TRIMMING.EDGES_NAME then EgtSetStatus( nId, GDB_ST.ON) end
nId = EgtGetNext( nId)
end
-- Aggiorno la Grafica
EgtDraw()