Compare commits

...

4 Commits

Author SHA1 Message Date
andrea.villa 7a64a68167 Corretto controllo esistenza lavorazione saltate 2024-12-02 08:53:25 +01:00
andrea.villa 2e086f9f42 Merge branch 'develop' into MachiningMultiDrill 2024-11-28 12:40:45 +01:00
andrea.villa c7e8c63f37 - Gestione Aggregati con forature multiple
- Aggiunto nuovo tipo di lavorazione: MultiDrill
- Aggiunto parametro USE_MULTI_DRILL da mettere nel BeamData per abilitare la gestione
2024-11-28 12:01:30 +01:00
andrea.villa 2311ab4614 Raggruppamento fori simili in un'unica lavorazione 2024-11-27 09:23:36 +01:00
3 changed files with 96 additions and 38 deletions
+43 -23
View File
@@ -362,7 +362,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
-- se foro -- se foro
if Drill.Identify( Proc) then if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento) -- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw) Proc.Diam, Proc.Len, Proc.Fcs, Proc.Fce, Proc.vtDrillDir = Drill.GetData( Proc, b3Raw)
-- verifico se devo inserire i prefori -- verifico se devo inserire i prefori
if Drill.IsPredrillNeeded( Proc) then if Drill.IsPredrillNeeded( Proc) then
local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc) local bAddProc, PredrillProc= Drill.AddPredrillFromDrillProc( Proc)
@@ -391,6 +391,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH)
Proc2.Fcs = Proc.Fce Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs Proc2.Fce = Proc.Fcs
Proc2.vtDrillDir = -Proc.vtDrillDir
Proc2.CutId = Proc.CutId Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId Proc2.TaskId = Proc.TaskId
Proc2.AdjId = Proc.AdjId Proc2.AdjId = Proc.AdjId
@@ -1119,7 +1120,7 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
end end
-- se senza geometria (già disabilitato) -- se senza geometria (già disabilitato)
if Proc.Flg == 0 and not Proc.Double then if Proc.Flg == 0 and not Proc.Double and not Proc.bGrouped then
bOk = false bOk = false
-- se intestatura -- se intestatura
elseif Hcut.Identify( Proc) then elseif Hcut.Identify( Proc) then
@@ -1352,7 +1353,8 @@ local function AddFeatureMachining( Proc, nPhase, nRawId, nPartId, dCurrOvmH, bN
-- se foratura ( 3/4-040-X) -- se foratura ( 3/4-040-X)
elseif Drill.Identify( Proc) then elseif Drill.Identify( Proc) then
-- esecuzione foratura -- esecuzione foratura
bOk, sErr = Drill.Make( Proc, nPhase, nRawId, nPartId) local bUseMultiDrill = BD.USE_MULTI_DRILL
bOk, sErr = Drill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill)
-- se giunzione francese ( 1/2-035-X) -- se giunzione francese ( 1/2-035-X)
elseif FrenchRidgeLap.Identify( Proc) then elseif FrenchRidgeLap.Identify( Proc) then
-- esecuzione giunzione francese -- esecuzione giunzione francese
@@ -2024,26 +2026,44 @@ function GetFeatureInfoAndDependency( vProc, b3Raw)
-- controllo la feature con tutte le altre per recuperare le dipendenze -- controllo la feature con tutte le altre per recuperare le dipendenze
for j = 1, #vProc do for j = 1, #vProc do
local ProcB = vProc[j] local ProcB = vProc[j]
-- verifico se feature tipo LapJoint è attraversata da almeno un foro -- se non è la stessa feature
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then if Proc.Id ~= ProcB.Id then
Proc.PassedByHole = true -- verifico se feature tipo LapJoint è attraversata da almeno un foro
ProcB.Dependency = {} if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
ProcB.Dependency.ExecBefore = Proc Proc.PassedByHole = true
end ProcB.Dependency = {}
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine ProcB.Dependency.ExecBefore = Proc
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then end
Proc.PassedByDtMortise = true -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
end if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
-- se tenone è attraversato da foro allora il foro deve essere fatto prima Proc.PassedByDtMortise = true
if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then end
Proc.PassedByHole = true -- se tenone è attraversato da foro allora il foro deve essere fatto prima
end if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
-- verifiche per specchiature Proc.PassedByHole = true
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then end
-- forature -- verifiche per specchiature
if BD.DOUBLE_HEAD_DRILLING and Drill.Identify( Proc) and Drill.Identify( ProcB) and not Proc.Mirror then if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then
if AreDrillingsMirrored( Proc, ProcB, b3Raw) then -- forature
Proc.Mirror = ProcB if BD.DOUBLE_HEAD_DRILLING and Drill.Identify( Proc) and Drill.Identify( ProcB) and not Proc.Mirror then
if AreDrillingsMirrored( Proc, ProcB, b3Raw) then
Proc.Mirror = ProcB
end
end
end
-- raggruppamento fori appartenenti allo stesso spezzone di trave
if Drill.Identify( Proc) and Proc.Flg ~= 0 and Drill.Identify( ProcB) and ProcB.Flg ~= 0 then
local dDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or BD.LONGCUT_ENDLEN/3, BD.DRILL_RANGE or BD.LONGCUT_ENDLEN)
local nXSegmentProc = ceil( ( Proc.Box:getCenter():getX() - b3Raw:getMin():getX()) / dDrillRange)
local nXSegmentProcB = ceil( ( ProcB.Box:getCenter():getX() - b3Raw:getMin():getX()) / dDrillRange)
-- se fanno parte dello stesso spezzone, scrivo info geometria nella prima e disattivo la seconda
if nXSegmentProc == nXSegmentProcB and Proc.Diam == ProcB.Diam and AreSameVectorApprox( Proc.vtDrillDir, ProcB.vtDrillDir) then
if not Proc.OtherGeometries then
Proc.OtherGeometries = {}
end
table.insert( Proc.OtherGeometries, ProcB)
ProcB.Flg = 0
ProcB.bGrouped = true
end end
end end
end end
+7 -4
View File
@@ -214,7 +214,7 @@ function GetMachinings( MachiningType, sType)
Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
end end
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
if EgtStartsWith( Machining.Type, 'Drill') then if EgtStartsWith( Machining.Type, 'Drill') or EgtStartsWith( Machining.Type, 'MultiDrill') then
Machining.SubType = 'Drill' Machining.SubType = 'Drill'
elseif EgtStartsWith( Machining.Type, 'AngleDrill') then elseif EgtStartsWith( Machining.Type, 'AngleDrill') then
Machining.SubType = 'AngleDrill' Machining.SubType = 'AngleDrill'
@@ -297,7 +297,7 @@ end
function ReturnParams( MachiningType, MachiningName, sType, ToolParams) function ReturnParams( MachiningType, MachiningName, sType, ToolParams)
if MachiningType == MCH_MY.DRILLING then if MachiningType == MCH_MY.DRILLING then
local _, sOrigType = EgtEndsWith( sType, '_H2') local _, sOrigType = EgtEndsWith( sType, '_H2')
return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen return MachiningName, sType, EgtIf( sOrigType == 'Drill' or sOrigType == 'MultiDrill' or sOrigType == 'Drill_AT' or sOrigType == 'AngleDrill' or sOrigType == 'Predrill' , ToolParams.TMaxMat, ToolParams.TMaxDepth), ToolParams.MaxToolLength, ToolParams.ToolDiam, ToolParams.DiamTh, ToolParams.FreeLen
elseif MachiningType == MCH_MY.SAWING then elseif MachiningType == MCH_MY.SAWING then
return MachiningName, ToolParams.H2 return MachiningName, ToolParams.H2
elseif MachiningType == MCH_MY.MILLING then elseif MachiningType == MCH_MY.MILLING then
@@ -455,10 +455,13 @@ function MachiningLib.FindCutting( sType, bTopHead, bDownHead)
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill) function MachiningLib.FindDrilling( dDiam, dDepth, bTopHead, bDownHead, bExcludeH2, bAngleTransmission, bIsPredrill, bIsMultidrill)
local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach local MachiningName, MachiningType, Param1, Param2, Param3, Param4, Param5, sTypeMach
-- se la macchina ha gruppi a forare, si prova con quelli
if bIsMultidrill then
sTypeMach = 'MultiDrill'
-- se il foro è un predrill, cerco solo punte abilitate al Predrill -- se il foro è un predrill, cerco solo punte abilitate al Predrill
if bIsPredrill then elseif bIsPredrill then
sTypeMach = 'Predrill' sTypeMach = 'Predrill'
else else
sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill') sTypeMach = EgtIf( bAngleTransmission, 'Drill_AT', 'Drill')
+44 -9
View File
@@ -102,8 +102,8 @@ end
function ProcessDrill.GetData( Proc, b3Raw) function ProcessDrill.GetData( Proc, b3Raw)
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
-- verifico se foro da adattare -- verifico se foro da adattare
local nNewAuxId
if EgtExistsInfo( Proc.Id, 'DiamUser') then if EgtExistsInfo( Proc.Id, 'DiamUser') then
local nNewAuxId
if AuxId then nNewAuxId = AuxId + Proc.Id end if AuxId then nNewAuxId = AuxId + Proc.Id end
if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then if AuxId and EgtGetType( nNewAuxId) == GDB_TY.CRV_ARC and BD.USER_HOLE_DIAM and BD.USER_HOLE_DIAM > 1 then
EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2) EgtModifyArcRadius( nNewAuxId, BD.USER_HOLE_DIAM / 2)
@@ -115,7 +115,13 @@ function ProcessDrill.GetData( Proc, b3Raw)
-- recupero faccia di entrata e uscita -- recupero faccia di entrata e uscita
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0 local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0 local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
return dDiam, dLen, nFcs, nFce
local vtDrillDir
if AuxId then
nNewAuxId = AuxId + Proc.Id
vtDrillDir = EgtCurveExtrusion( nNewAuxId, GDB_RT.GLOB)
end
return dDiam, dLen, nFcs, nFce, vtDrillDir
end end
--------------------------------------------------------------------- ---------------------------------------------------------------------
@@ -314,7 +320,7 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Applicazione della lavorazione -- Applicazione della lavorazione
function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, bUseMultiDrill)
-- default per costanti -- default per costanti
BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928) BD.DRILL_VX_MAX_ANGLEDRILL = ( BD.DRILL_VX_MAX_ANGLEDRILL or 0.928)
-- ingombro del pezzo -- ingombro del pezzo
@@ -387,9 +393,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
end end
-- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante -- primo gruppo di controlli con lunghezza utensile pari a metà foro se passante
-- recupero la lavorazione -- recupero la lavorazione
local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) local sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, dCheckDepth, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill)
if not sDrilling and dCheckDepth then if not sDrilling and dCheckDepth then
sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill) sDrilling, sType, dMaxDepth, dMaxToolLength, dToolDiam, dDiamTh, dToolFreeLen = ML.FindDrilling( dDiam, 0, bDrillUp, bDrillDown, bExcludeH2, bDrillAngTrasm, Proc.IsPredrill, bUseMultiDrill)
if sDrilling then dCheckDepth = nil end if sDrilling then dCheckDepth = nil end
end end
if not sDrilling then if not sDrilling then
@@ -554,16 +560,33 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
return false, sErr return false, sErr
end end
-- aggiungo geometria -- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}}) if Proc.SkippedGeometries and #Proc.SkippedGeometries > 0 then
EgtSetMachiningGeometry( Proc.SkippedGeometries)
Proc.SkippedGeometries = nil
elseif Proc.OtherGeometries and #Proc.OtherGeometries > 0 then
local HolesGeometries = {}
-- aggiungo foro principale
table.insert( HolesGeometries, { AuxId, -1})
-- aggiungo altre geometrie connesse
for i = 1, #Proc.OtherGeometries do
-- recupero geometria da lavorare
local OtherAuxId = Proc.OtherGeometries[i].Id + EgtGetInfo( Proc.OtherGeometries[i].Id, 'AUXID', 'i')
local Geometry = { OtherAuxId, -1}
table.insert( HolesGeometries, Geometry)
end
EgtSetMachiningGeometry( HolesGeometries)
else
EgtSetMachiningGeometry( {{ AuxId, -1}})
end
-- eventuale inversione -- eventuale inversione
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'Drill_AT' or sType == 'AngleDrill' or sType == 'Predrill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert) EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert) EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end end
-- imposto posizione braccio porta testa -- imposto posizione braccio porta testa
local nSCC = MCH_SCC.NONE local nSCC = MCH_SCC.NONE
if bDrillAngTrasm then if bDrillAngTrasm or bUseMultiDrill then
nSCC = MCH_SCC.ADIR_NEAR nSCC = MCH_SCC.ADIR_NEAR
elseif not BD.C_SIMM and not BD.TURN then elseif not BD.C_SIMM and not BD.TURN then
nSCC = MCH_SCC.ADIR_YM nSCC = MCH_SCC.ADIR_YM
@@ -623,13 +646,25 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
-- eseguo -- eseguo
local bOk = ML.ApplyMachining( true, false) local bOk = ML.ApplyMachining( true, false)
if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then if not bOk and bDownDrill and bOpen and abs( Proc.Flg) == 1 then
if sType == 'Drill' or sType == 'Drill_H2' or sType == 'AngleDrill' then if sType == 'Drill' or sType == 'MultiDrill' or sType == 'Drill_H2' or sType == 'AngleDrill' then
EgtSetMachiningParam( MCH_MP.INVERT, true) EgtSetMachiningParam( MCH_MP.INVERT, true)
else else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
end end
bOk = ML.ApplyMachining( true, false) bOk = ML.ApplyMachining( true, false)
end end
-- in caso di fori raggruppati, mi faccio restituire gli eventuali fori saltati
local SkippedGeometries = {}
SkippedGeometries = EgtGetMachiningSkippedGeometry()
if SkippedGeometries and #SkippedGeometries > 0 and bUseMultiDrill then
if #SkippedGeometries == #Proc.OtherGeometries + 1 then
EgtRemoveOperation( nMchId)
end
Proc.SkippedGeometries = SkippedGeometries
ProcessDrill.Make( Proc, nPhase, nRawId, nPartId, false)
end
if not bOk then if not bOk then
local _, sErr = EgtGetLastMachMgrError() local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false) EgtSetOperationMode( nMchId, false)