- in BeamExec.ProcessBeams modifiche per accettare grezzi compenetranti
- in BeamExec.GetFeatureInfoAndDependency si scelgono taglio di testa e coda anche obliqui, quelli più verso il centro della trave. Gli altri tagli si disattivano - da completare
This commit is contained in:
+129
-27
@@ -409,40 +409,43 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
|
||||
-- Inserimento dei pezzi con il loro grezzo
|
||||
local nCnt = 0
|
||||
local dLen = dRawL
|
||||
local dResidualLength = dRawL
|
||||
local idPrevRaw, dPrevDelta
|
||||
local dDeltaS = dOvmHead
|
||||
local dDeltaSMin = 0
|
||||
local dDeltaE = BeamData.OVM_MID
|
||||
local dStartOffset = dOvmHead
|
||||
local dEndOffset = 0 -- TODO cosa fare di BD.OVM_MID? usarlo solo se non è nesting obliquo?
|
||||
for i = 1, #PARTS do
|
||||
-- dati del pezzo
|
||||
local b3BoxExact = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT)
|
||||
if b3BoxExact:isEmpty() or PARTS[i].b3PartOriginal:isEmpty() then break end
|
||||
EgtOutLog( 'PartSez=' .. EgtNumToString( b3BoxExact:getDimY(), 1) .. 'x' .. EgtNumToString( b3BoxExact:getDimZ(), 1), 3)
|
||||
-- se sezione compatibile e lunghezza disponibile sufficiente
|
||||
local dPartLen = PARTS[i].b3PartOriginal:getDimX()
|
||||
local dPartLength = PARTS[i].b3PartOriginal:getDimX()
|
||||
local dPartWidth = PARTS[i].b3PartOriginal:getDimY()
|
||||
local dPartHeight = PARTS[i].b3PartOriginal:getDimZ()
|
||||
local dNextLen = dLen - EgtIf( i == 1, dDeltaS, 0) - dPartLen - dDeltaE
|
||||
if (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
|
||||
dNextLen + dDeltaE >= 0 then
|
||||
local dNextResidualLength = dResidualLength - EgtIf( i == 1, dStartOffset, 0) - dPartLength - dEndOffset
|
||||
local bIsSectionOk = (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
|
||||
( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL))
|
||||
if bIsSectionOk and ( dNextResidualLength + dEndOffset >= 0) then
|
||||
-- eventuale sovramateriale di testa
|
||||
if i > 1 then
|
||||
if PARTS[i].dPosX then
|
||||
dDeltaS = max( PARTS[i].dPosX - ( dRawL - dLen), dDeltaSMin)
|
||||
dStartOffset = PARTS[i].dPosX - ( dRawL - dResidualLength)
|
||||
if dStartOffset < -GEO.EPS_SMALL then
|
||||
dResidualLength = dResidualLength - dStartOffset
|
||||
dStartOffset = 0
|
||||
end
|
||||
else
|
||||
dDeltaS = max( dOvmMid - dDeltaE, 0)
|
||||
dStartOffset = max( dOvmMid - dEndOffset, 0)
|
||||
end
|
||||
end
|
||||
-- dimensioni del grezzo
|
||||
local dCrawLen = min( dPartLen + dDeltaS + dDeltaE, dLen)
|
||||
local dDelta = dCrawLen - dPartLen - dDeltaS
|
||||
local dCurrentRawLength = min( dPartLength + dStartOffset + dEndOffset, dResidualLength)
|
||||
local dDelta = dCurrentRawLength - dPartLength - dStartOffset
|
||||
-- creo e posiziono il grezzo
|
||||
PARTS[i].idRaw = EgtAddRawPart( Point3d(0,0,0), dCrawLen, dRawW, dRawH, BeamData.RAWCOL)
|
||||
PARTS[i].idRaw = EgtAddRawPart( Point3d(0,0,0), dCurrentRawLength, dRawW, dRawH, BeamData.RAWCOL)
|
||||
|
||||
EgtMoveToCornerRawPart( PARTS[i].idRaw, BeamData.ptOriXR, BeamData.dPosXR)
|
||||
EgtMoveRawPart( PARTS[i].idRaw, Vector3d( dLen - dRawL, 0, 0))
|
||||
EgtMoveRawPart( PARTS[i].idRaw, Vector3d( dResidualLength - dRawL, 0, 0))
|
||||
-- assegno ordine in lavorazione
|
||||
nCnt = nCnt + 1
|
||||
EgtSetInfo( PARTS[i].idRaw, 'ORD', nCnt)
|
||||
@@ -454,14 +457,14 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
-- aggiungo faccia per taglio iniziale al pezzo
|
||||
BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3PartOriginal)
|
||||
-- se sovramateriale di testa, lo notifico
|
||||
if dDeltaS > 0.09 then
|
||||
EgtSetInfo( PARTS[i].idRaw, 'HOVM', dDeltaS)
|
||||
if dStartOffset > 0.09 then
|
||||
EgtSetInfo( PARTS[i].idRaw, 'HOVM', dStartOffset)
|
||||
if idPrevRaw then
|
||||
EgtSetInfo( idPrevRaw, 'BDST', dDeltaS + dPrevDelta)
|
||||
EgtSetInfo( idPrevRaw, 'BDST', dStartOffset + dPrevDelta)
|
||||
end
|
||||
end
|
||||
if dDeltaE > 0.09 then
|
||||
EgtSetInfo( PARTS[i].idRaw, 'TOVM', dDeltaE)
|
||||
if dEndOffset > 0.09 then
|
||||
EgtSetInfo( PARTS[i].idRaw, 'TOVM', dEndOffset)
|
||||
end
|
||||
-- aggiungo faccia per taglio finale al pezzo
|
||||
BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3PartOriginal)
|
||||
@@ -479,13 +482,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
EgtMovePartInRawPart( PARTS[i].id, ( vtEccOri - vtEccRot))
|
||||
end
|
||||
-- aggiorno la lunghezza residua della barra
|
||||
dLen = dLen - dCrawLen
|
||||
dResidualLength = dResidualLength - dCurrentRawLength
|
||||
-- aggiorno grezzo precedente
|
||||
idPrevRaw = PARTS[i].idRaw
|
||||
dPrevDelta = dDelta
|
||||
PARTS[i].bIsLastPart = ( i == #PARTS)
|
||||
PARTS[i].dDistanceToNextPiece = dDelta
|
||||
PARTS[i].dRestLength = dLen
|
||||
PARTS[i].dRestLength = dResidualLength
|
||||
PARTS[i].b3Raw = EgtGetRawPartBBox( PARTS[i].idRaw)
|
||||
PARTS[i].dLength = PARTS[i].b3Raw:getDimX()
|
||||
PARTS[i].dWidth = PARTS[i].b3Raw:getDimY()
|
||||
@@ -496,7 +499,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
PARTS[i].nIndexInParts = i
|
||||
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
|
||||
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
|
||||
PARTS[i].dHeadOverMaterial = dDeltaS
|
||||
PARTS[i].dHeadOverMaterial = dStartOffset
|
||||
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
|
||||
|
||||
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or
|
||||
@@ -512,7 +515,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
PARTS[i].idTempGroup = idTempGroup
|
||||
|
||||
else
|
||||
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
|
||||
local sOut = 'Error: part L(' .. EgtNumToString( dPartLength, 1) .. ') too big for raw part L(' .. EgtNumToString( dResidualLength - 0.1, 1) .. ')'
|
||||
return false, sOut
|
||||
end
|
||||
-- se rimasto troppo poco grezzo, esco
|
||||
@@ -525,10 +528,10 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
|
||||
|
||||
-- Se rimasto materiale aggiungo grezzo dell'avanzo
|
||||
-- TODO valutare se ridurre la dLen minima perchè crea discrepanze tra lunghezza inserita e VMill
|
||||
if dLen > 10 then
|
||||
local idRaw = EgtAddRawPart( Point3d(0,0,0), dLen, dRawW, dRawH, BeamData.RAWCOL)
|
||||
if dResidualLength > 10 then
|
||||
local idRaw = EgtAddRawPart( Point3d(0,0,0), dResidualLength, dRawW, dRawH, BeamData.RAWCOL)
|
||||
EgtMoveToCornerRawPart( idRaw, BeamData.ptOriXR, BeamData.dPosXR)
|
||||
EgtMoveRawPart( idRaw, Vector3d( dLen - dRawL, 0, 0))
|
||||
EgtMoveRawPart( idRaw, Vector3d( dResidualLength - dRawL, 0, 0))
|
||||
-- assegno ordine in lavorazione
|
||||
nCnt = nCnt + 1
|
||||
EgtSetInfo( idRaw, 'ORD', nCnt)
|
||||
@@ -781,6 +784,12 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
-- gruppo per geometrie temporanee
|
||||
local idTempGroup = BeamLib.GetTempGroup()
|
||||
|
||||
local HeadProc = {}
|
||||
local TailProc = {}
|
||||
|
||||
-- ciclo tutte le feature
|
||||
for i = 1, #vProcSingleRot do
|
||||
local Proc = vProcSingleRot[i]
|
||||
@@ -791,6 +800,86 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
local ProcB = vProcSingleRot[j]
|
||||
-- non si controlla la feature con se stessa o se feature disabilitata
|
||||
if i ~= j and ProcB.nFlg ~= 0 then
|
||||
|
||||
local bAreBothTruncatingCuts =
|
||||
( ID.IsCut( Proc) or ID.IsHeadCut( Proc) or ID.IsTailCut( Proc)) and ( ID.IsCut( ProcB) or ID.IsHeadCut( ProcB) or ID.IsTailCut( ProcB))
|
||||
and ( FeatureLib.IsFeatureCuttingEntireSection( Proc.b3Box, Part) and FeatureLib.IsFeatureCuttingEntireSection( ProcB.b3Box, Part))
|
||||
|
||||
-- sono entrambi tagli troncanti di testa o coda
|
||||
if bAreBothTruncatingCuts then
|
||||
-- testa
|
||||
if Proc.Faces[1].vtN:getX() > GEO.EPS_SMALL and ProcB.Faces[1].vtN:getX() > GEO.EPS_SMALL then
|
||||
-- il primo taglio è più verso il centro della trave
|
||||
if ( Proc.b3Box:getMin():getX() < ProcB.b3Box:getMin():getX() - 10 * GEO.EPS_SMALL) then
|
||||
HeadProc = Proc
|
||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
||||
EgtMove( idProcCopy, - 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
||||
EgtMove( idProcBCopy, 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
||||
if not Proc.SlaveProcIndexes then
|
||||
Proc.SlaveProcIndexes = {}
|
||||
end
|
||||
table.insert( Proc.SlaveProcIndexes, j)
|
||||
ProcB.nIndexMasterProc = i
|
||||
ProcB.nFlg = 0
|
||||
end
|
||||
-- il secondo taglio è più verso il centro della trave
|
||||
elseif Proc.b3Box:getMin():getX() >= ProcB.b3Box:getMin():getX() - 10 * GEO.EPS_SMALL then
|
||||
HeadProc = ProcB
|
||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
||||
EgtMove( idProcBCopy, - 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
||||
EgtMove( idProcCopy, 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
||||
if not ProcB.SlaveProcIndexes then
|
||||
ProcB.SlaveProcIndexes = {}
|
||||
end
|
||||
table.insert( ProcB.SlaveProcIndexes, j)
|
||||
Proc.nIndexMasterProc = i
|
||||
Proc.nFlg = 0
|
||||
end
|
||||
end
|
||||
-- coda
|
||||
elseif Proc.Faces[1].vtN:getX() <= GEO.EPS_SMALL and ProcB.Faces[1].vtN:getX() <= GEO.EPS_SMALL then
|
||||
-- il primo taglio è più verso il centro della trave
|
||||
if Proc.b3Box:getMax():getX() > ProcB.b3Box:getMax():getX() + 10 * GEO.EPS_SMALL then
|
||||
TailProc = Proc
|
||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
||||
EgtMove( idProcCopy, - 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
||||
EgtMove( idProcBCopy, 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
||||
if not Proc.SlaveProcIndexes then
|
||||
Proc.SlaveProcIndexes = {}
|
||||
end
|
||||
table.insert( Proc.SlaveProcIndexes, j)
|
||||
ProcB.nIndexMasterProc = i
|
||||
ProcB.nFlg = 0
|
||||
end
|
||||
-- il secondo taglio è più verso il centro della trave
|
||||
elseif Proc.b3Box:getMax():getX() >= ProcB.b3Box:getMax():getX() - 10 * GEO.EPS_SMALL then
|
||||
TailProc = ProcB
|
||||
local idProcCopy = EgtCopyGlob( Proc.id, idTempGroup)
|
||||
local idProcBCopy = EgtCopyGlob( ProcB.id, idTempGroup)
|
||||
EgtMove( idProcBCopy, - 500 * GEO.EPS_SMALL * ProcB.Faces[1].vtN, GDB_RT.GLOB)
|
||||
EgtMove( idProcCopy, 500 * GEO.EPS_SMALL * Proc.Faces[1].vtN, GDB_RT.GLOB)
|
||||
-- se i tagli non si intersecano, quello più esterno è da disattivare
|
||||
if not EgtTestSurfaceSurface( idProcCopy, idProcBCopy, GEO.EPS_SMALL) then
|
||||
if not ProcB.SlaveProcIndexes then
|
||||
ProcB.SlaveProcIndexes = {}
|
||||
end
|
||||
table.insert( ProcB.SlaveProcIndexes, j)
|
||||
Proc.nIndexMasterProc = i
|
||||
Proc.nFlg = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- se entrambi tagli di testa, si tiene sempre il primo ( ma non quello aggiunto dall'automatismo)
|
||||
if ( ID.IsHeadCut( Proc) and not EgtGetInfo( Proc.id, 'HEAD_ADD_CUT', 'i')) and ID.IsHeadCut( ProcB) then
|
||||
if not Proc.SlaveProcIndexes then
|
||||
@@ -828,6 +917,16 @@ local function GetFeatureInfoAndDependency( vProcSingleRot, Part)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
HeadProc.Topology = {}
|
||||
TailProc.Topology = {}
|
||||
HeadProc.Topology.sFamily = 'HeadCut'
|
||||
HeadProc.Topology.sName = 'HeadCut'
|
||||
TailProc.Topology.sFamily = 'TailCut'
|
||||
TailProc.Topology.sName = 'TailCut'
|
||||
HeadProc.AvailableStrategies = GetStrategies( HeadProc, Part.sAISetupConfig)
|
||||
TailProc.AvailableStrategies = GetStrategies( TailProc, Part.sAISetupConfig)
|
||||
|
||||
return vProcSingleRot
|
||||
end
|
||||
|
||||
@@ -983,6 +1082,9 @@ local function CalculateStrategies( vProcSingleRot, Part)
|
||||
Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine = 99
|
||||
end
|
||||
|
||||
if not Proc.AvailableStrategies.dAllStrategiesTotalTime then
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = 0
|
||||
end
|
||||
Proc.AvailableStrategies.dAllStrategiesTotalTime = Proc.AvailableStrategies.dAllStrategiesTotalTime + Proc.AvailableStrategies[nIndexCurrentStrategy].Result.dTimeToMachine
|
||||
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
|
||||
if Part.GeneralParameters.GEN_sMachiningStrategy == 'FIRST_IN_LIST' and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then
|
||||
|
||||
Reference in New Issue
Block a user