Compare commits

..

2 Commits

Author SHA1 Message Date
luca.mazzoleni a8036e1645 Merge branch 'develop' into DeleteOldAlternatives 2026-07-20 18:01:59 +02:00
luca.mazzoleni 37ff2e7f4c - in BeamExec.ProcessAlternatives si azzerano le alternative non usate 2026-07-16 17:07:28 +02:00
11 changed files with 190 additions and 188 deletions
+1 -3
View File
@@ -647,13 +647,11 @@ if bToProcess then
PARTS[i].NotClampableLength = { STD = { dHead = 0, dTail = 0}, SIDE = { dHead = 0, dTail = 0}, DOWN = { dHead = 0, dTail = 0}}
PARTS[i].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
PARTS[i].idTempGroup = idTempGroup
PARTS[i].RestrictedLength = ( BeamData.GetRestrictedLength and BeamData.GetRestrictedLength( PARTS[i].dRawWidth, PARTS[i].dRawHeight, PARTS[i].dRawLength))
or BeamData.LEN_VERY_SHORT_PART
or 400
PARTS[i].sAISetupConfig = EgtGetInfo( PARTS[i].id, 'AISETUP', 's') or
( GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo] and GENERAL_PARAMETERS.BTL[PARTS[i].sBTLInfo].sAISetupConfig) or -- i parametri BTL potrebbero non esistere
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
-- si carica configurazione lavorazioni
TIMER:startElapsed('Json')
BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig)
+118 -95
View File
@@ -398,42 +398,42 @@ end
-------------------------------------------------------------------------------------------------------------
-- *** Funzioni posizionamento pezzi all'interno della barra***
-------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, bCreateMachGroup, bIsFlipRot)
function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, bCreateMachGroup, bIsFlipRot )
-- 1. Inizializzazione e Default
local idTempGroup = BeamLib.GetTempGroup()
local idTempGroup = BeamLib.GetTempGroup( )
local dMinLengthToCreateRaw = 10
BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11)
BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8)
BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11 )
BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8 )
dOvmMid = ( dOvmMid or 5.4)
dOvmHead = ( dOvmHead or 0)
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH)
dOvmMid = ( dOvmMid or 5.4 )
dOvmHead = ( dOvmHead or 0 )
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH )
-- 2. Gestione Gruppo di Lavoro
if ( bCreateMachGroup == nil) then bCreateMachGroup = true end
if ( bCreateMachGroup) then
local sMgName = EgtGetMachGroupNewName( 'Mach_1')
local idNewMg = EgtAddMachGroup( sMgName)
if ( not idNewMg) then
if ( bCreateMachGroup == nil ) then bCreateMachGroup = true end
if ( bCreateMachGroup ) then
local sMgName = EgtGetMachGroupNewName( 'Mach_1' )
local idNewMg = EgtAddMachGroup( sMgName )
if ( not idNewMg ) then
return false, 'Errore creazione gruppo di lavoro'
end
end
-- 3. Configurazione Tavola Macchina
EgtSetTable( 'Tab')
local nMGrpId = EgtGetCurrMachGroup()
if ( not EgtGetInfo( nMGrpId, 'BARLEN', 'd')) then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL)
EgtSetTable( 'Tab' )
local nMGrpId = EgtGetCurrMachGroup( )
if ( not EgtGetInfo( nMGrpId, 'BARLEN', 'd' ) ) then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL )
end
local b3Tab = EgtGetTableArea()
local dPosY = EgtIf( BeamData.CENTER_BEAM, ( b3Tab:getDimY() + dRawW * EgtIf( BeamData.RIGHT_LOAD, -1, 1)) / 2, EgtIf( BeamData.RIGHT_LOAD, 0, b3Tab:getDimY()))
local b3Tab = EgtGetTableArea( )
local dPosY = EgtIf( BeamData.CENTER_BEAM, ( b3Tab:getDimY( ) + dRawW * EgtIf( BeamData.RIGHT_LOAD, -1, 1 ) ) / 2, EgtIf( BeamData.RIGHT_LOAD, 0, b3Tab:getDimY( ) ) )
BeamData.ptOriXR = Point3d( b3Tab:getDimX(), dPosY, 0)
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR)
BeamData.ptOriXR = Point3d( b3Tab:getDimX( ), dPosY, 0 )
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR )
EgtImportSetup()
EgtImportSetup( )
-- 4. Ciclo di Inserimento Pezzi
local nCnt = 0
@@ -443,20 +443,20 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
for i = 1, #PARTS do
local CurrentPart = PARTS[i]
local b3BoxExact = EgtGetBBoxGlob( CurrentPart.id or GDB_ID.NULL, GDB_BB.EXACT)
local b3BoxExact = EgtGetBBoxGlob( CurrentPart.id or GDB_ID.NULL, GDB_BB.EXACT )
if ( b3BoxExact:isEmpty() or CurrentPart.b3PartOriginal:isEmpty()) then break end
if ( b3BoxExact:isEmpty( ) or CurrentPart.b3PartOriginal:isEmpty( ) ) then break end
local dPartLen = CurrentPart.b3PartOriginal:getDimX()
local dPartWidth = CurrentPart.b3PartOriginal:getDimY()
local dPartHeight = CurrentPart.b3PartOriginal:getDimZ()
local dPartLen = CurrentPart.b3PartOriginal:getDimX( )
local dPartWidth = CurrentPart.b3PartOriginal:getDimY( )
local dPartHeight = CurrentPart.b3PartOriginal:getDimZ( )
-- Se il pezzo corrente non ha coordinata, si calcola da OvmMid
if ( not CurrentPart.dPosX) then
if ( i == 1) then
CurrentPart.dPosX = dOvmHead
else
CurrentPart.dPosX = PARTS[i - 1].dPosX + PARTS[i - 1].b3PartOriginal:getDimX() + dOvmMid
CurrentPart.dPosX = PARTS[i - 1].dPosX + PARTS[i - 1].b3PartOriginal:getDimX( ) + dOvmMid
end
end
@@ -469,8 +469,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
local dEndOffset = dOvmMid
-- se ultimo pezzo bisogna allungare il grezzo del restante solo se non viene creato un grezzo indipendente
if ( i == #PARTS) then
local dPotentialRemaining = max( 0, dRawL - ( CurrentPart.dPosX + dPartLen))
if ( i == #PARTS ) then
local dPotentialRemaining = max( 0, dRawL - ( CurrentPart.dPosX + dPartLen ))
if ( dPotentialRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then
dEndOffset = 0 -- Coda a zero, il resto diventerà un idRawRest indipendente
else
@@ -479,9 +479,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
end
-- Gap reale tra i pezzi (può essere negativo in caso di compenetrazione nesting obliqui)
if ( i < #PARTS) then
if ( i < #PARTS ) then
local dTotalGap = PARTS[i + 1].dPosX - CurrentPart.dPosX - dPartLen
if ( dTotalGap > dOvmMid) then
if ( dTotalGap > dOvmMid ) then
dEndOffset = dOvmMid
dNextStartOffset = dTotalGap - dOvmMid
else
@@ -495,105 +495,102 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
local dDelta = dEndOffset
local dStartPos = CurrentPart.dPosX - dStartOffset
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))
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 ( dStartPos + dCurrentRawLen <= dRawL + GEO.EPS_SMALL)) then
if ( bIsSectionOk and ( dStartPos + dCurrentRawLen <= dRawL + GEO.EPS_SMALL ) ) then
-- 5. Creazione e Posizionamento del Contenitore RawPart
CurrentPart.idRaw = EgtAddRawPart( Point3d( 0, 0, 0), dCurrentRawLen, dRawW, dRawH, BeamData.RAWCOL)
EgtMoveToCornerRawPart( CurrentPart.idRaw, BeamData.ptOriXR, BeamData.dPosXR)
EgtMoveRawPart( CurrentPart.idRaw, Vector3d( -dStartPos, 0, 0))
CurrentPart.idRaw = EgtAddRawPart( Point3d( 0, 0, 0 ), dCurrentRawLen, dRawW, dRawH, BeamData.RAWCOL )
EgtMoveToCornerRawPart( CurrentPart.idRaw, BeamData.ptOriXR, BeamData.dPosXR )
EgtMoveRawPart( CurrentPart.idRaw, Vector3d( -dStartPos, 0, 0 ) )
-- 6. Configurazione Geometrie Pezzo
nCnt = nCnt + 1
EgtSetInfo( CurrentPart.idRaw, 'ORD', nCnt)
EgtSetInfo( CurrentPart.idRaw, 'ORD', nCnt )
if ( not BeamLib.CreateOrEmptyAddGroup( CurrentPart.id)) then
return false, 'Error creating Additional Group in Part ' .. tostring( CurrentPart.id)
if ( not BeamLib.CreateOrEmptyAddGroup( CurrentPart.id ) ) then
return false, 'Error creating Additional Group in Part ' .. tostring( CurrentPart.id )
end
BeamLib.AddPartStartFace( CurrentPart.id, CurrentPart.b3PartOriginal)
BeamLib.AddPartEndFace( CurrentPart.id, CurrentPart.b3PartOriginal)
BeamLib.AddPartStartFace( CurrentPart.id, CurrentPart.b3PartOriginal )
BeamLib.AddPartEndFace( CurrentPart.id, CurrentPart.b3PartOriginal )
-- Inserimento con dDelta (lascia lo spazio vuoto a sinistra e spinge il pezzo a destra)
EgtDeselectPartObjs( CurrentPart.id)
local ptPos = b3BoxExact:getMin() - CurrentPart.b3PartOriginal:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2)
EgtAddPartToRawPart( CurrentPart.id, ptPos, CurrentPart.idRaw)
EgtDeselectPartObjs( CurrentPart.id )
local ptPos = b3BoxExact:getMin( ) - CurrentPart.b3PartOriginal:getMin( ) + Vector3d( dDelta, ( dRawW - dPartWidth ) / 2, ( dRawH - dPartHeight ) / 2 )
EgtAddPartToRawPart( CurrentPart.id, ptPos, CurrentPart.idRaw )
-- Rotazione sezione se necessaria
if ( abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL) then
EgtRotatePartInRawPart( CurrentPart.id, X_AX(), 90)
local vtEccOri = CurrentPart.b3PartOriginal:getCenter() - b3BoxExact:getCenter()
local vtEccRot = Vector3d( vtEccOri)
vtEccRot:rotate( X_AX(), 90)
EgtMovePartInRawPart( CurrentPart.id, ( vtEccOri - vtEccRot))
if ( abs( dPartWidth - dRawW ) > 100 * GEO.EPS_SMALL ) then
EgtRotatePartInRawPart( CurrentPart.id, X_AX( ), 90 )
local vtEccOri = CurrentPart.b3PartOriginal:getCenter( ) - b3BoxExact:getCenter( )
local vtEccRot = Vector3d( vtEccOri )
vtEccRot:rotate( X_AX( ), 90 )
EgtMovePartInRawPart( CurrentPart.id, ( vtEccOri - vtEccRot ) )
end
-- 7. Popolamento Metadati della Tabella CurrentPart
CurrentPart.bIsLastPart = ( i == #PARTS)
CurrentPart.bIsLastPart = ( i == #PARTS )
CurrentPart.dDistanceToNextPiece = dEndOffset
CurrentPart.b3Raw = EgtGetRawPartBBox( CurrentPart.idRaw)
CurrentPart.dLength = CurrentPart.b3Raw:getDimX()
CurrentPart.dWidth = CurrentPart.b3Raw:getDimY()
CurrentPart.dHeight = CurrentPart.b3Raw:getDimZ()
CurrentPart.bSquareSection = abs( CurrentPart.dWidth - CurrentPart.dHeight) < 100 * GEO.EPS_SMALL
CurrentPart.b3Raw = EgtGetRawPartBBox( CurrentPart.idRaw )
CurrentPart.dLength = CurrentPart.b3Raw:getDimX( )
CurrentPart.dWidth = CurrentPart.b3Raw:getDimY( )
CurrentPart.dHeight = CurrentPart.b3Raw:getDimZ( )
CurrentPart.bSquareSection = abs( CurrentPart.dWidth - CurrentPart.dHeight ) < 100 * GEO.EPS_SMALL
CurrentPart.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( CurrentPart.id, 'Box') or GDB_ID.NULL)
CurrentPart.b3Part = EgtGetBBoxGlob( CurrentPart.idBoxTm, GDB_BB.STANDARD)
CurrentPart.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( CurrentPart.id, 'Box' ) or GDB_ID.NULL )
CurrentPart.b3Part = EgtGetBBoxGlob( CurrentPart.idBoxTm, GDB_BB.STANDARD )
CurrentPart.nIndexInParts = i
CurrentPart.SplittingPoints = BeamLib.GetPartSplittingPoints( CurrentPart)
CurrentPart.SplittingPoints = BeamLib.GetPartSplittingPoints( CurrentPart )
CurrentPart.NotClampableLength = { STD = { dHead = 0, dTail = 0 }, SIDE = { dHead = 0, dTail = 0 }, DOWN = { dHead = 0, dTail = 0 } }
CurrentPart.dHeadOverMaterial = dStartOffset
CurrentPart.sBTLInfo = EgtGetInfo( CurrentPart.id, 'PROJ', 's') or nil
CurrentPart.sBTLInfo = EgtGetInfo( CurrentPart.id, 'PROJ', 's' ) or nil
CurrentPart.idTempGroup = idTempGroup
CurrentPart.RestrictedLength = ( BeamData.GetRestrictedLength and BeamData.GetRestrictedLength( dPartWidth, dPartHeight, dPartLen))
or BeamData.LEN_VERY_SHORT_PART
or 400
-- Notifiche al Post-Processor basate sulla nuova scomposizione
if ( dStartOffset > 0.09) then EgtSetInfo( CurrentPart.idRaw, 'HOVM', dStartOffset) end
if ( dEndOffset > 0.09) then EgtSetInfo( CurrentPart.idRaw, 'TOVM', dEndOffset) end
if ( idPrevRaw) then EgtSetInfo( idPrevRaw, 'BDST', dStartOffset) end
if ( dStartOffset > 0.09 ) then EgtSetInfo( CurrentPart.idRaw, 'HOVM', dStartOffset ) end
if ( dEndOffset > 0.09 ) then EgtSetInfo( CurrentPart.idRaw, 'TOVM', dEndOffset ) end
if ( idPrevRaw ) then EgtSetInfo( idPrevRaw, 'BDST', dStartOffset ) end
-- Caricamento Strategie JSON
CurrentPart.sAISetupConfig = EgtGetInfo( CurrentPart.id, 'AISETUP', 's') or
( GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo] and GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo].sAISetupConfig) or
CurrentPart.sAISetupConfig = EgtGetInfo( CurrentPart.id, 'AISETUP', 's' ) or
( GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo] and GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo].sAISetupConfig ) or
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
TIMER:startElapsed( 'Json')
BeamExec.GetStrategiesFromJSONinBD( CurrentPart.sAISetupConfig)
CurrentPart.GeneralParameters = BeamLib.GetPieceGeneralParameters( CurrentPart, GENERAL_PARAMETERS_JSON)
TIMER:stopElapsed( 'Json')
TIMER:startElapsed( 'Json' )
BeamExec.GetStrategiesFromJSONinBD( CurrentPart.sAISetupConfig )
CurrentPart.GeneralParameters = BeamLib.GetPieceGeneralParameters( CurrentPart, GENERAL_PARAMETERS_JSON )
TIMER:stopElapsed( 'Json' )
CurrentPart.CombinationList = BeamExec.GetAvailableCombinations( CurrentPart, bIsFlipRot)
CurrentPart.CombinationList = BeamExec.GetAvailableCombinations( CurrentPart, bIsFlipRot )
-- Avanzamento calcolato sulla coordinata reale di fine RawPart (estremità sinistra sulla barra)
dMaxX = max( dMaxX, dStartPos + dCurrentRawLen)
dMaxX = max( dMaxX, dStartPos + dCurrentRawLen )
CurrentPart.dRestLength = dRawL - dMaxX
idPrevRaw = CurrentPart.idRaw
else
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for remaining bar space'
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1 ) .. ') too big for remaining bar space'
return false, sOut
end
end
-- 8. Chiusura Barra e Gestione Avanzo (Rest Material)
if ( idPrevRaw) then EgtSetInfo( idPrevRaw, 'BDST', 10000) end
if ( idPrevRaw ) then EgtSetInfo( idPrevRaw, 'BDST', 10000 ) end
local dRemaining = dRawL - dMaxX
if ( dRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then
local idRawRest = EgtAddRawPart( Point3d( 0, 0, 0), dRemaining, dRawW, dRawH, BeamData.RAWCOL)
EgtMoveToCornerRawPart( idRawRest, BeamData.ptOriXR, BeamData.dPosXR)
EgtMoveRawPart( idRawRest, Vector3d( -dMaxX, 0, 0))
local idRawRest = EgtAddRawPart( Point3d( 0, 0, 0 ), dRemaining, dRawW, dRawH, BeamData.RAWCOL )
EgtMoveToCornerRawPart( idRawRest, BeamData.ptOriXR, BeamData.dPosXR )
EgtMoveRawPart( idRawRest, Vector3d( -dMaxX, 0, 0 ) )
nCnt = nCnt + 1
EgtSetInfo( idRawRest, 'ORD', nCnt)
EgtSetInfo( idRawRest, 'ORD', nCnt )
if ( EgtGetRawPartBBox( idRawRest):getDimX() < BeamData.dMinRaw) then
if ( EgtGetRawPartBBox( idRawRest ):getDimX( ) < BeamData.dMinRaw ) then
PARTS[#PARTS].dDistanceToNextPiece = 10000
end
else
if ( #PARTS > 0) then PARTS[#PARTS].dDistanceToNextPiece = 10000 end
if ( #PARTS > 0 ) then PARTS[#PARTS].dDistanceToNextPiece = 10000 end
end
return true
@@ -779,11 +776,11 @@ local function AreDrillingsMirrored( Proc, ProcMirror, Part)
-- geometria ausiliaria foro principale
AuxId = EgtGetInfo( Proc.id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then return false end
if not AuxId or EgtGetType( AuxId ) ~= GDB_TY.CRV_ARC then return false end
-- geometria ausiliaria foro specchiato
local AuxIdMirror = EgtGetInfo( ProcMirror.id, 'AUXID', 'i')
if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.id end
if not AuxIdMirror or EgtGetType( AuxIdMirror) ~= GDB_TY.CRV_ARC then return false end
if not AuxIdMirror or EgtGetType( AuxIdMirror ) ~= GDB_TY.CRV_ARC then return false end
-- dati del foro principale
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
@@ -2656,17 +2653,43 @@ function BeamExec.ProcessAlternatives( PARTS)
end
-- passaggio info a interfaccia da scrivere sul pezzo
BEAM.INFONGEPART = {}
for i = 1, #AlternativesNest2D do
if PARTS[nPart].HeadcutInfo then
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',')
local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "")
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN)
local function IsStateInAlternativesNest2D( sState)
for _, v in ipairs( AlternativesNest2D) do
if v == sState then
return true
end
end
if PARTS[nPart].TailcutInfo then
local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].OffsetX, ',')
local sVtN = ( tostring( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "")
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i] .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN)
return false
end
BEAM.INFONGEPART = {}
local States = {
"1000",
"0100",
"0010",
"0001",
"1000_INV",
"0100_INV",
"0010_INV",
"0001_INV",
}
for i = 1, #States do
local sState = States[i]
if IsStateInAlternativesNest2D( sState) then
if PARTS[nPart].HeadcutInfo then
local HeadcutInfo = PARTS[nPart].HeadcutInfo[sState]
local sOffsetX = table.concat( HeadcutInfo.OffsetX, ',')
local sVtN = ( tostring( HeadcutInfo.vtN)):gsub("^%(", ""):gsub("%)$", "")
table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_H' .. '=' .. sOffsetX .. ';' .. sVtN )
end
if PARTS[nPart].TailcutInfo then
local TailCutInfo = PARTS[nPart].TailcutInfo[sState]
local sOffsetX = table.concat( TailCutInfo.OffsetX, ',')
local sVtN = ( tostring( TailCutInfo.vtN)):gsub("^%(", ""):gsub("%)$", "")
table.insert( BEAM.INFONGEPART, 'ALT' .. sState .. '_T' .. '=' .. sOffsetX .. ';' .. sVtN)
end
else
table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_H' .. '= ')
table.insert( BEAM.INFONGEPART, 'ALT' .. sState.. '_T' .. '= ')
end
end
+6 -6
View File
@@ -1662,16 +1662,12 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part)
local idTempGroup = Part.idTempGroup
-- TODO in futuro creare flatregion (se ci fossero isole il calcolo del percorso non sarebbe corretto)
local idFaceContour = EgtExtractSurfTmFacetLoops( ProcTm.id, Machining.Geometry[1][2], idTempGroup)
-- si settano i lati aperti della curva derivata dalla superficie
local sOpenEdges = ''
for i = 1, #ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges do
if ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].bIsOpen then
sOpenEdges = sOpenEdges .. EgtNumToString( ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].id) .. ','
EgtCurveCompoSetTempProp( idFaceContour, ProcTm.Faces[Machining.Geometry[1][2] + 1].Edges[i].id, 1)
end
end
EgtSetInfo( idFaceContour, 'OPEN', sOpenEdges)
-- dal momento che la funzione EgtPocketing non considera il grezzo, nei casi ottimizzati si deve correggere l'offset
local idTestCurve = EgtCopyGlob( idFaceContour, idTempGroup )
local bIsOptimizedPocketing = ( TOOLS[Machining.nToolIndex].dDiameter > TOOLS[Machining.nToolIndex].dSideStep - 10 * GEO.EPS_SMALL)
@@ -1682,7 +1678,11 @@ function MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machining, Part)
dOffset = TOOLS[Machining.nToolIndex].dDiameter - TOOLS[Machining.nToolIndex].dSideStep
end
EgtOffsetCurve( idFaceContour, dOffset)
EgtRemoveInfo( idFaceContour, 'OPEN')
-- si settano tutti i lati chiusi per la curva offsettata
local _, nFaceCountourCurveCount = EgtCurveDomain( idFaceContour)
for i = 1, nFaceCountourCurveCount do
EgtCurveCompoSetTempProp( idFaceContour, i - 1, 0)
end
end
-- calcolo percorso di svuotatura replicando il calcolo che fa la svuotatura
local idPocketingPath = EgtPocketing( idFaceContour, TOOLS[Machining.nToolIndex].dDiameter / 2, TOOLS[Machining.nToolIndex].dSideStep, 0, Machining.nSubType, true, idTempGroup)
+6 -15
View File
@@ -301,8 +301,6 @@ end
-------------------------------------------------------------------------------------------------------------
local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm, idAddedCollisionSurfTm)
local idAddGroup = BeamLib.GetAddGroup( Part.id)
-- spostamento assi macchina in posizione
local dDeltaXHeadOffset = MoveMachineAxesToPosition( ptOnToolTipCenter, vtHead, vtAux)
@@ -352,23 +350,17 @@ local function CheckCollisionPoint( sAxis, ptOnToolTipCenter, vtHead, vtAux, Par
end
if EgtGetDebugLevel() >= 3 and bCollisionFoundPiece then
EgtSetColor( CollisionSurfTmId[i], RED())
local idBeamCopy = EgtCopyGlob( idCheckCollisionTm, idAddGroup)
EgtSetName( idBeamCopy, 'COLL_BEAM')
local idHeadCopy = EgtCopyGlob( CollisionSurfTmId[i], idAddGroup)
EgtSetName( idHeadCopy, 'COLL_' .. sAxis)
EgtVector( idAddGroup, vtHead, ptOnToolTipCenter, GDB_RT.GLOB)
EgtSetStatus( { idBeamCopy, idHeadCopy}, GDB_ST.OFF)
end
if bCollisionFoundPiece then
break
end
end
-- se trovata collisione con pezzo è inutile procedere con il grezzo
if bCollisionFoundPiece then
-- se trovata collisione con pezzo è inutile procedere con il grezzo
if bCollisionFoundPiece then
return true
end
return true
end
-- check collisione con grezzo restante, se con il pezzo non c'è collisione e non è un taglio di testa o coda
local bCollisionFoundRestLength = false
@@ -438,8 +430,8 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
if bCheckFlange and Tool.sType == 'SAW_FLAT' then
local ptCenterFlange = PointsOnToolTipCenter[i] + vtHead * Tool.dThickness
local frHead = Frame3d( ptCenterFlange, vtHead)
local dFlangeRadius = Tool.ToolHolder.dDiameter / 2
local idFlangeCurve = EgtCircle( Part.idTempGroup, ORIG(), dFlangeRadius, GDB_RT.GLOB)
local dExtraSafety = 2 -- valore empirico che serve nei casi molto inclinati, ci potrebbero essere casi in cui va aumentato
local idFlangeCurve = EgtCircle( Part.idTempGroup, ORIG(), dExtraSafety + Tool.dDiameter / 2 - Tool.dMaxDepth, GDB_RT.GLOB)
EgtTransform( idFlangeCurve, frHead, GDB_RT.GLOB)
-- TODO verificare se questo controllo serve
@@ -451,7 +443,6 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
idAddedCollisionSurfTm = EgtSurfTmByRegionExtrusion( Part.idTempGroup, idFlangeCurve, vtExtrusion, 0.05, GDB_RT.GLOB)
end
-- TODO raggruppare parametri opzionali!
local bCollisionFoundPiece, bCollisionFoundRestLength = CheckCollisionPoint( sAxis, PointsOnToolTipCenter[i], vtHead, vtAux, Part, bCannotSplitRestLength, sRestLengthSideForPreSimulation, idCheckCollisionTm, idAddedCollisionSurfTm)
-- se trovata collisione con pezzo è inutile controllare gli altri punti
+1 -1
View File
@@ -326,7 +326,7 @@ function STR0001.Make( bAddMachining, Proc, Part, CustomParameters)
-- controllo conformità offset tenone
Strategy.Parameters.dOverMatOnRadius = EgtClamp( Strategy.Parameters.dOverMatOnRadius, -5, 5)
Strategy.Parameters.dOverMatOnLength = EgtClamp( Strategy.Parameters.dOverMatOnLength, -5, 5)
Strategy.Parameters.dOverMatOnLength = EgtClamp( Strategy.Parameters.dOverMatOnRadius, -5, 5)
-- calcolo se la lavorazione del tenone può essere spostata dopo taglio di coda
local dLengthOnX = Proc.b3Box:getDimX()
+1
View File
@@ -10,6 +10,7 @@ local MachiningLib = require( 'MachiningLib')
local FeatureLib = require( 'FeatureLib')
-- strategie di base
local FaceByMill = require( 'FACEBYMILL')
local FaceByBlade = require( 'FACEBYBLADE')
local AntiSplintOnFace = require( 'ANTISPLINTONFACE')
-- Tabella per definizione modulo
-3
View File
@@ -216,9 +216,6 @@ function STR0011.Make( bAddMachining, Proc, Part, CustomParameters)
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
-- aggiunge lavorazione
for j = 1, #Strategy.Machinings do
if Proc.AffectedFaces.bLeft and not Proc.FeatureInfo.bIsDrillOpen then
Strategy.Machinings[j].sStage = 'AfterTail'
end
Strategy.Machinings[j].nType = MCH_MY.DRILLING
Strategy.Machinings[j].Steps.dStep = TOOLS[Strategy.Machinings[j].ToolInfo.nToolIndex].dStep
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machinings[j])
+9 -23
View File
@@ -858,38 +858,24 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
CurrentMachining.LeadInForSplit.nType = MCH_MILL_LI.LINEAR
CurrentMachining.LeadOutForSplit.nType = MCH_MILL_LI.LINEAR
CurrentMachining.LeadInForSplit.dTangentDistance = 0
CurrentMachining.LeadInForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
CurrentMachining.LeadOutForSplit.dTangentDistance = 0
if not ID.IsFreeContour( Proc) then
CurrentMachining.LeadInForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
CurrentMachining.LeadOutForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
end
CurrentMachining.LeadOutForSplit.dPerpDistance = TOOLS[CurrentMachining.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
-- sistemo il lato e la direzione di lavoro; se FreeContour il lato è determinato dalla Feature, altrimenti dalla concordanza
if ID.IsFreeContour( Proc) then
CurrentMachining.bInvert = false
if Proc.nGrp == 0 then
CurrentMachining.nWorkside = MCH_MILL_WS.CENTER
elseif Proc.nGrp == 3 then
CurrentMachining.nWorkside = MCH_MILL_WS.LEFT
elseif Proc.nGrp == 4 then
CurrentMachining.nWorkside = MCH_MILL_WS.RIGHT
end
-- sistemo il lato e la direzione di lavoro
if CurrentMachining.bOtherDirection then
CurrentMachining.bToolInvert = true
CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, true, false)
CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
else
if CurrentMachining.bOtherDirection then
CurrentMachining.bToolInvert = true
CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, true, false)
CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
else
CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, false, true)
CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
end
CurrentMachining.bInvert = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, false, true)
CurrentMachining.nWorkside = EgtIf( TOOLS[CurrentMachining.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
end
CurrentMachining.ptEdge1 = EgtSP( Proc.idAddAuxGeom, GDB_ID.ROOT)
CurrentMachining.ptEdge2 = EgtEP( Proc.idAddAuxGeom, GDB_ID.ROOT)
CurrentMachining.dEdgeLength = EgtCurveLength( Proc.idAddAuxGeom)
CurrentMachining.vtEdgeDirection = EgtSV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtMV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtEV( Proc.idAddAuxGeom, GDB_ID.ROOT)
CurrentMachining.dLengthOnX = Proc.b3Box:getDimX()
CurrentMachining.vtHead = CurrentMachining.vtToolDirection
local MachiningToSplit = {}
table.insert( MachiningToSplit, CurrentMachining)
+40 -31
View File
@@ -358,8 +358,8 @@ local function GetBestBlade( Proc, Part, Face, OptionalParameters)
end
local function SetDiceFaceInfo( Proc, idDiceFace, sType)
EgtSetName( idDiceFace, 'Face' .. tostring( Proc.idFeature or 'Add') .. '_Dice_' .. sType)
local function SetDiceFaceInfo( Proc, idDiceFace)
EgtSetName( idDiceFace, 'Face' .. tostring( Proc.idFeature or 'Add') .. '_Dice')
end
@@ -577,11 +577,6 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
end
end
-- se la feature non è piccola il taglio doppio verticale non si può fare
if not FeatureInfo.bIsFeatureSmall then
return CuttingParametersList, EdgeToMachine
end
-- arrivati qui si prova il taglio doppio verticale (taglio doppio orizzontale non si può fare oppure non ci arriva)
EdgeToMachine = GetEdgeToMachine( FaceToMachine.Edges, 'Vertical')
local dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN
@@ -775,7 +770,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
Result.dQuality = FeatureLib.GetStrategyQuality( Machinings)
-- per tagli con lati brutti o ghigliottina si abbassa la qualità
if ( sChosenBladeType ~= 'Top') and ( sChosenBladeType ~= 'Bottom') then
Result.dQuality = FeatureLib.GetStrategyQuality( 'FINE')
Result.dQuality = FeatureLib.GetStrategyQuality( 'STD')
end
Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings)
Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6)
@@ -787,30 +782,45 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
end
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part)
local function UpdateDiceRaw( idRaw, idParallelTm, idPerpendicularTm, Part, MainFace, OtherFace)
-- contorno della faccia parallela
local vtNParallelFaceTm = EgtSurfTmFacetNormVersor( idParallelTm, 0, GDB_ID.ROOT)
local idParallelFaceCurveCompo = EgtExtractSurfTmLoops( idParallelTm, Part.idTempGroup)
EgtModifyCurveExtrusion( idParallelFaceCurveCompo, vtNParallelFaceTm, GDB_RT.GLOB)
EgtOffsetCurve( idParallelFaceCurveCompo, 100, GDB_OT.EXTEND)
-- frame solidale alla feature
local vtZ = MainFace.vtN
local vtX = OtherFace and OtherFace.vtN or nil
local frMainFace = Frame3d( MainFace.ptCenter, vtZ, vtX)
-- trimesh da sottrarre, tagliata con il piano perpendicolare
local vtExtrusion = 1000 * vtNParallelFaceTm
local idSurfTmToSubtract = EgtSurfTmByRegionExtrusion( Part.idTempGroup, idParallelFaceCurveCompo, vtExtrusion, 0.05, GDB_RT.GLOB)
-- box del cubetto in riferimento feature
local b3Surf = EgtGetBBoxRef( idParallelTm, GDB_BB.STANDARD, frMainFace)
if idPerpendicularTm then
local ptCenterPerpendicularTm, vtNPerpendicularTm = EgtSurfTmFacetCenter( idPerpendicularTm, 0, GDB_ID.ROOT)
EgtCutSurfTmPlane( idSurfTmToSubtract, ptCenterPerpendicularTm, -vtNPerpendicularTm, false, GDB_RT.GLOB)
-- dove la trimesh è stata tagliata mancherà la faccia: si riaggiunge
local idRemovedFaceCurveCompo = EgtExtractSurfTmLoops( idSurfTmToSubtract, Part.idTempGroup)
local idRemovedFaceTm = EgtSurfTmByFlatContour( Part.idTempGroup, idRemovedFaceCurveCompo)
local vtNRemovedFace = EgtSurfTmFacetNormVersor( idRemovedFaceTm, 0, GDB_ID.ROOT)
if AreSameVectorApprox( vtNPerpendicularTm, vtNRemovedFace) then
EgtInvertSurf( idRemovedFaceTm)
end
idSurfTmToSubtract = EgtSurfTmBySewing( Part.idTempGroup, { idSurfTmToSubtract, idRemovedFaceTm})
local b3SurfPerpendicular = EgtGetBBoxRef( idPerpendicularTm, GDB_BB.STANDARD, frMainFace)
b3Surf:Add( b3SurfPerpendicular)
else
-- se non arriva la superficie perpendicolare è un solo taglio parallelo: si estende il box in Z in modo da uscire dal pezzo
local ptDeltaZ = b3Surf:getMax() + vtZ * ( MainFace.dElevation + 5)
b3Surf:Add( ptDeltaZ)
end
-- estensione box per non avere problemi nella sottrazione booleana
if OtherFace and idPerpendicularTm then
local vtY = vtZ ^ vtX
local ptDeltaX = b3Surf:getMax() + vtX * 1
local ptDeltaZ = b3Surf:getMax() + vtZ * 1
local ptDeltaYplus = b3Surf:getMax() + vtY * 1
local ptDeltaYminus = b3Surf:getMin() - vtY * 1
b3Surf:Add( ptDeltaX)
b3Surf:Add( ptDeltaZ)
b3Surf:Add( ptDeltaYplus)
b3Surf:Add( ptDeltaYminus)
else
b3Surf:expand( 1)
end
-- si porta il box in riferimento globale
b3Surf:toGlob( frMainFace)
-- conversione box cubetto in superficie
local idSurfTmToSubtract = EgtSurfTmBBox( Part.idTempGroup, b3Surf, false, GDB_RT.GLOB)
-- sottrazione del cubetto dal grezzo
EgtSurfTmSubtract( idRaw, idSurfTmToSubtract)
@@ -846,8 +856,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
local bAreOrthogonalCutsInverted = false
for i = 1, #vCuts do
for j = 1, #vCuts[i] do
local sType = ( i % 2 == 0) and 'Paral' or 'Perp'
SetDiceFaceInfo( Proc, vCuts[i][j], sType)
SetDiceFaceInfo( Proc, vCuts[i][j])
end
end
-- calcolo lavorazioni
@@ -913,7 +922,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
end
-- aggiornamento grezzo dinamico
if i % 2 == 0 then
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, nil, Part)
UpdateDiceRaw( idCheckCollisionTm, idSurfToCut, vCuts[i-1][#vCuts[i-1]], Part, MainFace, OtherFace)
end
else
EgtErase( idSurfToCut)
@@ -977,7 +986,7 @@ local function CalculateDiceMachinings( vCuts, Parameters)
end
-- aggiornamento grezzo dinamico
if i % 2 == 0 then
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part)
UpdateDiceRaw( idCheckCollisionTm, vCuts[i][j], vCuts[i-1][j], Part, MainFace, OtherFace)
end
end
end
+6 -9
View File
@@ -602,18 +602,15 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
-- TODO fare funzione a parte: bisogna guardare il lato (e forse la faccia) lavorato comprensivo di attacchi, non la Proc
-- TODO già guardare se il box della faccia è aperto sulla coda, invece di tutta la trimesh, escluderebbe tanti casi
Cutting.bMoveAfterSplit = Cutting.bMoveAfterSplit or Cutting.LeadIn.bMoveAfterSplit or Cutting.LeadOut.bMoveAfterSplit
local bIsTruncatingCutOnTail = Proc.AffectedFaces.bLeft and
( ( Proc.Topology and ( Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'TailCut')) or
( FaceToMachine.vtN:getX() < GEO.EPS_SMALL and not OptionalParameters.dPocketHeight))
local bIsFeatureBigAsRawOnTail = ( Proc.b3Box:getDimY() > Part.b3Raw:getDimY() - 100 * GEO.EPS_SMALL) and
( Proc.b3Box:getDimZ() > Part.b3Raw:getDimZ() - 100 * GEO.EPS_SMALL) and
Proc.AffectedFaces.bLeft
if Cutting.bMoveAfterSplit or bIsTruncatingCutOnTail or bIsFeatureBigAsRawOnTail then
local bIsTruncatingCutOnTail = Proc.Topology and ( Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'TailCut') and Proc.AffectedFaces.bLeft
if Cutting.bMoveAfterSplit or bIsTruncatingCutOnTail then
Cutting.sStage = 'AfterTail'
elseif Proc.AffectedFaces.bLeft and
( EdgeToMachine.sType == 'Bottom' or
( Cutting.vtToolDirection:getX() < 0.707 and not ( Cutting.vtToolDirection:getX() > - 10 * GEO.EPS_SMALL and ( AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Z_AX()) or
AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Y_AX()))))) then
( Cutting.vtToolDirection:getX() < 0.707 and
not ( Cutting.vtToolDirection:getX() > - 10 * GEO.EPS_SMALL and
( AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Z_AX()) or
AreSameOrOppositeVectorApprox( EdgeToMachine.vtEdge, Y_AX()))))) then
local dLengthOnX = Cutting.dLengthOnX
-- se feature splittata non si considera la lunghezza della feature per il check spostamento dopo separazione
+2 -2
View File
@@ -2,5 +2,5 @@
-- Gestione della versione di BeamNT
NAME = 'BeamNT'
VERSION = '3.1g5'
MIN_EXE = '3.1g3'
VERSION = '3.1g1'
MIN_EXE = '3.1g1'