- in BeamExec.ProcessAlternatives si passano correttamente le info a interfaccia da scrivere sul pezzo
- in BeamLib aggiunta funzione ConvertBitIndexToRotationIndex per convertire da BitIndex a RotationIndex
This commit is contained in:
+19
-27
@@ -2121,8 +2121,8 @@ end
|
||||
function BeamExec.ProcessAlternatives( PARTS)
|
||||
|
||||
-- inizializzazione variabili globali per interfaccia
|
||||
BEAM.ALTERNATIVESNEST2D = ''
|
||||
BEAM.ALTERNATIVES = ''
|
||||
local Alternatives = {}
|
||||
local AlternativesNest2D = {}
|
||||
|
||||
-- ciclo sui pezzi
|
||||
local BestCombination = {}
|
||||
@@ -2451,23 +2451,14 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
local bApplOk, _, _ = EgtApplyAllMachinings()
|
||||
-- se non ci sono errori, soluzione alternativa valida: scrittura variabili globali per interfaccia
|
||||
if bApplOk then
|
||||
local Alternatives = {}
|
||||
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
||||
if TotalCombiToTest[z].bIsNesting2D then
|
||||
if BEAM.ALTERNATIVESNEST2D and BEAM.ALTERNATIVESNEST2D ~= "" then
|
||||
table.insert( Alternatives, BEAM.ALTERNATIVESNEST2D)
|
||||
end
|
||||
table.insert( Alternatives, sBitIndexCombinationWithInvert)
|
||||
BEAM.ALTERNATIVESNEST2D = table.concat( Alternatives, ', ')
|
||||
table.insert( AlternativesNest2D, sBitIndexCombinationWithInvert)
|
||||
else
|
||||
if BEAM.ALTERNATIVES and BEAM.ALTERNATIVES ~= "" then
|
||||
table.insert( Alternatives, BEAM.ALTERNATIVES)
|
||||
end
|
||||
table.insert( Alternatives, sBitIndexCombinationWithInvert)
|
||||
BEAM.ALTERNATIVES = table.concat( Alternatives, ', ')
|
||||
end
|
||||
end
|
||||
-- se ultima combinazione, si esce e non si riporta in posizione inizale. Verrà infatti cancellata
|
||||
-- se ultima combinazione, si esce e non si riporta in posizione iniziale. Verrà infatti cancellata
|
||||
if z == #TotalCombiToTest then break end
|
||||
|
||||
-- si riporta pezzo in posizione iniziale
|
||||
@@ -2481,21 +2472,22 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
|
||||
end
|
||||
|
||||
-- passaggio info a interfaccia da scrivere sul pezzo
|
||||
BEAM.INFONGEPART = {}
|
||||
for i = 1, #AlternativesNest2D do
|
||||
local sRotation = BeamLib.ConvertBitIndexToRotationIndex( AlternativesNest2D[i])
|
||||
if PARTS[nPart].HeadcutInfo then
|
||||
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[sRotation].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[sRotation].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN )
|
||||
end
|
||||
if PARTS[nPart].TailcutInfo then
|
||||
local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[sRotation].OffsetX, ',')
|
||||
local sVtN = ( tostring( PARTS[nPart].TailcutInfo[sRotation].vtN)):gsub("^%(", ""):gsub("%)$", "")
|
||||
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i] .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- si cancella eventuale mach group creato per le alternative
|
||||
EgtRemoveMachGroup( nTempMachGroupName)
|
||||
|
||||
|
||||
@@ -889,6 +889,31 @@ function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
||||
return NumberString
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.ConvertBitIndexToRotationIndex( sBitIndexCombination)
|
||||
local nRotationIndex
|
||||
|
||||
if sBitIndexCombination == '1000' then
|
||||
return 1
|
||||
elseif sBitIndexCombination == '0100' then
|
||||
return 2
|
||||
elseif sBitIndexCombination == '0010' then
|
||||
return 3
|
||||
elseif sBitIndexCombination == '0001' then
|
||||
return 4
|
||||
elseif sBitIndexCombination == '1000_INV' then
|
||||
return 5
|
||||
elseif sBitIndexCombination == '0100_INV' then
|
||||
return 6
|
||||
elseif sBitIndexCombination == '0010_INV' then
|
||||
return 7
|
||||
elseif sBitIndexCombination == '0001_INV' then
|
||||
return 8
|
||||
end
|
||||
|
||||
return nRotationIndex
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- reindicizza una tabella passata ripartendo dall'indice nStartIndex e mantenendo l'ordine
|
||||
function BeamLib.RotateTableFromIndex( Table, nStartIndex)
|
||||
|
||||
Reference in New Issue
Block a user