CAMAuto :
- Raggruppate funzioni riguardati i pezzi in PartData.
This commit is contained in:
+9
-79
@@ -18,7 +18,7 @@ EgtAddToPackagePath( WIN.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||
-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre
|
||||
EgtAddToPackagePath( WIN.BASEDIR .. '\\Strategies\\?.lua')
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle finestre
|
||||
local sMachDir = EgtGetCurrMachineDir()
|
||||
if not sMachDir then
|
||||
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Serramenti', 'ERROR')
|
||||
@@ -44,6 +44,7 @@ _G.package.loaded.FeatureData = nil
|
||||
_G.package.loaded.MachiningLib = nil
|
||||
|
||||
local WinExec = require( 'WinExec')
|
||||
local PartData = require( 'PartData')
|
||||
|
||||
-- Carico i dati globali
|
||||
local WinData = require( 'WinData')
|
||||
@@ -58,7 +59,7 @@ local ColA = Color3d( 255, 165, 0, 30)
|
||||
-- *** Recupero i pezzi da processare ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessInputData()
|
||||
-- Recupero le travi selezionate
|
||||
-- Recupero i pezzi selezionati
|
||||
local nId = EgtGetFirstSelectedObj()
|
||||
while nId do
|
||||
local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL)
|
||||
@@ -76,23 +77,9 @@ local function MyProcessInputData()
|
||||
end
|
||||
nId = EgtGetNextSelectedObj()
|
||||
end
|
||||
if #PARTS == 0 then
|
||||
EgtOutBox( 'Non sono state selezionati pezzi', 'Lavora Pezzi', 'ERROR')
|
||||
return false
|
||||
else
|
||||
-- recupero tutte le dimensioni necessarie
|
||||
local sOut = ''
|
||||
for i = 1, #PARTS do
|
||||
PARTS[i].b3Raw = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'GeoRaw'), 'AuxFrame')
|
||||
PARTS[i].frame = EgtFR( idFrame)
|
||||
sOut = sOut .. PARTS[i].sName .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
EgtOutLog( 'Pezzi selezionati : ' .. sOut, 1)
|
||||
end
|
||||
|
||||
|
||||
PartData.GetDimensionPart( PARTS)
|
||||
|
||||
EgtDeselectAll()
|
||||
|
||||
return true
|
||||
@@ -107,26 +94,6 @@ local function GetDataConfig()
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetDispOffsetFromNotes( nPieceIndex)
|
||||
local bAllOffsetsAreOk = false
|
||||
|
||||
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
|
||||
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_1', 'd')
|
||||
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_1', 'd')
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_2', 'd')
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_2', 'd')
|
||||
|
||||
-- controllo se tutti gli offset siano settati
|
||||
if PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ and
|
||||
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY and PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ then
|
||||
bAllOffsetsAreOk = true
|
||||
end
|
||||
|
||||
return bAllOffsetsAreOk
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetDispOffsetFromInput( nPieceIndex)
|
||||
-- assegno alle stringhe i valori letti, in modo che vengano proposti quelli nel dialogo
|
||||
@@ -151,43 +118,6 @@ local function GetDispOffsetFromInput( nPieceIndex)
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Crea il grezzo che verrà messo in macchina
|
||||
---------------------------------------------------------------------
|
||||
local function AddOverMaterialToRaw( PARTS)
|
||||
for i = 1, #PARTS do
|
||||
|
||||
-- prima di aggiungere sovramateriale al grezzo, calcolo dimensioni del finito
|
||||
local b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].b3Part = b3Part
|
||||
PARTS[i].dPartLength = PARTS[i].b3Part:getDimX()
|
||||
PARTS[i].dPartWidth = PARTS[i].b3Part:getDimY()
|
||||
PARTS[i].dPartHeight = PARTS[i].b3Part:getDimZ()
|
||||
|
||||
-- recupero sovramateriale
|
||||
PARTS[i].RawOffset = {}
|
||||
-- recupero info sovramateriale
|
||||
PARTS[i].RawOffset.dOverMatIn = EgtGetInfo( PARTS[i].id, 'OVERMAT_IN', 'd') or 5
|
||||
PARTS[i].RawOffset.dOverMatOut = EgtGetInfo( PARTS[i].id, 'OVERMAT_OUT', 'd') or 5
|
||||
PARTS[i].RawOffset.dOverMatLeft = EgtGetInfo( PARTS[i].id, 'OVERMAT_LEFT', 'd') or 5
|
||||
PARTS[i].RawOffset.dOverMatRight = EgtGetInfo( PARTS[i].id, 'OVERMAT_RIGHT', 'd') or 5
|
||||
|
||||
PARTS[i].dRawLength = PARTS[i].RawOffset.dOverMatLeft + PARTS[i].dPartLength + PARTS[i].RawOffset.dOverMatRight
|
||||
PARTS[i].dRawWidth = PARTS[i].RawOffset.dOverMatOut + PARTS[i].dPartWidth + PARTS[i].RawOffset.dOverMatIn
|
||||
PARTS[i].dRawHeight = PARTS[i].dPartHeight
|
||||
|
||||
EgtModifyRawPartSize( PARTS[i].idRaw, PARTS[i].dRawLength, PARTS[i].dRawWidth, PARTS[i].dPartHeight)
|
||||
|
||||
local vtMove = Vector3d( PARTS[i].RawOffset.dOverMatLeft, PARTS[i].RawOffset.dOverMatOut, 0)
|
||||
EgtMovePartInRawPart( PARTS[i].id, vtMove)
|
||||
|
||||
-- TODO da controllare, se ruotato di 180° bisognerebbe prendere dOverMatIn. Lo stesso per la X
|
||||
PARTS[i].OffsetPartToRaw = {}
|
||||
PARTS[i].OffsetPartToRaw.X = PARTS[i].RawOffset.dOverMatLeft
|
||||
PARTS[i].OffsetPartToRaw.Y = PARTS[i].RawOffset.dOverMatOut
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Crea il grezzo che verrà messo in macchina
|
||||
---------------------------------------------------------------------
|
||||
@@ -246,7 +176,7 @@ local nMachGroupId = EgtGetFirstMachGroup()
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- *** Inserimento delle travi nel grezzo ***
|
||||
-- *** Inserimento dei pezzi nel grezzo ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessPieces()
|
||||
|
||||
@@ -261,7 +191,7 @@ local function MyProcessPieces()
|
||||
AlignRawsToTable( PARTS)
|
||||
|
||||
-- aggiungo sovramateriale ai grezzi
|
||||
AddOverMaterialToRaw( PARTS)
|
||||
PartData.AddOverMaterialToRaw( PARTS)
|
||||
|
||||
-- recupero offset per posizionamento
|
||||
for i = 1, #PARTS do
|
||||
@@ -269,7 +199,7 @@ local function MyProcessPieces()
|
||||
PARTS[i].DispOffsets.Phase1 = {}
|
||||
PARTS[i].DispOffsets.Phase2 = {}
|
||||
|
||||
local bInsertedAllOffs = GetDispOffsetFromNotes( i)
|
||||
local bInsertedAllOffs = PartData.GetDispOffsetFromNotes( PARTS, i)
|
||||
-- se non sono settati nelle note, li chiedo
|
||||
if not bInsertedAllOffs then
|
||||
bInsertedAllOffs = GetDispOffsetFromInput( i)
|
||||
|
||||
Reference in New Issue
Block a user