- Ridefinito flusso automatismo
- Aggiunta gestion AuxInfo per gestire ordine lavorazioni - Piccole migliorie varie
This commit is contained in:
Vendored
+11
-1
@@ -114,7 +114,17 @@
|
||||
"EgtSurfTmIntersect",
|
||||
"GDB_IN",
|
||||
"GEO",
|
||||
"dist"
|
||||
"dist",
|
||||
"EgtSetMachiningParam",
|
||||
"EgtCreateMachining",
|
||||
"EgtSetMachiningGeometry",
|
||||
"EgtGetMachiningParam",
|
||||
"EgtGetLastMachMgrError",
|
||||
"EgtSetOperationMode",
|
||||
"EgtApplyMachining",
|
||||
"EgtSetCurrPhase",
|
||||
"EgtApplyAllMachinings",
|
||||
"EgtGetDebugLevel"
|
||||
],
|
||||
"Lua.diagnostics.disable": [
|
||||
"empty-block"
|
||||
|
||||
+154
-149
@@ -45,8 +45,6 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
|
||||
-- scelgo il migliore
|
||||
if bIsToolCompatible then
|
||||
-- se ToolHolder più grande dell'utensile, il primo oggetto in collisione è il ToolHolder. Altrimenti il motore.
|
||||
local dDimObjToCheck = EgtIf( TOOLS[i].ToolHolder.dDiameter > TOOLS[i].dDiameter, TOOLS[i].ToolHolder.dDiameter, WinData.C_SIMM_ENC)
|
||||
local dCurrentMaxMatReduction = WinData.COLL_SIC or 5
|
||||
|
||||
-- dCurrMachReduction = negativo -> limitare, positivo -> mm extra disponibili
|
||||
@@ -126,9 +124,18 @@ end
|
||||
function MachiningLib.FindDrill()
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche
|
||||
function MachiningLib.GetPhaseMach( Proc)
|
||||
local nPhase
|
||||
if Proc.nPhase then
|
||||
nPhase = Proc.nPhase
|
||||
end
|
||||
return nPhase
|
||||
end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- salva in lista globale la lavorazione appena calcolata
|
||||
function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd)
|
||||
function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd, AuxInfoToAdd)
|
||||
-- Controllo parametri obbligatori
|
||||
if not MachiningToAdd.nType or not MachiningToAdd.nToolIndex or not MachiningToAdd.Geometry or not ProcToAdd.id then
|
||||
return false
|
||||
@@ -162,167 +169,165 @@ function MachiningLib.AddNewMachining( ProcToAdd, MachiningToAdd)
|
||||
local Machining = {}
|
||||
Machining.Proc = ProcToAdd
|
||||
Machining.Machining = MachiningToAdd
|
||||
Machining.AuxInfo = AuxInfoToAdd
|
||||
table.insert( MACHININGS, Machining)
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per aggiungere una nuova lavorazione
|
||||
function MachiningLib.AddOperations( vProc, Part)
|
||||
function MachiningLib.AddOperation( OperationToInsert)
|
||||
local nErr
|
||||
local sErr = ''
|
||||
local bAreAllMachiningApplyOk = true
|
||||
|
||||
for i = 1, #MACHININGS do
|
||||
-- creazione lavorazione
|
||||
local nOperationId = EgtCreateMachining( MACHININGS[i].Machining.sOperationName, MACHININGS[i].Machining.nType, MACHININGS[i].Machining.sToolName)
|
||||
-- creazione lavorazione
|
||||
local nOperationId = EgtCreateMachining( OperationToInsert.Machining.sOperationName, OperationToInsert.Machining.nType, OperationToInsert.Machining.sToolName)
|
||||
|
||||
if nOperationId then
|
||||
-- impostazione geometria
|
||||
EgtSetMachiningGeometry( MACHININGS[i].Machining.Geometry)
|
||||
if nOperationId then
|
||||
-- impostazione geometria
|
||||
EgtSetMachiningGeometry( OperationToInsert.Machining.Geometry)
|
||||
|
||||
-- impostazione parametri lavorazione
|
||||
if MACHININGS[i].Machining.sDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, MACHININGS[i].Machining.sDepth)
|
||||
end
|
||||
if MACHININGS[i].Machining.bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, MACHININGS[i].Machining.bInvert)
|
||||
end
|
||||
if MACHININGS[i].Machining.nWorkSide then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, MACHININGS[i].Machining.nWorkSide)
|
||||
end
|
||||
if MACHININGS[i].Machining.nFaceuse then
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, MACHININGS[i].Machining.nFaceuse)
|
||||
end
|
||||
if MACHININGS[i].Machining.nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, MACHININGS[i].Machining.nSCC)
|
||||
end
|
||||
if MACHININGS[i].Machining.bToolInvert then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, MACHININGS[i].Machining.bToolInvert)
|
||||
end
|
||||
if MACHININGS[i].Machining.sBlockedAxis then
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, MACHININGS[i].Machining.sBlockedAxis)
|
||||
end
|
||||
if MACHININGS[i].Machining.sInitialAngles then
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, MACHININGS[i].Machining.sInitialAngles)
|
||||
end
|
||||
if MACHININGS[i].Machining.nHeadSide then
|
||||
EgtSetMachiningParam( MCH_MP.HEADSIDE, MACHININGS[i].Machining.nHeadSide)
|
||||
end
|
||||
if MACHININGS[i].Machining.nSubType then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, MACHININGS[i].Machining.nSubType)
|
||||
end
|
||||
if MACHININGS[i].Machining.dOverlap then
|
||||
EgtSetMachiningParam( MCH_MP.OVERL, MACHININGS[i].Machining.dOverlap)
|
||||
end
|
||||
|
||||
-- step
|
||||
if MACHININGS[i].Machining.Steps then
|
||||
if MACHININGS[i].Machining.Steps.dStepType then
|
||||
EgtSetMachiningParam( MCH_MP.STEPTYPE, MACHININGS[i].Machining.Steps.dStepType)
|
||||
end
|
||||
if MACHININGS[i].Machining.Steps.dStep then
|
||||
EgtSetMachiningParam( MCH_MP.STEP, MACHININGS[i].Machining.Steps.dStep)
|
||||
end
|
||||
if MACHININGS[i].Machining.Steps.dSideStep then
|
||||
EgtSetMachiningParam( MCH_MP.SIDESTEP, MACHININGS[i].Machining.Steps.dSideStep)
|
||||
end
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dStartPos then
|
||||
EgtSetMachiningParam( MCH_MP.STARTPOS, MACHININGS[i].Machining.dStartPos)
|
||||
end
|
||||
if MACHININGS[i].Machining.dReturnPos then
|
||||
EgtSetMachiningParam( MCH_MP.RETURNPOS, MACHININGS[i].Machining.dReturnPos)
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dRadialOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, MACHININGS[i].Machining.dRadialOffset)
|
||||
end
|
||||
if MACHININGS[i].Machining.dLongitudinalOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, MACHININGS[i].Machining.dLongitudinalOffset)
|
||||
end
|
||||
|
||||
-- paraemtri attacco
|
||||
if MACHININGS[i].Machining.LeadIn then
|
||||
if MACHININGS[i].Machining.LeadIn.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, MACHININGS[i].Machining.LeadIn.nType)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dStartAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, MACHININGS[i].Machining.LeadIn.dStartAddLength)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, MACHININGS[i].Machining.LeadIn.dTangentDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, MACHININGS[i].Machining.LeadIn.dPerpDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, MACHININGS[i].Machining.LeadIn.dElevation)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadIn.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, MACHININGS[i].Machining.LeadIn.dCompLength)
|
||||
end
|
||||
end
|
||||
-- parametri uscita
|
||||
if MACHININGS[i].Machining.LeadOut then
|
||||
if MACHININGS[i].Machining.LeadOut.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MACHININGS[i].Machining.LeadOut.nType)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dEndAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, MACHININGS[i].Machining.LeadOut.dEndAddLength)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, MACHININGS[i].Machining.LeadOut.dTangentDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, MACHININGS[i].Machining.LeadOut.dPerpDistance)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, MACHININGS[i].Machining.LeadOut.dElevation)
|
||||
end
|
||||
if MACHININGS[i].Machining.LeadOut.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, MACHININGS[i].Machining.LeadOut.dCompLength)
|
||||
end
|
||||
end
|
||||
|
||||
if MACHININGS[i].Machining.dStartSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.STARTSLOWLEN, MACHININGS[i].Machining.dStartSlowLen)
|
||||
end
|
||||
if MACHININGS[i].Machining.dEndSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.ENDSLOWLEN, MACHININGS[i].Machining.dEndSlowLen)
|
||||
end
|
||||
if MACHININGS[i].Machining.dThrouAddLen then
|
||||
EgtSetMachiningParam( MCH_MP.THROUADDLEN, MACHININGS[i].Machining.dThrouAddLen)
|
||||
end
|
||||
|
||||
-- parametri da settare nelle note di sistema
|
||||
-- TODO da decidere quali sono le note da salvare qui. Probabilmente tutte quelle relative all'ordine delle lavorazioni
|
||||
local sSystemNotes = EgtGetMachiningParam( MCH_MP.SYSNOTES)
|
||||
--if MACHININGS[i].Machining.nMachiningOrder then
|
||||
-- sSystemNotes = EgtSetValInNotes( sSystemNotes, 'MachiningOrder', MACHININGS[i].Machining.nMachiningOrder)
|
||||
--end
|
||||
EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes)
|
||||
|
||||
-- parametri da settare nelle note utente
|
||||
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||
if MACHININGS[i].Machining.dMaxElev then
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', MACHININGS[i].Machining.dMaxElev)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
|
||||
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
|
||||
if not bIsApplyOk then
|
||||
bAreAllMachiningApplyOk = false
|
||||
nErr, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nOperationId, false)
|
||||
end
|
||||
else
|
||||
return false, 'UNEXPECTED ERROR: Error on creating machining'
|
||||
-- impostazione parametri lavorazione
|
||||
if OperationToInsert.Machining.sDepth then
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, OperationToInsert.Machining.sDepth)
|
||||
end
|
||||
if OperationToInsert.Machining.bInvert then
|
||||
EgtSetMachiningParam( MCH_MP.INVERT, OperationToInsert.Machining.bInvert)
|
||||
end
|
||||
if OperationToInsert.Machining.nWorkSide then
|
||||
EgtSetMachiningParam( MCH_MP.WORKSIDE, OperationToInsert.Machining.nWorkSide)
|
||||
end
|
||||
if OperationToInsert.Machining.nFaceuse then
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, OperationToInsert.Machining.nFaceuse)
|
||||
end
|
||||
if OperationToInsert.Machining.nSCC then
|
||||
EgtSetMachiningParam( MCH_MP.SCC, OperationToInsert.Machining.nSCC)
|
||||
end
|
||||
if OperationToInsert.Machining.bToolInvert then
|
||||
EgtSetMachiningParam( MCH_MP.TOOLINVERT, OperationToInsert.Machining.bToolInvert)
|
||||
end
|
||||
if OperationToInsert.Machining.sBlockedAxis then
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, OperationToInsert.Machining.sBlockedAxis)
|
||||
end
|
||||
if OperationToInsert.Machining.sInitialAngles then
|
||||
EgtSetMachiningParam( MCH_MP.INITANGS, OperationToInsert.Machining.sInitialAngles)
|
||||
end
|
||||
if OperationToInsert.Machining.nHeadSide then
|
||||
EgtSetMachiningParam( MCH_MP.HEADSIDE, OperationToInsert.Machining.nHeadSide)
|
||||
end
|
||||
if OperationToInsert.Machining.nSubType then
|
||||
EgtSetMachiningParam( MCH_MP.SUBTYPE, OperationToInsert.Machining.nSubType)
|
||||
end
|
||||
if OperationToInsert.Machining.dOverlap then
|
||||
EgtSetMachiningParam( MCH_MP.OVERL, OperationToInsert.Machining.dOverlap)
|
||||
end
|
||||
|
||||
-- step
|
||||
if OperationToInsert.Machining.Steps then
|
||||
if OperationToInsert.Machining.Steps.dStepType then
|
||||
EgtSetMachiningParam( MCH_MP.STEPTYPE, OperationToInsert.Machining.Steps.dStepType)
|
||||
end
|
||||
if OperationToInsert.Machining.Steps.dStep then
|
||||
EgtSetMachiningParam( MCH_MP.STEP, OperationToInsert.Machining.Steps.dStep)
|
||||
end
|
||||
if OperationToInsert.Machining.Steps.dSideStep then
|
||||
EgtSetMachiningParam( MCH_MP.SIDESTEP, OperationToInsert.Machining.Steps.dSideStep)
|
||||
end
|
||||
end
|
||||
|
||||
if OperationToInsert.Machining.dStartPos then
|
||||
EgtSetMachiningParam( MCH_MP.STARTPOS, OperationToInsert.Machining.dStartPos)
|
||||
end
|
||||
if OperationToInsert.Machining.dReturnPos then
|
||||
EgtSetMachiningParam( MCH_MP.RETURNPOS, OperationToInsert.Machining.dReturnPos)
|
||||
end
|
||||
|
||||
if OperationToInsert.Machining.dRadialOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, OperationToInsert.Machining.dRadialOffset)
|
||||
end
|
||||
if OperationToInsert.Machining.dLongitudinalOffset then
|
||||
EgtSetMachiningParam( MCH_MP.OFFSL, OperationToInsert.Machining.dLongitudinalOffset)
|
||||
end
|
||||
|
||||
-- paraemtri attacco
|
||||
if OperationToInsert.Machining.LeadIn then
|
||||
if OperationToInsert.Machining.LeadIn.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADINTYPE, OperationToInsert.Machining.LeadIn.nType)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadIn.dStartAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, OperationToInsert.Machining.LeadIn.dStartAddLength)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadIn.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LITANG, OperationToInsert.Machining.LeadIn.dTangentDistance)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadIn.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LIPERP, OperationToInsert.Machining.LeadIn.dPerpDistance)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadIn.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LIELEV, OperationToInsert.Machining.LeadIn.dElevation)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadIn.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LICOMPLEN, OperationToInsert.Machining.LeadIn.dCompLength)
|
||||
end
|
||||
end
|
||||
-- parametri uscita
|
||||
if OperationToInsert.Machining.LeadOut then
|
||||
if OperationToInsert.Machining.LeadOut.nType then
|
||||
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, OperationToInsert.Machining.LeadOut.nType)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadOut.dEndAddLength then
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, OperationToInsert.Machining.LeadOut.dEndAddLength)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadOut.dTangentDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOTANG, OperationToInsert.Machining.LeadOut.dTangentDistance)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadOut.dPerpDistance then
|
||||
EgtSetMachiningParam( MCH_MP.LOPERP, OperationToInsert.Machining.LeadOut.dPerpDistance)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadOut.dElevation then
|
||||
EgtSetMachiningParam( MCH_MP.LOELEV, OperationToInsert.Machining.LeadOut.dElevation)
|
||||
end
|
||||
if OperationToInsert.Machining.LeadOut.dCompLength then
|
||||
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, OperationToInsert.Machining.LeadOut.dCompLength)
|
||||
end
|
||||
end
|
||||
|
||||
if OperationToInsert.Machining.dStartSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.STARTSLOWLEN, OperationToInsert.Machining.dStartSlowLen)
|
||||
end
|
||||
if OperationToInsert.Machining.dEndSlowLen then
|
||||
EgtSetMachiningParam( MCH_MP.ENDSLOWLEN, OperationToInsert.Machining.dEndSlowLen)
|
||||
end
|
||||
if OperationToInsert.Machining.dThrouAddLen then
|
||||
EgtSetMachiningParam( MCH_MP.THROUADDLEN, OperationToInsert.Machining.dThrouAddLen)
|
||||
end
|
||||
|
||||
-- parametri da settare nelle note di sistema
|
||||
-- TODO da decidere quali sono le note da salvare qui. Probabilmente tutte quelle relative all'ordine delle lavorazioni
|
||||
local sSystemNotes = EgtGetMachiningParam( MCH_MP.SYSNOTES)
|
||||
--if OperationToInsert.Machining.nMachiningOrder then
|
||||
-- sSystemNotes = EgtSetValInNotes( sSystemNotes, 'MachiningOrder', OperationToInsert.Machining.nMachiningOrder)
|
||||
--end
|
||||
EgtSetMachiningParam( MCH_MP.SYSNOTES, sSystemNotes)
|
||||
|
||||
-- parametri da settare nelle note utente
|
||||
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
|
||||
if OperationToInsert.Machining.dMaxElev then
|
||||
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', OperationToInsert.Machining.dMaxElev)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
||||
|
||||
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
|
||||
if not bIsApplyOk then
|
||||
bAreAllMachiningApplyOk = false
|
||||
nErr, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nOperationId, false)
|
||||
end
|
||||
return bIsApplyOk, sErr
|
||||
else
|
||||
return false, 'UNEXPECTED ERROR: Error on creating machining'
|
||||
end
|
||||
return bAreAllMachiningApplyOk, sErr
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+91
-83
@@ -199,9 +199,8 @@ end
|
||||
-- *** Inserimento delle lavorazioni nelle travi ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function CollectFeatures( Part)
|
||||
local function CollectFeatures( vProc, Part)
|
||||
-- recupero le feature
|
||||
local vPartProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = WinLib.GetAddGroup( Part.id)
|
||||
LayerId[2] = EgtGetFirstNameInGroup( Part.id or GDB_ID.NULL, 'Processings')
|
||||
@@ -249,10 +248,10 @@ local function CollectFeatures( Part)
|
||||
end
|
||||
|
||||
-- inserisco feature in lista
|
||||
table.insert( vPartProc, Proc)
|
||||
table.insert( vProc, Proc)
|
||||
else
|
||||
Proc.nFlg = 0
|
||||
table.insert( vPartProc, Proc)
|
||||
table.insert( vProc, Proc)
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)')
|
||||
end
|
||||
end
|
||||
@@ -260,7 +259,7 @@ local function CollectFeatures( Part)
|
||||
ProcId = EgtGetNext( ProcId)
|
||||
end
|
||||
end
|
||||
return vPartProc
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -279,10 +278,6 @@ local function GetFeatureInfoAndDependency( vProc, Part)
|
||||
return vProc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function OrderMachining( vProc, PARTS)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Ordina le feature in base a fase di lavorazione
|
||||
-- L'ordine è indicativamente:
|
||||
@@ -292,54 +287,57 @@ end
|
||||
-- 4) Profili Lati
|
||||
-- 5) Incontri/scontri
|
||||
-- TODO Ordinamento da fare
|
||||
local function OrderFeatures( vProc)
|
||||
local vProcToSort = vProc
|
||||
-- funzione di confronto. TRUE = B1 prima di B2. FALSE = B2 prima di B1
|
||||
local function CompareFeatures( B1, B2)
|
||||
-- se secondo disabilitato, va lasciato dopo
|
||||
if B1.nFlg ~= 0 and B2.nFlg == 0 then
|
||||
return true
|
||||
elseif B1.nPhase and B2.nPhase and B1.nPhase < B2.nPhase then
|
||||
return true
|
||||
elseif B1.nPhase and B2.nPhase and B2.nPhase < B1.nPhase then
|
||||
return true
|
||||
-- altrimenti si inverte
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
local function OrderMachining( MACHININGS)
|
||||
|
||||
-- test della funzione di ordinamento
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
EgtOutLog( ' CompareFeatures Test ')
|
||||
local bCompTest = true
|
||||
for i = 1, #vProcToSort do
|
||||
for j = i + 1, #vProcToSort do
|
||||
local bComp1 = CompareFeatures( vProcToSort[i], vProcToSort[j])
|
||||
local bComp2 = CompareFeatures( vProcToSort[j], vProcToSort[i])
|
||||
if bComp1 == bComp2 then
|
||||
bCompTest = false
|
||||
EgtOutLog( string.format( ' ProcId : %d vs %d --> ERROR', vProcToSort[i].id, vProcToSort[j].id))
|
||||
end
|
||||
end
|
||||
end
|
||||
if bCompTest then
|
||||
EgtOutLog( ' ALL OK')
|
||||
end
|
||||
end
|
||||
|
||||
-- eseguo ordinamento
|
||||
table.sort( vProcToSort, CompareFeatures)
|
||||
-- local vProcToSort = vProc
|
||||
-- -- funzione di confronto. TRUE = B1 prima di B2. FALSE = B2 prima di B1
|
||||
-- local function CompareFeatures( B1, B2)
|
||||
-- -- se secondo disabilitato, va lasciato dopo
|
||||
-- if B1.nFlg ~= 0 and B2.nFlg == 0 then
|
||||
-- return true
|
||||
-- elseif B1.nPhase and B2.nPhase and B1.nPhase < B2.nPhase then
|
||||
-- return true
|
||||
-- elseif B1.nPhase and B2.nPhase and B2.nPhase < B1.nPhase then
|
||||
-- return true
|
||||
-- -- altrimenti si inverte
|
||||
-- else
|
||||
-- return false
|
||||
-- end
|
||||
-- end
|
||||
|
||||
return vProcToSort
|
||||
-- -- test della funzione di ordinamento
|
||||
-- if EgtGetDebugLevel() >= 3 then
|
||||
-- EgtOutLog( ' CompareFeatures Test ')
|
||||
-- local bCompTest = true
|
||||
-- for i = 1, #vProcToSort do
|
||||
-- for j = i + 1, #vProcToSort do
|
||||
-- local bComp1 = CompareFeatures( vProcToSort[i], vProcToSort[j])
|
||||
-- local bComp2 = CompareFeatures( vProcToSort[j], vProcToSort[i])
|
||||
-- if bComp1 == bComp2 then
|
||||
-- bCompTest = false
|
||||
-- EgtOutLog( string.format( ' ProcId : %d vs %d --> ERROR', vProcToSort[i].id, vProcToSort[j].id))
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- if bCompTest then
|
||||
-- EgtOutLog( ' ALL OK')
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- -- eseguo ordinamento
|
||||
-- table.sort( vProcToSort, CompareFeatures)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- applica le lavorazioni
|
||||
local function AddMachinings( ProcPart, Part)
|
||||
local function AddMachinings( vProc, PARTS)
|
||||
local bMachiningOk = true
|
||||
for nFeatureIndex = 1, #ProcPart do
|
||||
local Proc = ProcPart[nFeatureIndex]
|
||||
for nFeatureIndex = 1, #vProc do
|
||||
local Proc = vProc[nFeatureIndex]
|
||||
local Part = PARTS[vProc[nFeatureIndex].nIndexPiece]
|
||||
if ID.IsDrilling( Proc) then
|
||||
bMachiningOk = Drilling.Make( Proc, Part)
|
||||
end
|
||||
@@ -364,8 +362,12 @@ local function AddMachinings( ProcPart, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function PrintFeatures( vProc, Part)
|
||||
EgtOutLog( ' RawBox=' .. tostring( Part.RawBox))
|
||||
local function PrintFeatures( vProc, PARTS)
|
||||
EgtOutLog( ' === PARTS ====')
|
||||
for i = 1, #PARTS do
|
||||
EgtOutLog( ' RawBox(' .. tostring( i) .. ') =' .. tostring( PARTS[i].RawBox))
|
||||
end
|
||||
EgtOutLog( ' === FEATURES ====')
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
local sOut = string.format( 'Id=%3d Flg=%2d Type=%s', Proc.id, Proc.nFlg, Proc.sType)
|
||||
@@ -378,45 +380,51 @@ function WinExec.ProcessFeatures( PARTS)
|
||||
-- ciclo sui pezzi
|
||||
local nTotErr = 0
|
||||
local Stats = {}
|
||||
local nOrd = 1
|
||||
local Part = {}
|
||||
|
||||
local vProc = {}
|
||||
MACHININGS = {}
|
||||
|
||||
-- si recuperano tutte le feature di tutti i pezzi in una lista unica
|
||||
for nPart = 1, #PARTS do
|
||||
-- lista contenente le feature da eseguire
|
||||
|
||||
-- recupero le feature di lavorazione della trave
|
||||
table.insert( vProc, CollectFeatures( PARTS[nPart]))
|
||||
|
||||
vProc = CollectFeatures( vProc, PARTS[nPart])
|
||||
|
||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||
vProc[nPart] = GetFeatureInfoAndDependency( vProc[nPart], PARTS[nPart])
|
||||
|
||||
-- debug
|
||||
if EgtGetDebugLevel() >= 1 then
|
||||
PrintFeatures( vProc[nPart], PARTS[nPart])
|
||||
end
|
||||
|
||||
-- ordino le features
|
||||
vProc[nPart] = OrderFeatures( vProc[nPart])
|
||||
|
||||
EgtOutLog( ' *** AddMachinings ***', 1)
|
||||
|
||||
-- TODO da fare
|
||||
MACHININGS = {}
|
||||
-- esegue le strategie migliori che ha precedentemente scelto e salva le lavorazioni nella lista globale
|
||||
AddMachinings( vProc[nPart], PARTS[nPart])
|
||||
|
||||
|
||||
EgtOutLog( ' *** End AddMachinings ***', 1)
|
||||
-- passo al grezzo successivo
|
||||
nOrd = nOrd + 1
|
||||
vProc = GetFeatureInfoAndDependency( vProc, PARTS[nPart])
|
||||
end
|
||||
|
||||
OrderMachining( vProc, PARTS)
|
||||
-- debug
|
||||
if EgtGetDebugLevel() >= 1 then
|
||||
PrintFeatures( vProc, PARTS)
|
||||
end
|
||||
|
||||
EgtOutLog( ' *** AddMachinings ***', 1)
|
||||
|
||||
-- esegue le lavorazioni e le salva in lista
|
||||
AddMachinings( vProc, PARTS)
|
||||
|
||||
-- ordina le lavorazioni
|
||||
OrderMachining( MACHININGS)
|
||||
|
||||
-- scrivo lavorazioni prima fase
|
||||
EgtSetCurrPhase( 1)
|
||||
for i = 1, #MACHININGS do
|
||||
if MACHININGS[i].AuxInfo.nPhase == 1 then
|
||||
-- aggiunge effettivamente la lavorazione
|
||||
MachiningLib.AddOperation( MACHININGS[i])
|
||||
end
|
||||
end
|
||||
|
||||
-- scrivo lavorazioni prima fase
|
||||
EgtSetCurrPhase( 2)
|
||||
for i = 1, #MACHININGS do
|
||||
if MACHININGS[i].AuxInfo.nPhase == 2 then
|
||||
-- aggiunge effettivamente la lavorazione
|
||||
MachiningLib.AddOperation( MACHININGS[i])
|
||||
end
|
||||
end
|
||||
|
||||
EgtOutLog( ' *** End AddMachinings ***', 1)
|
||||
|
||||
-- aggiunge effettivamente le lavorazioni
|
||||
MachiningLib.AddOperations( vProc, PARTS)
|
||||
|
||||
-- Aggiornamento finale di tutto
|
||||
EgtSetCurrPhase( 1)
|
||||
local bApplOk, sApplErrors, sApplWarns = EgtApplyAllMachinings()
|
||||
|
||||
@@ -102,7 +102,8 @@ local function MyProcessInputData()
|
||||
for i = 1, #PARTS do
|
||||
PARTS[i].b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Solid') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].b3FinishedPiece = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo') or GDB_ID.NULL, GDB_BB.STANDARD)
|
||||
PARTS[i].frame = EgtFR( EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo'), 'Frame'))
|
||||
local idFrame = EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo'), 'AuxFrame') or EgtGetFirstNameInGroup( EgtGetFirstNameInGroup( PARTS[i].id, 'Geo'), 'Frame')
|
||||
PARTS[i].frame = EgtFR( idFrame)
|
||||
sOut = sOut .. PARTS[i].sName .. ', '
|
||||
end
|
||||
sOut = sOut:sub( 1, -3)
|
||||
|
||||
@@ -17,14 +17,15 @@ EgtMdbSave()
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function Profiling.Make( Proc, Part)
|
||||
local ToolInfo = {}
|
||||
local Machining = {}
|
||||
Machining.LeadIn = {}
|
||||
Machining.LeadOut = {}
|
||||
Machining.Steps = {}
|
||||
|
||||
-- se so che utensili utilizzare, associazione diretta
|
||||
if Proc.nToolsToUse then
|
||||
for i = 1, Proc.nToolsToUse do
|
||||
local Machining = {}
|
||||
local AuxInfo = {}
|
||||
Machining.LeadIn = {}
|
||||
Machining.LeadOut = {}
|
||||
Machining.Steps = {}
|
||||
local ToolSearchParameters = {}
|
||||
ToolSearchParameters.sName = Proc.Tools[i].sName
|
||||
ToolSearchParameters.dElevation = 0
|
||||
@@ -44,7 +45,8 @@ function Profiling.Make( Proc, Part)
|
||||
Machining.LeadOut.dTangentDistance = TOOLS[ToolInfo.nToolIndex].dDiameter
|
||||
Machining.LeadOut.dPerpDistance = 0
|
||||
Machining.Geometry = Proc.id
|
||||
MachiningLib.AddNewMachining( Proc, Machining)
|
||||
AuxInfo.nPhase = MachiningLib.GetPhaseMach( Proc)
|
||||
MachiningLib.AddNewMachining( Proc, Machining, AuxInfo)
|
||||
else
|
||||
return false, 'Tool not found'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user