-- NewTrimming.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_CREATING_NEW_TRIMMING = 'Error in Creating New Trimming : ' -- Recupero il Part corrente local nCurrPartId = EgtGetCurrPart() if nCurrPartId == nil then EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Current Part not Found', 'Error', 'ERROR', 'OK') return end -- Chiedo all'utente le Tolleranze e le Salvo come Info nel Layer di Trimming local vsVal = EgtDialogBox( 'New Trimming', { 'Surf Linear Tolerance', tostring( LIN_TOL)}, { 'Surf Angular Tolerance', tostring( ANG_TOL)}, { 'Surf Norm Angular Tolerance', tostring( ANG_FACE_TOL)}, { 'For Holes','CK:0'}) if not vsVal or #vsVal ~= 4 then return end -- Creo il Layer di Trimming all'interno del Part corrente e lo rendo corrente local nCurrLayerId = GlobVar.CreateTrimmingLayer( nCurrPartId, ( tonumber( vsVal[4]) == 1)) if nCurrLayerId == GDB_ID.NULL then EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Defining Layer failed', 'Error', 'ERROR', 'OK') return end EgtSetCurrPartLayer( nCurrPartId, nCurrLayerId) local dLinTol = tonumber( vsVal[1]) local dAngTol = tonumber( vsVal[2]) local dAngFaceTol = tonumber( vsVal[3]) KEY_LIN_TOL = 'LinTol' KEY_ANG_TOL = 'AngTol' KEY_SURF_ANG_TOL = 'SurfAngTol' bOk = EgtSetInfo( nCurrLayerId, KEY_LIN_TOL, dLinTol) and EgtSetInfo( nCurrLayerId, KEY_ANG_TOL, dAngTol) and EgtSetInfo( nCurrLayerId, KEY_SURF_ANG_TOL, dAngFaceTol) if not bOk then EgtOutBox( ERROR_CREATING_NEW_TRIMMING .. 'Saving Tolerances failed', 'Error', 'ERROR', 'OK') EgtErase( nCurrLayerId) return end -- Aggiorno la Grafica EgtDraw()