- Lavorazione profili nella fase opportuna

- Migliorie varie
This commit is contained in:
andrea.villa
2024-06-21 17:15:37 +02:00
parent 66869aa0d8
commit 28e38b0441
6 changed files with 135 additions and 54 deletions
+29 -37
View File
@@ -43,24 +43,7 @@ _G.package.loaded.WinLib = nil
_G.package.loaded.FeatureData = nil
_G.package.loaded.MachiningLib = nil
-- TODO controllare se c'è un modo migliore per resettare librerie delle strategie caricate precedentemente
-- Per ottimizzare potremmo anche ciclare solo fino al numero di strategie raggiunto per il momento.
-- Infatti difficile ci siano 9999 strategie.
-- reset strategie caricate come librerie
for i = 1, 99 do
local IdSTRTemp = EgtReplaceString( tostring( i/10000, 4), '0.', '')
local sLibraryToReload = "STR" .. IdSTRTemp .. "\\STR" .. IdSTRTemp
local sLibraryConfigToReload = sLibraryToReload .. "Config"
if _G.package.loaded[sLibraryToReload] then
_G.package.loaded[sLibraryToReload] = nil
end
if _G.package.loaded[sLibraryConfigToReload] then
_G.package.loaded[sLibraryConfigToReload] = nil
end
end
local WinExec = require( 'WinExec')
local WinLib = require( 'WinLib')
-- Carico i dati globali
local WinData = require( 'WinData')
@@ -101,7 +84,7 @@ local function MyProcessInputData()
local sOut = ''
for i = 1, #PARTS do
PARTS[i].b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Solid') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3FinishedPiece = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3FinishedPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo'), 'AuxFrame') or EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo'), 'Frame')
PARTS[i].frame = EgtFR( idFrame)
sOut = sOut .. PARTS[i].sName .. ', '
@@ -124,20 +107,28 @@ local function GetDataConfig()
return true
end
-------------------------------------------------------------------------------------------------------------
local function UpdateRawPosition( PARTS)
for i = 1, #PARTS do
PARTS[i].b3FinishedPart = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].b3RawPart = EgtGetBBoxGlob( PARTS[i].idRaw or GDB_ID.NULL, GDB_BB.STANDARD)
end
end
-------------------------------------------------------------------------------------------------------------
local function GetDispOffsetFromNotes( nPieceIndex)
local bAllOffsetsAreOk = false
PARTS[nPieceIndex].DispOffset.Phase1.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffset.Phase1.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_1', 'd')
PARTS[nPieceIndex].DispOffset.Phase1.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_1', 'd')
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetX = 0 -- dovrà essere calcolato in base alle lavorazioni
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetY = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFY_2', 'd')
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetZ = EgtGetInfo( PARTS[nPieceIndex].id, 'OFFZ_2', 'd')
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].DispOffset.Phase1.dOffsetY and PARTS[nPieceIndex].DispOffset.Phase1.dOffsetZ and
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetY and PARTS[nPieceIndex].DispOffset.Phase2.dOffsetZ then
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
@@ -147,10 +138,10 @@ end
-------------------------------------------------------------------------------------------------------------
local function GetDispOffsetFromInput( nPieceIndex)
-- assegno alle stringhe i valori letti, in modo che vengano proposti quelli nel dialogo
local sOffYPh1 = EgtIf( PARTS[nPieceIndex].DispOffset.Phase1.dOffsetY, tostring( PARTS[nPieceIndex].DispOffset.Phase1.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
local sOffZPh1 = EgtIf( PARTS[nPieceIndex].DispOffset.Phase1.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffset.Phase1.dOffsetZ), '0')
local sOffYPh2 = EgtIf( PARTS[nPieceIndex].DispOffset.Phase2.dOffsetY, tostring( PARTS[nPieceIndex].DispOffset.Phase2.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
local sOffZPh2 = EgtIf( PARTS[nPieceIndex].DispOffset.Phase2.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffset.Phase2.dOffsetZ), '0')
local sOffYPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
local sOffZPh1 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ), '0')
local sOffYPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY), tostring( PARTS[nPieceIndex].dPartWidth / 2))
local sOffZPh2 = EgtIf( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ, tostring( PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ), '0')
local vInp = EgtDialogBox( 'Dati di disposizione pezzo: ' .. PARTS[nPieceIndex].sName,
{'Sporgenza laterale FASE1', sOffYPh1}, {'Posizione Z FASE1', sOffZPh1},
@@ -160,10 +151,10 @@ local function GetDispOffsetFromInput( nPieceIndex)
end
-- salvo input nei valori che utilizzerò dopo
PARTS[nPieceIndex].DispOffset.Phase1.dOffsetY = tonumber( vInp[1])
PARTS[nPieceIndex].DispOffset.Phase1.dOffsetZ = tonumber( vInp[2])
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetY = tonumber( vInp[3])
PARTS[nPieceIndex].DispOffset.Phase2.dOffsetZ = tonumber( vInp[4])
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetY = tonumber( vInp[1])
PARTS[nPieceIndex].DispOffsets.Phase1.dOffsetZ = tonumber( vInp[2])
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetY = tonumber( vInp[3])
PARTS[nPieceIndex].DispOffsets.Phase2.dOffsetZ = tonumber( vInp[4])
return true
end
@@ -280,9 +271,9 @@ local function MyProcessPieces()
-- recupero offset per posizionamento
for i = 1, #PARTS do
PARTS[i].DispOffset = {}
PARTS[i].DispOffset.Phase1 = {}
PARTS[i].DispOffset.Phase2 = {}
PARTS[i].DispOffsets = {}
PARTS[i].DispOffsets.Phase1 = {}
PARTS[i].DispOffsets.Phase2 = {}
local bInsertedAllOffs = GetDispOffsetFromNotes( i)
-- se non sono settati nelle note, li chiedo
@@ -297,6 +288,7 @@ local function MyProcessPieces()
-- si dispongono i pezzi sulla tavola
WinData.ExecDisposition( PARTS)
UpdateRawPosition( PARTS)
-- Impostazione dell'attrezzaggio di default
-- TODO se lascio il campo vuoto non mi carica il default!!!!!!!