Merge branch 'develop' into CuttingImprovements
This commit is contained in:
+3
-2
@@ -32,7 +32,7 @@ if not sMachDir then
|
||||
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Travi', 'ERROR')
|
||||
return
|
||||
end
|
||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
|
||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamDataNew.lua') then
|
||||
EgtOutBox( 'La macchina corrente non è configurata per lavorare travi', 'Lavora Travi', 'ERROR')
|
||||
BEAM.ERR = 12
|
||||
BEAM.MSG = 'Error not configured for beams machine : ' .. sMachine
|
||||
@@ -63,7 +63,7 @@ _G.package.loaded.PreSimulationLib = nil
|
||||
_G.package.loaded['HEADCUT\\HEADCUT'] = nil
|
||||
_G.package.loaded['TAILCUT\\TAILCUT'] = nil
|
||||
-- libreria macchina
|
||||
_G.package.loaded.BeamData = nil
|
||||
_G.package.loaded.BeamDataNew = nil
|
||||
-- libreria calcolo tempo esecuzione
|
||||
_G.package.loaded.TimeLib = nil
|
||||
|
||||
@@ -247,6 +247,7 @@ elseif BEAM.FLAG == 9 then
|
||||
Part.id = EgtGetParent( EgtGetParent( BEAM.FEATUREID))
|
||||
Part.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( Part.id, 'Box') or GDB_ID.NULL)
|
||||
Part.b3Part = EgtGetBBoxGlob( Part.idBoxTm, GDB_BB.STANDARD)
|
||||
Part.idTempGroup = idTempGroup
|
||||
|
||||
local Proc = FeatureLib.GetProcFromTrimesh( BEAM.FEATUREID, Part)
|
||||
Proc.nGrp = EgtGetInfo( Proc.id, 'GRP', 'i')
|
||||
|
||||
+26
-5
@@ -35,6 +35,7 @@ STRATEGIES = {} -- tabella contenente le strategie disponibili per ogni
|
||||
STRATEGIES_CONFIG = {} -- tabella contenente i parametri di default delle strategie disponibili
|
||||
MACHININGS = {} -- tabella contenente le lavorazioni da applicare
|
||||
MACHININGS.Info = {}
|
||||
DB_MACH_APPLIED = {} -- tabella contenente informazioni delle lavorazioni create e aggiunte in lista
|
||||
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
|
||||
RESULT = {} -- tabella contenente il risultato, feature per feature, dell'applicazione della strategia scelta e il resoconto dell'analisi fatta
|
||||
GENERAL_PARAMETERS = {} -- tabella contenente i parametri generali già letti e importati
|
||||
@@ -1150,7 +1151,7 @@ local function CalculateMachinings( vProc, Part, nInitialRotation)
|
||||
elseif Proc.bSide and nCurrRotation ~= n90Rotation then
|
||||
BeamLib.RotateRawPart( Part, n90Rotation - nCurrRotation)
|
||||
nCurrRotation = n90Rotation
|
||||
elseif nCurrRotation ~= n0Rotation and not( Proc.bSide) and not( Proc.bDown) then
|
||||
elseif Proc.bStd and nCurrRotation ~= n0Rotation then
|
||||
BeamLib.RotateRawPart( Part, n0Rotation - nCurrRotation)
|
||||
nCurrRotation = n0Rotation
|
||||
end
|
||||
@@ -1368,6 +1369,7 @@ local function GetProcessingListFromCombination( BestCombination)
|
||||
-- aggiungo processing da fare in ultima fase
|
||||
if #BestCombination.Rot0 > 0 then
|
||||
for i = 1, #BestCombination.Rot0 do
|
||||
BestCombination.Rot0[i].bStd = true
|
||||
table.insert( vProc, BestCombination.Rot0[i])
|
||||
end
|
||||
end
|
||||
@@ -1599,6 +1601,11 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
-- si mette subito il pezzo nella fase
|
||||
if nOrd == 1 then
|
||||
EgtSetCurrPhase( 1)
|
||||
local nPhase = EgtGetCurrPhase()
|
||||
-- salvo info nuova fase aggiunta
|
||||
local MachExtraInfo = { sType = 'DISP',
|
||||
nPhase = nPhase}
|
||||
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
||||
else
|
||||
BeamLib.AddPhaseWithRawParts( PARTS[nPart].idRaw, BeamData.ptOriXR, BeamData.dPosXR, 0)
|
||||
end
|
||||
@@ -1634,6 +1641,7 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
end
|
||||
-- altrimenti si fanno tutti i calcoli
|
||||
else
|
||||
-- TODO serve ancora ordinare le feature con nuovo metodo di calcolo ottimizzazione lavorazioni?
|
||||
-- ordinamento di base delle feature
|
||||
vProc = OrderFeatures( vProc)
|
||||
|
||||
@@ -1670,12 +1678,16 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bSide = true
|
||||
elseif MACHININGS.Info.nHeadCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bDown = true
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotHeadCut][MatrixResult.nIndexHeadCutInVProc].bStd = true
|
||||
end
|
||||
-- si imposta flag rotazione per taglio di coda
|
||||
if MACHININGS.Info.nSplitCutRotation == 2 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bSide = true
|
||||
elseif MACHININGS.Info.nSplitCutRotation == 3 then
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bDown = true
|
||||
else
|
||||
PROCESSINGS[nPart].Rotation[nRotSplitCut][MatrixResult.nIndexTailCutInVProc].bStd = true
|
||||
end
|
||||
|
||||
local vProcHeadTail = {}
|
||||
@@ -1685,13 +1697,16 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
bAllStrategiesApplied = false
|
||||
MACHININGS, bAllStrategiesApplied = CalculateMachinings( vProcHeadTail, PARTS[nPart], MatrixResult.nInitialPosition)
|
||||
|
||||
-- ordinamento lavorazioni
|
||||
-- TODO sostituire con sorting Egt
|
||||
-- TODO completare ordinamento. Mancano le dipendenze.
|
||||
-- TODO la FinalizeSorting andrebbe rimossa e usato un sorting che non viola le dipendenze
|
||||
-- si preparano le lavorazioni assegnandole al proprio stage
|
||||
MACHININGS = MachiningLib.PrepareMachiningsForSorting( PARTS[nPart])
|
||||
|
||||
-- TODO queste funzioni andrebbero rimosse e utilizzato algoritmo di sorting dedicato
|
||||
-- #### #### #### #### #### #### #### #### #### ####
|
||||
-- ordinamento lavorazioni per stage (N.B.: potrebbe compromettere ordine lavorazioni della feature, che non può essere cambiato)
|
||||
MACHININGS = BeamLib.StableSort( MACHININGS, MachiningLib.CompareMachinings)
|
||||
-- dopo il sorting bisogna riverificare che ordine delle lavorazioni della feature non sia compromesso
|
||||
MACHININGS = MachiningLib.FinalizeSorting()
|
||||
-- #### #### #### #### #### #### #### #### #### ####
|
||||
|
||||
-- finiti i calcoli di applicazione delle lavorazioni, si riporta il pezzo nello zero della fase
|
||||
nRawId = PARTS[nPart].idRaw
|
||||
@@ -1775,9 +1790,15 @@ function BeamExec.ProcessMachinings( PARTS)
|
||||
-- aggiunta lavorazioni in ultima fase
|
||||
MachiningLib.AddOperations( MACHININGS, PARTS[nPart], 'STD')
|
||||
|
||||
-- ottimizzazione con algoritmo ShortestPath
|
||||
TIMER:startElapsed( 'Sorting')
|
||||
MachiningLib.ShortestPathSorting()
|
||||
TIMER:stopElapsed( 'Sorting')
|
||||
|
||||
EgtOutLog( ' *** End AddMachinings ***', 1)
|
||||
-- azzero lavorazioni per pezzo successivo
|
||||
MACHININGS = {}
|
||||
DB_MACH_APPLIED = {}
|
||||
MACHININGS.Info = {}
|
||||
-- indice pezzo successivo
|
||||
nOrd = nOrd + 1
|
||||
|
||||
+6
-2
@@ -104,7 +104,7 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamLib.AddPhaseWithRawParts( idRaw, OriXR, PosXR, dDeltaSucc)
|
||||
EgtAddPhase()
|
||||
local nPhase = EgtAddPhase()
|
||||
-- si aprono i limiti tavola per permettere rotazioni di pezzi più larghi della tavola
|
||||
EgtSetTableAreaOffset( 2000, 2000, 2000, 2000)
|
||||
local dRawMove = 0
|
||||
@@ -116,6 +116,10 @@ function BeamLib.AddPhaseWithRawParts( idRaw, OriXR, PosXR, dDeltaSucc)
|
||||
dRawMove = dRawMove + EgtGetRawPartBBox( idRaw):getDimX()
|
||||
idRaw = EgtGetNextRawPart( idRaw)
|
||||
end
|
||||
-- salvo info nuova fase aggiunta
|
||||
local MachExtraInfo = { sType = 'DISP',
|
||||
nPhase = nPhase}
|
||||
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -912,7 +916,7 @@ function BeamLib.GetStrategiesFromList( Proc, StrategyList)
|
||||
-- aggiungo in lista solo le strategie attive
|
||||
if StrategyList.FEATURE[i].TopologyList[j].StrategyList then
|
||||
for k = 1, #StrategyList.FEATURE[i].TopologyList[j].StrategyList do
|
||||
if StrategyList.FEATURE[i].TopologyList[j].StrategyList[k].nIndexInList >= 0 then
|
||||
if ( not StrategyList.FEATURE[i].TopologyList[j].StrategyList[k].nIndexInList) or ( StrategyList.FEATURE[i].TopologyList[j].StrategyList[k].nIndexInList) >= 0 then
|
||||
table.insert( ActiveStrategyList, BeamLib.TableCopyDeep( StrategyList.FEATURE[i].TopologyList[j].StrategyList[k]))
|
||||
end
|
||||
end
|
||||
|
||||
+135
-149
@@ -1033,7 +1033,7 @@ local function AddNewMachining( ProcToAdd, MachiningToAdd, AuxiliaryDataToAdd)
|
||||
nHeadCutRotation = 3
|
||||
elseif ProcToAdd.bSide then
|
||||
nHeadCutRotation = 2
|
||||
else
|
||||
else -- ProcToAdd.bStd
|
||||
nHeadCutRotation = 1
|
||||
end
|
||||
MACHININGS.Info.nHeadCutRotation = max( MACHININGS.Info.nHeadCutRotation or 0, nHeadCutRotation)
|
||||
@@ -1043,7 +1043,7 @@ local function AddNewMachining( ProcToAdd, MachiningToAdd, AuxiliaryDataToAdd)
|
||||
nSplitCutRotation = 3
|
||||
elseif ProcToAdd.bSide and MachiningToAdd.sStage == 'AfterTail' then
|
||||
nSplitCutRotation = 2
|
||||
else
|
||||
else -- ProcToAdd.bStd
|
||||
nSplitCutRotation = 1
|
||||
end
|
||||
MACHININGS.Info.nSplitCutRotation = max( MACHININGS.Info.nSplitCutRotation or 0, nSplitCutRotation)
|
||||
@@ -1173,17 +1173,20 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
|
||||
for i = 1, #MACHININGS do
|
||||
-- si aggiungono solo quelle della fase richiesta
|
||||
if ( sRotation == 'STD' and not MACHININGS[i].Proc.bDown and not MACHININGS[i].Proc.bSide) or
|
||||
if ( MACHININGS[i].Proc.bStd and sRotation == 'STD') or
|
||||
( MACHININGS[i].Proc.bDown and sRotation == 'DOWN') or
|
||||
( MACHININGS[i].Proc.bSide and sRotation == 'SIDE') then
|
||||
local nClonesToAdd = 1
|
||||
if MACHININGS[i].AuxiliaryData.Clones then
|
||||
nClonesToAdd = #MACHININGS[i].AuxiliaryData.Clones
|
||||
end
|
||||
-- dati da salvare dopo applicazione della lavorazione
|
||||
MACHININGS[i].Machining.MachStartAxesPos = {}
|
||||
MACHININGS[i].Machining.MachEndAxesPos = {}
|
||||
MACHININGS[i].Machining.nOperationId = {}
|
||||
for j = 1, nClonesToAdd do
|
||||
-- creazione lavorazione
|
||||
local nOperationId = EgtCreateMachining( MACHININGS[i].Machining.sOperationName, MACHININGS[i].Machining.nType, MACHININGS[i].Machining.sToolName)
|
||||
|
||||
if nOperationId then
|
||||
-- impostazione geometria
|
||||
local Geometry
|
||||
@@ -1281,6 +1284,16 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
end
|
||||
|
||||
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
|
||||
|
||||
-- si salva sulla lista info lavorazione applicata
|
||||
local MachExtraInfo = { sType = 'MACH',
|
||||
nIndexInMachinings = i,
|
||||
nOperationId = nOperationId,
|
||||
MachStartAxesPos = EgtGetMachiningStartAxes(),
|
||||
MachEndAxesPos = EgtGetMachiningEndAxes()}
|
||||
table.insert( DB_MACH_APPLIED, MachExtraInfo)
|
||||
|
||||
-- se errore in applicazione
|
||||
if not bIsApplyOk then
|
||||
bAreAllMachiningApplyOk = false
|
||||
nErr, sErr = EgtGetLastMachMgrError()
|
||||
@@ -1290,36 +1303,40 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.sStatus = 'Not-Applicable'
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.sApplyInfo = sErr
|
||||
RESULT[MACHININGS[i].Proc.nIndexInResult].ChosenStrategy.nApplyError = nErr
|
||||
-- se non deve essere igniorato, si salva ingombro lavorazione attuale e fasi successive
|
||||
elseif not MACHININGS[i].AuxiliaryData.bIgnoreNotClampableLength then
|
||||
-- salvo ingombro non pinzabile testa/coda
|
||||
local nCurrRotation = MACHININGS[i].Proc.nIndexRotation
|
||||
local dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nCurrRotation)
|
||||
Part.NotClampableLength[sRotation].dHead = max( Part.NotClampableLength[sRotation].dHead, dNotClampHead)
|
||||
Part.NotClampableLength[sRotation].dTail = max( Part.NotClampableLength[sRotation].dTail, dNotClampTail)
|
||||
-- se applicazione andata a buon fine
|
||||
else
|
||||
|
||||
if sRotation == 'DOWN' then
|
||||
-- se non deve essere igniorato, si salva ingombro lavorazione attuale e fasi successive
|
||||
if not MACHININGS[i].AuxiliaryData.bIgnoreNotClampableLength then
|
||||
-- salvo ingombro non pinzabile testa/coda
|
||||
local nCurrRotation = MACHININGS[i].Proc.nIndexRotation
|
||||
local dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nCurrRotation)
|
||||
Part.NotClampableLength[sRotation].dHead = max( Part.NotClampableLength[sRotation].dHead, dNotClampHead)
|
||||
Part.NotClampableLength[sRotation].dTail = max( Part.NotClampableLength[sRotation].dTail, dNotClampTail)
|
||||
|
||||
if sRotation == 'DOWN' then
|
||||
local nNextRotation = EgtIf( nCurrRotation - 1 < 1, nCurrRotation - 1 + 4, nCurrRotation - 1)
|
||||
-- se rotazione attiva (SIDE)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['SIDE'].dHead = max( Part.NotClampableLength['SIDE'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['SIDE'].dTail = max( Part.NotClampableLength['SIDE'].dTail, dNotClampTail)
|
||||
end
|
||||
nNextRotation = EgtIf( nNextRotation - 1 < 1, nNextRotation - 1 + 4, nNextRotation - 1)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
end
|
||||
elseif sRotation == 'SIDE' then
|
||||
local nNextRotation = EgtIf( nCurrRotation - 1 < 1, nCurrRotation - 1 + 4, nCurrRotation - 1)
|
||||
-- se rotazione attiva (SIDE)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['SIDE'].dHead = max( Part.NotClampableLength['SIDE'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['SIDE'].dTail = max( Part.NotClampableLength['SIDE'].dTail, dNotClampTail)
|
||||
end
|
||||
nNextRotation = EgtIf( nNextRotation - 1 < 1, nNextRotation - 1 + 4, nNextRotation - 1)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
end
|
||||
elseif sRotation == 'SIDE' then
|
||||
local nNextRotation = EgtIf( nCurrRotation - 1 < 1, nCurrRotation - 1 + 4, nCurrRotation - 1)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
-- se rotazione attiva (STD)
|
||||
if string.sub( Part.ChosenCombination, nNextRotation, nNextRotation) == '1' then
|
||||
dNotClampHead, dNotClampTail = FeatureLib.GetFeatureRotationNotClampableLengths( MACHININGS[i].Proc, Part, nNextRotation)
|
||||
Part.NotClampableLength['STD'].dHead = max( Part.NotClampableLength['STD'].dHead, dNotClampHead)
|
||||
Part.NotClampableLength['STD'].dTail = max( Part.NotClampableLength['STD'].dTail, dNotClampTail)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1615,19 +1632,6 @@ end
|
||||
-- TODO libreria Sorting??
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local SortingComparisonRules = {
|
||||
-- ordine interno alla feature
|
||||
function( MachiningA, MachiningB)
|
||||
if MachiningA.Proc.id == MachiningB.Proc.id then
|
||||
if MachiningA.Machining.nFeatureInternalIndex < MachiningB.Machining.nFeatureInternalIndex then
|
||||
return 1
|
||||
elseif MachiningA.Machining.nFeatureInternalIndex > MachiningB.Machining.nFeatureInternalIndex then
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end,
|
||||
|
||||
-- dipendenze solo spostamento stage 2->4
|
||||
-- TODO da fare
|
||||
|
||||
@@ -1641,110 +1645,6 @@ local SortingComparisonRules = {
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- dipendenze
|
||||
-- TODO da fare
|
||||
|
||||
-- segment
|
||||
function ( MachiningA, MachiningB)
|
||||
if MachiningA.Machining.nPartSegment < MachiningB.Machining.nPartSegment then
|
||||
return 1
|
||||
elseif MachiningA.Machining.nPartSegment > MachiningB.Machining.nPartSegment then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- testa
|
||||
-- TODO da fare
|
||||
|
||||
-- famiglia utensile
|
||||
function ( MachiningA, MachiningB)
|
||||
-- TODO tirare fuori da qua??
|
||||
local ToolFamilyOrder = {
|
||||
SAWBLADE = 1,
|
||||
DRILLBIT = 2,
|
||||
MILL = 3,
|
||||
MORTISE = 4
|
||||
}
|
||||
local nToolFamilyOrderA = ToolFamilyOrder[ TOOLS[ MachiningA.Machining.nToolIndex].sFamily]
|
||||
local nToolFamilyOrderB = ToolFamilyOrder[ TOOLS[ MachiningB.Machining.nToolIndex].sFamily]
|
||||
|
||||
if nToolFamilyOrderA < nToolFamilyOrderB then
|
||||
return 1
|
||||
elseif nToolFamilyOrderA > nToolFamilyOrderB then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- performance utensile
|
||||
function( MachiningA, MachiningB)
|
||||
local dToolPerformanceIndexA = TOOLS[MachiningA.Machining.nToolIndex].dPerformanceIndex
|
||||
local dToolPerformanceIndexB = TOOLS[MachiningB.Machining.nToolIndex].dPerformanceIndex
|
||||
|
||||
if dToolPerformanceIndexA > dToolPerformanceIndexB then
|
||||
return 1
|
||||
elseif dToolPerformanceIndexA < dToolPerformanceIndexB then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- probabilmente arrivati qui significa che gli utensili A e B sono gli stessi
|
||||
-- se così non fosse e tutte le caratteristiche sopra sono uguali, ordine alfabetico
|
||||
function( MachiningA, MachiningB)
|
||||
local sToolNameA = TOOLS[MachiningA.Machining.nToolIndex].sName
|
||||
local sToolNameB = TOOLS[MachiningB.Machining.nToolIndex].sName
|
||||
|
||||
if sToolNameA < sToolNameB then
|
||||
return 1
|
||||
elseif sToolNameA > sToolNameB then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- lato di lavoro
|
||||
-- TODO questo, insieme all'ordinamento X, andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
|
||||
function( MachiningA, MachiningB)
|
||||
if MachiningA.Machining.vtToolDirection:getY() < -0.174 and MachiningB.Machining.vtToolDirection:getY() >= 0.174 then
|
||||
return 1
|
||||
elseif MachiningA.Machining.vtToolDirection:getY() >= 0.174 and MachiningB.Machining.vtToolDirection:getY() < -0.174 then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
|
||||
-- ordinamento X
|
||||
-- TODO questo andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
|
||||
function( MachiningA, MachiningB)
|
||||
local bIsMachiningOnFront = MachiningA.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL
|
||||
local nResult = 0
|
||||
|
||||
-- se lavorazione davanti ordine testa->coda
|
||||
if bIsMachiningOnFront then
|
||||
if MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
|
||||
nResult = 1
|
||||
elseif MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
|
||||
nResult = -1
|
||||
end
|
||||
-- se lavorazione dietro ordine coda->testa
|
||||
else
|
||||
if MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
|
||||
nResult = 1
|
||||
elseif MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
|
||||
nResult = -1
|
||||
end
|
||||
end
|
||||
|
||||
return nResult
|
||||
end
|
||||
}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -1761,5 +1661,91 @@ function MachiningLib.CompareMachinings( MachiningA, MachiningB)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function OrderMachining( MachiningOptList)
|
||||
-- Recupero l'identificativo del gruppo di lavoro corrente
|
||||
for i = 1, #MachiningOptList - 1 do
|
||||
local idSource = DB_MACH_APPLIED[MachiningOptList[i+1]].nOperationId
|
||||
local idRef = DB_MACH_APPLIED[MachiningOptList[i]].nOperationId
|
||||
EgtRelocateGlob( idSource, idRef, GDB_IN.AFTER)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function MachiningLib.ShortestPathSorting()
|
||||
-- verificare se serve settare prima e ultima lavorazione
|
||||
-- EgtOptMachSetFirstMachining( int nId)
|
||||
-- EgtOptMachSetLastMachining( int nId)
|
||||
|
||||
local nStartIndex
|
||||
local i = 1
|
||||
while i <= #DB_MACH_APPLIED do
|
||||
local nMachInDisp = 0
|
||||
local MachiningOptList = {}
|
||||
|
||||
-- se è una lavorazione
|
||||
if DB_MACH_APPLIED[i].sType ~= 'DISP' then
|
||||
-- inizio
|
||||
nStartIndex = i
|
||||
EgtOptMachInit()
|
||||
|
||||
-- leggere feed dalla macchina
|
||||
EgtOptMachSetFeeds( 10000, 2000)
|
||||
|
||||
-- tra gruppi (stage) non si può ottimizzare
|
||||
EgtOptMachSetAllGroupsDependencesAsMandatory( true)
|
||||
|
||||
-- se è una lavorazione
|
||||
while DB_MACH_APPLIED[i] and DB_MACH_APPLIED[i].sType ~= 'DISP' do
|
||||
-- aggiungo lavorazioni
|
||||
local nToolIndex = MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nToolIndex
|
||||
EgtOptMachAddTool( nToolIndex, 2, 2) -- , [ num dTC_X, num dTC_Y, num dTC_Z, num dTC_A, num dTC_B, num dTC_C])
|
||||
-- viene eseguito prima il gruppo con indice più alto, quindi si inverte indice dato che lo stage è dal più piccolo al più grande
|
||||
local nOperationId = DB_MACH_APPLIED[i].nOperationId
|
||||
local nGroup = 10 - MACHININGS[DB_MACH_APPLIED[i].nIndexInMachinings].Machining.nStage
|
||||
local MachStartAxesPos = DB_MACH_APPLIED[i].MachStartAxesPos
|
||||
local MachEndAxesPos = DB_MACH_APPLIED[i].MachEndAxesPos
|
||||
EgtOptMachAddMachining( i, nToolIndex, nGroup, MachStartAxesPos, MachEndAxesPos)
|
||||
table.insert( MachiningOptList, i)
|
||||
|
||||
nMachInDisp = nMachInDisp + 1
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
local nStopIndex = nStartIndex + nMachInDisp - 1
|
||||
-- cliclo su tutte le lavorazioni
|
||||
for k = nStartIndex, nStopIndex do
|
||||
for j = nStartIndex, nStopIndex do
|
||||
-- se non è stessa lavorazione, imposto dati e dipendenze
|
||||
if k ~= j then
|
||||
-- se stessa Proc
|
||||
if MACHININGS[DB_MACH_APPLIED[k].nIndexInMachinings].Proc.id == MACHININGS[DB_MACH_APPLIED[j].nIndexInMachinings].Proc.id then
|
||||
-- se lavorazioni della stessa feature, obbligatorio rispettare ordine
|
||||
if MACHININGS[DB_MACH_APPLIED[k].nIndexInMachinings].Machining.nFeatureInternalIndex < MACHININGS[DB_MACH_APPLIED[j].nIndexInMachinings].Machining.nFeatureInternalIndex then
|
||||
EgtOptMachAddDependence( k, j)
|
||||
end
|
||||
-- se tra due Proc diverse
|
||||
else
|
||||
-- TODO :
|
||||
-- se ci sono dipendenze tra due feature diverse, la dipendenza è obbligatoria! ATTENZIONE A DIPENDENZE INCROCIATE A->B, B->C, C->A
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- calcolo ordine lavorazioni
|
||||
MachiningOptList = EgtOptMachGetResult( MachiningOptList)
|
||||
|
||||
OrderMachining( MachiningOptList)
|
||||
|
||||
-- fine
|
||||
EgtOptMachTerminate()
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return MachiningLib
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ if not sMachDir then
|
||||
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Travi', 'ERROR')
|
||||
return
|
||||
end
|
||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamData.lua') then
|
||||
if not EgtExistsFile( sMachDir .. '\\Beam\\BeamDataNew.lua') then
|
||||
EgtOutBox( 'La macchina corrente non è configurata per lavorare travi', 'Lavora Travi', 'ERROR')
|
||||
return
|
||||
end
|
||||
@@ -51,7 +51,7 @@ _G.package.loaded.PreSimulationLib = nil
|
||||
_G.package.loaded['HEADCUT\\HEADCUT'] = nil
|
||||
_G.package.loaded['TAILCUT\\TAILCUT'] = nil
|
||||
-- libreria macchina
|
||||
_G.package.loaded.BeamData = nil
|
||||
_G.package.loaded.BeamDataNew = nil
|
||||
-- libreria calcolo tempo esecuzione
|
||||
_G.package.loaded.TimeLib = nil
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ]
|
||||
},
|
||||
{ "sName": "Bevel-1-Through",
|
||||
"sImage": "ConfigStrategy\\Cut-1-Through.png",
|
||||
"sImage": "ConfigStrategy\\Bevel-1-Through.png",
|
||||
"StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
"sName": "dOpenMinSafe",
|
||||
"sNameNge": "OPENMINSAFE",
|
||||
"sValue": "40",
|
||||
"sValue": "10",
|
||||
"sDescriptionShort": "Minimum approach distance on open sides",
|
||||
"sDescriptionLong": "Minimum approach distance on open sides",
|
||||
"sType": "d",
|
||||
|
||||
@@ -241,6 +241,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
OptionalParametersFaceByBlade2.dDepthToMachine = dDepthToMachine
|
||||
|
||||
Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, BottomEdgeToMachine, OptionalParametersFaceByBlade2)
|
||||
Cutting2.nInternalSortingPriority = 3
|
||||
Cutting2.dResultWeight = 0.3
|
||||
table.insert( CalculatedMachinings, Cutting2)
|
||||
|
||||
elseif not Cutting2.bIsApplicable and Cutting1.bIsApplicable then
|
||||
@@ -249,6 +251,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
OptionalParametersFaceByBlade1.dDepthToMachine = dDepthToMachine
|
||||
|
||||
Cutting1 = FaceByBlade.Make( Proc, Part, BottomFace, BottomEdgeToMachine, OptionalParametersFaceByBlade1)
|
||||
Cutting1.nInternalSortingPriority = 3
|
||||
Cutting1.dResultWeight = 0.3
|
||||
table.insert( CalculatedMachinings, Cutting1)
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user