Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8d3cd461b | |||
| c506486585 | |||
| a73c0c85ac | |||
| fb3a5ec0be | |||
| e3e7537f8f | |||
| eec6b50985 | |||
| b5cb706ad5 | |||
| 053755e583 | |||
| c7045499f4 | |||
| 44478b91f0 | |||
| 1f4aa15af4 |
+19
-2
@@ -388,10 +388,18 @@ if bToProcess then
|
|||||||
else
|
else
|
||||||
PARTS[i].b3PartOriginal = b3Solid
|
PARTS[i].b3PartOriginal = b3Solid
|
||||||
end
|
end
|
||||||
|
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||||
|
local sOut = 'Piece-Length (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||||
|
'out of machine limits (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||||
|
BEAM.ERR = 17
|
||||||
|
BEAM.MSG = sOut
|
||||||
|
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||||
|
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- Assegno lunghezza della barra
|
-- Assegno lunghezza della barra
|
||||||
-- TODO nella ProcessBeams andava in errore con 10mm!!! CONTROLLARE
|
dBarLen = PARTS[1].b3PartOriginal:getDimX() + 10
|
||||||
dBarLen = PARTS[1].b3PartOriginal:getDimX() + 20
|
|
||||||
if dBarLen < 2200 then
|
if dBarLen < 2200 then
|
||||||
dBarLen = dBarLen + 1800
|
dBarLen = dBarLen + 1800
|
||||||
end
|
end
|
||||||
@@ -448,6 +456,15 @@ if bToProcess then
|
|||||||
else
|
else
|
||||||
PARTS[i].b3PartOriginal = b3Solid
|
PARTS[i].b3PartOriginal = b3Solid
|
||||||
end
|
end
|
||||||
|
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||||
|
local sOut = 'Piece-Length (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||||
|
'out of machine limits (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||||
|
BEAM.ERR = 17
|
||||||
|
BEAM.MSG = sOut
|
||||||
|
WriteErrToLogFile( BEAM.ERR, BEAM.MSG)
|
||||||
|
PostErrView( BEAM.ERR, BEAM.MSG)
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+228
-410
@@ -256,27 +256,6 @@ function BeamExec.GetStrategiesFromJSONinBD( sAISetupConfigName)
|
|||||||
end
|
end
|
||||||
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?
|
-- TODO prevedere parametri per preferire carico del pezzo verticale oppure orizzontale?
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- funzione che controlla validità delle combinazioni proposte
|
-- funzione che controlla validità delle combinazioni proposte
|
||||||
@@ -382,179 +361,188 @@ function BeamExec.GetAvailableCombinations( PartInfo, bIsFlipRot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- *** Funzioni posizionamento pezzi all'interno della barra***
|
-- *** funzioni posizionamento pezzi all'interno della barra ***
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, bCreateMachGroup, bIsFlipRot )
|
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, bCreateMachGroup, bIsFlipRot)
|
||||||
-- 1. Inizializzazione e Default
|
-- gruppo per geometrie temporanee
|
||||||
local idTempGroup = BeamLib.GetTempGroup( )
|
local idTempGroup = BeamLib.GetTempGroup()
|
||||||
|
|
||||||
BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11 )
|
-- default per nuove costanti qualora non definite
|
||||||
BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8 )
|
BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11)
|
||||||
|
BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8)
|
||||||
|
|
||||||
dOvmMid = ( dOvmMid or 5.4 )
|
-- sovramateriale intermedio nullo se non definito
|
||||||
dOvmHead = ( dOvmHead or 0 )
|
dOvmMid = ( dOvmMid or 0)
|
||||||
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH )
|
|
||||||
|
|
||||||
-- 2. Gestione Gruppo di Lavoro
|
-- Determinazione minimo grezzo scaricabile
|
||||||
if ( bCreateMachGroup == nil ) then bCreateMachGroup = true end
|
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
|
||||||
if ( bCreateMachGroup ) then
|
|
||||||
local sMgName = EgtGetMachGroupNewName( 'Mach_1' )
|
-- Creazione nuovo gruppo di lavoro (di default va creato)
|
||||||
local idNewMg = EgtAddMachGroup( sMgName )
|
if bCreateMachGroup == nil then
|
||||||
if ( not idNewMg ) then
|
bCreateMachGroup = true
|
||||||
return false, 'Errore creazione gruppo di lavoro'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
if bCreateMachGroup then
|
||||||
-- 3. Configurazione Tavola Macchina
|
local sMgName = EgtGetMachGroupNewName( 'Mach_1')
|
||||||
EgtSetTable( 'Tab' )
|
local idNewMg = EgtAddMachGroup( sMgName)
|
||||||
local nMGrpId = EgtGetCurrMachGroup( )
|
if not idNewMg then
|
||||||
if ( not EgtGetInfo( nMGrpId, 'BARLEN', 'd' ) ) then
|
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
|
||||||
EgtSetInfo( nMGrpId, 'BARLEN', dRawL )
|
|
||||||
end
|
|
||||||
|
|
||||||
local b3Tab = EgtGetTableArea( )
|
|
||||||
local dPosY = EgtIf( BeamData.CENTER_BEAM, ( b3Tab:getDimY( ) + dRawW * EgtIf( BeamData.RIGHT_LOAD, -1, 1 ) ) / 2, EgtIf( BeamData.RIGHT_LOAD, 0, b3Tab:getDimY( ) ) )
|
|
||||||
|
|
||||||
BeamData.ptOriXR = Point3d( b3Tab:getDimX( ), dPosY, 0 )
|
|
||||||
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR )
|
|
||||||
|
|
||||||
EgtImportSetup( )
|
|
||||||
|
|
||||||
-- 4. Ciclo di Inserimento Pezzi
|
|
||||||
local nCnt = 0
|
|
||||||
local dMaxX = 0
|
|
||||||
local idPrevRaw = nil
|
|
||||||
local dNextStartOffset = dOvmHead -- Il primo pezzo applica il sormonto iniziale a destra (testa)
|
|
||||||
|
|
||||||
for i = 1, #PARTS do
|
|
||||||
local CurrentPart = PARTS[i]
|
|
||||||
local b3BoxExact = EgtGetBBoxGlob( CurrentPart.id or GDB_ID.NULL, GDB_BB.EXACT )
|
|
||||||
|
|
||||||
if ( b3BoxExact:isEmpty( ) or CurrentPart.b3PartOriginal:isEmpty( ) ) then break end
|
|
||||||
|
|
||||||
local dPartLen = CurrentPart.b3PartOriginal:getDimX( )
|
|
||||||
local dPartWidth = CurrentPart.b3PartOriginal:getDimY( )
|
|
||||||
local dPartHeight = CurrentPart.b3PartOriginal:getDimZ( )
|
|
||||||
|
|
||||||
local dStartOffset = dNextStartOffset
|
|
||||||
local dEndOffset = dOvmMid
|
|
||||||
|
|
||||||
-- LOGICA LOOK-AHEAD: Analisi del gap reale per la ripartizione specchiata
|
|
||||||
if ( i < #PARTS ) then
|
|
||||||
local dTotalGap = PARTS[i + 1].dPosX - CurrentPart.dPosX - dPartLen
|
|
||||||
if ( dTotalGap > dOvmMid ) then
|
|
||||||
dEndOffset = dOvmMid -- Max 5.4mm sulla coda (lato sinistro del grezzo)
|
|
||||||
dNextStartOffset = dTotalGap - dOvmMid -- Il residuo sulla testa del prossimo (lato destro)
|
|
||||||
else
|
|
||||||
-- Gestione automatica sotto-soglia o compenetrazione geometrica (Nesting Obliquo)
|
|
||||||
dEndOffset = dTotalGap
|
|
||||||
dNextStartOffset = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- MATEMATICA CORRETTA PER X CAD INVERTITA:
|
|
||||||
-- Il grezzo idRaw si estende verso destra. Spostando il pezzo internamente di dEndOffset (dDelta),
|
|
||||||
-- lasciamo dEndOffset a sinistra (coda) e matematicamente dStartOffset a destra (testa).
|
|
||||||
local dCrawLen = dPartLen + dStartOffset + dEndOffset
|
|
||||||
local dDelta = dEndOffset
|
|
||||||
local dStartPos = (CurrentPart.dPosX or 0) - dStartOffset
|
|
||||||
|
|
||||||
local bIsSectionOk = ( ( abs( dPartWidth - dRawW ) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH ) < 100 * GEO.EPS_SMALL ) or
|
|
||||||
( abs( dPartHeight - dRawW ) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH ) < 100 * GEO.EPS_SMALL ) )
|
|
||||||
|
|
||||||
if ( bIsSectionOk and ( dStartPos + dCrawLen <= dRawL + GEO.EPS_SMALL ) ) then
|
|
||||||
|
|
||||||
-- 5. Creazione e Posizionamento del Contenitore RawPart
|
|
||||||
CurrentPart.idRaw = EgtAddRawPart( Point3d( 0, 0, 0 ), dCrawLen, dRawW, dRawH, BeamData.RAWCOL )
|
|
||||||
EgtMoveToCornerRawPart( CurrentPart.idRaw, BeamData.ptOriXR, BeamData.dPosXR )
|
|
||||||
EgtMoveRawPart( CurrentPart.idRaw, Vector3d( -dStartPos, 0, 0 ) )
|
|
||||||
|
|
||||||
-- 6. Configurazione Geometrie Pezzo
|
|
||||||
nCnt = nCnt + 1
|
|
||||||
EgtSetInfo( CurrentPart.idRaw, 'ORD', nCnt )
|
|
||||||
|
|
||||||
if ( not BeamLib.CreateOrEmptyAddGroup( CurrentPart.id ) ) then
|
|
||||||
return false, 'Error creating Additional Group in Part ' .. tostring( CurrentPart.id )
|
|
||||||
end
|
|
||||||
|
|
||||||
BeamLib.AddPartStartFace( CurrentPart.id, CurrentPart.b3PartOriginal )
|
|
||||||
BeamLib.AddPartEndFace( CurrentPart.id, CurrentPart.b3PartOriginal )
|
|
||||||
|
|
||||||
-- Inserimento con dDelta (lascia lo spazio vuoto a sinistra e spinge il pezzo a destra)
|
|
||||||
EgtDeselectPartObjs( CurrentPart.id )
|
|
||||||
local ptPos = b3BoxExact:getMin( ) - CurrentPart.b3PartOriginal:getMin( ) + Vector3d( dDelta, ( dRawW - dPartWidth ) / 2, ( dRawH - dPartHeight ) / 2 )
|
|
||||||
EgtAddPartToRawPart( CurrentPart.id, ptPos, CurrentPart.idRaw )
|
|
||||||
|
|
||||||
-- Rotazione sezione se necessaria
|
|
||||||
if ( abs( dPartWidth - dRawW ) > 100 * GEO.EPS_SMALL ) then
|
|
||||||
EgtRotatePartInRawPart( CurrentPart.id, X_AX( ), 90 )
|
|
||||||
local vtEccOri = CurrentPart.b3PartOriginal:getCenter( ) - b3BoxExact:getCenter( )
|
|
||||||
local vtEccRot = Vector3d( vtEccOri )
|
|
||||||
vtEccRot:rotate( X_AX( ), 90 )
|
|
||||||
EgtMovePartInRawPart( CurrentPart.id, ( vtEccOri - vtEccRot ) )
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 7. Popolamento Metadati della Tabella CurrentPart
|
|
||||||
CurrentPart.bIsLastPart = ( i == #PARTS )
|
|
||||||
CurrentPart.dDistanceToNextPiece = dEndOffset
|
|
||||||
CurrentPart.b3Raw = EgtGetRawPartBBox( CurrentPart.idRaw )
|
|
||||||
CurrentPart.dLength = CurrentPart.b3Raw:getDimX( )
|
|
||||||
CurrentPart.dWidth = CurrentPart.b3Raw:getDimY( )
|
|
||||||
CurrentPart.dHeight = CurrentPart.b3Raw:getDimZ( )
|
|
||||||
CurrentPart.bSquareSection = abs( CurrentPart.dWidth - CurrentPart.dHeight ) < 100 * GEO.EPS_SMALL
|
|
||||||
|
|
||||||
CurrentPart.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( CurrentPart.id, 'Box' ) or GDB_ID.NULL )
|
|
||||||
CurrentPart.b3Part = EgtGetBBoxGlob( CurrentPart.idBoxTm, GDB_BB.STANDARD )
|
|
||||||
CurrentPart.nIndexInParts = i
|
|
||||||
CurrentPart.SplittingPoints = BeamLib.GetPartSplittingPoints( CurrentPart )
|
|
||||||
CurrentPart.NotClampableLength = { STD = { dHead = 0, dTail = 0 }, SIDE = { dHead = 0, dTail = 0 }, DOWN = { dHead = 0, dTail = 0 } }
|
|
||||||
CurrentPart.dHeadOverMaterial = dStartOffset
|
|
||||||
CurrentPart.sBTLInfo = EgtGetInfo( CurrentPart.id, 'PROJ', 's' ) or nil
|
|
||||||
CurrentPart.idTempGroup = idTempGroup
|
|
||||||
|
|
||||||
-- Notifiche al Post-Processor basate sulla nuova scomposizione
|
|
||||||
if ( dStartOffset > 0.09 ) then EgtSetInfo( CurrentPart.idRaw, 'HOVM', dStartOffset ) end
|
|
||||||
if ( dEndOffset > 0.09 ) then EgtSetInfo( CurrentPart.idRaw, 'TOVM', dEndOffset ) end
|
|
||||||
if ( idPrevRaw ) then EgtSetInfo( idPrevRaw, 'BDST', dStartOffset ) end
|
|
||||||
|
|
||||||
-- Caricamento Strategie JSON
|
|
||||||
CurrentPart.sAISetupConfig = EgtGetInfo( CurrentPart.id, 'AISETUP', 's' ) or
|
|
||||||
( GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo] and GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo].sAISetupConfig ) or
|
|
||||||
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
|
|
||||||
|
|
||||||
TIMER:startElapsed( 'Json' )
|
|
||||||
BeamExec.GetStrategiesFromJSONinBD( CurrentPart.sAISetupConfig )
|
|
||||||
CurrentPart.GeneralParameters = BeamLib.GetPieceGeneralParameters( CurrentPart, GENERAL_PARAMETERS_JSON )
|
|
||||||
TIMER:stopElapsed( 'Json' )
|
|
||||||
|
|
||||||
CurrentPart.CombinationList = BeamExec.GetAvailableCombinations( CurrentPart, bIsFlipRot )
|
|
||||||
|
|
||||||
-- Avanzamento calcolato sulla coordinata reale di fine RawPart (estremità sinistra sulla barra)
|
|
||||||
dMaxX = max( dMaxX, dStartPos + dCrawLen )
|
|
||||||
CurrentPart.dRestLength = dRawL - dMaxX
|
|
||||||
idPrevRaw = CurrentPart.idRaw
|
|
||||||
else
|
|
||||||
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1 ) .. ') too big for remaining bar space'
|
|
||||||
return false, sOut
|
return false, sOut
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 8. Chiusura Barra e Gestione Avanzo (Rest Material)
|
-- Impostazione della tavola
|
||||||
if ( idPrevRaw ) then EgtSetInfo( idPrevRaw, 'BDST', 10000 ) end
|
EgtSetTable( 'Tab')
|
||||||
|
|
||||||
local dRemaining = dRawL - dMaxX
|
-- salvo nota con lunghezza grezzo
|
||||||
if ( dRemaining > 10 ) then
|
-- Recupero l'identificativo del gruppo di lavoro corrente
|
||||||
local idRawRest = EgtAddRawPart( Point3d( 0, 0, 0 ), dRemaining, dRawW, dRawH, BeamData.RAWCOL )
|
local nMGrpId = EgtGetCurrMachGroup()
|
||||||
EgtMoveToCornerRawPart( idRawRest, BeamData.ptOriXR, BeamData.dPosXR )
|
-- Lunghezza della barra
|
||||||
EgtMoveRawPart( idRawRest, Vector3d( -dMaxX, 0, 0 ) )
|
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
|
||||||
|
if not dBarLen then
|
||||||
|
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Area tavola
|
||||||
|
local b3Tab = EgtGetTableArea()
|
||||||
|
-- Calcolo posizione estremo TR/BR della tavola rispetto a sua origine in BL
|
||||||
|
local dPosY = EgtIf( BeamData.CENTER_BEAM, ( b3Tab:getDimY() + dRawW * EgtIf( BeamData.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BeamData.RIGHT_LOAD, 0, b3Tab:getDimY()))
|
||||||
|
BeamData.ptOriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
|
||||||
|
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
|
||||||
|
|
||||||
|
-- Impostazione dell'attrezzaggio di default
|
||||||
|
EgtImportSetup()
|
||||||
|
|
||||||
|
-- Inserimento dei pezzi con il loro grezzo
|
||||||
|
local nCnt = 0
|
||||||
|
local dLen = dRawL
|
||||||
|
local idPrevRaw, dPrevDelta
|
||||||
|
local dDeltaS = dOvmHead
|
||||||
|
local dDeltaSMin = 0
|
||||||
|
local dDeltaE = BeamData.OVM_MID
|
||||||
|
for i = 1, #PARTS do
|
||||||
|
-- dati del pezzo
|
||||||
|
local b3BoxExact = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT)
|
||||||
|
if b3BoxExact:isEmpty() or PARTS[i].b3PartOriginal:isEmpty() then break end
|
||||||
|
EgtOutLog( 'PartSez=' .. EgtNumToString( b3BoxExact:getDimY(), 1) .. 'x' .. EgtNumToString( b3BoxExact:getDimZ(), 1), 3)
|
||||||
|
-- se sezione compatibile e lunghezza disponibile sufficiente
|
||||||
|
local dPartLen = PARTS[i].b3PartOriginal:getDimX()
|
||||||
|
local dPartWidth = PARTS[i].b3PartOriginal:getDimY()
|
||||||
|
local dPartHeight = PARTS[i].b3PartOriginal:getDimZ()
|
||||||
|
local dNextLen = dLen - EgtIf( i == 1, dDeltaS, 0) - dPartLen - dDeltaE
|
||||||
|
if (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
|
||||||
|
( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
|
||||||
|
dNextLen + dDeltaE >= 0 then
|
||||||
|
-- eventuale sovramateriale di testa
|
||||||
|
if i > 1 then
|
||||||
|
if PARTS[i].dPosX then
|
||||||
|
dDeltaS = max( PARTS[i].dPosX - ( dRawL - dLen), dDeltaSMin)
|
||||||
|
else
|
||||||
|
dDeltaS = max( dOvmMid - dDeltaE, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- dimensioni del grezzo
|
||||||
|
local dCrawLen = min( dPartLen + dDeltaS + dDeltaE, dLen)
|
||||||
|
local dDelta = dCrawLen - dPartLen - dDeltaS
|
||||||
|
-- creo e posiziono il grezzo
|
||||||
|
PARTS[i].idRaw = EgtAddRawPart( Point3d(0,0,0), dCrawLen, dRawW, dRawH, BeamData.RAWCOL)
|
||||||
|
|
||||||
|
EgtMoveToCornerRawPart( PARTS[i].idRaw, BeamData.ptOriXR, BeamData.dPosXR)
|
||||||
|
EgtMoveRawPart( PARTS[i].idRaw, Vector3d( dLen - dRawL, 0, 0))
|
||||||
|
-- assegno ordine in lavorazione
|
||||||
|
nCnt = nCnt + 1
|
||||||
|
EgtSetInfo( PARTS[i].idRaw, 'ORD', nCnt)
|
||||||
|
-- creo o pulisco gruppo geometrie aggiuntive
|
||||||
|
if not BeamLib.CreateOrEmptyAddGroup( PARTS[i].id) then
|
||||||
|
local sOut = 'Error creating Additional Group in Part ' .. tostring( PARTS[i].id)
|
||||||
|
return false, sOut
|
||||||
|
end
|
||||||
|
-- aggiungo faccia per taglio iniziale al pezzo
|
||||||
|
BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3PartOriginal)
|
||||||
|
-- se sovramateriale di testa, lo notifico
|
||||||
|
if dDeltaS > 0.09 then
|
||||||
|
EgtSetInfo( PARTS[i].idRaw, 'HOVM', dDeltaS)
|
||||||
|
if idPrevRaw then
|
||||||
|
EgtSetInfo( idPrevRaw, 'BDST', dDeltaS + dPrevDelta)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dDeltaE > 0.09 then
|
||||||
|
EgtSetInfo( PARTS[i].idRaw, 'TOVM', dDeltaE)
|
||||||
|
end
|
||||||
|
-- aggiungo faccia per taglio finale al pezzo
|
||||||
|
BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3PartOriginal)
|
||||||
|
-- inserisco il pezzo nel grezzo
|
||||||
|
EgtDeselectPartObjs( PARTS[i].id)
|
||||||
|
local ptPos = b3BoxExact:getMin() - PARTS[i].b3PartOriginal:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2)
|
||||||
|
EgtAddPartToRawPart( PARTS[i].id, ptPos, PARTS[i].idRaw)
|
||||||
|
if abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL then
|
||||||
|
-- rotazione attorno a centro geometria complessiva del pezzo
|
||||||
|
EgtRotatePartInRawPart( PARTS[i].id, X_AX(), 90)
|
||||||
|
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
|
||||||
|
local vtEccOri = PARTS[i].b3PartOriginal:getCenter() - b3BoxExact:getCenter()
|
||||||
|
local vtEccRot = Vector3d( vtEccOri)
|
||||||
|
vtEccRot:rotate( X_AX(), 90)
|
||||||
|
EgtMovePartInRawPart( PARTS[i].id, ( vtEccOri - vtEccRot))
|
||||||
|
end
|
||||||
|
-- aggiorno la lunghezza residua della barra
|
||||||
|
dLen = dLen - dCrawLen
|
||||||
|
-- aggiorno grezzo precedente
|
||||||
|
idPrevRaw = PARTS[i].idRaw
|
||||||
|
dPrevDelta = dDelta
|
||||||
|
PARTS[i].bIsLastPart = ( i == #PARTS)
|
||||||
|
PARTS[i].dDistanceToNextPiece = dDelta
|
||||||
|
PARTS[i].dRestLength = dLen
|
||||||
|
PARTS[i].b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw)
|
||||||
|
PARTS[i].dLength = PARTS[i].b3Raw:getDimX()
|
||||||
|
PARTS[i].dWidth = PARTS[i].b3Raw:getDimY()
|
||||||
|
PARTS[i].dHeight = PARTS[i].b3Raw:getDimZ()
|
||||||
|
PARTS[i].bSquareSection = abs( PARTS[i].dWidth - PARTS[i].dHeight) < 100 * GEO.EPS_SMALL
|
||||||
|
PARTS[i].idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL)
|
||||||
|
PARTS[i].b3Part = EgtGetBBoxGlob( PARTS[i].idBoxTm, GDB_BB.STANDARD)
|
||||||
|
PARTS[i].nIndexInParts = i
|
||||||
|
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
|
||||||
|
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
|
||||||
|
PARTS[i].dHeadOverMaterial = dDeltaS
|
||||||
|
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
|
||||||
|
|
||||||
|
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or
|
||||||
|
( GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo] and GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig) or -- i parametri BTL potrebbero non esistere
|
||||||
|
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
|
||||||
|
|
||||||
|
-- si carica configurazione lavorazioni
|
||||||
|
TIMER:startElapsed('Json')
|
||||||
|
BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig)
|
||||||
|
PARTS[i].GeneralParameters = BeamLib.GetPieceGeneralParameters( PARTS[i], GENERAL_PARAMETERS_JSON)
|
||||||
|
TIMER:stopElapsed('Json')
|
||||||
|
PARTS[i].CombinationList = BeamExec.GetAvailableCombinations( PARTS[i], bIsFlipRot)
|
||||||
|
PARTS[i].idTempGroup = idTempGroup
|
||||||
|
|
||||||
|
else
|
||||||
|
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
|
||||||
|
return false, sOut
|
||||||
|
end
|
||||||
|
-- se rimasto troppo poco grezzo, esco
|
||||||
|
--if Len < BeamData.MinRaw then break end
|
||||||
|
DeltaS = 0
|
||||||
|
end
|
||||||
|
if idPrevRaw then
|
||||||
|
EgtSetInfo( idPrevRaw, 'BDST', 10000)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Se rimasto materiale aggiungo grezzo dell'avanzo
|
||||||
|
-- TODO valutare se ridurre la dLen minima perchè crea discrepanze tra lunghezza inserita e VMill
|
||||||
|
if dLen > 10 then
|
||||||
|
local idRaw = EgtAddRawPart( Point3d(0,0,0), dLen, dRawW, dRawH, BeamData.RAWCOL)
|
||||||
|
EgtMoveToCornerRawPart( idRaw, BeamData.ptOriXR, BeamData.dPosXR)
|
||||||
|
EgtMoveRawPart( idRaw, Vector3d( dLen - dRawL, 0, 0))
|
||||||
|
-- assegno ordine in lavorazione
|
||||||
nCnt = nCnt + 1
|
nCnt = nCnt + 1
|
||||||
EgtSetInfo( idRawRest, 'ORD', nCnt )
|
EgtSetInfo( idRaw, 'ORD', nCnt)
|
||||||
|
-- aggiorno distanza dell'ultimo pezzo dall'eventuale grezzo scaricabile
|
||||||
if ( EgtGetRawPartBBox( idRawRest ):getDimX( ) < BeamData.dMinRaw ) then
|
if EgtGetRawPartBBox( idRaw):getDimX() < BeamData.dMinRaw then
|
||||||
PARTS[#PARTS].dDistanceToNextPiece = 10000
|
PARTS[#PARTS].dDistanceToNextPiece = 10000
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if ( #PARTS > 0 ) then PARTS[#PARTS].dDistanceToNextPiece = 10000 end
|
PARTS[#PARTS].dDistanceToNextPiece = 10000
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -798,24 +786,9 @@ end
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||||
-- gruppo per geometrie temporanee
|
|
||||||
local idTempGroup = BeamLib.GetTempGroup()
|
|
||||||
|
|
||||||
local HeadProcOriginal
|
|
||||||
local TailProcOriginal
|
|
||||||
local HeadProc
|
|
||||||
local TailProc
|
|
||||||
|
|
||||||
-- ciclo tutte le feature
|
-- ciclo tutte le feature
|
||||||
for i = 1, #vProcSingleRot do
|
for i = 1, #vProcSingleRot do
|
||||||
local Proc = vProcSingleRot[i]
|
local Proc = vProcSingleRot[i]
|
||||||
if Proc.Topology.sName == 'HeadCut' then
|
|
||||||
HeadProcOriginal = Proc
|
|
||||||
HeadProcOriginal.bIsOriginalHeadcut = true
|
|
||||||
elseif Proc.Topology.sName == 'TailCut' then
|
|
||||||
TailProcOriginal = Proc
|
|
||||||
TailProcOriginal.bIsOriginalTailcut = true
|
|
||||||
end
|
|
||||||
-- se feature abilitata alla lavorazione
|
-- se feature abilitata alla lavorazione
|
||||||
if Proc.nFlg ~= 0 then
|
if Proc.nFlg ~= 0 then
|
||||||
-- controllo la feature con tutte le altre per recuperare le dipendenze
|
-- controllo la feature con tutte le altre per recuperare le dipendenze
|
||||||
@@ -823,86 +796,6 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
|||||||
local ProcB = vProcSingleRot[j]
|
local ProcB = vProcSingleRot[j]
|
||||||
-- non si controlla la feature con se stessa o se feature disabilitata
|
-- non si controlla la feature con se stessa o se feature disabilitata
|
||||||
if i ~= j and ProcB.nFlg ~= 0 then
|
if i ~= j and ProcB.nFlg ~= 0 then
|
||||||
|
|
||||||
local bAreBothTruncatingCuts =
|
|
||||||
( ID.IsCut( Proc) or ID.IsHeadCut( Proc) or ID.IsTailCut( Proc)) and ( ID.IsCut( ProcB) or ID.IsHeadCut( ProcB) or ID.IsTailCut( ProcB))
|
|
||||||
and ( FeatureLib.IsFeatureCuttingEntireSection( Proc.b3Box, Part) and FeatureLib.IsFeatureCuttingEntireSection( ProcB.b3Box, Part))
|
|
||||||
|
|
||||||
-- si trovano i veri tagli di testa e coda e si disattivano gli altri, se necessario
|
|
||||||
if bAreBothTruncatingCuts then
|
|
||||||
-- testa
|
|
||||||
if Proc.Faces[1].vtN:getX() > GEO.EPS_SMALL and ProcB.Faces[1].vtN:getX() > GEO.EPS_SMALL then
|
|
||||||
-- il primo taglio è più verso il centro della trave
|
|
||||||
if ( Proc.b3Box:getMin():getX() < ProcB.b3Box:getMin():getX() - 10 * GEO.EPS_SMALL) then
|
|
||||||
HeadProc = Proc
|
|
||||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
|
||||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
|
||||||
EgtMove( idProcCopy, - 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
EgtMove( idProcBCopy, 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
|
||||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
|
||||||
if not Proc.SlaveProcIndexes then
|
|
||||||
Proc.SlaveProcIndexes = {}
|
|
||||||
end
|
|
||||||
table.insert( Proc.SlaveProcIndexes, j)
|
|
||||||
ProcB.nIndexMasterProc = i
|
|
||||||
ProcB.nFlg = 0
|
|
||||||
end
|
|
||||||
-- il secondo taglio è più verso il centro della trave
|
|
||||||
elseif Proc.b3Box:getMin():getX() >= ProcB.b3Box:getMin():getX() - 10 * GEO.EPS_SMALL then
|
|
||||||
HeadProc = ProcB
|
|
||||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
|
||||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
|
||||||
EgtMove( idProcBCopy, - 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
EgtMove( idProcCopy, 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
|
||||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
|
||||||
if not ProcB.SlaveProcIndexes then
|
|
||||||
ProcB.SlaveProcIndexes = {}
|
|
||||||
end
|
|
||||||
table.insert( ProcB.SlaveProcIndexes, i)
|
|
||||||
Proc.nIndexMasterProc = j
|
|
||||||
Proc.nFlg = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- coda
|
|
||||||
elseif Proc.Faces[1].vtN:getX() <= GEO.EPS_SMALL and ProcB.Faces[1].vtN:getX() <= GEO.EPS_SMALL then
|
|
||||||
-- il primo taglio è più verso il centro della trave
|
|
||||||
if Proc.b3Box:getMax():getX() > ProcB.b3Box:getMax():getX() + 10 * GEO.EPS_SMALL then
|
|
||||||
TailProc = Proc
|
|
||||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
|
||||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
|
||||||
EgtMove( idProcCopy, - 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
EgtMove( idProcBCopy, 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
|
||||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
|
||||||
if not Proc.SlaveProcIndexes then
|
|
||||||
Proc.SlaveProcIndexes = {}
|
|
||||||
end
|
|
||||||
table.insert( Proc.SlaveProcIndexes, j)
|
|
||||||
ProcB.nIndexMasterProc = i
|
|
||||||
ProcB.nFlg = 0
|
|
||||||
end
|
|
||||||
-- il secondo taglio è più verso il centro della trave
|
|
||||||
elseif Proc.b3Box:getMax():getX() >= ProcB.b3Box:getMax():getX() - 10 * GEO.EPS_SMALL then
|
|
||||||
TailProc = ProcB
|
|
||||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
|
||||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
|
||||||
EgtMove( idProcBCopy, - 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
EgtMove( idProcCopy, 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
|
||||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
|
||||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
|
||||||
if not ProcB.SlaveProcIndexes then
|
|
||||||
ProcB.SlaveProcIndexes = {}
|
|
||||||
end
|
|
||||||
table.insert( ProcB.SlaveProcIndexes, i)
|
|
||||||
Proc.nIndexMasterProc = j
|
|
||||||
Proc.nFlg = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- se entrambi tagli di testa, si tiene sempre il primo ( ma non quello aggiunto dall'automatismo)
|
-- se entrambi tagli di testa, si tiene sempre il primo ( ma non quello aggiunto dall'automatismo)
|
||||||
if ( ID.IsHeadCut( Proc) and not EgtGetInfo( Proc.id, 'HEAD_ADD_CUT', 'i')) and ID.IsHeadCut( ProcB) then
|
if ( ID.IsHeadCut( Proc) and not EgtGetInfo( Proc.id, 'HEAD_ADD_CUT', 'i')) and ID.IsHeadCut( ProcB) then
|
||||||
if not Proc.SlaveProcIndexes then
|
if not Proc.SlaveProcIndexes then
|
||||||
@@ -940,43 +833,7 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return vProcSingleRot
|
||||||
if not HeadProc then
|
|
||||||
HeadProc = HeadProcOriginal
|
|
||||||
end
|
|
||||||
if not TailProc then
|
|
||||||
TailProc = TailProcOriginal
|
|
||||||
end
|
|
||||||
HeadProc.Topology = {}
|
|
||||||
TailProc.Topology = {}
|
|
||||||
HeadProc.Topology.sFamily = 'HeadCut'
|
|
||||||
HeadProc.Topology.sName = 'HeadCut'
|
|
||||||
TailProc.Topology.sFamily = 'TailCut'
|
|
||||||
TailProc.Topology.sName = 'TailCut'
|
|
||||||
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)
|
|
||||||
if PtSortedHead then
|
|
||||||
HeadcutInfo.OffsetX = {}
|
|
||||||
for i = 1, #PtSortedHead do
|
|
||||||
table.insert( HeadcutInfo.OffsetX, Part.b3Part:getMax():getX() - PtSortedHead[i]:getX())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local TailcutInfo = {}
|
|
||||||
local PtSortedTail = BeamLib.GetSortedVertices( TailProc)
|
|
||||||
if PtSortedTail then
|
|
||||||
TailcutInfo.OffsetX = {}
|
|
||||||
for i = 1, #PtSortedHead do
|
|
||||||
table.insert( TailcutInfo.OffsetX, Part.b3Part:getMin():getX() - PtSortedTail[i]:getX())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- per nesting, si settano come info le normali delle facce di taglio
|
|
||||||
HeadcutInfo.vtN = HeadProc.Faces[1].vtN
|
|
||||||
TailcutInfo.vtN = TailProc.Faces[1].vtN
|
|
||||||
|
|
||||||
return vProcSingleRot, HeadcutInfo, TailcutInfo
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1131,9 +988,6 @@ local function CalculateStrategies( vProcSingleRot, Part)
|
|||||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine = 99
|
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine = 99
|
||||||
end
|
end
|
||||||
|
|
||||||
if not Proc.AvailableStrategies.dAllStrategiesTotalTime then
|
|
||||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = 0
|
|
||||||
end
|
|
||||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = Proc.AvailableStrategies.dAllStrategiesTotalTime + Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine
|
Proc.AvailableStrategies.dAllStrategiesTotalTime = Proc.AvailableStrategies.dAllStrategiesTotalTime + Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine
|
||||||
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
||||||
if Part.GeneralParameters.GEN_sMachiningStrategy == 'FIRST_IN_LIST' and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then
|
if Part.GeneralParameters.GEN_sMachiningStrategy == 'FIRST_IN_LIST' and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then
|
||||||
@@ -1343,11 +1197,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
|||||||
local StrategyScriptName = Proc.ChosenStrategy.sStrategyId .. '\\' .. Proc.ChosenStrategy.sStrategyId
|
local StrategyScriptName = Proc.ChosenStrategy.sStrategyId .. '\\' .. Proc.ChosenStrategy.sStrategyId
|
||||||
local StrategyScript = require( StrategyScriptName)
|
local StrategyScript = require( StrategyScriptName)
|
||||||
-- eseguo la strategia e si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
-- eseguo la strategia e si applicano le lavorazioni. Si passa la Proc e i parametri personalizzati
|
||||||
local _, Result = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy)
|
_, _ = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy)
|
||||||
-- per i tagli di testa e coda, che non hanno girato nel CalculateStrategies, si devono settare i risultati
|
|
||||||
if ID.IsHeadCut( Proc) or ID.IsTailCut( Proc) then
|
|
||||||
Proc.ChosenStrategy.Result = Result
|
|
||||||
end
|
|
||||||
-- se tutte le strategie disponibili non sono applicabili
|
-- se tutte le strategie disponibili non sono applicabili
|
||||||
else
|
else
|
||||||
local nOffsetIndex = EgtIf( Part.bPartInCombiIsInverted, 4, 0)
|
local nOffsetIndex = EgtIf( Part.bPartInCombiIsInverted, 4, 0)
|
||||||
@@ -1399,16 +1249,12 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
|
|||||||
-- se è prerotazione, oltre al ciclo normale, si devono verificare anche invertiti
|
-- se è prerotazione, oltre al ciclo normale, si devono verificare anche invertiti
|
||||||
local bCalcInverted = bIsFlipRot and PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion
|
local bCalcInverted = bIsFlipRot and PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion
|
||||||
local nCycles = EgtIf( bCalcInverted, 2, 1)
|
local nCycles = EgtIf( bCalcInverted, 2, 1)
|
||||||
PARTS[nPart].HeadcutInfo = {}
|
|
||||||
PARTS[nPart].TailcutInfo = {}
|
|
||||||
-- per ogni inversione
|
-- per ogni inversione
|
||||||
for nInvertIndex = 1, nCycles do
|
for nInvertIndex = 1, nCycles do
|
||||||
-- per ogni rotazione
|
-- per ogni rotazione
|
||||||
for nRotIndex = 1, 4 do
|
for nRotIndex = 1, 4 do
|
||||||
local nOffsetIndex = EgtIf( nInvertIndex == 2, 4, 0)
|
local nOffsetIndex = EgtIf( nInvertIndex == 2, 4, 0)
|
||||||
-- le rotazioni sono 1,2,3,4 (0, 90, 180, 270) e 5,6,7,8 (le stesse invertite)
|
|
||||||
local nIndex = nRotIndex + nOffsetIndex
|
local nIndex = nRotIndex + nOffsetIndex
|
||||||
local HeadcutInfo, TailcutInfo
|
|
||||||
-- si calcolano le feature solo se la rotazione può essere presa in considerazione
|
-- si calcolano le feature solo se la rotazione può essere presa in considerazione
|
||||||
if PARTS[nPart].CombinationList.Rotations[nRotIndex] == 1 then
|
if PARTS[nPart].CombinationList.Rotations[nRotIndex] == 1 then
|
||||||
-- recupero le feature di lavorazione della trave
|
-- recupero le feature di lavorazione della trave
|
||||||
@@ -1416,23 +1262,11 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
|
|||||||
|
|
||||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||||
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
|
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
|
||||||
vProcRot[nIndex], HeadcutInfo, TailcutInfo = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart])
|
vProcRot[nIndex] = GetFeatureInfoAndDependency( vProcRot[nIndex], PARTS[nPart])
|
||||||
else
|
else
|
||||||
-- inserisco una tabella vuota
|
-- inserisco una tabella vuota
|
||||||
table.insert( vProcRot, {})
|
table.insert( vProcRot, {})
|
||||||
end
|
end
|
||||||
if HeadcutInfo then
|
|
||||||
PARTS[nPart].HeadcutInfo[nIndex] = {
|
|
||||||
OffsetX = HeadcutInfo.OffsetX,
|
|
||||||
vtN = HeadcutInfo.vtN
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if TailcutInfo then
|
|
||||||
PARTS[nPart].TailcutInfo[nIndex] = {
|
|
||||||
OffsetX = TailcutInfo.OffsetX,
|
|
||||||
vtN = TailcutInfo.vtN
|
|
||||||
}
|
|
||||||
end
|
|
||||||
-- rotazione pezzo di 90° per volta
|
-- rotazione pezzo di 90° per volta
|
||||||
BeamLib.RotateRawPart( PARTS[nPart], 1)
|
BeamLib.RotateRawPart( PARTS[nPart], 1)
|
||||||
-- aggiorno info pezzo
|
-- aggiorno info pezzo
|
||||||
@@ -1662,15 +1496,13 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
|||||||
for nProc = 1, #ProcessingsOnPart.Rotation[1] do
|
for nProc = 1, #ProcessingsOnPart.Rotation[1] do
|
||||||
-- Si controlla sempre la rotazione 1 perchè la dipendenza di una feature da un'altra non dipende dalla rotazione
|
-- Si controlla sempre la rotazione 1 perchè la dipendenza di una feature da un'altra non dipende dalla rotazione
|
||||||
-- se feature disattivata perchè eseguita da master a lei associata dichiaro comunque eseguita
|
-- se feature disattivata perchè eseguita da master a lei associata dichiaro comunque eseguita
|
||||||
local ProcOnFirstRotation = ProcessingsOnPart.Rotation[1][nProc]
|
if ProcessingsOnPart.Rotation[1][nProc].nFlg == 0 and ProcessingsOnPart.Rotation[1][nProc].nIndexMasterProc then
|
||||||
if ProcOnFirstRotation.nFlg == 0 and ProcOnFirstRotation.nIndexMasterProc then
|
ProcessingsOnPart.Rotation[1][nProc].nIndexRotation = nUnloadPos
|
||||||
ProcOnFirstRotation.nIndexRotation = nUnloadPos
|
table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[1][nProc])
|
||||||
table.insert( SingleCombination.Rot0, ProcOnFirstRotation)
|
|
||||||
SingleCombination.nComplete = SingleCombination.nComplete + 1
|
SingleCombination.nComplete = SingleCombination.nComplete + 1
|
||||||
else
|
else
|
||||||
local nOffsetIndex = EgtIf( SingleCombination.bPartInCombiIsInverted, 4, 0)
|
local nOffsetIndex = EgtIf( SingleCombination.bPartInCombiIsInverted, 4, 0)
|
||||||
if not ( ( ID.IsHeadCut( ProcOnFirstRotation) and ProcOnFirstRotation.bIsOriginalHeadcut)
|
if not ID.IsHeadCut( ProcessingsOnPart.Rotation[1][nProc]) and not ID.IsTailCut( ProcessingsOnPart.Rotation[1][nProc]) then
|
||||||
or ( ID.IsTailCut( ProcOnFirstRotation) and ProcOnFirstRotation.bIsOriginalTailcut)) then
|
|
||||||
-- ciclo sulle rotazioni
|
-- ciclo sulle rotazioni
|
||||||
local nNextRot = nUnloadPos
|
local nNextRot = nUnloadPos
|
||||||
local ResultsList = {}
|
local ResultsList = {}
|
||||||
@@ -1696,40 +1528,34 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
|||||||
nNextRot = EgtIf( nNextRot + 1 > 4, nNextRot + 1 - 4, nNextRot + 1)
|
nNextRot = EgtIf( nNextRot + 1 > 4, nNextRot + 1 - 4, nNextRot + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se la feature può essere lavorata in almeno una rotazione e non è un taglio di testa o coda
|
-- se la feature può essere lavorata in almeno una rotazione
|
||||||
if ID.IsHeadCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) then
|
if #ResultsList > 0 then
|
||||||
SingleCombination.nIndexHeadCutInVProc = nProc
|
local Proc, Data = GetProcBestMachRotationFromList( ResultsList, PartInfo)
|
||||||
elseif ID.IsTailCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) then
|
Proc.nIndexRotation = Data.nIndexRotation
|
||||||
SingleCombination.nIndexTailCutInVProc = nProc
|
-- inserisco la Proc nell'apposita lista
|
||||||
else
|
if Data.nIndexRotation == nUnloadPos then
|
||||||
if #ResultsList > 0 then
|
table.insert( SingleCombination.Rot0, Proc)
|
||||||
local Proc, Data = GetProcBestMachRotationFromList( ResultsList, PartInfo)
|
elseif Data.nIndexRotation == nUnloadPos + 1 then
|
||||||
Proc.nIndexRotation = Data.nIndexRotation
|
table.insert( SingleCombination.Rot90, Proc)
|
||||||
-- inserisco la Proc nell'apposita lista
|
bRot90 = true
|
||||||
if Data.nIndexRotation == nUnloadPos then
|
|
||||||
table.insert( SingleCombination.Rot0, Proc)
|
|
||||||
elseif Data.nIndexRotation == nUnloadPos + 1 then
|
|
||||||
table.insert( SingleCombination.Rot90, Proc)
|
|
||||||
bRot90 = true
|
|
||||||
else
|
|
||||||
table.insert( SingleCombination.Rot180, Proc)
|
|
||||||
bRot180 = true
|
|
||||||
end
|
|
||||||
|
|
||||||
SingleCombination.dTotalTimeToMachine = SingleCombination.dTotalTimeToMachine + Data.dTimeToMachine
|
|
||||||
SingleCombination.dTotalQuality = SingleCombination.dTotalQuality + Data.dQuality
|
|
||||||
SingleCombination.dTotalCompletionIndex = SingleCombination.dTotalCompletionIndex + Data.dCompletionIndex
|
|
||||||
SingleCombination.nComplete = SingleCombination.nComplete + EgtIf( Data.bComplete, 1, 0)
|
|
||||||
SingleCombination.nNotComplete = SingleCombination.nNotComplete + EgtIf( Data.bNotComplete, 1, 0)
|
|
||||||
SingleCombination.nNotExecute = SingleCombination.nNotExecute + EgtIf( Data.bNotApplicable, 1, 0)
|
|
||||||
SingleCombination.nIndexInCombinationList = i
|
|
||||||
SingleCombination.nIndexRotation = nUnloadPos
|
|
||||||
else
|
else
|
||||||
ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc].nIndexRotation = nUnloadPos
|
table.insert( SingleCombination.Rot180, Proc)
|
||||||
ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc].nFlg = 0
|
bRot180 = true
|
||||||
table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc])
|
|
||||||
SingleCombination.nNotExecute = SingleCombination.nNotExecute + 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SingleCombination.dTotalTimeToMachine = SingleCombination.dTotalTimeToMachine + Data.dTimeToMachine
|
||||||
|
SingleCombination.dTotalQuality = SingleCombination.dTotalQuality + Data.dQuality
|
||||||
|
SingleCombination.dTotalCompletionIndex = SingleCombination.dTotalCompletionIndex + Data.dCompletionIndex
|
||||||
|
SingleCombination.nComplete = SingleCombination.nComplete + EgtIf( Data.bComplete, 1, 0)
|
||||||
|
SingleCombination.nNotComplete = SingleCombination.nNotComplete + EgtIf( Data.bNotComplete, 1, 0)
|
||||||
|
SingleCombination.nNotExecute = SingleCombination.nNotExecute + EgtIf( Data.bNotApplicable, 1, 0)
|
||||||
|
SingleCombination.nIndexInCombinationList = i
|
||||||
|
SingleCombination.nIndexRotation = nUnloadPos
|
||||||
|
else
|
||||||
|
ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc].nIndexRotation = nUnloadPos
|
||||||
|
ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc].nFlg = 0
|
||||||
|
table.insert( SingleCombination.Rot0, ProcessingsOnPart.Rotation[nUnloadPos+nOffsetIndex][nProc])
|
||||||
|
SingleCombination.nNotExecute = SingleCombination.nNotExecute + 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if ID.IsHeadCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) then
|
if ID.IsHeadCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) then
|
||||||
@@ -1844,7 +1670,7 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
nPhase = nPhase}
|
nPhase = nPhase}
|
||||||
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
||||||
else
|
else
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, nPart, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||||
end
|
end
|
||||||
-- si sposta il pezzo nella posizione originale, di quando è stata fatta la collect. In questo modo tutti i dati calcolati nella collect restano validi.
|
-- si sposta il pezzo nella posizione originale, di quando è stata fatta la collect. In questo modo tutti i dati calcolati nella collect restano validi.
|
||||||
-- Altrimenti bisognava ricalcolare tutto, aumentando tempo di calcolo.
|
-- Altrimenti bisognava ricalcolare tutto, aumentando tempo di calcolo.
|
||||||
@@ -2002,7 +1828,7 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||||
nCurrPosition = nRotation
|
nCurrPosition = nRotation
|
||||||
EgtSetInfo( idDisp, 'ROT', -2)
|
EgtSetInfo( idDisp, 'ROT', -2)
|
||||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'DOWN')
|
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'DOWN')
|
||||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
end
|
end
|
||||||
@@ -2011,7 +1837,7 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
if MatrixResult.bSomeFeatureSide then
|
if MatrixResult.bSomeFeatureSide then
|
||||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||||
if MatrixResult.bSomeFeatureDown then
|
if MatrixResult.bSomeFeatureDown then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, nPart, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||||
nPhase = EgtGetCurrPhase()
|
nPhase = EgtGetCurrPhase()
|
||||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||||
@@ -2030,14 +1856,14 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||||
nCurrPosition = nRotation
|
nCurrPosition = nRotation
|
||||||
EgtSetInfo( idDisp, 'ROT', -1)
|
EgtSetInfo( idDisp, 'ROT', -1)
|
||||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'SIDE')
|
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'SIDE')
|
||||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||||
if MatrixResult.bSomeFeatureDown or MatrixResult.bSomeFeatureSide then
|
if MatrixResult.bSomeFeatureDown or MatrixResult.bSomeFeatureSide then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, nPart, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||||
nPhase = EgtGetCurrPhase()
|
nPhase = EgtGetCurrPhase()
|
||||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||||
@@ -2056,7 +1882,7 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nInitialPosition - 1)
|
BeamLib.RotateRawPart( PARTS[nPart], nInitialPosition - 1)
|
||||||
|
|
||||||
-- aggiunta lavorazioni in ultima fase
|
-- aggiunta lavorazioni in ultima fase
|
||||||
_, _, _, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'STD')
|
_, _, _, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'STD')
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
|
|
||||||
-- se bisogna riprocessare, si annulla tutto
|
-- se bisogna riprocessare, si annulla tutto
|
||||||
@@ -2096,7 +1922,7 @@ function BeamExec.ProcessMachinings( PARTS, bIsFlipRot)
|
|||||||
-- ===== finiti i pezzi, si scarica il restante =====
|
-- ===== finiti i pezzi, si scarica il restante =====
|
||||||
local idRestPart = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
local idRestPart = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
||||||
if idRestPart and EgtGetRawPartBBox( idRestPart):getDimX() >= BeamData.dMinRaw then
|
if idRestPart and EgtGetRawPartBBox( idRestPart):getDimX() >= BeamData.dMinRaw then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, #PARTS + 1, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
BeamLib.AddPhaseWithRawParts( idRestPart, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||||
local nPhase = EgtGetCurrPhase()
|
local nPhase = EgtGetCurrPhase()
|
||||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'TYPE', 'REST')
|
EgtSetInfo( idDisp, 'TYPE', 'REST')
|
||||||
@@ -2141,8 +1967,8 @@ end
|
|||||||
function BeamExec.ProcessAlternatives( PARTS)
|
function BeamExec.ProcessAlternatives( PARTS)
|
||||||
|
|
||||||
-- inizializzazione variabili globali per interfaccia
|
-- inizializzazione variabili globali per interfaccia
|
||||||
local Alternatives = {}
|
BEAM.ALTERNATIVESNEST2D = ''
|
||||||
local AlternativesNest2D = {}
|
BEAM.ALTERNATIVES = ''
|
||||||
|
|
||||||
-- ciclo sui pezzi
|
-- ciclo sui pezzi
|
||||||
local BestCombination = {}
|
local BestCombination = {}
|
||||||
@@ -2372,7 +2198,7 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||||
nCurrPosition = nRotation
|
nCurrPosition = nRotation
|
||||||
EgtSetInfo( idDisp, 'ROT', -2)
|
EgtSetInfo( idDisp, 'ROT', -2)
|
||||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'DOWN')
|
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'DOWN')
|
||||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
end
|
end
|
||||||
@@ -2381,7 +2207,7 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
if MatrixResult.bSomeFeatureSide then
|
if MatrixResult.bSomeFeatureSide then
|
||||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||||
if MatrixResult.bSomeFeatureDown then
|
if MatrixResult.bSomeFeatureDown then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, nPart, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||||
nPhase = EgtGetCurrPhase()
|
nPhase = EgtGetCurrPhase()
|
||||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||||
@@ -2400,14 +2226,14 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
BeamLib.RotateRawPart( PARTS[nPart], nRotation - nCurrPosition)
|
||||||
nCurrPosition = nRotation
|
nCurrPosition = nRotation
|
||||||
EgtSetInfo( idDisp, 'ROT', -1)
|
EgtSetInfo( idDisp, 'ROT', -1)
|
||||||
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'SIDE')
|
bAreAllMachiningApplyOk, sErr, bSplitExecutedOnRot, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'SIDE')
|
||||||
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
bSplitAlreadyExecuted = bSplitAlreadyExecuted or bSplitExecutedOnRot
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
-- se ci sono state lavorazioni in rotazione precedente devo creare altra fase. Altrimenti già creata da prima
|
||||||
if MatrixResult.bSomeFeatureDown or MatrixResult.bSomeFeatureSide then
|
if MatrixResult.bSomeFeatureDown or MatrixResult.bSomeFeatureSide then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, nPart, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, EgtIf( bSplitAlreadyExecuted, BeamData.RAW_OFFSET, 0))
|
||||||
nPhase = EgtGetCurrPhase()
|
nPhase = EgtGetCurrPhase()
|
||||||
idDisp = EgtGetPhaseDisposition( nPhase)
|
idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'ORD', nOrd)
|
EgtSetInfo( idDisp, 'ORD', nOrd)
|
||||||
@@ -2426,7 +2252,7 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
BeamLib.RotateRawPart( PARTS[nPart], nInitialPosition - 1)
|
BeamLib.RotateRawPart( PARTS[nPart], nInitialPosition - 1)
|
||||||
|
|
||||||
-- aggiunta lavorazioni in ultima fase
|
-- aggiunta lavorazioni in ultima fase
|
||||||
_, _, _, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS, PARTS[nPart], 'STD')
|
_, _, _, bTryToReProcess = MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'STD')
|
||||||
bProcess = bProcess or bTryToReProcess
|
bProcess = bProcess or bTryToReProcess
|
||||||
|
|
||||||
-- se bisogna riprocessare, si annulla tutto
|
-- se bisogna riprocessare, si annulla tutto
|
||||||
@@ -2460,7 +2286,7 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
-- ===== finiti i pezzi, si scarica il restante =====
|
-- ===== finiti i pezzi, si scarica il restante =====
|
||||||
local idRestPart = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
local idRestPart = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
||||||
if idRestPart and EgtGetRawPartBBox( idRestPart):getDimX() >= BeamData.dMinRaw then
|
if idRestPart and EgtGetRawPartBBox( idRestPart):getDimX() >= BeamData.dMinRaw then
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, #PARTS + 1, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
BeamLib.AddPhaseWithRawParts( idRestPart, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||||
local nPhase = EgtGetCurrPhase()
|
local nPhase = EgtGetCurrPhase()
|
||||||
local idDisp = EgtGetPhaseDisposition( nPhase)
|
local idDisp = EgtGetPhaseDisposition( nPhase)
|
||||||
EgtSetInfo( idDisp, 'TYPE', 'REST')
|
EgtSetInfo( idDisp, 'TYPE', 'REST')
|
||||||
@@ -2471,14 +2297,23 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
local bApplOk, _, _ = EgtApplyAllMachinings()
|
local bApplOk, _, _ = EgtApplyAllMachinings()
|
||||||
-- se non ci sono errori, soluzione alternativa valida: scrittura variabili globali per interfaccia
|
-- se non ci sono errori, soluzione alternativa valida: scrittura variabili globali per interfaccia
|
||||||
if bApplOk then
|
if bApplOk then
|
||||||
|
local Alternatives = {}
|
||||||
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
||||||
if TotalCombiToTest[z].bIsNesting2D then
|
if TotalCombiToTest[z].bIsNesting2D then
|
||||||
table.insert( AlternativesNest2D, sBitIndexCombinationWithInvert)
|
if BEAM.ALTERNATIVESNEST2D and BEAM.ALTERNATIVESNEST2D ~= "" then
|
||||||
else
|
table.insert( Alternatives, BEAM.ALTERNATIVESNEST2D)
|
||||||
|
end
|
||||||
table.insert( Alternatives, sBitIndexCombinationWithInvert)
|
table.insert( Alternatives, sBitIndexCombinationWithInvert)
|
||||||
|
BEAM.ALTERNATIVESNEST2D = table.concat( Alternatives, ', ')
|
||||||
|
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
|
||||||
end
|
end
|
||||||
-- se ultima combinazione, si esce e non si riporta in posizione iniziale. Verrà infatti cancellata
|
-- se ultima combinazione, si esce e non si riporta in posizione inizale. Verrà infatti cancellata
|
||||||
if z == #TotalCombiToTest then break end
|
if z == #TotalCombiToTest then break end
|
||||||
|
|
||||||
-- si riporta pezzo in posizione iniziale
|
-- si riporta pezzo in posizione iniziale
|
||||||
@@ -2492,23 +2327,6 @@ function BeamExec.ProcessAlternatives( PARTS)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- passaggio info a interfaccia da scrivere sul pezzo
|
|
||||||
BEAM.INFONGEPART = {}
|
|
||||||
table.insert( BEAM.INFONGEPART, 'INITIALPOSITION=' .. PARTS[nPart].nInitialPosition)
|
|
||||||
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
|
|
||||||
|
|
||||||
-- si cancella eventuale mach group creato per le alternative
|
-- si cancella eventuale mach group creato per le alternative
|
||||||
EgtRemoveMachGroup( nTempMachGroupName)
|
EgtRemoveMachGroup( nTempMachGroupName)
|
||||||
|
|
||||||
|
|||||||
+4
-146
@@ -161,45 +161,17 @@ function BeamLib.GetPartSplittingPoints( Part)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function BeamLib.AddPhaseWithRawParts( PARTS, nPartIndex, OriXR, PosXR, dDeltaSucc)
|
function BeamLib.AddPhaseWithRawParts( idRaw, OriXR, PosXR, dDeltaSucc)
|
||||||
local nPhase = EgtAddPhase()
|
local nPhase = EgtAddPhase()
|
||||||
local Part
|
|
||||||
local idRaw
|
|
||||||
-- se l'indice è oltre significa che è l'ultimo grezzo senza pezzi
|
|
||||||
if nPartIndex > #PARTS then
|
|
||||||
idRaw = EgtGetNextRawPart( PARTS[#PARTS].idRaw)
|
|
||||||
else
|
|
||||||
Part = PARTS[nPartIndex]
|
|
||||||
idRaw = Part.idRaw
|
|
||||||
end
|
|
||||||
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
|
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
|
||||||
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
|
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
|
||||||
local dRawMove = 0
|
local dRawMove = 0
|
||||||
local bIsFirstRaw = true
|
|
||||||
local dPosXFirst = 0
|
|
||||||
while idRaw do
|
while idRaw do
|
||||||
local dPosX
|
|
||||||
for i = 1, #PARTS do
|
|
||||||
local CurrentPart = PARTS[i]
|
|
||||||
if CurrentPart.idRaw == idRaw then
|
|
||||||
dPosX = CurrentPart.dPosX
|
|
||||||
if bIsFirstRaw then
|
|
||||||
dPosXFirst = dPosX
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if i == #PARTS then
|
|
||||||
dPosX = PARTS[i].dPosX + PARTS[i].b3Raw:getDimX()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if bIsFirstRaw then
|
|
||||||
bIsFirstRaw = false
|
|
||||||
else
|
|
||||||
dRawMove = dDeltaSucc + dPosX - dPosXFirst
|
|
||||||
end
|
|
||||||
EgtKeepRawPart( idRaw)
|
EgtKeepRawPart( idRaw)
|
||||||
EgtMoveToCornerRawPart( idRaw, OriXR, PosXR)
|
EgtMoveToCornerRawPart( idRaw, OriXR, PosXR)
|
||||||
EgtMoveRawPart( idRaw, Vector3d( - dRawMove, 0, 0))
|
EgtMoveRawPart( idRaw, Vector3d( - dRawMove, 0, 0))
|
||||||
|
if dRawMove == 0 then dRawMove = dRawMove + dDeltaSucc end
|
||||||
|
dRawMove = dRawMove + EgtGetRawPartBBox( idRaw):getDimX()
|
||||||
idRaw = EgtGetNextRawPart( idRaw)
|
idRaw = EgtGetNextRawPart( idRaw)
|
||||||
end
|
end
|
||||||
-- salvo info nuova fase aggiunta
|
-- salvo info nuova fase aggiunta
|
||||||
@@ -423,24 +395,6 @@ function BeamLib.GetAddGroup( PartId)
|
|||||||
return AddGrpId, sMchGrp
|
return AddGrpId, sMchGrp
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Funzione prossimo nome MachGroup libero (numero intero)
|
|
||||||
function BeamLib.GetNewMachGroupName()
|
|
||||||
local idMachGroup = EgtGetFirstMachGroup()
|
|
||||||
if not idMachGroup then return 1 end
|
|
||||||
local nMaxMachGroup = 0
|
|
||||||
while idMachGroup do
|
|
||||||
local sMachGroupName = EgtGetMachGroupName( idMachGroup)
|
|
||||||
local nMachGroupName = tonumber( sMachGroupName)
|
|
||||||
if nMachGroupName > nMaxMachGroup then
|
|
||||||
nMaxMachGroup = nMachGroupName
|
|
||||||
end
|
|
||||||
idMachGroup = EgtGetNextMachGroup( idMachGroup)
|
|
||||||
end
|
|
||||||
|
|
||||||
return nMaxMachGroup + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- restituisce le facce della parte interessate dalla feature Proc
|
-- restituisce le facce della parte interessate dalla feature Proc
|
||||||
-- TODO da spostare in FeatureLib???
|
-- TODO da spostare in FeatureLib???
|
||||||
@@ -558,69 +512,10 @@ function BeamLib.GetDirectionFromSCC( nSCC)
|
|||||||
elseif nSCC == MCH_SCC.ADIR_ZM then
|
elseif nSCC == MCH_SCC.ADIR_ZM then
|
||||||
vtSCC = -Z_AX()
|
vtSCC = -Z_AX()
|
||||||
end
|
end
|
||||||
|
|
||||||
return vtSCC
|
return vtSCC
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Restituisce una tabella con i punti ai vertici della faccia, in globale
|
|
||||||
-- ordinati partendo da quello ai valori minimi degli assi e i successivi secondo rotazione destrorsa X+;
|
|
||||||
-- solo per Proc a 1 faccia
|
|
||||||
function BeamLib.GetSortedVertices( Proc)
|
|
||||||
local PtVerticesSorted = {}
|
|
||||||
|
|
||||||
-- se più di una faccia si esce subito
|
|
||||||
if Proc.nFct > 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local PtVertices = {}
|
|
||||||
local nFirstIndex
|
|
||||||
local dMinYZ = GEO.INFINITO
|
|
||||||
for i = 1, #Proc.Faces[1].Edges do
|
|
||||||
local Edge = Proc.Faces[1].Edges[i]
|
|
||||||
table.insert( PtVertices, Edge.ptStart)
|
|
||||||
if ( Edge.ptStart:getY() + Edge.ptStart:getZ() < dMinYZ) then
|
|
||||||
nFirstIndex = i
|
|
||||||
dMinYZ = Edge.ptStart:getY() + Edge.ptStart:getZ()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert( PtVerticesSorted, PtVertices[nFirstIndex])
|
|
||||||
local nCurrentIndex = nFirstIndex
|
|
||||||
-- faccia che guarda verso X+, ordine ok
|
|
||||||
if Proc.Faces[1].vtN:getX() > GEO.EPS_SMALL then
|
|
||||||
for _ = 1, #PtVertices - 1 do
|
|
||||||
_, nCurrentIndex = BeamLib.GetAdjacentIndices( nCurrentIndex, #PtVertices)
|
|
||||||
table.insert( PtVerticesSorted, PtVertices[nCurrentIndex])
|
|
||||||
end
|
|
||||||
-- faccia che guarda verso X-, ordine da invertire
|
|
||||||
else
|
|
||||||
for _ = 1, #PtVertices - 1 do
|
|
||||||
nCurrentIndex = BeamLib.GetAdjacentIndices( nCurrentIndex, #PtVertices)
|
|
||||||
table.insert( PtVerticesSorted, PtVertices[nCurrentIndex])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return PtVerticesSorted
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
|
||||||
-- restituisce il precedente e prossimo indice 1-based, tenendo conto del massimo indice
|
|
||||||
function BeamLib.GetAdjacentIndices( nCurrentIndex, nMaxIndex)
|
|
||||||
local nPreviousIndex, nNextIndex
|
|
||||||
|
|
||||||
if ( nCurrentIndex < 1) or ( nCurrentIndex > nMaxIndex) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- circular indexing 1-based
|
|
||||||
nPreviousIndex = ((nCurrentIndex - 2 + nMaxIndex) % nMaxIndex) + 1
|
|
||||||
nNextIndex = (nCurrentIndex % nMaxIndex) + 1
|
|
||||||
|
|
||||||
return nPreviousIndex, nNextIndex
|
|
||||||
end
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
|
||||||
function BeamLib.Is3EdgesApprox( Proc, idFace, nAddGrpId)
|
function BeamLib.Is3EdgesApprox( Proc, idFace, nAddGrpId)
|
||||||
@@ -936,43 +831,6 @@ function BeamLib.CalculateStringBinaryFormat( dNumber, CharNumber)
|
|||||||
return NumberString
|
return NumberString
|
||||||
end
|
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)
|
|
||||||
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
|
--- 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
|
--- ATTENZIONE: in caso di modifiche vanno gestiti anche i tipi custom; sarebbe meglio metterla nel LuaLibs
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ end
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra
|
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra
|
||||||
function FeatureLib.IsFeatureCuttingEntireSection( b3Proc, Part)
|
local function IsFeatureCuttingEntireSection( b3Proc, Part)
|
||||||
return ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL))
|
return ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ function FeatureLib.ClassifyTopology( Proc, Part)
|
|||||||
|
|
||||||
if not Proc.AffectedFaces then Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part) end
|
if not Proc.AffectedFaces then Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part) end
|
||||||
|
|
||||||
local bIsFeatureCuttingEntireSection = FeatureLib.IsFeatureCuttingEntireSection( Proc.b3Box, Part)
|
local bIsFeatureCuttingEntireSection = IsFeatureCuttingEntireSection( Proc.b3Box, Part)
|
||||||
local bIsFeatureCuttingEntireLength = IsFeatureCuttingEntireLength( Proc.b3Box, Part)
|
local bIsFeatureCuttingEntireLength = IsFeatureCuttingEntireLength( Proc.b3Box, Part)
|
||||||
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc, Part)
|
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc, Part)
|
||||||
local vAdj = Proc.AdjacencyMatrix
|
local vAdj = Proc.AdjacencyMatrix
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
-- lavorazione in collisione con il pezzo: non fattibile
|
-- lavorazione in collisione con il pezzo: non fattibile
|
||||||
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
local bCollisionFound, bMoveAfterSplit = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||||
if bCollisionFound then
|
if bCollisionFound then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -373,7 +373,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
|||||||
CheckCollisionOptionalParameters.PointsToCheck = {}
|
CheckCollisionOptionalParameters.PointsToCheck = {}
|
||||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadIn.ptPoint)
|
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadIn.ptPoint)
|
||||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadOut.ptPoint)
|
table.insert( CheckCollisionOptionalParameters.PointsToCheck, PerpendicularLeadInOut.LeadOut.ptPoint)
|
||||||
local bCollisionFoundPerpendicular, bMoveAfterSplitPerpendicular = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
local bCollisionFoundPerpendicular, bMoveAfterSplitPerpendicular = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||||
-- attacco perpendicolare possibile
|
-- attacco perpendicolare possibile
|
||||||
if not bCollisionFoundPerpendicular then
|
if not bCollisionFoundPerpendicular then
|
||||||
LeadInOut.Perpendicular = PerpendicularLeadInOut
|
LeadInOut.Perpendicular = PerpendicularLeadInOut
|
||||||
@@ -403,7 +403,7 @@ local function TestEngagement( sBladeEngagement, Parameters, OptionalParameters)
|
|||||||
CheckCollisionOptionalParameters.PointsToCheck = {}
|
CheckCollisionOptionalParameters.PointsToCheck = {}
|
||||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadIn.ptPoint)
|
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadIn.ptPoint)
|
||||||
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadOut.ptPoint)
|
table.insert( CheckCollisionOptionalParameters.PointsToCheck, TangentLeadInOut.LeadOut.ptPoint)
|
||||||
local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( sBladeEngagement, CheckCollisionParameters, CheckCollisionOptionalParameters)
|
local bCollisionFoundTangent, bMoveAfterSplitTangent = PreSimulationLib.CheckCollision( CheckCollisionParameters, CheckCollisionOptionalParameters)
|
||||||
-- attacco tangenziale possibile
|
-- attacco tangenziale possibile
|
||||||
if not bCollisionFoundTangent then
|
if not bCollisionFoundTangent then
|
||||||
LeadInOut.Tangent = TangentLeadInOut
|
LeadInOut.Tangent = TangentLeadInOut
|
||||||
@@ -607,6 +607,9 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
|||||||
local ToolInfo = {}
|
local ToolInfo = {}
|
||||||
|
|
||||||
-- parametri obbligatori
|
-- parametri obbligatori
|
||||||
|
if type( ToolSearchParameters.FaceToMachine) ~= 'table' then
|
||||||
|
error( 'FindBlade : missing face info')
|
||||||
|
end
|
||||||
if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then
|
if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then
|
||||||
error( 'FindBlade : missing top head info')
|
error( 'FindBlade : missing top head info')
|
||||||
end
|
end
|
||||||
@@ -625,7 +628,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
|||||||
local bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false
|
local bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false
|
||||||
local EdgeToMachine = ToolSearchParameters.EdgeToMachine
|
local EdgeToMachine = ToolSearchParameters.EdgeToMachine
|
||||||
local Part = ToolSearchParameters.Part
|
local Part = ToolSearchParameters.Part
|
||||||
local bIsDicing = ToolSearchParameters.bIsDicing or false
|
local idCheckCollisionTm = ToolSearchParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = ToolSearchParameters.sRestLengthSideForPreSimulation or 'Tail'
|
local sRestLengthSideForPreSimulation = ToolSearchParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
local bCannotSplitRestLength = ToolSearchParameters.bCannotSplitRestLength or false
|
local bCannotSplitRestLength = ToolSearchParameters.bCannotSplitRestLength or false
|
||||||
local bDisableRealElevationCheck = ToolSearchParameters.bDisableRealElevationCheck or false
|
local bDisableRealElevationCheck = ToolSearchParameters.bDisableRealElevationCheck or false
|
||||||
@@ -660,7 +663,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
|||||||
dDepthToMachine = min( dElevation, TOOLS[i].dMaxDepth)
|
dDepthToMachine = min( dElevation, TOOLS[i].dMaxDepth)
|
||||||
}
|
}
|
||||||
local BladeEngagementOptionalParameters = {
|
local BladeEngagementOptionalParameters = {
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||||
@@ -672,6 +675,12 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
|||||||
if not bIsBladeOk then
|
if not bIsBladeOk then
|
||||||
bIsToolCompatible = false
|
bIsToolCompatible = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- se si ha solo la faccia si può verificare se questa è orientata correttamente
|
||||||
|
elseif FaceToMachine then
|
||||||
|
if MachiningLib.IsFaceZOutOfRange( FaceToMachine.vtN, TOOLS[i]) then
|
||||||
|
bIsToolCompatible = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1175,7 +1184,7 @@ end
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
-- funzione per aggiungere una nuova lavorazione
|
-- funzione per aggiungere una nuova lavorazione
|
||||||
function MachiningLib.AddOperations( MACHININGS, PARTS, Part, sRotation)
|
function MachiningLib.AddOperations( MACHININGS, Part, sRotation)
|
||||||
local nErr
|
local nErr
|
||||||
local sErr = ''
|
local sErr = ''
|
||||||
local bAreAllMachiningApplyOk = true
|
local bAreAllMachiningApplyOk = true
|
||||||
@@ -1443,7 +1452,7 @@ function MachiningLib.AddOperations( MACHININGS, PARTS, Part, sRotation)
|
|||||||
bSplitExecuted = true
|
bSplitExecuted = true
|
||||||
MACHININGS.Info.bSplitExecuted = true
|
MACHININGS.Info.bSplitExecuted = true
|
||||||
|
|
||||||
BeamLib.AddPhaseWithRawParts( PARTS, Part.nIndexInParts, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
|
BeamLib.AddPhaseWithRawParts( Part.idRaw, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
|
||||||
-- se grezzo successivo senza pezzi e finale, va tolto
|
-- se grezzo successivo senza pezzi e finale, va tolto
|
||||||
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
|
local nNextRawId = EgtGetNextRawPart( Part.idRaw)
|
||||||
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BeamData.dMinRaw then
|
if nNextRawId and EgtGetPartInRawPartCount( nNextRawId) == 0 and EgtGetRawPartBBox( nNextRawId):getDimX() < BeamData.dMinRaw then
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ local function MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
|
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm)
|
||||||
|
|
||||||
-- spostamento assi macchina in posizione
|
-- spostamento assi macchina in posizione
|
||||||
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
|
||||||
@@ -337,32 +337,32 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
|
|||||||
|
|
||||||
-- check collisione con pezzo
|
-- check collisione con pezzo
|
||||||
local bCollisionFoundPiece = false
|
local bCollisionFoundPiece = false
|
||||||
if not bCheckOnlyRestlength then
|
if not idCheckCollisionTm then
|
||||||
local idCheckCollisionTm = Part.idBoxTm
|
idCheckCollisionTm = Part.idBoxTm
|
||||||
-- se testa o coda attaccate, si considerano nella superficie di collisione
|
-- se testa o coda attaccate, si considerano nella superficie di collisione
|
||||||
if bCannotSplitRestLength then
|
if bCannotSplitRestLength then
|
||||||
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||||
idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||||
end
|
end
|
||||||
for i = 1, #CollisionSurfTmId do
|
end
|
||||||
bCollisionFoundPiece = EgtCDeSolidSolid( idCheckCollisionTm, CollisionSurfTmId[i], BeamData.COLL_SIC)
|
for i = 1, #CollisionSurfTmId do
|
||||||
if not type( bCollisionFoundPiece) == "boolean" then
|
bCollisionFoundPiece = EgtCDeSolidSolid( idCheckCollisionTm, CollisionSurfTmId[i], BeamData.COLL_SIC)
|
||||||
error( 'Presimulation fail')
|
if not type( bCollisionFoundPiece) == "boolean" then
|
||||||
end
|
error( 'Presimulation fail')
|
||||||
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
|
|
||||||
EgtSetColor( CollisionSurfTmId[i], RED())
|
|
||||||
end
|
|
||||||
if bCollisionFoundPiece then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
|
||||||
|
EgtSetColor( CollisionSurfTmId[i], RED())
|
||||||
|
end
|
||||||
|
if bCollisionFoundPiece then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- se trovata collisione con pezzo è inutile procedere con il grezzo
|
-- se trovata collisione con pezzo è inutile procedere con il grezzo
|
||||||
if bCollisionFoundPiece then
|
if bCollisionFoundPiece then
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- check collisione con grezzo restante, se con il pezzo non c'è collisione e non è un taglio di testa o coda
|
-- check collisione con grezzo restante, se con il pezzo non c'è collisione e non è un taglio di testa o coda
|
||||||
local bCollisionFoundRestLength = false
|
local bCollisionFoundRestLength = false
|
||||||
@@ -401,7 +401,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
|||||||
|
|
||||||
-- parametri opzionali
|
-- parametri opzionali
|
||||||
OptionalParameters = OptionalParameters or {}
|
OptionalParameters = OptionalParameters or {}
|
||||||
local bCheckOnlyRestlength = OptionalParameters.bCheckOnlyRestlength or false
|
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||||
local vtAux = OptionalParameters.vtAux
|
local vtAux = OptionalParameters.vtAux
|
||||||
@@ -426,7 +426,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
|||||||
-- se non si trova collisione si ritorna se è necessario separare prima di effettuare la lavorazione (ossia non c'è collisione con il pezzo ma c'è con il grezzo restante)
|
-- se non si trova collisione si ritorna se è necessario separare prima di effettuare la lavorazione (ossia non c'è collisione con il pezzo ma c'è con il grezzo restante)
|
||||||
for i = 1, #PointsOnToolTipCenter do
|
for i = 1, #PointsOnToolTipCenter do
|
||||||
|
|
||||||
local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( sAxis, PointsOnToolTipCenter[i], vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, bCheckOnlyRestlength)
|
local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( sAxis, PointsOnToolTipCenter[i], vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm)
|
||||||
|
|
||||||
-- se trovata collisione con pezzo è inutile controllare gli altri punti
|
-- se trovata collisione con pezzo è inutile controllare gli altri punti
|
||||||
if bCollisionFoundPiece then
|
if bCollisionFoundPiece then
|
||||||
@@ -445,7 +445,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, OptionalParameters)
|
function PreSimulationLib.CheckCollision( Parameters, OptionalParameters)
|
||||||
|
|
||||||
local bCollisionFound
|
local bCollisionFound
|
||||||
local bMoveAfterSplitL3, bMoveAfterSplitR3, bMoveAfterSplitR2, bMoveAfterSplitR1
|
local bMoveAfterSplitL3, bMoveAfterSplitR3, bMoveAfterSplitR2, bMoveAfterSplitR1
|
||||||
@@ -459,24 +459,19 @@ function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, Optional
|
|||||||
OptionalParameters = OptionalParameters or {}
|
OptionalParameters = OptionalParameters or {}
|
||||||
|
|
||||||
local OptionalParametersCheckCollisionWithAxis = {}
|
local OptionalParametersCheckCollisionWithAxis = {}
|
||||||
OptionalParametersCheckCollisionWithAxis.bCheckOnlyRestlength = false
|
|
||||||
OptionalParametersCheckCollisionWithAxis.PointsToCheck = OptionalParameters.PointsToCheck or nil
|
OptionalParametersCheckCollisionWithAxis.PointsToCheck = OptionalParameters.PointsToCheck or nil
|
||||||
OptionalParametersCheckCollisionWithAxis.sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
OptionalParametersCheckCollisionWithAxis.sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
OptionalParametersCheckCollisionWithAxis.bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
OptionalParametersCheckCollisionWithAxis.bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||||
OptionalParametersCheckCollisionWithAxis.sBlockedAxis = OptionalParameters.sBlockedAxis
|
OptionalParametersCheckCollisionWithAxis.sBlockedAxis = OptionalParameters.sBlockedAxis
|
||||||
OptionalParametersCheckCollisionWithAxis.vtAux = OptionalParameters.vtAux
|
OptionalParametersCheckCollisionWithAxis.vtAux = OptionalParameters.vtAux
|
||||||
|
OptionalParametersCheckCollisionWithAxis.idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
|
|
||||||
local sBlockedAxis = OptionalParameters.sBlockedAxis
|
local sBlockedAxis = OptionalParameters.sBlockedAxis
|
||||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
|
||||||
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
||||||
local bCheckOnlyRestlengthForAxisABC = false
|
|
||||||
|
|
||||||
-- se cubetti in modalità standard (no DownUp) gli assi AB e C si controllano solo con grezzo (ci sarebbe collisione con il materiale già rimosso controllando AB e C con pezzo)
|
|
||||||
if bIsDicing and ( sBladeEngagement == 'Standard') then
|
|
||||||
bCheckOnlyRestlengthForAxisABC = true
|
|
||||||
-- se l'elevazione reale (rispetto al pezzo + eventuale materiale in testa/coda) è maggiore del massimo materiale è sempre collisione
|
-- se l'elevazione reale (rispetto al pezzo + eventuale materiale in testa/coda) è maggiore del massimo materiale è sempre collisione
|
||||||
-- TODO rifare con funzione
|
-- TODO rifare con funzione
|
||||||
elseif not bDisableRealElevationCheck then
|
if not bDisableRealElevationCheck then
|
||||||
local Edge = Parameters.Edge
|
local Edge = Parameters.Edge
|
||||||
local vtNFace = Parameters.vtNFace
|
local vtNFace = Parameters.vtNFace
|
||||||
local dDepthToMachine = Parameters.dDepthToMachine
|
local dDepthToMachine = Parameters.dDepthToMachine
|
||||||
@@ -523,9 +518,6 @@ function PreSimulationLib.CheckCollision( sBladeEngagement, Parameters, Optional
|
|||||||
-- ultimo asse lineare prima dei rotativi (solitamente Z) si controlla sempre
|
-- ultimo asse lineare prima dei rotativi (solitamente Z) si controlla sempre
|
||||||
bCollisionFound, bMoveAfterSplitL3 = CheckCollisionWithAxis( sL3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
bCollisionFound, bMoveAfterSplitL3 = CheckCollisionWithAxis( sL3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||||
|
|
||||||
-- assi rotativi: se richiesto si controlla la collisione solo col grezzo
|
|
||||||
OptionalParametersCheckCollisionWithAxis.bCheckOnlyRestlength = bCheckOnlyRestlengthForAxisABC
|
|
||||||
|
|
||||||
if sR3 and not bCollisionFound then
|
if sR3 and not bCollisionFound then
|
||||||
bCollisionFound, bMoveAfterSplitR3 = CheckCollisionWithAxis( sR3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
bCollisionFound, bMoveAfterSplitR3 = CheckCollisionWithAxis( sR3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||||
end
|
end
|
||||||
|
|||||||
+404
-623
File diff suppressed because it is too large
Load Diff
@@ -1,477 +0,0 @@
|
|||||||
-- BeamNestProcess.lua by Egaltech s.r.l. 2023/01/15
|
|
||||||
-- Gestione nesting automatico travi
|
|
||||||
-- 2022/10/05 Piccole modifiche per far funzionare correttamente i compilati.
|
|
||||||
-- 2022/10/06 Corretto bug che moltiplicava i pezzi se erano presenti più grezzi della stessa sezione.
|
|
||||||
-- 2023/01/15 Piccole correzioni.
|
|
||||||
|
|
||||||
-- Intestazioni
|
|
||||||
require( 'EgtBase')
|
|
||||||
_ENV = EgtProtectGlobal()
|
|
||||||
EgtEnableDebug( false)
|
|
||||||
|
|
||||||
-- Per test
|
|
||||||
--NEST = {}
|
|
||||||
--NEST.FILE = 'c:\\TechnoEssetre7\\EgtData\\Prods\\0010\\Bar_10_1.btl'
|
|
||||||
--NEST.MACHINE = 'Essetre-90480019_MW'
|
|
||||||
--NEST.FLAG = 3
|
|
||||||
|
|
||||||
local sLog = ' +++ BeamNestProcess : ' .. NEST.FILE .. ', ' .. NEST.MACHINE .. ', ' .. LEN[1]
|
|
||||||
EgtOutLog( sLog)
|
|
||||||
|
|
||||||
-- flag per abilitare statistiche in log
|
|
||||||
local bLogStat = false
|
|
||||||
|
|
||||||
-- Cancello file di log specifico
|
|
||||||
local sLogFile = EgtChangePathExtension( NEST.FILE, '.txt')
|
|
||||||
EgtEraseFile( sLogFile)
|
|
||||||
|
|
||||||
-- Funzioni per scrittura su file di log specifico
|
|
||||||
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
|
|
||||||
local hFile = io.open( sLogFile, 'a')
|
|
||||||
hFile:write( 'ERR=' .. tostring( nErr) .. '\n')
|
|
||||||
hFile:write( sMsg .. '\n')
|
|
||||||
hFile:write( 'ROT=' .. tostring( nRot or 0) .. '\n')
|
|
||||||
hFile:write( 'CUTID=' .. tostring( nCutId or 0) .. '\n')
|
|
||||||
hFile:write( 'TASKID=' .. tostring( nTaskId or 0) .. '\n')
|
|
||||||
hFile:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
local function WriteTimeToLogFile( dTime)
|
|
||||||
local hFile = io.open( sLogFile, 'a')
|
|
||||||
hFile:write( 'TIME=' .. EgtNumToString( dTime) .. '\n')
|
|
||||||
hFile:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Funzione per gestire visualizzazione dopo errore
|
|
||||||
local function PostErrView( nErr, sMsg)
|
|
||||||
if nErr ~= 0 and ( NEST.FLAG == 1 or NEST.FLAG == 2 or NEST.FLAG == 5) then
|
|
||||||
EgtSetView( SCE_VD.ISO_SW, false)
|
|
||||||
EgtZoom( SCE_ZM.ALL)
|
|
||||||
EgtOutBox( sMsg, 'BatchProcess (err=' .. tostring( nErr) .. ')', 'ERRORS')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Funzione per gestire visualizzazione dopo warning
|
|
||||||
local function PostWarnView( nWarn, sMsg)
|
|
||||||
if nWarn ~= 0 and ( NEST.FLAG == 1 or NEST.FLAG == 2 or NEST.FLAG == 5) then
|
|
||||||
EgtSetView( SCE_VD.ISO_SW, false)
|
|
||||||
EgtZoom( SCE_ZM.ALL)
|
|
||||||
EgtOutBox( sMsg, 'BatchProcess (wrn=' .. tostring( nWarn) .. ')', 'WARNINGS')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Funzione per aggiornare dati ausiliari
|
|
||||||
local function UpdateAuxData( sAuxFile)
|
|
||||||
local bModif = false
|
|
||||||
-- Se definito LOAD90, aggiorno
|
|
||||||
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
|
|
||||||
if sLoad90 ~= '' then
|
|
||||||
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
|
|
||||||
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
|
|
||||||
bModif = true
|
|
||||||
end
|
|
||||||
return bModif
|
|
||||||
end
|
|
||||||
|
|
||||||
local function PartsToFill( Parts)
|
|
||||||
local nToFill = 0
|
|
||||||
for i = 1, #Parts do
|
|
||||||
if Parts[i].Cnt > 0 then
|
|
||||||
nToFill = nToFill + Parts[i].Cnt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nToFill
|
|
||||||
end
|
|
||||||
|
|
||||||
local function ExecMaximumFilling( Raw, Parts)
|
|
||||||
-- Inizializzo maximum filler
|
|
||||||
EgtMaxFillerStart()
|
|
||||||
-- Inserisco i pezzi
|
|
||||||
for i = 1, #Parts do
|
|
||||||
EgtMaxFillerAddPart( i, Parts[i].Len, Parts[i].DispLen or Parts[i].Len, Parts[i].Cnt or 1)
|
|
||||||
end
|
|
||||||
-- Eseguo l'ottimizzazione
|
|
||||||
EgtMaxFillerCompute( Raw.LenToFill, Raw.StartGap, Raw.MidGap, Raw.EndGap, Raw.SortType)
|
|
||||||
-- Recupero i risultati
|
|
||||||
local nFilledParts, nDiffParts, dTotFillRatio = EgtMaxFillerGetResults()
|
|
||||||
local OneRes = {}
|
|
||||||
for i = 0, nDiffParts - 1 do
|
|
||||||
local nPartId, nCount = EgtMaxFillerGetOneResult( i)
|
|
||||||
table.insert( OneRes, { Id=nPartId, Count=nCount})
|
|
||||||
end
|
|
||||||
--return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Time=dTime, Data=OneRes}
|
|
||||||
return { FilledParts=nFilledParts, DiffParts=nDiffParts, FillRatio=dTotFillRatio, Data=OneRes}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Funzione per trovare nome MachGroup
|
|
||||||
local function NewMachGroupName()
|
|
||||||
local nMachGroupId = EgtGetFirstMachGroup()
|
|
||||||
if not nMachGroupId then return 1 end
|
|
||||||
local nMaxMachGroup = 0
|
|
||||||
while nMachGroupId do
|
|
||||||
sMachGroupName = EgtGetMachGroupName(nMachGroupId)
|
|
||||||
local nMachGroupName = tonumber(sMachGroupName)
|
|
||||||
if nMachGroupName > nMaxMachGroup then
|
|
||||||
nMaxMachGroup = nMachGroupName
|
|
||||||
end
|
|
||||||
nMachGroupId = EgtGetNextMachGroup(nMachGroupId)
|
|
||||||
end
|
|
||||||
return nMaxMachGroup + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local function TotRawCount(Raws)
|
|
||||||
local nTotRaws = 0
|
|
||||||
for RawIndex = 1, #Raws do
|
|
||||||
nTotRaws = nTotRaws + Raws[RawIndex].Count
|
|
||||||
end
|
|
||||||
return nTotRaws
|
|
||||||
end
|
|
||||||
|
|
||||||
local function TotPartLen(Parts)
|
|
||||||
local nTotPartLen = 0
|
|
||||||
for PartIndex = 1, #Parts do
|
|
||||||
nTotPartLen = nTotPartLen + ( Parts[PartIndex].Len * Parts[PartIndex].Cnt)
|
|
||||||
end
|
|
||||||
return nTotPartLen
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Imposto direttorio libreria specializzata per Travi
|
|
||||||
EgtAddToPackagePath( NEST.BASEDIR .. '\\LuaLibs\\?.lua')
|
|
||||||
|
|
||||||
-- Imposto la macchina corrente e verifico sia abilitata per la lavorazione delle Travi
|
|
||||||
EgtSetCurrMachine( NEST.MACHINE)
|
|
||||||
local sMachDir = EgtGetCurrMachineDir()
|
|
||||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
|
|
||||||
NEST.ERR = 12
|
|
||||||
NEST.MSG = 'Error not configured for beam machine : ' .. sMachine
|
|
||||||
WriteErrToLogFile( NEST.ERR, NEST.MSG)
|
|
||||||
PostErrView( NEST.ERR, NEST.MSG)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
|
|
||||||
EgtRemoveBaseMachineDirFromPackagePath()
|
|
||||||
EgtAddToPackagePath( sMachDir .. '\\Beam\\?.lua')
|
|
||||||
|
|
||||||
-- Inizializzo contatori errori e avvisi
|
|
||||||
local nErrCnt = 0
|
|
||||||
local nWarnCnt = 0
|
|
||||||
|
|
||||||
-- Grezzi
|
|
||||||
local Raws = {}
|
|
||||||
-- creo tabella dei grezzi
|
|
||||||
for nIndex, nLen in pairs( LEN) do
|
|
||||||
Raws[tonumber(nIndex)] = {LenToFill = nLen, StartGap = NEST.STARTOFFSET, MidGap = NEST.OFFSET, EndGap = 0, SortType = -1}
|
|
||||||
end
|
|
||||||
for nIndex, nQty in pairs( QTY) do
|
|
||||||
Raws[tonumber(nIndex)].Count = nQty
|
|
||||||
end
|
|
||||||
-- cerco il grezzo con la lunghezza maggiore, epurata dello start gap
|
|
||||||
local maxRawLenToFillNoStartGap = 0
|
|
||||||
for RawIndex = 1, #Raws do
|
|
||||||
if Raws[RawIndex].Count > 0 then
|
|
||||||
maxRawLenToFillNoStartGap = max( maxRawLenToFillNoStartGap, Raws[RawIndex].LenToFill - Raws[RawIndex].StartGap)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Pezzi
|
|
||||||
local Parts = {}
|
|
||||||
-- ciclo su pezzi per aggiungerli al nesting
|
|
||||||
local dTotLen = 0
|
|
||||||
for nPartId, nCount in pairs( PART) do
|
|
||||||
-- recupero lunghezza pezzo
|
|
||||||
local Len = EgtGetInfo( nPartId, "L", 'd')
|
|
||||||
local DispLen = EgtIf( Len <= 1000, 2000, 0) --EgtIf( Len <= 2000, max( 2000, 6000 - Len), 0)
|
|
||||||
-- aggiungo il pezzo solo se ci sta nel grezzo più lungo a disposizione
|
|
||||||
if Len < maxRawLenToFillNoStartGap then
|
|
||||||
for nCntIndex = 1 , nCount do
|
|
||||||
table.insert( Parts, {Id = nPartId, Len = Len, DispLen = DispLen, Cnt = 1})
|
|
||||||
dTotLen = dTotLen + Len
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- lunghezza totale pezzi
|
|
||||||
local dTotPartLen = TotPartLen( Parts)
|
|
||||||
-- calcolo media delle barre necessarie
|
|
||||||
local NeededRawsForType = {}
|
|
||||||
for RawIndex = 1, #Raws do
|
|
||||||
NeededRawsForType[RawIndex] = min( ceil( dTotPartLen / Raws[RawIndex].LenToFill), Raws[RawIndex].Count)
|
|
||||||
end
|
|
||||||
local RawQtySum = 0
|
|
||||||
for NeededRawIndex = 1, #NeededRawsForType do
|
|
||||||
RawQtySum = RawQtySum + NeededRawsForType[NeededRawIndex]
|
|
||||||
end
|
|
||||||
local MediumRawQty = ceil( RawQtySum / #NeededRawsForType)
|
|
||||||
if MediumRawQty > 1 then
|
|
||||||
MediumRawQty = MediumRawQty - 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- lista dei risultati
|
|
||||||
local ResultList = {}
|
|
||||||
local BestResult = nil
|
|
||||||
local BestResultIndex = nil
|
|
||||||
-- riordino lista pezzi per lunghezza
|
|
||||||
table.sort( Parts, function( B1, B2) return B1.Len < B2.Len end)
|
|
||||||
|
|
||||||
local function NestSolutionByIndex( Index)
|
|
||||||
|
|
||||||
-- creo copia lista raw
|
|
||||||
local TempRaws = {}
|
|
||||||
for TempRawIndex = 1, #Raws do
|
|
||||||
table.insert(TempRaws, {LenToFill = Raws[TempRawIndex].LenToFill, StartGap = Raws[TempRawIndex].StartGap, MidGap = Raws[TempRawIndex].MidGap, EndGap = Raws[TempRawIndex].EndGap, SortType = Raws[TempRawIndex].SortType, Count = Raws[TempRawIndex].Count})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- recupero pezzi corti
|
|
||||||
local ShortList = {}
|
|
||||||
local LongList = {}
|
|
||||||
|
|
||||||
for PartIndex = 1, #Parts do
|
|
||||||
if PartIndex <= Index then
|
|
||||||
table.insert( ShortList, Parts[PartIndex])
|
|
||||||
else
|
|
||||||
table.insert( LongList, Parts[PartIndex])
|
|
||||||
end
|
|
||||||
Parts[PartIndex].Cnt = 1
|
|
||||||
end
|
|
||||||
-- numero di pezzi piccoli per barra
|
|
||||||
local ShortCount = Index
|
|
||||||
local ShortForRaw = floor( ShortCount / MediumRawQty)
|
|
||||||
local ExtraShortForRaw = 0
|
|
||||||
if MediumRawQty > 0 then
|
|
||||||
ExtraShortForRaw = fmod( ShortCount, MediumRawQty)
|
|
||||||
end
|
|
||||||
-- creo lista pezzi corti singoli
|
|
||||||
local SingleShortList = {}
|
|
||||||
for ShortIndex = 1, #ShortList do
|
|
||||||
for ShortCount = 1, ShortList[ShortIndex].Cnt do
|
|
||||||
table.insert( SingleShortList, {Id = ShortList[ShortIndex].Id, Len = ShortList[ShortIndex].Len, DispLen = ShortList[ShortIndex].DispLen, Cnt = 1})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- li divido per le barre previste
|
|
||||||
local RawsShortList = {}
|
|
||||||
local RawIndex = 0
|
|
||||||
local ShortRawIndex = 0
|
|
||||||
for ShortIndex = 1, #SingleShortList do
|
|
||||||
if ShortRawIndex > 0 then
|
|
||||||
table.insert( RawsShortList[RawIndex], SingleShortList[ShortIndex])
|
|
||||||
ShortRawIndex = ShortRawIndex - 1
|
|
||||||
else
|
|
||||||
table.insert( RawsShortList, {SingleShortList[ShortIndex]})
|
|
||||||
RawIndex = RawIndex + 1
|
|
||||||
ShortRawIndex = ShortForRaw + EgtIf( RawIndex <= ExtraShortForRaw, 1, 0) - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Ciclo fino ad esaurimento pezzi o barre
|
|
||||||
local dTotPartInRawLen = 0
|
|
||||||
local nRawTot = 0
|
|
||||||
local dRawTotLen = 0
|
|
||||||
local dTime = 0
|
|
||||||
local nCycle = 1
|
|
||||||
local CurrResult = {}
|
|
||||||
while TotRawCount( TempRaws) > 0 and PartsToFill( Parts) > 0 do
|
|
||||||
|
|
||||||
-- creo lista con pezzi lunghi e pezzi corti di questo Cycle
|
|
||||||
local PartsToNest = {}
|
|
||||||
for PartIndex = 1, #LongList do
|
|
||||||
table.insert( PartsToNest, LongList[PartIndex])
|
|
||||||
end
|
|
||||||
for CycleIndex = 1, #RawsShortList do
|
|
||||||
if CycleIndex <= nCycle then
|
|
||||||
for PartIndex = 1, #RawsShortList[CycleIndex] do
|
|
||||||
table.insert( PartsToNest, RawsShortList[CycleIndex][PartIndex])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- se non ci sono pezzi da nestare, esco
|
|
||||||
if PartsToFill( PartsToNest) <= 0 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
-- Eseguo ottimizzazione per ogni lunghezza di barra
|
|
||||||
local Results = {}
|
|
||||||
for RawIndex = 1, #TempRaws do
|
|
||||||
if TempRaws[RawIndex].Count > 0 then
|
|
||||||
Results[RawIndex] = ExecMaximumFilling( TempRaws[RawIndex], PartsToNest)
|
|
||||||
else
|
|
||||||
Results[RawIndex] = { FillRatio = 0.001, LenToFill = 1000, DiffParts = 0}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- verifico quale e' quella con meno scarto
|
|
||||||
local nMinWasteRawIndex = GDB_ID.NULL
|
|
||||||
local dMinWaste = 100000
|
|
||||||
for ResultIndex = 1, #Results do
|
|
||||||
if Results[ResultIndex] then
|
|
||||||
local dWaste = (1 - Results[ResultIndex].FillRatio) * TempRaws[ResultIndex].LenToFill
|
|
||||||
if Results[ResultIndex].DiffParts > 0 and dWaste < dMinWaste then
|
|
||||||
dMinWaste = dWaste
|
|
||||||
nMinWasteRawIndex = ResultIndex
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- verifico se ci sono pezzi
|
|
||||||
if nMinWasteRawIndex > 0 and Results[nMinWasteRawIndex] and Results[nMinWasteRawIndex].DiffParts > 0 then
|
|
||||||
-- riporto barra e pezzi nel risultato corrente
|
|
||||||
local CurrBar = { BarLen = TempRaws[nMinWasteRawIndex].LenToFill, Parts = {}}
|
|
||||||
local CurrX = TempRaws[nMinWasteRawIndex].StartGap
|
|
||||||
local nInfoIndex = 1
|
|
||||||
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
|
||||||
local PartIndex = Results[nMinWasteRawIndex].Data[i].Id
|
|
||||||
local PartId = PartsToNest[PartIndex].Id
|
|
||||||
local dLen = PartsToNest[PartIndex].Len
|
|
||||||
for j = 1, Results[nMinWasteRawIndex].Data[i].Count do
|
|
||||||
-- creo pezzo copia
|
|
||||||
CurrPart = { Index = nInfoIndex, PartId = PartId, PosX = CurrX}
|
|
||||||
table.insert( CurrBar.Parts, CurrPart)
|
|
||||||
CurrX = CurrX + dLen + TempRaws[nMinWasteRawIndex].MidGap
|
|
||||||
nInfoIndex = nInfoIndex + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.insert( CurrResult, CurrBar)
|
|
||||||
dTotPartInRawLen = dTotPartInRawLen + ( Results[nMinWasteRawIndex].FillRatio * TempRaws[nMinWasteRawIndex].LenToFill)
|
|
||||||
nRawTot = nRawTot + 1
|
|
||||||
dRawTotLen = dRawTotLen + TempRaws[nMinWasteRawIndex].LenToFill
|
|
||||||
-- Aggiorno per prossima iterazione
|
|
||||||
TempRaws[nMinWasteRawIndex].Count = TempRaws[nMinWasteRawIndex].Count - 1
|
|
||||||
for i = 1, Results[nMinWasteRawIndex].DiffParts do
|
|
||||||
local PartId = Results[nMinWasteRawIndex].Data[i].Id
|
|
||||||
PartsToNest[PartId].Cnt = PartsToNest[PartId].Cnt - Results[nMinWasteRawIndex].Data[i].Count
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- se non sono riuscito ad inserire alcun pezzo esco dal ciclo perche' non ci sono pezzi inseribili
|
|
||||||
break
|
|
||||||
end
|
|
||||||
nCycle = nCycle + 1
|
|
||||||
end
|
|
||||||
-- riporto risultato in lista
|
|
||||||
ResultList[Index] = dTotPartInRawLen
|
|
||||||
if not BestResult or not BestResultIndex or
|
|
||||||
( dTotPartInRawLen > ResultList[BestResultIndex] + 0.02 or ( abs( dTotPartInRawLen - ResultList[BestResultIndex]) < 0.02 and dRawTotLen < BestResult.RawTotLen - 0.02)) then
|
|
||||||
BestResult = CurrResult
|
|
||||||
BestResult.RawTotLen = dRawTotLen
|
|
||||||
BestResultIndex = Index
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local CycleCount = 0
|
|
||||||
|
|
||||||
local MinTime = 10 + pow( 3, ceil( log10( #Parts)) - 1)
|
|
||||||
if bLogStat then EgtOutLog('MinTime: ' .. MinTime ) end
|
|
||||||
local MaxTime = 30 + pow( 7, ceil( log10( #Parts)) - 1)
|
|
||||||
if bLogStat then EgtOutLog('MaxTime: ' .. MaxTime ) end
|
|
||||||
local TargetRatio = 0.98
|
|
||||||
local dTargetRatioLen = TargetRatio * dTotLen
|
|
||||||
if bLogStat then EgtOutLog('TargetRatioLen: ' .. dTargetRatioLen ) end
|
|
||||||
local CurrTime = 0
|
|
||||||
|
|
||||||
local function NestSolutionFromSP( StartingPoint, OscillationStep)
|
|
||||||
-- ciclo sulle possibilita' da un punto di origine con uno step fisso
|
|
||||||
local CurrResultIndex = StartingPoint
|
|
||||||
NestSolutionByIndex( StartingPoint)
|
|
||||||
if OscillationStep == 0 then return end
|
|
||||||
local CycleIndex = 1
|
|
||||||
local nOutOfBoundary = 0
|
|
||||||
while nOutOfBoundary ~= 3 do
|
|
||||||
CurrTime = EgtStopCounter() / 1000
|
|
||||||
if bLogStat then EgtOutLog('CurrTime: ' .. CurrTime ) end
|
|
||||||
if bLogStat then EgtOutLog('BestRatio: ' .. dTotLen / BestResult.RawTotLen ) end
|
|
||||||
-- se e' passato il tempo massimo, o e' passato il tempo minimo, ha inserito tutti i pezzi e la percentuale di utilizzo del materiale e' maggiore della soglia
|
|
||||||
if CurrTime > MaxTime or ( CurrTime > MinTime and ResultList[BestResultIndex] > dTotLen - 0.1 and ( dTotLen / BestResult.RawTotLen ) >= TargetRatio) then
|
|
||||||
if bLogStat then EgtOutLog('Brake') end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
local bCurrOutOfBoundary = false
|
|
||||||
if CurrResultIndex < 0 then
|
|
||||||
bCurrOutOfBoundary = true
|
|
||||||
if nOutOfBoundary == 2 then
|
|
||||||
nOutOfBoundary = 3
|
|
||||||
else
|
|
||||||
nOutOfBoundary = 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if CurrResultIndex > #Parts then
|
|
||||||
bCurrOutOfBoundary = true
|
|
||||||
if nOutOfBoundary == 1 then
|
|
||||||
nOutOfBoundary = 3
|
|
||||||
else
|
|
||||||
nOutOfBoundary = 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not bCurrOutOfBoundary and not ResultList[CurrResultIndex] then
|
|
||||||
NestSolutionByIndex( CurrResultIndex)
|
|
||||||
if bLogStat then EgtOutLog('CurrResultIndex: ' .. CurrResultIndex ) end
|
|
||||||
if bLogStat then EgtOutLog('Result: ' .. ResultList[CurrResultIndex]) end
|
|
||||||
CycleCount = CycleCount + 1
|
|
||||||
end
|
|
||||||
CurrResultIndex = StartingPoint + EgtIf( CycleIndex % 2 == 0, (CycleIndex / 2) * OscillationStep, -( ( CycleIndex + 1) / 2) * OscillationStep )
|
|
||||||
CycleIndex = CycleIndex + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- lancio calcolo
|
|
||||||
EgtStartCounter()
|
|
||||||
local StartingResult = floor( #Parts * 0.3)
|
|
||||||
if bLogStat then EgtOutLog('StartingResult: ' .. StartingResult ) end
|
|
||||||
--local Step = floor( #Parts / 10) * floor( log10( #Parts))
|
|
||||||
local nDividendo = pow( 10, floor( log10( #Parts)) - 1)
|
|
||||||
nDividendo = EgtIf( nDividendo ~= 1, nDividendo, 10)
|
|
||||||
local Step = floor( #Parts / nDividendo) * floor( log10( #Parts))
|
|
||||||
if bLogStat then EgtOutLog('Step: ' .. Step ) end
|
|
||||||
NestSolutionFromSP( StartingResult, Step)
|
|
||||||
if Step > 1 then
|
|
||||||
NestSolutionFromSP( StartingResult, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- creo gruppi di lavorazione per risultato
|
|
||||||
for MachGroupIndex = 1, #BestResult do
|
|
||||||
local CurrMachGroup = BestResult[ MachGroupIndex]
|
|
||||||
-- creo gruppo di lavorazione
|
|
||||||
local MachGroupName = NewMachGroupName()
|
|
||||||
nMachGroup = EgtAddMachGroup( MachGroupName)
|
|
||||||
EgtSetInfo( nMachGroup, "BARLEN", CurrMachGroup.BarLen)
|
|
||||||
EgtSetInfo( nMachGroup, "MATERIAL", NEST.MATERIAL)
|
|
||||||
EgtSetInfo( nMachGroup, "AUTONEST", 1)
|
|
||||||
-- scrivo dati per variabili P di comunicazione con la macchina in gruppo di lavorazione
|
|
||||||
EgtSetInfo( nMachGroup, "PRODID", NEST.PRODID)
|
|
||||||
EgtSetInfo( nMachGroup, "PATTID", nMachGroup)
|
|
||||||
-- Disegno i pezzi
|
|
||||||
for i = 1, #CurrMachGroup.Parts do
|
|
||||||
local CurrPart = CurrMachGroup.Parts[ i]
|
|
||||||
-- creo pezzo copia
|
|
||||||
local nPartDuploId = EgtDuploNew( CurrPart.PartId)
|
|
||||||
EgtSetInfo( nMachGroup, "PART" .. CurrPart.Index, nPartDuploId .. "," .. CurrPart.PosX)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- creo grezzi per ogni gruppo di lavorazione
|
|
||||||
local nRawCnt = 0
|
|
||||||
local nRawTot = ResultList[BestResultIndex]
|
|
||||||
_G.BEAM = {}
|
|
||||||
BEAM.FILE = NEST.FILE
|
|
||||||
BEAM.MACHINE = NEST.MACHINE
|
|
||||||
BEAM.FLAG = 6 -- CREATE_PANEL
|
|
||||||
BEAM.BASEDIR = NEST.BASEDIR
|
|
||||||
nMachGroup = EgtGetFirstMachGroup()
|
|
||||||
while nMachGroup do
|
|
||||||
local nNextMachGroup = EgtGetNextMachGroup( nMachGroup)
|
|
||||||
EgtSetCurrMachGroup( nMachGroup)
|
|
||||||
if EgtGetInfo( nMachGroup, "AUTONEST",'i') == 1 then
|
|
||||||
EgtRemoveInfo( nMachGroup, "AUTONEST")
|
|
||||||
EgtSetInfo( nMachGroup, "UPDATEUI", 1)
|
|
||||||
local bOk, sErr = pcall( dofile, BEAM.BASEDIR .. "\\BatchProcessNew.lua")
|
|
||||||
if not bOk then
|
|
||||||
EgtOutLog( 'Error in BatchProcessNew.lua call (' .. ( sErr or '') ..')')
|
|
||||||
end
|
|
||||||
nRawCnt = nRawCnt + 1
|
|
||||||
-- aggiorno interfaccia
|
|
||||||
EgtProcessEvents( 200 + ( nRawCnt / nRawTot * 100), 0)
|
|
||||||
end
|
|
||||||
nMachGroup = nNextMachGroup
|
|
||||||
end
|
|
||||||
|
|
||||||
EgtResetCurrMachGroup()
|
|
||||||
|
|
||||||
NEST.ERR = 0
|
|
||||||
|
|
||||||
EgtOutLog( ' +++ BeamNestProcess completed')
|
|
||||||
@@ -131,6 +131,14 @@ local function MyProcessInputData()
|
|||||||
else
|
else
|
||||||
PARTS[i].b3PartOriginal = b3Solid
|
PARTS[i].b3PartOriginal = b3Solid
|
||||||
end
|
end
|
||||||
|
if BeamData.MAX_LENGTH and BeamData.MAX_LENGTH > 10 and b3Solid:getDimX() > BeamData.MAX_LENGTH then
|
||||||
|
local sOut = 'Lunghezza (' .. EgtNumToString( b3Solid:getDimX(), 2) .. ') ' ..
|
||||||
|
'oltre i limiti della macchina (' .. EgtNumToString( BeamData.MAX_LENGTH, 2) .. ') '
|
||||||
|
EgtOutLog( sOut)
|
||||||
|
EgtOutBox( sOut, 'Lavora Travi', 'WARNING')
|
||||||
|
EgtDraw()
|
||||||
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
dRawW = PARTS[1].b3PartOriginal:getDimY()
|
dRawW = PARTS[1].b3PartOriginal:getDimY()
|
||||||
dRawH = PARTS[1].b3PartOriginal:getDimZ()
|
dRawH = PARTS[1].b3PartOriginal:getDimZ()
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ local function GetTenonStrategy( Proc, Part)
|
|||||||
ToolSearchParameters.dElevation = EgtSurfTmFacetElevationInBBox( Strategy.idTenonCutPlane, 0, Part.b3Part, true, GDB_ID.ROOT)
|
ToolSearchParameters.dElevation = EgtSurfTmFacetElevationInBBox( Strategy.idTenonCutPlane, 0, Part.b3Part, true, GDB_ID.ROOT)
|
||||||
|
|
||||||
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtTenonN
|
||||||
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
||||||
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing')
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sPocketingList, 'Pocketing')
|
||||||
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,6 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- se la lavorazione ostacola il pinzaggio, non posso farla, serve una lavorazioen che lasci il testimone
|
-- se la lavorazione ostacola il pinzaggio, non posso farla, serve una lavorazioen che lasci il testimone
|
||||||
-- TODO Girando il pezzo trova sempre che limitano il pinzaggio se pezzo piccolo!! Il controllo non va bene. Da rifare
|
|
||||||
if MachiningLib.IsFeatureHinderingClamping( Proc, Part) then
|
if MachiningLib.IsFeatureHinderingClamping( Proc, Part) then
|
||||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. StrategyLib.Config.sStrategyId .. ' not applicable ( Feature hinders clamping)'
|
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. StrategyLib.Config.sStrategyId .. ' not applicable ( Feature hinders clamping)'
|
||||||
EgtOutLog( sErr)
|
EgtOutLog( sErr)
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
|||||||
local dShortPartLength = OptionalParameters.dShortPartLength or BeamData.LEN_SHORT_PART
|
local dShortPartLength = OptionalParameters.dShortPartLength or BeamData.LEN_SHORT_PART
|
||||||
local EdgeToMachineTop = OptionalParameters.EdgeToMachineTop
|
local EdgeToMachineTop = OptionalParameters.EdgeToMachineTop
|
||||||
local EdgeToMachineBottom = OptionalParameters.EdgeToMachineBottom
|
local EdgeToMachineBottom = OptionalParameters.EdgeToMachineBottom
|
||||||
local bIsDicing = OptionalParameters.bIsDicing
|
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation
|
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation
|
||||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength
|
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength
|
||||||
-- TODO qui sarebbe meglio avere dExtra come OptionalParameter???
|
-- TODO qui sarebbe meglio avere dExtra come OptionalParameter???
|
||||||
@@ -289,7 +289,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
|||||||
FaceToMachine = Face,
|
FaceToMachine = Face,
|
||||||
EdgeToMachine = EdgeToMachineTop,
|
EdgeToMachine = EdgeToMachineTop,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -304,7 +304,7 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
|
|||||||
FaceToMachine = Face,
|
FaceToMachine = Face,
|
||||||
EdgeToMachine = EdgeToMachineBottom,
|
EdgeToMachine = EdgeToMachineBottom,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -371,7 +371,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
local bReduceBladePath = OptionalParameters.bReduceBladePath or false
|
local bReduceBladePath = OptionalParameters.bReduceBladePath or false
|
||||||
local bAllowFastCuts = OptionalParameters.bAllowFastCuts or false
|
local bAllowFastCuts = OptionalParameters.bAllowFastCuts or false
|
||||||
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
||||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||||
-- lati da lavorare in base al tipo di lama
|
-- lati da lavorare in base al tipo di lama
|
||||||
@@ -390,7 +390,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
EdgeToMachineTop = EdgeToMachineList.Top,
|
EdgeToMachineTop = EdgeToMachineList.Top,
|
||||||
EdgeToMachineBottom = EdgeToMachineList.Bottom,
|
EdgeToMachineBottom = EdgeToMachineList.Bottom,
|
||||||
nToolIndex = nToolIndex,
|
nToolIndex = nToolIndex,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = EdgeToMachineList.TopGuillotine,
|
EdgeToMachine = EdgeToMachineList.TopGuillotine,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -475,7 +475,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
OptionalParameters = OptionalParameters or {}
|
OptionalParameters = OptionalParameters or {}
|
||||||
local nToolIndex = OptionalParameters.nToolIndex
|
local nToolIndex = OptionalParameters.nToolIndex
|
||||||
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
local FaceToMachine = Proc.Faces[OptionalParameters.nFaceToMachineIndex or 1]
|
||||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||||
|
|
||||||
@@ -499,7 +499,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = EdgeToMachine,
|
EdgeToMachine = EdgeToMachine,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -512,7 +512,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -534,7 +534,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
EdgeToMachine = BeamLib.FindEdgeBestOrientedAsDirection( FaceToMachine.Edges, -EdgeToMachine.vtN),
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -553,7 +553,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = EdgeToMachine,
|
EdgeToMachine = EdgeToMachine,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -589,7 +589,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
FaceToMachine = FaceToMachine,
|
FaceToMachine = FaceToMachine,
|
||||||
EdgeToMachine = EdgeToMachine,
|
EdgeToMachine = EdgeToMachine,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
})
|
})
|
||||||
@@ -607,7 +607,7 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
|
|||||||
dDepthToMachine = dDepthToMachine
|
dDepthToMachine = dDepthToMachine
|
||||||
}
|
}
|
||||||
local BladeEngagementOptionalParameters = {
|
local BladeEngagementOptionalParameters = {
|
||||||
bIsDicing = bIsDicing,
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
}
|
}
|
||||||
@@ -782,6 +782,52 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part, MainFace, OtherFace)
|
||||||
|
|
||||||
|
-- frame solidale alla feature
|
||||||
|
local vtZ = MainFace.vtN
|
||||||
|
local vtX = OtherFace and OtherFace.vtN or nil
|
||||||
|
local frMainFace = Frame3d( MainFace.ptCenter, vtZ, vtX)
|
||||||
|
|
||||||
|
-- box del cubetto in riferimento feature
|
||||||
|
local b3Surf = EgtGetBBoxRef( idParallelTm, GDB_BB.STANDARD, frMainFace)
|
||||||
|
if idPerpendicularTm then
|
||||||
|
local b3SurfPerpendicular = EgtGetBBoxRef( idPerpendicularTm, GDB_BB.STANDARD, frMainFace)
|
||||||
|
b3Surf:Add( b3SurfPerpendicular)
|
||||||
|
else
|
||||||
|
-- se non arriva la superficie perpendicolare è un solo taglio parallelo: si estende il box in Z in modo da uscire dal pezzo
|
||||||
|
local ptDeltaZ = b3Surf:getMax() + vtZ * ( MainFace.dElevation + 5)
|
||||||
|
b3Surf:Add( ptDeltaZ)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- estensione box per non avere problemi nella sottrazione booleana
|
||||||
|
if OtherFace and idPerpendicularTm then
|
||||||
|
local vtY = vtZ ^ vtX
|
||||||
|
local ptDeltaX = b3Surf:getMax() + vtX * 1
|
||||||
|
local ptDeltaZ = b3Surf:getMax() + vtZ * 1
|
||||||
|
local ptDeltaYplus = b3Surf:getMax() + vtY * 1
|
||||||
|
local ptDeltaYminus = b3Surf:getMin() - vtY * 1
|
||||||
|
b3Surf:Add( ptDeltaX)
|
||||||
|
b3Surf:Add( ptDeltaZ)
|
||||||
|
b3Surf:Add( ptDeltaYplus)
|
||||||
|
b3Surf:Add( ptDeltaYminus)
|
||||||
|
else
|
||||||
|
b3Surf:expand( 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- si porta il box in riferimento globale
|
||||||
|
b3Surf:toGlob( frMainFace)
|
||||||
|
|
||||||
|
-- conversione box cubetto in superficie
|
||||||
|
local idSurfTmToSubtract = EgtSurfTmBBox( Part.idTempGroup, b3Surf, false, GDB_RT.GLOB)
|
||||||
|
|
||||||
|
-- sottrazione del cubetto dal grezzo
|
||||||
|
EgtSurfTmSubtract( idRaw, idSurfTmToSubtract)
|
||||||
|
|
||||||
|
return idRaw
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function CalculateDiceMachinings( vCuts, Parameters)
|
local function CalculateDiceMachinings( vCuts, Parameters)
|
||||||
local Machinings = {}
|
local Machinings = {}
|
||||||
local bMoveAfterSplit = false
|
local bMoveAfterSplit = false
|
||||||
@@ -789,6 +835,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
local Proc = Parameters.Proc
|
local Proc = Parameters.Proc
|
||||||
local Part = Parameters.Part
|
local Part = Parameters.Part
|
||||||
local MainFace = Parameters.MainFace
|
local MainFace = Parameters.MainFace
|
||||||
|
local OtherFace = next( Parameters.OtherFace) and Parameters.OtherFace or nil
|
||||||
local Tool = Parameters.Tool
|
local Tool = Parameters.Tool
|
||||||
local sChosenBladeType = Parameters.sChosenBladeType
|
local sChosenBladeType = Parameters.sChosenBladeType
|
||||||
local dExtendAfterTail = Parameters.dExtendAfterTail
|
local dExtendAfterTail = Parameters.dExtendAfterTail
|
||||||
@@ -797,21 +844,15 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
local bCannotSplitRestLength = Parameters.bCannotSplitRestLength
|
local bCannotSplitRestLength = Parameters.bCannotSplitRestLength
|
||||||
local bReduceDiceDepth = Parameters.bReduceDiceDepth
|
local bReduceDiceDepth = Parameters.bReduceDiceDepth
|
||||||
|
|
||||||
|
-- trimesh con RestLength
|
||||||
|
local b3CheckCollision = BeamLib.GetPartBoxWithHeadTail( Part, sRestLengthSideForPreSimulation)
|
||||||
|
local idCheckCollisionTm = EgtSurfTmBBox( Part.idTempGroup, b3CheckCollision, false, GDB_RT.GLOB)
|
||||||
|
|
||||||
-- eventuale inversione tagli ortogonali e aggiunta informazioni alla geometria
|
-- eventuale inversione tagli ortogonali e aggiunta informazioni alla geometria
|
||||||
local bAreOrthogonalCutsInverted = false
|
local bAreOrthogonalCutsInverted = false
|
||||||
for i = 1, #vCuts do
|
for i = 1, #vCuts do
|
||||||
for j = 1, #vCuts[i] do
|
for j = 1, #vCuts[i] do
|
||||||
SetDiceFaceInfo( Proc, vCuts[i][j])
|
SetDiceFaceInfo( Proc, vCuts[i][j])
|
||||||
-- TODO vedere se questa parte serve ancora; in teoria no perchè il taglio è girato automaticamente nella FaceByBlade
|
|
||||||
-- if ( i % 2) == 1 then
|
|
||||||
-- local vtO = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
|
||||||
-- if MachiningLib.IsFaceZOutOfRange( vtO, Tool) then
|
|
||||||
-- EgtInvertSurf( vCuts[i][j])
|
|
||||||
-- local vtCurrentFaceNormal = EgtSurfTmFacetNormVersor( vCuts[i][j], 0, GDB_ID.ROOT)
|
|
||||||
-- EgtMove( vCuts[i][j], -vtCurrentFaceNormal * Tool.dThickness, GDB_RT.GLOB)
|
|
||||||
-- bAreOrthogonalCutsInverted = true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- calcolo lavorazioni
|
-- calcolo lavorazioni
|
||||||
@@ -852,19 +893,17 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
end
|
end
|
||||||
-- calcolo lavorazione della singola faccia
|
-- calcolo lavorazione della singola faccia
|
||||||
-- per tagli paralleli e faccia aperta si prova a tagliare come se fosse una faccia singola, accorpando i tagli
|
-- per tagli paralleli e faccia aperta si prova a tagliare come se fosse una faccia singola, accorpando i tagli
|
||||||
-- TODO bIsDicing è da mettere a true?
|
|
||||||
local bCanMergeParallelCuts = ( ( i % 2) == 0) and ( Proc.nFct == 1)
|
local bCanMergeParallelCuts = ( ( i % 2) == 0) and ( Proc.nFct == 1)
|
||||||
local bIsDicingOk = true
|
local bIsDicingOk = true
|
||||||
if bCanMergeParallelCuts then
|
if bCanMergeParallelCuts then
|
||||||
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
||||||
local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
local idSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false)
|
||||||
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( nSurfToCut, Part)
|
local ProcTrimesh = FeatureLib.GetProcFromTrimesh( idSurfToCut, Part)
|
||||||
|
|
||||||
local OptionalParametersCutWholeWaste = {
|
local OptionalParametersCutWholeWaste = {
|
||||||
nToolIndex = Tool.nIndex,
|
nToolIndex = Tool.nIndex,
|
||||||
dExtendAfterTail = dExtendAfterTail,
|
dExtendAfterTail = dExtendAfterTail,
|
||||||
bReduceBladePath = bReduceBladePath,
|
bReduceBladePath = bReduceBladePath,
|
||||||
bIsDicing = false,
|
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength
|
bCannotSplitRestLength = bCannotSplitRestLength
|
||||||
}
|
}
|
||||||
@@ -877,8 +916,12 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
bMoveAfterSplit = true
|
bMoveAfterSplit = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- aggiornamento grezzo dinamico
|
||||||
|
if i % 2 == 0 then
|
||||||
|
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, vCuts[i-1][#vCuts[i-1]], Part, MainFace, OtherFace)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
EgtErase( nSurfToCut)
|
EgtErase( idSurfToCut)
|
||||||
bIsDicingOk = false
|
bIsDicingOk = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -919,9 +962,10 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
dRadialStepSpan = 0,
|
dRadialStepSpan = 0,
|
||||||
dExtendAfterTail = dExtendAfterTail,
|
dExtendAfterTail = dExtendAfterTail,
|
||||||
bIsDicing = true,
|
bIsDicing = true,
|
||||||
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||||
bDisableRealElevationCheck = ( i % 2) > 0 -- se taglio perpendicolare non si deve mai considerare il materiale precedente
|
bDisableRealElevationCheck = true
|
||||||
}
|
}
|
||||||
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||||
Cutting.ptCenter = Point3d( ProcTrimesh.Faces[1].ptCenter:getX(), 0, 0)
|
Cutting.ptCenter = Point3d( ProcTrimesh.Faces[1].ptCenter:getX(), 0, 0)
|
||||||
@@ -936,6 +980,10 @@ local function CalculateDiceMachinings( vCuts, Parameters)
|
|||||||
if Cutting.sStage == 'AfterTail' then
|
if Cutting.sStage == 'AfterTail' then
|
||||||
bMoveAfterSplit = true
|
bMoveAfterSplit = true
|
||||||
end
|
end
|
||||||
|
-- aggiornamento grezzo dinamico
|
||||||
|
if i % 2 == 0 then
|
||||||
|
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part, MainFace, OtherFace)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -977,7 +1025,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
|
|||||||
-- scelta lama da sopra o da sotto
|
-- scelta lama da sopra o da sotto
|
||||||
local sChosenBladeType = ''
|
local sChosenBladeType = ''
|
||||||
if not nToolIndex then
|
if not nToolIndex then
|
||||||
nToolIndex, sChosenBladeType = GetBestBlade( Proc, Part)
|
nToolIndex, sChosenBladeType = GetBestBlade( Proc, Part, Face1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- se non trovata lama la lavorazione non è fattibile
|
-- se non trovata lama la lavorazione non è fattibile
|
||||||
@@ -1013,6 +1061,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
|
|||||||
Proc = Proc,
|
Proc = Proc,
|
||||||
Part = Part,
|
Part = Part,
|
||||||
MainFace = Face1,
|
MainFace = Face1,
|
||||||
|
OtherFace = Face2,
|
||||||
Tool = TOOLS[nToolIndex],
|
Tool = TOOLS[nToolIndex],
|
||||||
sChosenBladeType = sChosenBladeType,
|
sChosenBladeType = sChosenBladeType,
|
||||||
dExtendAfterTail = dExtendAfterTail,
|
dExtendAfterTail = dExtendAfterTail,
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
|||||||
local dRadialStepSpan = OptionalParameters.dRadialStepSpan
|
local dRadialStepSpan = OptionalParameters.dRadialStepSpan
|
||||||
local sUserNotes = OptionalParameters.sUserNotes or ''
|
local sUserNotes = OptionalParameters.sUserNotes or ''
|
||||||
local bIsDicing = OptionalParameters.bIsDicing or false
|
local bIsDicing = OptionalParameters.bIsDicing or false
|
||||||
|
local idCheckCollisionTm = OptionalParameters.idCheckCollisionTm
|
||||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||||
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
local bDisableRealElevationCheck = OptionalParameters.bDisableRealElevationCheck or false
|
||||||
@@ -237,6 +238,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
|||||||
end
|
end
|
||||||
local BladeEngagementOptionalParameters = {
|
local BladeEngagementOptionalParameters = {
|
||||||
bIsDicing = bIsDicing,
|
bIsDicing = bIsDicing,
|
||||||
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||||
@@ -360,6 +362,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
|||||||
}
|
}
|
||||||
local BladeEngagementOptionalParameters = {
|
local BladeEngagementOptionalParameters = {
|
||||||
bIsDicing = bIsDicing,
|
bIsDicing = bIsDicing,
|
||||||
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||||
@@ -478,6 +481,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
|||||||
}
|
}
|
||||||
local BladeEngagementOptionalParameters = {
|
local BladeEngagementOptionalParameters = {
|
||||||
bIsDicing = bIsDicing,
|
bIsDicing = bIsDicing,
|
||||||
|
idCheckCollisionTm = idCheckCollisionTm,
|
||||||
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
sRestLengthSideForPreSimulation = sRestLengthSideForPreSimulation,
|
||||||
bCannotSplitRestLength = bCannotSplitRestLength,
|
bCannotSplitRestLength = bCannotSplitRestLength,
|
||||||
bDisableRealElevationCheck = bDisableRealElevationCheck
|
bDisableRealElevationCheck = bDisableRealElevationCheck
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
==== Beam Update Log ====
|
==== Beam Update Log ====
|
||||||
|
|
||||||
Versione 2.6-- (--/--/2024)
|
Versione 3.1e1 (29/05/2026)
|
||||||
- Primo commit creazione nuovo automatismo BEAM con strategie
|
- Primo commit nuovo automatismo a strategie
|
||||||
+2
-2
@@ -2,5 +2,5 @@
|
|||||||
-- Gestione della versione di Beam
|
-- Gestione della versione di Beam
|
||||||
|
|
||||||
NAME = 'Beam'
|
NAME = 'Beam'
|
||||||
VERSION = '2.8a1'
|
VERSION = '3.1e1'
|
||||||
MIN_EXE = '2.7j2'
|
MIN_EXE = '3.1e1'
|
||||||
|
|||||||
Reference in New Issue
Block a user