- in BeamExec si scrivono HeadcutInfo e TailcutInfo nel PARTS che serviranno per nesting; da completare output alternative

This commit is contained in:
luca.mazzoleni
2026-05-13 16:00:20 +02:00
parent f6d6043c0e
commit 1e86180723
+51 -13
View File
@@ -251,6 +251,27 @@ function BeamExec.GetStrategiesFromJSONinBD( sAISetupConfigName)
end
end
-------------------------------------------------------------------------------------------------------------
local function GetRotationName( nRotIndex, nInvertIndex)
local sRotation = ''
if nRotIndex == 1 then
sRotation = '0'
elseif nRotIndex == 2 then
sRotation = '90'
elseif nRotIndex == 3 then
sRotation = '180'
elseif nRotIndex == 4 then
sRotation = '270'
end
if nInvertIndex > 1 then
sRotation = sRotation .. 'INV'
end
return sRotation
end
-- TODO prevedere parametri per preferire carico del pezzo verticale oppure orizzontale?
-------------------------------------------------------------------------------------------------------------
-- funzione che controlla validità delle combinazioni proposte
@@ -927,29 +948,27 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
HeadProc.AvailableStrategies = GetStrategies( HeadProc, Part.sAISetupConfig)
TailProc.AvailableStrategies = GetStrategies( TailProc, Part.sAISetupConfig)
-- per nesting, si settano come info gli offset X degli estremi dei tagli
local HeadcutInfo = {}
local PtSortedHead = BeamLib.GetSortedVertices( HeadProc)
local PtSortedTail = BeamLib.GetSortedVertices( TailProc)
if PtSortedHead then
local HeadVertexOffsetX = {}
HeadcutInfo.OffsetX = {}
for i = 1, #PtSortedHead do
table.insert( HeadVertexOffsetX, Part.b3Part:getMax():getX() - PtSortedHead[i]:getX())
table.insert( HeadcutInfo.OffsetX, Part.b3Part:getMax():getX() - PtSortedHead[i]:getX())
end
local sInfo = table.concat( HeadVertexOffsetX, ',')
EgtSetInfo( Part.id, 'HEADOFFSETX', sInfo)
end
local TailcutInfo = {}
local PtSortedTail = BeamLib.GetSortedVertices( TailProc)
if PtSortedTail then
local TailVertexOffsetX = {}
TailcutInfo.OffsetX = {}
for i = 1, #PtSortedHead do
table.insert( TailVertexOffsetX, Part.b3Part:getMin():getX() - PtSortedTail[i]:getX())
table.insert( TailcutInfo.OffsetX, Part.b3Part:getMin():getX() - PtSortedTail[i]:getX())
end
local sInfo = table.concat( TailVertexOffsetX, ',')
EgtSetInfo( Part.id, 'TAILOFFSETX', sInfo)
end
-- per nesting, si settano come info le normali delle facce di taglio
EgtSetInfo( Part.id, 'HEADVTN', tostring( HeadProc.Faces[1].vtN))
EgtSetInfo( Part.id, 'TAILVTN', tostring( TailProc.Faces[1].vtN))
HeadcutInfo.vtN = HeadProc.Faces[1].vtN
TailcutInfo.vtN = TailProc.Faces[1].vtN
return vProcSingleRot
return vProcSingleRot, HeadcutInfo, TailcutInfo
end
-------------------------------------------------------------------------------------------------------------
@@ -1368,12 +1387,15 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
-- se è prerotazione, oltre al ciclo normale, si devono verificare anche invertiti
local bCalcInverted = bIsFlipRot and PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion
local nCycles = EgtIf( bCalcInverted, 2, 1)
PARTS[nPart].HeadcutInfo = {}
PARTS[nPart].TailcutInfo = {}
-- per ogni inversione
for nInvertIndex = 1, nCycles do
-- per ogni rotazione
for nRotIndex = 1, 4 do
local nOffsetIndex = EgtIf( nInvertIndex == 2, 4, 0)
local nIndex = nRotIndex + nOffsetIndex
local HeadcutInfo, TailcutInfo
-- si calcolano le feature solo se la rotazione può essere presa in considerazione
if PARTS[nPart].CombinationList.Rotations[nRotIndex] == 1 then
-- recupero le feature di lavorazione della trave
@@ -1381,11 +1403,24 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
vProcRot[nIndex] = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart])
vProcRot[nIndex], HeadcutInfo, TailcutInfo = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart])
else
-- inserisco una tabella vuota
table.insert( vProcRot, {})
end
local sRotation = GetRotationName( nRotIndex, nInvertIndex)
if HeadcutInfo then
PARTS[nPart].HeadcutInfo[sRotation] = {
OffsetX = HeadcutInfo.OffsetX,
vtN = HeadcutInfo.vtN
}
end
if TailcutInfo then
PARTS[nPart].TailcutInfo[sRotation] = {
OffsetX = TailcutInfo.OffsetX,
vtN = TailcutInfo.vtN
}
end
-- rotazione pezzo di 90° per volta
BeamLib.RotateRawPart( PARTS[nPart], 1)
-- aggiorno info pezzo
@@ -2451,6 +2486,9 @@ function BeamExec.ProcessAlternatives( PARTS)
-- TEST
BEAM.INFONGEPART = { 'TEST=666,999,666,999', 'TEST2=44444444444', 'TEST3=sksksk'}
-- local sHeadVtN = ( tostring( HeadProc.Faces[1].vtN)):gsub("^%(", ""):gsub("%)$", "")
-- local sTailVtN = ( tostring( TailProc.Faces[1].vtN)):gsub("^%(", ""):gsub("%)$", "")
-- TEST