|
|
|
@@ -576,11 +576,6 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
|
|
|
|
|
-- salvo nota con lunghezza grezzo
|
|
|
|
|
-- Recupero l'identificativo del gruppo di lavoro corrente
|
|
|
|
|
local nMGrpId = EgtGetCurrMachGroup()
|
|
|
|
|
-- Lunghezza della barra
|
|
|
|
|
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
|
|
|
|
|
if not dBarLen then
|
|
|
|
|
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Area tavola
|
|
|
|
|
local b3Tab = EgtGetTableArea()
|
|
|
|
@@ -592,6 +587,18 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
|
|
|
|
|
-- Impostazione dell'attrezzaggio di default
|
|
|
|
|
EgtImportSetup()
|
|
|
|
|
|
|
|
|
|
-- se pretagli di coda sono attivi, aumento di 10mm la lunghezza del grezzo per fare effettivamente tagliare del materiale.
|
|
|
|
|
-- Altrimenti le lavorazioni pensano di essere nel vuoto e si muovono in rapido
|
|
|
|
|
if BD.PRECUT_TAIL and VerifyBigSectionCut( dRawW, dRawH) then
|
|
|
|
|
dRawL = dRawL + 10
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Lunghezza della barra
|
|
|
|
|
local dBarLen = EgtGetInfo( nMGrpId, 'BARLEN', 'd')
|
|
|
|
|
if not dBarLen then
|
|
|
|
|
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Inserimento dei pezzi con il loro grezzo
|
|
|
|
|
local Cnt = 0
|
|
|
|
|
local Len = dRawL
|
|
|
|
@@ -617,12 +624,16 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, b
|
|
|
|
|
local vProc = CollectFeatures( Pz, b3Solid, 0)
|
|
|
|
|
local bSFinishingNeeded, nReplacedHeadCutFeatureId, nHeadCuttingFeatureId = AnalyzeHeadFeatures( b3Solid, vProc, dRawW, dRawH)
|
|
|
|
|
local bEFinishingNeeded, nReplacedTailCutFeatureId, nTailCuttingFeatureId = AnalyzeTailFeatures( b3Solid, vProc, dRawW, dRawH)
|
|
|
|
|
-- Scrivo gli di delle facce di taglio custom: serviranno dopo per calcolare l'elevazione rispetto a queste
|
|
|
|
|
-- Scrivo gli id delle facce di taglio custom: serviranno dopo per calcolare l'elevazione rispetto a queste
|
|
|
|
|
if nHeadCuttingFeatureId then
|
|
|
|
|
EgtSetInfo( vBeam[i].Id, 'HEADCUTFEATUREID', nHeadCuttingFeatureId)
|
|
|
|
|
else
|
|
|
|
|
EgtRemoveInfo( vBeam[i].Id, 'HEADCUTFEATUREID')
|
|
|
|
|
end
|
|
|
|
|
if nTailCuttingFeatureId then
|
|
|
|
|
EgtSetInfo( vBeam[i].Id, 'TAILCUTFEATUREID', nTailCuttingFeatureId)
|
|
|
|
|
else
|
|
|
|
|
EgtRemoveInfo( vBeam[i].Id, 'TAILCUTFEATUREID')
|
|
|
|
|
end
|
|
|
|
|
if bBigSectionCut then
|
|
|
|
|
-- lascio in coda solo il materiale necessario; il resto verrà tolto nell'head cut successivo
|
|
|
|
@@ -870,6 +881,45 @@ local function ReorderTruncatingCuts( vProc, nPartId)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
-- mi assicuro che vengano rispettate le dipendenze tra le feature
|
|
|
|
|
local function ReorderFeatureWithDependency( vProc)
|
|
|
|
|
-- si riordina considerando le dipendenze con alcuni limiti:
|
|
|
|
|
-- * se ci sono dipendenze incrociate il risultato finale non è controllato ( A->B e B->C e C->A)
|
|
|
|
|
-- * se ci sono dipendenze opposte va in errore ( A->B e B->A)
|
|
|
|
|
|
|
|
|
|
-- si sistemano le feature da lavorare prima
|
|
|
|
|
local i = 1
|
|
|
|
|
local nMaxIter = ( #vProc * #vProc) + 1
|
|
|
|
|
local nIter = 0
|
|
|
|
|
while i <= #vProc do
|
|
|
|
|
nIter = nIter + 1
|
|
|
|
|
if nIter > nMaxIter then
|
|
|
|
|
error( "UNEXPECTED ERROR ON DEPENDENCY")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- si controllano solo i fori
|
|
|
|
|
if Drill.Identify( vProc[i]) and vProc[i].Dependency and vProc[i].Dependency.ExecBefore and vProc[i].Dependency.ExecBefore.Id then
|
|
|
|
|
local nRefId = vProc[i].Dependency.ExecBefore.Id
|
|
|
|
|
local nRefIndex
|
|
|
|
|
|
|
|
|
|
for j = 1, #vProc do
|
|
|
|
|
if i ~= j and vProc[j].Id == nRefId then
|
|
|
|
|
nRefIndex = j
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- se il processo deve stare prima, ma ora è dopo
|
|
|
|
|
if nRefIndex and nRefIndex < i then
|
|
|
|
|
table.insert( vProc, nRefIndex, table.remove( vProc, i))
|
|
|
|
|
i = max( nRefIndex - 1, 1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
i = i + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function OrderFeatures( vProc, b3Raw, nPartId)
|
|
|
|
|
|
|
|
|
@@ -899,6 +949,13 @@ local function OrderFeatures( vProc, b3Raw, nPartId)
|
|
|
|
|
if Hcut.Identify( B2) then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- se uno dipende dall'altro
|
|
|
|
|
if B1.Dependency and B1.Dependency.ExecBefore and B1.Dependency.ExecBefore.Id == B2.Id then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
if B2.Dependency and B2.Dependency.ExecBefore and B2.Dependency.ExecBefore.Id == B1.Id then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- se uno di testa e non l'altro, privilegio quello di testa (a meno che non siano dei fori)
|
|
|
|
|
if B1.Head ~= B2.Head and not Drill.Identify(B1) and not Drill.Identify(B2) then
|
|
|
|
|
return B1.Head
|
|
|
|
@@ -1192,6 +1249,9 @@ local function OrderFeatures( vProc, b3Raw, nPartId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ReorderTruncatingCuts( vProc, nPartId)
|
|
|
|
|
|
|
|
|
|
-- si riverificano feature con dipendenze
|
|
|
|
|
ReorderFeatureWithDependency( vProc)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
@@ -2036,14 +2096,18 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt
|
|
|
|
|
if vDistHead and #vDistHead > 0 then
|
|
|
|
|
-- verifico che il foro sia di testa
|
|
|
|
|
if ( bOpen or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fce ~= 0)) then
|
|
|
|
|
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
|
|
|
|
|
if vProc[i].Dependency and vProc[i].Dependency.ExecAfter and vProc[i].Dependency.ExecAfter.Id == vMachineBeforeIntersectingDrillings.Head.Id then
|
|
|
|
|
vProc[i].MachineAfterHeadCutId = vMachineBeforeIntersectingDrillings.Head.Id
|
|
|
|
|
end
|
|
|
|
|
vProc[i].Head = true
|
|
|
|
|
end
|
|
|
|
|
-- se esiste intersezione tra il foro e la feature di coda
|
|
|
|
|
elseif vDistTail and #vDistTail > 0 then
|
|
|
|
|
-- verifico che il foro sia di coda
|
|
|
|
|
if ( bOpen or ( not bOpen and vtExtr:getX() < 0 and vProc[i].Fcs ~= 0) or ( not bOpen and vtExtr:getX() > 0 and vProc[i].Fce ~= 0)) then
|
|
|
|
|
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
|
|
|
|
|
if vProc[i].Dependency and vProc[i].Dependency.ExecAfter and vProc[i].Dependency.ExecAfter.Id == vMachineBeforeIntersectingDrillings.Tail.Id then
|
|
|
|
|
vProc[i].MachineAfterTailCutId = vMachineBeforeIntersectingDrillings.Tail.Id
|
|
|
|
|
end
|
|
|
|
|
vProc[i].Tail = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@@ -2051,6 +2115,7 @@ local function SetDrillingsToMachineAfterHeadOrTailCut( vProc, vMachineBeforeInt
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function AreDrillingsMirrored( Proc, ProcMirror, b3Raw)
|
|
|
|
|
if Proc.Id == ProcMirror.Id then return false end
|
|
|
|
@@ -2117,63 +2182,103 @@ end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
function GetFeatureInfoAndDependency( vProc, b3Raw, nPartId)
|
|
|
|
|
-- ciclo tutte le feature
|
|
|
|
|
for i = 1, #vProc do
|
|
|
|
|
local Proc = vProc[i]
|
|
|
|
|
-- calcolo topologia della feature
|
|
|
|
|
if NeedTopologyFeature( Proc) then
|
|
|
|
|
Topology.Classify( Proc, b3Raw)
|
|
|
|
|
-- se non richiesto, setto 'SPECIAL'
|
|
|
|
|
else
|
|
|
|
|
Proc.Topology = 'SPECIAL'
|
|
|
|
|
Proc.TopologyLongName = Proc.Topology
|
|
|
|
|
end
|
|
|
|
|
-- controllo la feature con tutte le altre per recuperare le dipendenze
|
|
|
|
|
for j = 1, #vProc do
|
|
|
|
|
local ProcB = vProc[j]
|
|
|
|
|
-- verifico se feature tipo LapJoint è attraversata da almeno un foro
|
|
|
|
|
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
|
|
|
|
|
-- se foro in coda non setto la dipendenza
|
|
|
|
|
if not ProcB.AffectedFaces.Left then
|
|
|
|
|
Proc.PassedByHole = true
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
end
|
|
|
|
|
if vProc and #vProc > 0 and nPartId then
|
|
|
|
|
-- recupero ID per tagli troncanti testa e coda
|
|
|
|
|
local nHeadCuttingFeatureId = EgtGetInfo( nPartId, 'HEADCUTFEATUREID', 'i') or 0
|
|
|
|
|
local nTailCuttingFeatureId = EgtGetInfo( nPartId, 'TAILCUTFEATUREID', 'i') or 0
|
|
|
|
|
-- ciclo tutte le feature
|
|
|
|
|
for i = 1, #vProc do
|
|
|
|
|
local Proc = vProc[i]
|
|
|
|
|
-- calcolo topologia della feature
|
|
|
|
|
if NeedTopologyFeature( Proc) then
|
|
|
|
|
Topology.Classify( Proc, b3Raw)
|
|
|
|
|
-- se non richiesto, setto 'SPECIAL'
|
|
|
|
|
else
|
|
|
|
|
Proc.Topology = 'SPECIAL'
|
|
|
|
|
Proc.TopologyLongName = Proc.Topology
|
|
|
|
|
end
|
|
|
|
|
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
|
|
|
|
|
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove')
|
|
|
|
|
and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) and DtMortise.IsDeeper( ProcB, b3Raw) then
|
|
|
|
|
Proc.PassedByDtMortise = true
|
|
|
|
|
end
|
|
|
|
|
-- se tenone è attraversato da foro allora il foro deve essere fatto prima
|
|
|
|
|
if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
|
|
|
|
Proc.PassedByHole = true
|
|
|
|
|
end
|
|
|
|
|
-- verifiche per specchiature
|
|
|
|
|
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then
|
|
|
|
|
-- forature
|
|
|
|
|
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
|
|
|
|
|
-- controllo la feature con tutte le altre per recuperare le dipendenze
|
|
|
|
|
for j = 1, #vProc do
|
|
|
|
|
-- non si controlla feature con sé stessa
|
|
|
|
|
if i ~= j then
|
|
|
|
|
local ProcB = vProc[j]
|
|
|
|
|
-- verifico se feature tipo LapJoint è attraversata da almeno un foro
|
|
|
|
|
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
|
|
|
|
|
-- se foro in coda non setto la dipendenza
|
|
|
|
|
if not ProcB.AffectedFaces.Left then
|
|
|
|
|
Proc.PassedByHole = true
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine
|
|
|
|
|
if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove')
|
|
|
|
|
and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) and DtMortise.IsDeeper( ProcB, b3Raw) then
|
|
|
|
|
Proc.PassedByDtMortise = true
|
|
|
|
|
end
|
|
|
|
|
-- se tenone è attraversato da foro allora il foro deve essere fatto prima
|
|
|
|
|
if Tenon.Identify( Proc) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
|
|
|
|
Proc.PassedByHole = true
|
|
|
|
|
end
|
|
|
|
|
-- se taglio attraversato da foro, si definisce precedenza in base ad angolo
|
|
|
|
|
if Drill.Identify( Proc) and Cut.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then
|
|
|
|
|
-- recupero e verifico l'entità foro
|
|
|
|
|
local DrillAuxId = ( EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0) + Proc.Id
|
|
|
|
|
local vtDrillExtr = EgtCurveExtrusion( DrillAuxId, GDB_RT.GLOB)
|
|
|
|
|
local bOpen = ( Proc.Fce ~= 0) and ( Proc.Fce ~= Proc.Fcs)
|
|
|
|
|
local ptCut, vtCutN = EgtSurfTmFacetCenter( ProcB.Id, 0, GDB_ID.ROOT)
|
|
|
|
|
local dMaxAngleDrillOnCut = BD.MAX_ANGLE_DRILL_CUT or 10
|
|
|
|
|
if GetAngle( vtDrillExtr, vtCutN) > dMaxAngleDrillOnCut then
|
|
|
|
|
if bOpen and GetAngle( -vtDrillExtr, vtCutN) < dMaxAngleDrillOnCut then
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecAfter = ProcB
|
|
|
|
|
else
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecBefore = ProcB
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecAfter = Proc
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecAfter = ProcB
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- verifiche per specchiature
|
|
|
|
|
if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then
|
|
|
|
|
-- forature
|
|
|
|
|
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
|
|
|
|
|
-- verifiche per tagli troncanti testa e coda: devono sempre essere subito dopo il taglio di testa e il taglio di coda, rispettivamente
|
|
|
|
|
if Proc.Prc == 340 and ProcB == nHeadCuttingFeatureId then
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecBefore = ProcB
|
|
|
|
|
elseif Proc == nHeadCuttingFeatureId and ProcB.Prc == 340 then
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
elseif Proc.Prc == 350 and ProcB == nTailCuttingFeatureId then
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecBefore = ProcB
|
|
|
|
|
elseif Proc == nTailCuttingFeatureId and ProcB.Prc == 350 then
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
end
|
|
|
|
|
-- se una feature deve essere lavorata prima dei tagli troncanti, si setta che non esiste taglio troncante
|
|
|
|
|
if Proc.Dependency and Proc.Dependency.ExecBefore and Proc.Dependency.ExecBefore.Id == nHeadCuttingFeatureId then
|
|
|
|
|
-- EgtRemoveInfo( nPartId, 'HEADCUTFEATUREID')
|
|
|
|
|
end
|
|
|
|
|
if Proc.Dependency and Proc.Dependency.ExecBefore and Proc.Dependency.ExecBefore.Id == nTailCuttingFeatureId then
|
|
|
|
|
-- EgtRemoveInfo( nPartId, 'TAILCUTFEATUREID')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- verifiche per tagli troncanti testa e coda: devono sempre essere subito dopo il taglio di testa e il taglio di coda, rispettivamente
|
|
|
|
|
local nHeadCuttingFeatureId = EgtGetInfo( nPartId, 'HEADCUTFEATUREID', 'i')
|
|
|
|
|
local nTailCuttingFeatureId = EgtGetInfo( nPartId, 'TAILCUTFEATUREID', 'i')
|
|
|
|
|
if Proc.Prc == 340 and ProcB == nHeadCuttingFeatureId then
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecBefore = ProcB
|
|
|
|
|
elseif Proc == nHeadCuttingFeatureId and ProcB.Prc == 340 then
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
elseif Proc.Prc == 350 and ProcB == nTailCuttingFeatureId then
|
|
|
|
|
Proc.Dependency = {}
|
|
|
|
|
Proc.Dependency.ExecBefore = ProcB
|
|
|
|
|
elseif Proc == nTailCuttingFeatureId and ProcB.Prc == 350 then
|
|
|
|
|
ProcB.Dependency = {}
|
|
|
|
|
ProcB.Dependency.ExecBefore = Proc
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|