- in Process require di BeamExec spostato dopo la dichiarazione delle variabili globali
- in BeamExec -> CollectFeatures si salva l'indice della Proc nel vProc - in FeatureLib aggiunta funzione GetFeatureMaxNotClampableLengths - correzioni e migliorie GetFeatureMaxNotClampableLengths
This commit is contained in:
@@ -588,6 +588,7 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( Part)
|
||||
-- recupero le feature
|
||||
local nProcCount = 0
|
||||
local vProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = BeamLib.GetAddGroup( Part.id)
|
||||
@@ -645,6 +646,8 @@ local function CollectFeatures( Part)
|
||||
end
|
||||
-- se ci sono strategie disponibili, aggiungo a lista delle feature da lavorare
|
||||
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
||||
nProcCount = nProcCount + 1
|
||||
Proc.nIndexInVProc = nProcCount
|
||||
table.insert( vProc, Proc)
|
||||
-- altrimenti errore (non ci sono strategie per lavorare la topologia riconosciuta)
|
||||
else
|
||||
@@ -658,6 +661,8 @@ local function CollectFeatures( Part)
|
||||
end
|
||||
else
|
||||
Proc.nFlg = 0
|
||||
nProcCount = nProcCount + 1
|
||||
Proc.nIndexInVProc = nProcCount
|
||||
table.insert( vProc, Proc)
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)')
|
||||
end
|
||||
@@ -1022,9 +1027,6 @@ function BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
|
||||
vProcRot[dRotIndex] = GetFeatureInfoAndDependency( vProcRot[dRotIndex], PARTS[nPart])
|
||||
|
||||
-- calcola le strategie applicabili ( presenti nella tabella vProcRot[dRotIndex].AvailableStrategies)
|
||||
vProcRot[dRotIndex] = CalculateStrategies( vProcRot[dRotIndex], PARTS[nPart])
|
||||
else
|
||||
-- inserisco una tabella vuota
|
||||
table.insert( vProcRot, {})
|
||||
@@ -1307,6 +1309,9 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
for nPart = 1, #PARTS do
|
||||
-- calcolo della migliore strategia per ogni rotazione del pezzo
|
||||
for dRotIndex = 1, 4 do
|
||||
-- calcola le strategie applicabili
|
||||
PROCESSINGS[nPart].Rotation[dRotIndex] = CalculateStrategies( PROCESSINGS[nPart].Rotation[dRotIndex], PARTS[nPart])
|
||||
-- tra le calcolate, sceglie la migliore
|
||||
PROCESSINGS[nPart].Rotation[dRotIndex] = GetBestStrategy( PROCESSINGS[nPart].Rotation[dRotIndex])
|
||||
end
|
||||
|
||||
|
||||
+24
-5
@@ -430,7 +430,7 @@ function FeatureLib.GetFeatureVolume( Proc, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO bisogna calcolarla per tutte le rotazioni; funzione copiata direttamente da automatismo vecchio, da migliorare / completare
|
||||
-- TODO funzione copiata direttamente da automatismo vecchio, da migliorare / completare
|
||||
function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
local NotClampableLength = {}
|
||||
|
||||
@@ -492,13 +492,32 @@ function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
end
|
||||
end
|
||||
|
||||
NotClampableLength.Rot0 = { Head = dNotClampableLengthHead, Tail = dNotClampableLengthTail}
|
||||
NotClampableLength.Rot90 = { Head = dNotClampableLengthHead, Tail = dNotClampableLengthTail}
|
||||
NotClampableLength.Rot180 = { Head = dNotClampableLengthHead, Tail = dNotClampableLengthTail}
|
||||
NotClampableLength.Rot270 = { Head = dNotClampableLengthHead, Tail = dNotClampableLengthTail}
|
||||
NotClampableLength.dNotClampableLengthHead = dNotClampableLengthHead
|
||||
NotClampableLength.dNotClampableLengthTail = dNotClampableLengthTail
|
||||
|
||||
return NotClampableLength
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
|
||||
local nPartIndex = Part.nIndexInParts
|
||||
local nProcIndex = Proc.nIndexInVProc
|
||||
local Rotations = PROCESSINGS[nPartIndex].Rotation
|
||||
|
||||
local dMaxOnHead = 0
|
||||
local dMaxOnTail = 0
|
||||
for i = 1, #Part.CombinationList do
|
||||
for j = 1, 4 do
|
||||
-- controllo che la rotazione sia attiva
|
||||
if string.sub( Part.CombinationList[i].sBitIndexCombination, j, j) == '1' then
|
||||
dMaxOnHead = max( Rotations[j][nProcIndex].NotClampableLength.dNotClampableLengthHead, dMaxOnHead)
|
||||
dMaxOnTail = max( Rotations[j][nProcIndex].NotClampableLength.dNotClampableLengthTail, dMaxOnTail)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return dMaxOnHead, dMaxOnTail
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return FeatureLib
|
||||
+3
-3
@@ -74,14 +74,14 @@ for i = 1, #vtCoreStrategiesNames do
|
||||
end
|
||||
|
||||
|
||||
local BeamExec = require( 'BeamExec')
|
||||
|
||||
-- Variabili globali
|
||||
PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
|
||||
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
|
||||
|
||||
-- Carico i dati globali
|
||||
local BeamData = require( 'BeamData')
|
||||
-- carico librerie
|
||||
local BeamExec = require( 'BeamExec')
|
||||
|
||||
-- Variabili di modulo
|
||||
local dRawW
|
||||
@@ -307,7 +307,7 @@ end
|
||||
-- *** Inserimento delle lavorazioni nelle travi ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessFeatures()
|
||||
local PROCESSINGS = BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
PROCESSINGS = BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
local bOk, Stats = BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
local nErrCnt = 0
|
||||
local nWarnCnt = 0
|
||||
|
||||
@@ -10,34 +10,15 @@ local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
-- strategie di base
|
||||
local BladeToWaste = require( 'BLADETOWASTE')
|
||||
local FaceByBlade = require( 'FACEBYBLADE')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0005 = {}
|
||||
local Strategy = {}
|
||||
local Cutting = {}
|
||||
Cutting.Result = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function GetBestCuttingStrategy( Proc, Part, StrategyParameters)
|
||||
local sCuttingStrategy = ''
|
||||
local dFeatureVolume = FeatureLib.GetFeatureVolume( Proc, Part)
|
||||
local dFeatureMaxDimension = max( Proc.b3Box:getDimX(), Proc.b3Box:getDimY(), Proc.b3Box:getDimZ())
|
||||
local dFeatureMaxNotClampableLengthHead = max( Proc.NotClampableLength.Rot0.Head, Proc.NotClampableLength.Rot90.Head, Proc.NotClampableLength.Rot180.Head, Proc.NotClampableLength.Rot270.Head)
|
||||
local dFeatureMaxNotClampableLengthTail = max( Proc.NotClampableLength.Rot0.Tail, Proc.NotClampableLength.Rot90.Tail, Proc.NotClampableLength.Rot180.Tail, Proc.NotClampableLength.Rot270.Tail)
|
||||
|
||||
if dFeatureVolume < StrategyParameters.dMaxWasteVolume + 10 * GEO.EPS_SMALL
|
||||
and dFeatureMaxDimension < StrategyParameters.dMaxWasteLength + 10 * GEO.EPS_SMALL then
|
||||
-- TODO non sto considerando se l'utensile (non ancora scelto) ci arriva o no!
|
||||
sCuttingStrategy = 'DROP_WHOLE_WASTE'
|
||||
elseif FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN}) then
|
||||
sCuttingStrategy = 'LEAVE_WASTE_ATTACHED'
|
||||
else
|
||||
sCuttingStrategy = 'DICE_CUT'
|
||||
end
|
||||
|
||||
return sCuttingStrategy
|
||||
end
|
||||
|
||||
|
||||
function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
@@ -47,26 +28,34 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
Strategy.Result = {}
|
||||
Strategy.Result.sInfo = ''
|
||||
Cutting.Result = {}
|
||||
|
||||
local Cutting = {}
|
||||
local sCuttingStrategy = ''
|
||||
local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
|
||||
local bLeaveWasteAttached = Strategy.Parameters.sCuttingStrategy == 'LEAVE_WASTE_ATTACHED'
|
||||
local bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN})
|
||||
if bFeatureHindersClamping or bLeaveWasteAttached then
|
||||
-- TODO Lavorazione con codolo
|
||||
-- verificare se basta una lavorazione o ne servono due. Servirà cercare l'utensile e stabilire dove lasciare il codolo.
|
||||
-- La FaceByBlade (o altra??) dovrà accettare opzionalmente di fermarsi prima (basta l'Offset??) e accettare l'utensile forzato.
|
||||
-- attenzione perchè se l'inclinazione della faccia la fa finire oltre lo spigolo questo riduce il massimo calcolare (come calcolare????)
|
||||
--Cutting = FaceByBlade.Make( )
|
||||
--Cutting.AddResult( Cutting)
|
||||
|
||||
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
|
||||
sCuttingStrategy = GetBestCuttingStrategy( Proc, Part, Strategy.Parameters)
|
||||
else
|
||||
sCuttingStrategy = Strategy.Parameters.sCuttingStrategy
|
||||
-- se la lavorazione con codolo fallisce o non è possibile si proseguirà a quella con cubetti
|
||||
|
||||
-- TODO gestione lavorazioni spezzate
|
||||
|
||||
-- TODO ordinamento lavorazioni (se necessario)
|
||||
end
|
||||
|
||||
if sCuttingStrategy == 'DROP_WHOLE_WASTE' then
|
||||
|
||||
elseif sCuttingStrategy == 'LEAVE_WASTE_ATTACHED' then
|
||||
|
||||
elseif sCuttingStrategy == 'DICE_CUT' then
|
||||
|
||||
else
|
||||
-- strategia di taglio non riconosciuta
|
||||
if #Cutting.Result == 0 and not bLeaveWasteAttached then
|
||||
-- BladeToWaste
|
||||
end
|
||||
|
||||
-- aggiunta lavorazioni alla lista. Vanno gestiti anche eventuali stepXY?
|
||||
|
||||
-- output risultati
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ local STR0005Data = {
|
||||
{ sName = 'sCuttingStrategy', sNameNge = 'CUTTING_STRATEGY', sValue = 'AUTO', sType = 'combo', sMinUserLevel = '1',
|
||||
Choices = { sValue = 'AUTO', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
|
||||
{ sValue = 'DROP_WHOLE_WASTE', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
|
||||
{ sValue = 'LEAVE_WASTE_ATTACHED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
|
||||
{ sValue = 'DICE_CUT', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
|
||||
{ sValue = 'LEAVE_WASTE_ATTACHED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
|
||||
{ sName = 'dMaxWasteLength', sNameNge = 'MAX_WASTE_LENGTH', sValue = '300', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'dMaxWasteVolume', sNameNge = 'MAX_WASTE_VOLUME', sValue = '6000000', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
|
||||
}
|
||||
|
||||
@@ -15,3 +15,12 @@ local MachiningLib = require( 'MachiningLib')
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
|
||||
EgtOutLog( ' BLADETOWASTE started', 1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- if dFeatureVolume < StrategyParameters.dMaxWasteVolume + 10 * GEO.EPS_SMALL
|
||||
-- and dFeatureMaxDimension < StrategyParameters.dMaxWasteLength + 10 * GEO.EPS_SMALL then
|
||||
|
||||
-- end
|
||||
Reference in New Issue
Block a user