Files
trimming/NewTrimming.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

48 lines
1.9 KiB
Lua

-- 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])
bOk = EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_LIN_TOL, dLinTol) and
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_ANG_TOL, dAngTol) and
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.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()