Trimming 3.1h2 :

- spostate le costanti in EgtConst nella tabella MCH_TRIMMING.
This commit is contained in:
Daniele Bariletti
2026-08-26 12:12:39 +02:00
parent 05031aa6b9
commit 551dd86eaa
19 changed files with 268 additions and 269 deletions
+28 -28
View File
@@ -32,12 +32,12 @@ end
-- Chiedo l'operazione da svolgere su tale superficie e ricavo i parametri inseriti
local dSize = STRIP_SIZE
local dStoredSize = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE, 'd')
local dStoredSize = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SURF_BORDER_SIZE, 'd')
if dStoredSize ~= nil then dSize = dStoredSize end
local dSizeTol = STRIP_SIZE_TOL
local dStoredSizeTol = EgtGetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE_TOL, 'd')
local dStoredSizeTol = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SURF_BORDER_SIZE_TOL, 'd')
if dStoredSizeTol ~= nil then dSizeTol = dStoredSizeTol end
local nLastSelType = EgtGetInfo( nCurrLayerId, KEY_SELECTION_LAST_SELECTION_TYPE, 'i')
local nLastSelType = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_SELECTION_TYPE, 'i')
local sLabels = { 'Insert Surface', 'Face Search', 'Surf Search'}
local sTypeDBSel
if nLastSelType ~= nil then
@@ -56,16 +56,16 @@ local vsVal = EgtDialogBox( 'Seletion', { 'Type', sTypeDBSel},
if not vsVal or #vsVal ~= 3 then return end
dSize = tonumber( vsVal[2])
dSizeTol = tonumber( vsVal[3])
EgtSetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE, dSize)
EgtSetInfo( nCurrLayerId, KEY_SURF_BORDER_SIZE_TOL, dSizeTol)
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SURF_BORDER_SIZE, dSize)
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SURF_BORDER_SIZE_TOL, dSizeTol)
for i, sLabel in ipairs( sLabels) do
if sLabel == vsVal[1] then EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_SELECTION_TYPE, i) break end
if sLabel == vsVal[1] then EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_SELECTION_TYPE, i) break end
end
-- Recupero le tolleranze impostate alla creazione del Layer di Trimming corrente
local dLinTol = EgtGetInfo( nCurrLayerId, KEY_LIN_TOL, 'd')
local dAngTol = EgtGetInfo( nCurrLayerId, KEY_ANG_TOL, 'd')
local dAngFaceTol = EgtGetInfo( nCurrLayerId, KEY_SURF_ANG_TOL, 'd')
local dLinTol = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_LIN_TOL, 'd')
local dAngTol = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_ANG_TOL, 'd')
local dAngFaceTol = EgtGetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SURF_ANG_TOL, 'd')
local bOk = ( dLinTol ~= nil and dAngTol ~= nil and dAngFaceTol ~= nil)
if not bOk then
EgtOutBox( ERROR_SELECTION .. 'Not a valid Trimming Layer', 'Error', 'ERROR', 'OK')
@@ -88,7 +88,7 @@ local vIdToErase = {}
local nId = EgtGetFirstInGroup( nCurrLayerId)
while nId do
local sName = EgtGetName( nId)
if sName ~= SELECTION_SURF_NAME then table.insert( vIdToErase, nId)
if sName ~= MCH_TRIMMING.SELECTION_SURF_NAME then table.insert( vIdToErase, nId)
else EgtSetStatus( nId, GDB_ST.ON) end
nId = EgtGetNext( nId)
end
@@ -118,15 +118,15 @@ if vsVal[1] == 'Insert Surface' then
end
-- Dalle superfici già presenti nel Layer di selezione, rimuovo gli Id dei riferimenti ( per non duplicare superfici)
local vOldSelSurfId = {}
local nId = EgtGetFirstNameInGroup( nCurrLayerId, SELECTION_SURF_NAME)
local nId = EgtGetFirstNameInGroup( nCurrLayerId, MCH_TRIMMING.SELECTION_SURF_NAME)
while nId do
local nObjType = EgtGetType( nId)
if nObjType == GDB_TY.SRF_MESH or nObjType == GDB_TY.SRF_BEZ then
-- Se la superficie selezionata precedentemente ha come riferimento una superficie, ne memorizzo l'Id
local nRefSurfId = EgtGetInfo( nId, KEY_SELECTION_REF_SURF, 'i')
local nRefSurfId = EgtGetInfo( nId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, 'i')
if nRefSurfId then table.insert( vOldSelSurfId, nRefSurfId) end
end
nId = EgtGetNextName( nId, SELECTION_SURF_NAME)
nId = EgtGetNextName( nId, MCH_TRIMMING.SELECTION_SURF_NAME)
end
local setToRemove = {}
for _, v in ipairs( vOldSelSurfId) do setToRemove[v] = true end
@@ -145,14 +145,14 @@ if vsVal[1] == 'Insert Surface' then
table.insert( vNewSurfIds, nInsertSurfId)
-- Assegno Colore e Nome
local bOk = EgtSetColor( nInsertSurfId, SELECTION_SURF_COLOR) and
EgtSetInfo( nInsertSurfId, KEY_SELECTION_REF_SURF, vSurfIds[i]) and
EgtSetName( nInsertSurfId, SELECTION_SURF_NAME)
EgtSetInfo( nInsertSurfId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, vSurfIds[i]) and
EgtSetName( nInsertSurfId, MCH_TRIMMING.SELECTION_SURF_NAME)
if not bOk then
EgtOutBox( ERROR_SELECTION .. 'Copying Surface failed', 'Error', 'ERROR', 'OK')
return
end
end
EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_IDS, vNewSurfIds)
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_IDS, vNewSurfIds)
--------------------------------- Ricerca delle facce adiancenti --------------------------------
-- [Tolleranza angolare di superficie]
@@ -168,9 +168,9 @@ elseif vsVal[1] == 'Face Search' then
end
-- Assegno Colore, Info e Name
bOk = EgtSetColor( nInsertSurfId, SELECTION_SURF_COLOR) and
EgtSetInfo( nInsertSurfId, KEY_SELECTION_REF_SURF, nSelObjId) and
EgtSetName( nInsertSurfId, SELECTION_SURF_NAME) and
EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_IDS, { nInsertSurfId})
EgtSetInfo( nInsertSurfId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, nSelObjId) and
EgtSetName( nInsertSurfId, MCH_TRIMMING.SELECTION_SURF_NAME) and
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_IDS, { nInsertSurfId})
-- Se invece è una Trimesh, recupero il primo triangolo selezionato
else
@@ -190,9 +190,9 @@ elseif vsVal[1] == 'Face Search' then
end
-- Assegno Colore, Info e Name
bOk = EgtSetColor( nInsertSurfId, SELECTION_SURF_COLOR) and
EgtSetInfo( nInsertSurfId, KEY_SELECTION_REF_SURF, nId) and
EgtSetName( nInsertSurfId, SELECTION_SURF_NAME) and
EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_IDS, { nInsertSurfId})
EgtSetInfo( nInsertSurfId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, nId) and
EgtSetName( nInsertSurfId, MCH_TRIMMING.SELECTION_SURF_NAME) and
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_IDS, { nInsertSurfId})
end
if not bOk then
EgtOutBox( ERROR_SELECTION .. 'Copying Surface failed', 'Error', 'ERROR', 'OK')
@@ -229,15 +229,15 @@ elseif vsVal[1] == 'Surf Search' then
table.insert( vSelSurfId, nSelObjId)
-- Dalle superfici già presenti nel Layer di selezione, rimuovo gli Id dei riferimenti ( per non duplicare superfici)
local vOldSelSurfId = {}
local nId = EgtGetFirstNameInGroup( nCurrLayerId, SELECTION_SURF_NAME)
local nId = EgtGetFirstNameInGroup( nCurrLayerId, MCH_TRIMMING.SELECTION_SURF_NAME)
while nId do
local nObjType = EgtGetType( nId)
if nObjType == GDB_TY.SRF_MESH or nObjType == GDB_TY.SRF_BEZ then
-- Se la superficie selezionata precedentemente ha come riferimento una superficie, ne memorizzo l'Id
local nRefSurfId = EgtGetInfo( nId, KEY_SELECTION_REF_SURF, 'i')
local nRefSurfId = EgtGetInfo( nId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, 'i')
if nRefSurfId then table.insert( vOldSelSurfId, nRefSurfId) end
end
nId = EgtGetNextName( nId, SELECTION_SURF_NAME)
nId = EgtGetNextName( nId, MCH_TRIMMING.SELECTION_SURF_NAME)
end
local setToRemove = {}
for _, v in ipairs( vOldSelSurfId) do setToRemove[v] = true end
@@ -255,14 +255,14 @@ elseif vsVal[1] == 'Surf Search' then
end
table.insert( vNewInsertedSrfIds, nInsertSurfId)
bOk = EgtSetColor( nInsertSurfId, SELECTION_SURF_COLOR) and
EgtSetInfo( nInsertSurfId, KEY_SELECTION_REF_SURF, vSurfIds[nSurf]) and
EgtSetName( nInsertSurfId, SELECTION_SURF_NAME)
EgtSetInfo( nInsertSurfId, MCH_TRIMMING.KEY_SELECTION_REF_SURF, vSurfIds[nSurf]) and
EgtSetName( nInsertSurfId, MCH_TRIMMING.SELECTION_SURF_NAME)
if not bOk then
EgtOutBox( ERROR_SELECTION .. 'Copying Surface failed', 'Error', 'ERROR', 'OK')
return
end
end
EgtSetInfo( nCurrLayerId, KEY_SELECTION_LAST_IDS, vNewInsertedSrfIds)
EgtSetInfo( nCurrLayerId, MCH_TRIMMING.KEY_SELECTION_LAST_IDS, vNewInsertedSrfIds)
end