- in NestProcess prime modifiche per nesting obliquo (da completare)
- in BeamExec test BEAM.INFONGEPART per scrittura note pezzo in nge tramite Aedifica - in BeamLib aggiunta funzione RotateTableFromIndex per reindicizzare una tabella passata
This commit is contained in:
@@ -2446,6 +2446,18 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- TEST
|
||||
BEAM.INFONGEPART = 'TEST=666,999,666,999'
|
||||
-- TEST
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- si cancella eventuale mach group creato per le alternative
|
||||
EgtRemoveMachGroup( nTempMachGroupName)
|
||||
|
||||
|
||||
@@ -889,6 +889,18 @@ function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
||||
return NumberString
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- reindicizza una tabella passata ripartendo dall'indice nStartIndex e mantenendo l'ordine
|
||||
function BeamLib.RotateTableFromIndex( Table, nStartIndex)
|
||||
local RotatedTable = {}
|
||||
|
||||
for i = 1, #Table do
|
||||
RotatedTable[#RotatedTable + 1] = Table[((RotatedTable + i - 2) % #Table) + 1]
|
||||
end
|
||||
|
||||
return RotatedTable
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
--- copia una tabella lua in modo ricorsivo, ossia mantiene indipendenti anche tutte le sottotabelle
|
||||
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
|
||||
|
||||
+90
-1
@@ -4,4 +4,93 @@
|
||||
-- Intestazioni
|
||||
require( 'EgtBase')
|
||||
_ENV = EgtProtectGlobal()
|
||||
EgtEnableDebug( false)
|
||||
EgtEnableDebug( true)
|
||||
|
||||
-- Include
|
||||
local BeamLib = require( 'BeamLib')
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
-- stati che definiscono rotazione / inversione della parte
|
||||
local STATE = {
|
||||
STD = 1, -- Standard
|
||||
ROT180 = 2, -- Rotazione 180deg attorno a X+
|
||||
INV = 3, -- Inversione (rotazione 180deg attorno a Z+)
|
||||
INV_ROT180 = 4 -- Inversione + rotazione
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
-- inventario grezzi
|
||||
local RawInventory = {
|
||||
Stock = {},
|
||||
ActiveBeams = {}
|
||||
}
|
||||
|
||||
function RawInventory:BuildStock()
|
||||
if #LEN ~= #QTY then
|
||||
error( 'NestProcess: invalid stock data')
|
||||
end
|
||||
|
||||
for i = 1, #LEN do
|
||||
self.Stock[#self.Stock + 1] = {
|
||||
Length = LEN[i],
|
||||
Count = QTY[i]
|
||||
}
|
||||
end
|
||||
|
||||
return RawInventory
|
||||
end
|
||||
|
||||
function RawInventory:AddActiveBeam()
|
||||
-- TODO da fare
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
-- PartTemplates (informazioni geometriche pezzi univoci) e JobPool (lista di tutti i singoli pezzi, multipli compresi, da nestare)
|
||||
local PartTemplates = {}
|
||||
local JobPool = {}
|
||||
|
||||
function PartTemplates:AddPart( id)
|
||||
PartTemplates[id] = {}
|
||||
PartTemplates[id].dLength = EgtGetInfo( id, 'L', 'd')
|
||||
-- TODO qua gli stati abilitati dovranno arrivare dalle alternatives
|
||||
local VerticesHead = EgtSplitString( EgtGetInfo( id, 'HEADOFFSETX', 'd'))
|
||||
local vtNHead = Vector3d( EgtSplitString( EgtGetInfo( id, 'HEADVTN', 'd')))
|
||||
local VerticesTail = EgtSplitString( EgtGetInfo( id, 'TAILOFFSETX', 'd'))
|
||||
local vtNTail = Vector3d( EgtSplitString( EgtGetInfo( id, 'TAILVTN', 'd')))
|
||||
PartTemplates[id].States = {
|
||||
[STATE.STD] = {
|
||||
Head = { Vertices = VerticesHead, vtN = vtNHead},
|
||||
Tail = { Vertices = VerticesTail, vtN = vtNTail}
|
||||
},
|
||||
[STATE.ROT180] = {
|
||||
Head = { Vertices = BeamLib.RotateTableFromIndex( VerticesHead, 3), vtN = vtNHead},
|
||||
Tail = { Vertices = BeamLib.RotateTableFromIndex( VerticesTail, 3), vtN = vtNHead}
|
||||
},
|
||||
[STATE.INV] = {
|
||||
Head = { Vertices = VerticesTail, vtN = vtNTail},
|
||||
Tail = { Vertices = VerticesHead, vtN = vtNHead}
|
||||
},
|
||||
[STATE.INV_ROT180] = {
|
||||
Head = { Vertices = BeamLib.RotateTableFromIndex( VerticesTail, 3), vtN = vtNHead},
|
||||
Tail = { Vertices = BeamLib.RotateTableFromIndex( VerticesHead, 3), vtN = vtNHead}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- creazione combinata (si cicla una sola volta) di entrambe le tabelle
|
||||
local function BuildPartTemplatesAndJobPool()
|
||||
for id, nCount in pairs( PART) do
|
||||
PartTemplates:AddPart( id)
|
||||
end
|
||||
|
||||
return PartTemplates, JobPool
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
RawInventory:BuildStock()
|
||||
BuildPartTemplatesAndJobPool()
|
||||
Reference in New Issue
Block a user