DataBeam: - primo implemento modifiche per forature in testa o coda per considerare materiale eventualmente già rimosso da lavorazioni precedenti
This commit is contained in:
+53
-4
@@ -224,13 +224,22 @@ local function IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
return false
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function IsFeatureCuttingEntireSection( b3Proc, dRawW, dRawH)
|
||||
return ((abs(b3Proc:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or b3Proc:getDimY() > dRawW) and (abs(b3Proc:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or b3Proc:getDimZ() > dRawH))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
local dRawW = b3Raw:getDimY()
|
||||
local dRawH = b3Raw:getDimZ()
|
||||
-- recupero le feature
|
||||
local vProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = BL.GetAddGroup( PartId)
|
||||
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
|
||||
local nMachineBeforeIntersectingDrillingsIdHead, dMachineBeforeIntersectingDrillingsXHead, nMachineBeforeIntersectingDrillingsIdTail, dMachineBeforeIntersectingDrillingsXTail = nil, GEO.INFINITO, nil, -GEO.INFINITO
|
||||
local b3MachineBeforeIntersectingDrillingsBoxHead, b3MachineBeforeIntersectingDrillingsBoxTail = nil, nil
|
||||
for nInd = 1, 2 do
|
||||
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
|
||||
while ProcId do
|
||||
@@ -258,6 +267,17 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
Proc.Head = IsHeadFeature( Proc, b3Raw, dCurrOvmH)
|
||||
Proc.Tail, Proc.AdvTail = IsTailFeature( Proc, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
if Proc.Fct == 1 and IsFeatureCuttingEntireSection( Proc.Box , dRawW, dRawH) and ( Proc.Head or Proc.Tail) and Proc.Prc ~= 340 and Proc.Prc ~= 350 then
|
||||
if Proc.Head and Proc.Box:getCenter():getX() < dMachineBeforeIntersectingDrillingsXHead then
|
||||
dMachineBeforeIntersectingDrillingsXHead = Proc.Box:getCenter():getX()
|
||||
nMachineBeforeIntersectingDrillingsIdHead = Proc.Id
|
||||
b3MachineBeforeIntersectingDrillingsBoxHead = Proc.Box
|
||||
elseif Proc.Tail and Proc.Box:getCenter():getX() > dMachineBeforeIntersectingDrillingsXTail then
|
||||
dMachineBeforeIntersectingDrillingsXTail = Proc.Box:getCenter():getX()
|
||||
nMachineBeforeIntersectingDrillingsIdTail = Proc.Id
|
||||
b3MachineBeforeIntersectingDrillingsBoxTail = Proc.Box
|
||||
end
|
||||
end
|
||||
table.insert( vProc, Proc)
|
||||
-- se foro
|
||||
if Drill.Identify( Proc) then
|
||||
@@ -308,7 +328,11 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
ProcId = EgtGetNext( ProcId)
|
||||
end
|
||||
end
|
||||
return vProc
|
||||
local vMachineBeforeIntersectingDrillings = {
|
||||
Head = { Id = nMachineBeforeIntersectingDrillingsIdHead, Box = b3MachineBeforeIntersectingDrillingsBoxHead},
|
||||
Tail = { Id = nMachineBeforeIntersectingDrillingsIdTail, Box = b3MachineBeforeIntersectingDrillingsBoxTail}
|
||||
}
|
||||
return vProc, vMachineBeforeIntersectingDrillings
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
@@ -328,7 +352,7 @@ local function AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
end
|
||||
if Proc.Head and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 340 then
|
||||
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
|
||||
bHeadFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
|
||||
bHeadFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
|
||||
end
|
||||
end
|
||||
return bHeadFinishingNeeded, nReplacedFeatureId
|
||||
@@ -351,7 +375,7 @@ local function AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
|
||||
end
|
||||
if Proc.Tail and Proc.Id ~= nReplacedFeatureId and Proc.Prc ~= 350 then
|
||||
-- controllo se la feature taglia l'intera sezione; in caso positivo la finitura non è necessaria
|
||||
bTailFinishingNeeded = not ((abs(Proc.Box:getDimY() - dRawW) < 10 * GEO.EPS_SMALL or Proc.Box:getDimY() > dRawW) and (abs(Proc.Box:getDimZ() - dRawH) < 10 * GEO.EPS_SMALL or Proc.Box:getDimZ() > dRawH))
|
||||
bTailFinishingNeeded = not IsFeatureCuttingEntireSection( Proc.Box, dRawW, dRawH)
|
||||
end
|
||||
end
|
||||
return bTailFinishingNeeded, nReplacedFeatureId
|
||||
@@ -853,12 +877,18 @@ local function ClassifyFeatures( vProc, b3Raw, Stats)
|
||||
local bSplitRot = false
|
||||
local nHeading
|
||||
local nSplitting
|
||||
local vMachineBeforeIntersectingDrillingsId = {}
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
local bOk = true
|
||||
local bDown = false
|
||||
local bSide = false
|
||||
local bDownSideOnHeadOk = false
|
||||
|
||||
if Proc.MachineBeforeIntersectingDrillings then
|
||||
table.Insert ( vMachineBeforeIntersectingDrillingsId, Proc.Id)
|
||||
end
|
||||
|
||||
-- se senza geometria (già disabilitato
|
||||
if Proc.Flg == 0 then
|
||||
bOk = false
|
||||
@@ -1275,6 +1305,23 @@ local function MoveDrillsOnTenon( vProc)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||
for i = 1, #vProc do
|
||||
if Drill.Identify( vProc[i]) then
|
||||
-- se esiste intersezione tra il foro e la feature di testa
|
||||
if vMachineBeforeIntersectingDrillings.Head.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Head.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
|
||||
vMachineBeforeIntersectingDrillings.Head.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
|
||||
-- se esiste intersezione tra il foro e la feature di coda
|
||||
elseif vMachineBeforeIntersectingDrillings.Tail.Box and vProc[i].Box:getMin():getX() < vMachineBeforeIntersectingDrillings.Tail.Box:getMax():getX() + 100 * GEO.EPS_SMALL and
|
||||
vMachineBeforeIntersectingDrillings.Tail.Box:getMin():getX() < vProc[i].Box:getMax():getX() + 100 * GEO.EPS_SMALL then
|
||||
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.ProcessFeatures()
|
||||
-- verifica se possibile rotazione di 90 gradi
|
||||
@@ -1304,7 +1351,9 @@ function BeamExec.ProcessFeatures()
|
||||
local dCurrOvmH = EgtGetInfo( nRawId, 'HOVM', 'd') or 0
|
||||
local dCurrOvmT = EgtGetInfo( nRawId, 'TOVM', 'd') or 0
|
||||
-- recupero le feature di lavorazione della trave
|
||||
local vProc = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
local vProc, vMachineBeforeIntersectingDrillings = CollectFeatures( nPartId, b3Raw, dCurrOvmH, dCurrOvmT)
|
||||
-- verifica presenza forature da spostare dopo le lavorazioni di testa o coda
|
||||
SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeIntersectingDrillings)
|
||||
-- le ordino lungo X
|
||||
OrderFeatures( vProc, b3Raw)
|
||||
-- le classifico
|
||||
|
||||
@@ -394,6 +394,17 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId)
|
||||
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
|
||||
-- aggiusto l'affondamento
|
||||
local sMyWarn
|
||||
|
||||
-- test
|
||||
if Proc.MachineAfterHeadCutId then
|
||||
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
|
||||
local dMoveDistance, ptPointOnSurface = EgtPointSurfTmDist( ptCen, Proc.MachineAfterHeadCutId, GDB_RT.GLOB)
|
||||
local vtMove = -vtExtr * dMoveDistance
|
||||
EgtMove( AuxId, vtMove, GDB_RT.GLOB)
|
||||
EgtModifyCurveThickness( Proc.MachineAfterHeadCutId, dLen - dMoveDistance)
|
||||
end
|
||||
-- fine test
|
||||
|
||||
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dDepth, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||
dDepth = dMaxDepth
|
||||
|
||||
Reference in New Issue
Block a user