Compare commits

..

1 Commits

Author SHA1 Message Date
daniele.nicoli 4f24b32705 - PreSimulationLib - Unificata funzione per la pre simulazione della distanza tra punto e grezzo
-LeadInOutLib - unificata con funzione in PreSimulationLib
- STR0011 - Aggiunto calcolo per approccio in velocità di lavoro
- MachiningLib - Drill - Calcolo massima profondità del foro rispetto a portautensile
2026-07-28 17:07:30 +02:00
10 changed files with 174 additions and 115 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].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].sBTLInfo = EgtGetInfo( PARTS[i].id, 'PROJ', 's') or nil
PARTS[i].idTempGroup = idTempGroup 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 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.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 GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
-- si carica configurazione lavorazioni -- si carica configurazione lavorazioni
TIMER:startElapsed('Json') TIMER:startElapsed('Json')
BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig) BeamExec.GetStrategiesFromJSONinBD( PARTS[i].sAISetupConfig)
+83 -86
View File
@@ -398,42 +398,42 @@ end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** Funzioni posizionamento pezzi all'interno della barra*** -- *** 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 -- 1. Inizializzazione e Default
local idTempGroup = BeamLib.GetTempGroup() local idTempGroup = BeamLib.GetTempGroup( )
local dMinLengthToCreateRaw = 10 local dMinLengthToCreateRaw = 10
BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11) BeamData.OVM_BLADE_HBEAM = ( BeamData.OVM_BLADE_HBEAM or 11 )
BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8) BeamData.OVM_CHAIN_HBEAM = ( BeamData.OVM_CHAIN_HBEAM or 8 )
dOvmMid = ( dOvmMid or 5.4) dOvmMid = ( dOvmMid or 5.4 )
dOvmHead = ( dOvmHead or 0) dOvmHead = ( dOvmHead or 0 )
BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) BeamExec.CalcMinUnloadableRaw( dRawW, dRawH )
-- 2. Gestione Gruppo di Lavoro -- 2. Gestione Gruppo di Lavoro
if ( bCreateMachGroup == nil) then bCreateMachGroup = true end if ( bCreateMachGroup == nil ) then bCreateMachGroup = true end
if ( bCreateMachGroup) then if ( bCreateMachGroup ) then
local sMgName = EgtGetMachGroupNewName( 'Mach_1') local sMgName = EgtGetMachGroupNewName( 'Mach_1' )
local idNewMg = EgtAddMachGroup( sMgName) local idNewMg = EgtAddMachGroup( sMgName )
if ( not idNewMg) then if ( not idNewMg ) then
return false, 'Errore creazione gruppo di lavoro' return false, 'Errore creazione gruppo di lavoro'
end end
end end
-- 3. Configurazione Tavola Macchina -- 3. Configurazione Tavola Macchina
EgtSetTable( 'Tab') EgtSetTable( 'Tab' )
local nMGrpId = EgtGetCurrMachGroup() local nMGrpId = EgtGetCurrMachGroup( )
if ( not EgtGetInfo( nMGrpId, 'BARLEN', 'd')) then if ( not EgtGetInfo( nMGrpId, 'BARLEN', 'd' ) ) then
EgtSetInfo( nMGrpId, 'BARLEN', dRawL) EgtSetInfo( nMGrpId, 'BARLEN', dRawL )
end end
local b3Tab = EgtGetTableArea() 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 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.ptOriXR = Point3d( b3Tab:getDimX( ), dPosY, 0 )
BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR) BeamData.dPosXR = EgtIf( BeamData.RIGHT_LOAD, MCH_CR.BR, MCH_CR.TR )
EgtImportSetup() EgtImportSetup( )
-- 4. Ciclo di Inserimento Pezzi -- 4. Ciclo di Inserimento Pezzi
local nCnt = 0 local nCnt = 0
@@ -443,20 +443,20 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
for i = 1, #PARTS do for i = 1, #PARTS do
local CurrentPart = PARTS[i] 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 dPartLen = CurrentPart.b3PartOriginal:getDimX( )
local dPartWidth = CurrentPart.b3PartOriginal:getDimY() local dPartWidth = CurrentPart.b3PartOriginal:getDimY( )
local dPartHeight = CurrentPart.b3PartOriginal:getDimZ() local dPartHeight = CurrentPart.b3PartOriginal:getDimZ( )
-- Se il pezzo corrente non ha coordinata, si calcola da OvmMid -- Se il pezzo corrente non ha coordinata, si calcola da OvmMid
if ( not CurrentPart.dPosX) then if ( not CurrentPart.dPosX) then
if ( i == 1) then if ( i == 1) then
CurrentPart.dPosX = dOvmHead CurrentPart.dPosX = dOvmHead
else 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
end end
@@ -469,8 +469,8 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
local dEndOffset = dOvmMid local dEndOffset = dOvmMid
-- se ultimo pezzo bisogna allungare il grezzo del restante solo se non viene creato un grezzo indipendente -- se ultimo pezzo bisogna allungare il grezzo del restante solo se non viene creato un grezzo indipendente
if ( i == #PARTS) then if ( i == #PARTS ) then
local dPotentialRemaining = max( 0, dRawL - ( CurrentPart.dPosX + dPartLen)) local dPotentialRemaining = max( 0, dRawL - ( CurrentPart.dPosX + dPartLen ))
if ( dPotentialRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then if ( dPotentialRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then
dEndOffset = 0 -- Coda a zero, il resto diventerà un idRawRest indipendente dEndOffset = 0 -- Coda a zero, il resto diventerà un idRawRest indipendente
else else
@@ -479,9 +479,9 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
end end
-- Gap reale tra i pezzi (può essere negativo in caso di compenetrazione nesting obliqui) -- 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 local dTotalGap = PARTS[i + 1].dPosX - CurrentPart.dPosX - dPartLen
if ( dTotalGap > dOvmMid) then if ( dTotalGap > dOvmMid ) then
dEndOffset = dOvmMid dEndOffset = dOvmMid
dNextStartOffset = dTotalGap - dOvmMid dNextStartOffset = dTotalGap - dOvmMid
else else
@@ -495,105 +495,102 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS, b
local dDelta = dEndOffset local dDelta = dEndOffset
local dStartPos = CurrentPart.dPosX - dStartOffset local dStartPos = CurrentPart.dPosX - dStartOffset
local bIsSectionOk = ( ( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or 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)) ( 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 -- 5. Creazione e Posizionamento del Contenitore RawPart
CurrentPart.idRaw = EgtAddRawPart( Point3d( 0, 0, 0), dCurrentRawLen, dRawW, dRawH, BeamData.RAWCOL) CurrentPart.idRaw = EgtAddRawPart( Point3d( 0, 0, 0 ), dCurrentRawLen, dRawW, dRawH, BeamData.RAWCOL )
EgtMoveToCornerRawPart( CurrentPart.idRaw, BeamData.ptOriXR, BeamData.dPosXR) EgtMoveToCornerRawPart( CurrentPart.idRaw, BeamData.ptOriXR, BeamData.dPosXR )
EgtMoveRawPart( CurrentPart.idRaw, Vector3d( -dStartPos, 0, 0)) EgtMoveRawPart( CurrentPart.idRaw, Vector3d( -dStartPos, 0, 0 ) )
-- 6. Configurazione Geometrie Pezzo -- 6. Configurazione Geometrie Pezzo
nCnt = nCnt + 1 nCnt = nCnt + 1
EgtSetInfo( CurrentPart.idRaw, 'ORD', nCnt) EgtSetInfo( CurrentPart.idRaw, 'ORD', nCnt )
if ( not BeamLib.CreateOrEmptyAddGroup( CurrentPart.id)) then if ( not BeamLib.CreateOrEmptyAddGroup( CurrentPart.id ) ) then
return false, 'Error creating Additional Group in Part ' .. tostring( CurrentPart.id) return false, 'Error creating Additional Group in Part ' .. tostring( CurrentPart.id )
end end
BeamLib.AddPartStartFace( CurrentPart.id, CurrentPart.b3PartOriginal) BeamLib.AddPartStartFace( CurrentPart.id, CurrentPart.b3PartOriginal )
BeamLib.AddPartEndFace( 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) -- Inserimento con dDelta (lascia lo spazio vuoto a sinistra e spinge il pezzo a destra)
EgtDeselectPartObjs( CurrentPart.id) EgtDeselectPartObjs( CurrentPart.id )
local ptPos = b3BoxExact:getMin() - CurrentPart.b3PartOriginal:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2) local ptPos = b3BoxExact:getMin( ) - CurrentPart.b3PartOriginal:getMin( ) + Vector3d( dDelta, ( dRawW - dPartWidth ) / 2, ( dRawH - dPartHeight ) / 2 )
EgtAddPartToRawPart( CurrentPart.id, ptPos, CurrentPart.idRaw) EgtAddPartToRawPart( CurrentPart.id, ptPos, CurrentPart.idRaw )
-- Rotazione sezione se necessaria -- Rotazione sezione se necessaria
if ( abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL) then if ( abs( dPartWidth - dRawW ) > 100 * GEO.EPS_SMALL ) then
EgtRotatePartInRawPart( CurrentPart.id, X_AX(), 90) EgtRotatePartInRawPart( CurrentPart.id, X_AX( ), 90 )
local vtEccOri = CurrentPart.b3PartOriginal:getCenter() - b3BoxExact:getCenter() local vtEccOri = CurrentPart.b3PartOriginal:getCenter( ) - b3BoxExact:getCenter( )
local vtEccRot = Vector3d( vtEccOri) local vtEccRot = Vector3d( vtEccOri )
vtEccRot:rotate( X_AX(), 90) vtEccRot:rotate( X_AX( ), 90 )
EgtMovePartInRawPart( CurrentPart.id, ( vtEccOri - vtEccRot)) EgtMovePartInRawPart( CurrentPart.id, ( vtEccOri - vtEccRot ) )
end end
-- 7. Popolamento Metadati della Tabella CurrentPart -- 7. Popolamento Metadati della Tabella CurrentPart
CurrentPart.bIsLastPart = ( i == #PARTS) CurrentPart.bIsLastPart = ( i == #PARTS )
CurrentPart.dDistanceToNextPiece = dEndOffset CurrentPart.dDistanceToNextPiece = dEndOffset
CurrentPart.b3Raw = EgtGetRawPartBBox( CurrentPart.idRaw) CurrentPart.b3Raw = EgtGetRawPartBBox( CurrentPart.idRaw )
CurrentPart.dLength = CurrentPart.b3Raw:getDimX() CurrentPart.dLength = CurrentPart.b3Raw:getDimX( )
CurrentPart.dWidth = CurrentPart.b3Raw:getDimY() CurrentPart.dWidth = CurrentPart.b3Raw:getDimY( )
CurrentPart.dHeight = CurrentPart.b3Raw:getDimZ() CurrentPart.dHeight = CurrentPart.b3Raw:getDimZ( )
CurrentPart.bSquareSection = abs( CurrentPart.dWidth - CurrentPart.dHeight) < 100 * GEO.EPS_SMALL CurrentPart.bSquareSection = abs( CurrentPart.dWidth - CurrentPart.dHeight ) < 100 * GEO.EPS_SMALL
CurrentPart.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( CurrentPart.id, 'Box') or GDB_ID.NULL) CurrentPart.idBoxTm = EgtGetFirstInGroup( EgtGetFirstNameInGroup( CurrentPart.id, 'Box' ) or GDB_ID.NULL )
CurrentPart.b3Part = EgtGetBBoxGlob( CurrentPart.idBoxTm, GDB_BB.STANDARD) CurrentPart.b3Part = EgtGetBBoxGlob( CurrentPart.idBoxTm, GDB_BB.STANDARD )
CurrentPart.nIndexInParts = i 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.NotClampableLength = { STD = { dHead = 0, dTail = 0 }, SIDE = { dHead = 0, dTail = 0 }, DOWN = { dHead = 0, dTail = 0 } }
CurrentPart.dHeadOverMaterial = dStartOffset 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.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 -- Notifiche al Post-Processor basate sulla nuova scomposizione
if ( dStartOffset > 0.09) then EgtSetInfo( CurrentPart.idRaw, 'HOVM', 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 ( dEndOffset > 0.09 ) then EgtSetInfo( CurrentPart.idRaw, 'TOVM', dEndOffset ) end
if ( idPrevRaw) then EgtSetInfo( idPrevRaw, 'BDST', dStartOffset) end if ( idPrevRaw ) then EgtSetInfo( idPrevRaw, 'BDST', dStartOffset ) end
-- Caricamento Strategie JSON -- Caricamento Strategie JSON
CurrentPart.sAISetupConfig = EgtGetInfo( CurrentPart.id, 'AISETUP', 's') or CurrentPart.sAISetupConfig = EgtGetInfo( CurrentPart.id, 'AISETUP', 's' ) or
( GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo] and GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo].sAISetupConfig) or ( GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo] and GENERAL_PARAMETERS.BTL[CurrentPart.sBTLInfo].sAISetupConfig ) or
GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil GENERAL_PARAMETERS.PROJECT.sAISetupConfig or nil
TIMER:startElapsed( 'Json') TIMER:startElapsed( 'Json' )
BeamExec.GetStrategiesFromJSONinBD( CurrentPart.sAISetupConfig) BeamExec.GetStrategiesFromJSONinBD( CurrentPart.sAISetupConfig )
CurrentPart.GeneralParameters = BeamLib.GetPieceGeneralParameters( CurrentPart, GENERAL_PARAMETERS_JSON) CurrentPart.GeneralParameters = BeamLib.GetPieceGeneralParameters( CurrentPart, GENERAL_PARAMETERS_JSON )
TIMER:stopElapsed( '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) -- 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 CurrentPart.dRestLength = dRawL - dMaxX
idPrevRaw = CurrentPart.idRaw idPrevRaw = CurrentPart.idRaw
else 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 return false, sOut
end end
end end
-- 8. Chiusura Barra e Gestione Avanzo (Rest Material) -- 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 local dRemaining = dRawL - dMaxX
if ( dRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then if ( dRemaining > dMinLengthToCreateRaw - GEO.EPS_SMALL) then
local idRawRest = EgtAddRawPart( Point3d( 0, 0, 0), dRemaining, dRawW, dRawH, BeamData.RAWCOL) local idRawRest = EgtAddRawPart( Point3d( 0, 0, 0 ), dRemaining, dRawW, dRawH, BeamData.RAWCOL )
EgtMoveToCornerRawPart( idRawRest, BeamData.ptOriXR, BeamData.dPosXR) EgtMoveToCornerRawPart( idRawRest, BeamData.ptOriXR, BeamData.dPosXR )
EgtMoveRawPart( idRawRest, Vector3d( -dMaxX, 0, 0)) EgtMoveRawPart( idRawRest, Vector3d( -dMaxX, 0, 0 ) )
nCnt = nCnt + 1 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 PARTS[#PARTS].dDistanceToNextPiece = 10000
end end
else else
if ( #PARTS > 0) then PARTS[#PARTS].dDistanceToNextPiece = 10000 end if ( #PARTS > 0 ) then PARTS[#PARTS].dDistanceToNextPiece = 10000 end
end end
return true return true
@@ -779,11 +776,11 @@ local function AreDrillingsMirrored( Proc, ProcMirror, Part)
-- geometria ausiliaria foro principale -- geometria ausiliaria foro principale
AuxId = EgtGetInfo( Proc.id, 'AUXID', 'i') AuxId = EgtGetInfo( Proc.id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.id end 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 -- geometria ausiliaria foro specchiato
local AuxIdMirror = EgtGetInfo( ProcMirror.id, 'AUXID', 'i') local AuxIdMirror = EgtGetInfo( ProcMirror.id, 'AUXID', 'i')
if AuxIdMirror then AuxIdMirror = AuxIdMirror + ProcMirror.id end 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 -- dati del foro principale
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB) local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
@@ -2661,7 +2658,7 @@ function BeamExec.ProcessAlternatives( PARTS)
if PARTS[nPart].HeadcutInfo then if PARTS[nPart].HeadcutInfo then
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',') local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',')
local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "") local sVtN = ( tostring( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].vtN)):gsub("^%(", ""):gsub("%)$", "")
table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN) table.insert( BEAM.INFONGEPART, 'ALT' .. AlternativesNest2D[i].. '_H' .. '=' .. sOffsetX .. ';' .. sVtN )
end end
if PARTS[nPart].TailcutInfo then if PARTS[nPart].TailcutInfo then
local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].OffsetX, ',') local sOffsetX = table.concat( PARTS[nPart].TailcutInfo[AlternativesNest2D[i]].OffsetX, ',')
-3
View File
@@ -36,9 +36,6 @@ function FeatureLib.GetProcFromTrimesh( idTrimesh, Part, ProcToCopyFrom)
if ProcToCopyFrom and Proc.dVolume < 10 * GEO.EPS_SMALL then if ProcToCopyFrom and Proc.dVolume < 10 * GEO.EPS_SMALL then
Proc.dVolume = ProcToCopyFrom.dVolume Proc.dVolume = ProcToCopyFrom.dVolume
end end
Proc.nParts = EgtSurfTmPartCount( Proc.id) or 1
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
-- TODO servono anche altri dati raccolti nel collect?? -- TODO servono anche altri dati raccolti nel collect??
return Proc return Proc
+11 -14
View File
@@ -9,6 +9,7 @@ require( 'EgtBase')
local BeamData = require( 'BeamDataNew') local BeamData = require( 'BeamDataNew')
local FaceData = require( 'FaceData') local FaceData = require( 'FaceData')
local BeamLib = require( 'BeamLib') local BeamLib = require( 'BeamLib')
local PreSimulationLib = require( 'PreSimulationLib')
EgtOutLog( ' LeadInOutLib started', 1) EgtOutLog( ' LeadInOutLib started', 1)
@@ -71,24 +72,20 @@ end
local function CalculateLeadInOutLength( ptToolCenter, vtNFace, b3Box, vtLeadInOut, Tool) local function CalculateLeadInOutLength( ptToolCenter, vtNFace, b3Box, vtLeadInOut, Tool)
-- al momento gestita solo lama -- al momento gestita solo lama
if not Tool.sFamily == 'SawBlade' then if not Tool.sFamily == 'SAWBLADE' then
error(' Tool family not implemented') error(' Tool family not implemented')
end end
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z local ptStart = Point3d( ptToolCenter)
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000) local DistanceData = {}
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000) DistanceData.vtNFace = vtNFace
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0) DistanceData.vtMove = vtLeadInOut
DistanceData.dToolThickness = Tool.dThickness
DistanceData.dToolDiameter = Tool.dDiameter
DistanceData.sToolFamily = Tool.sFamily
DistanceData.ptReferencePoint = ptStart + DistanceData.dToolThickness * DistanceData.vtNFace
-- si setta utensile lama per il controllo collisione return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
EgtCAvSetSawTool( Tool.dThickness, Tool.dDiameter, Tool.dThickness, 0, 0)
-- calcolo distanza di cui retrarre con funzioni Tool Collision Avoidance
local dLength = min( EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxX, vtLeadInOut),
EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxY, vtLeadInOut),
EgtCAvToolPosBox( ptToolCenter + Tool.dThickness * vtNFace, vtNFace, b3BoxZ, vtLeadInOut))
return dLength
end end
+26
View File
@@ -791,6 +791,25 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
return ToolInfo return ToolInfo
end end
-- Calcolo profondità massima del foro rispetto al Portautensile (solo per utensile punta)
-------------------------------------------------------------------------------------------------------------
function MachiningLib.GetDrillMaxDepthFromToolHolderSideEncumbrance( FeatureInfo, nToolIndex, b3Raw)
local b3Box = BBox3d( b3Raw)
b3Box:expand( BeamData.COLL_SIC)
local ptStart = Point3d( FeatureInfo.ptDrillCenter)
local dToolLength = TOOLS[nToolIndex].dLength
local dMaxDepth = TOOLS[nToolIndex].dMaxDepth
local DistanceData = {}
DistanceData.vtNFace = Vector3d( FeatureInfo.vtDrillExtrusion)
DistanceData.vtMove = Vector3d( FeatureInfo.vtDrillExtrusion)
DistanceData.dToolLength = TOOLS[nToolIndex].ToolHolder.dLength
DistanceData.dToolDiameter = TOOLS[nToolIndex].ToolHolder.dDiameter
DistanceData.sToolFamily = 'TOOLHOLDER'
DistanceData.ptReferencePoint = ptStart + ( ( dToolLength - dMaxDepth - DistanceData.dToolLength) * DistanceData.vtNFace)
return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche -- funzione per cercare utensile tipo PUNTA A FORARE con certe caratteristiche
function MachiningLib.FindDrill( Proc, ToolSearchParameters) function MachiningLib.FindDrill( Proc, ToolSearchParameters)
@@ -907,6 +926,13 @@ function MachiningLib.FindDrill( Proc, ToolSearchParameters)
ToolInfo.nToolIndex = nBestToolIndex ToolInfo.nToolIndex = nBestToolIndex
ToolInfo.dResidualDepth = dBestToolResidualDepth ToolInfo.dResidualDepth = dBestToolResidualDepth
if nBestToolIndex then
local dTHReduction = MachiningLib.GetDrillMaxDepthFromToolHolderSideEncumbrance( Proc.FeatureInfo, nBestToolIndex, ToolSearchParameters.Part.b3Raw)
local dTHResidualDepth = ToolSearchParameters.dElevation + dTHReduction - TOOLS[nBestToolIndex].dMaxDepth
if dTHResidualDepth < dBestToolResidualDepth then
ToolInfo.dResidualDepth = dTHResidualDepth
end
end
-- si salva se la punta ha lo stesso diametro del foro -- si salva se la punta ha lo stesso diametro del foro
if nBestToolIndex and TOOLS[nBestToolIndex].dDiameter - ToolSearchParameters.dToolDiameter > 100 * GEO.EPS_SMALL then if nBestToolIndex and TOOLS[nBestToolIndex].dDiameter - ToolSearchParameters.dToolDiameter > 100 * GEO.EPS_SMALL then
ToolInfo.bDrillIsExactDiameter = true ToolInfo.bDrillIsExactDiameter = true
+29
View File
@@ -103,6 +103,35 @@ function PreSimulationLib.GetPointOnToolTipCenter( ptPointAtDepth, vtHead, vtNFa
return ptPointAtDepth + vtToolOffset * Tool.dDiameter / 2 + vtNFace * EgtIf( AreSameVectorApprox( vtHead, vtNFace), 0, Tool.dThickness) return ptPointAtDepth + vtToolOffset * Tool.dDiameter / 2 + vtNFace * EgtIf( AreSameVectorApprox( vtHead, vtNFace), 0, Tool.dThickness)
end end
-------------------------------------------------------------------------------------------------------------
function PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
-- Box del pezzo espansi ortogonalmente alle tre direzioni canoniche X, Y e Z
local b3BoxX = BBox3d( b3Box) ; b3BoxX:expand( 0, 1000, 1000)
local b3BoxY = BBox3d( b3Box) ; b3BoxY:expand( 1000, 0, 1000)
local b3BoxZ = BBox3d( b3Box) ; b3BoxZ:expand( 1000, 1000, 0)
-- Imposta l'utensile correttamente
if DistanceData.sToolFamily == 'DRILLBIT' then
-- si setta utensile Punta per il controllo collisione
EgtCAvSetAdvTool( DistanceData.dToolLength, DistanceData.dToolDiameter, ( DistanceData.dToolTotalLength - DistanceData.dToolLength), 0, 0)
elseif DistanceData.sToolFamily == 'SAWBLADE' then
-- si setta utensile Lama per il controllo collisione
EgtCAvSetSawTool( DistanceData.dToolThickness, DistanceData.dToolDiameter, DistanceData.dToolThickness, 0, 0)
elseif DistanceData.sToolFamily == 'TOOLHOLDER' then
-- si setta utensile Cilindrico per simulare il portautensile in caso di fori inclinati nei quali è possibile che il portautensile collida
EgtCAvSetStdTool( DistanceData.dToolLength, DistanceData.dToolDiameter, 0)
-- altre tipologie non gestite
else
return nil
end
-- calcolo distanza di cui retrarre con funzioni Tool Collision Avoidance *da top dell'utensile*
local dLength = min( EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxX, DistanceData.vtMove),
EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxY, DistanceData.vtMove),
EgtCAvToolPosBox( DistanceData.ptReferencePoint, DistanceData.vtNFace, b3BoxZ, DistanceData.vtMove))
return dLength
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- calcolo punto sull'uscita testa a partire dal punto di lavorazione o di attacco sul diametro utensile -- calcolo punto sull'uscita testa a partire dal punto di lavorazione o di attacco sul diametro utensile
local function GetToolExitPoint( ptMachining, vtNEdge, vtHead, Tool, bIsDownUp) local function GetToolExitPoint( ptMachining, vtNEdge, vtHead, Tool, bIsDownUp)
+22
View File
@@ -8,6 +8,7 @@ local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamDataNew') local BeamData = require( 'BeamDataNew')
local MachiningLib = require( 'MachiningLib') local MachiningLib = require( 'MachiningLib')
local FeatureLib = require( 'FeatureLib') local FeatureLib = require( 'FeatureLib')
local PreSimulationLib = require( 'PreSimulationLib')
-- strategie di base -- strategie di base
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -37,6 +38,24 @@ local function GetSCC( vtMachiningDirection)
return nSCC return nSCC
end end
-- Calcolo distanza dalla quale andare a velocità di lavoro ( Start Safety Length)
-------------------------------------------------------------------------------------------------------------
local function GetDrillApprochSafeDistance( FeatureInfo, nToolIndex, b3Raw)
local b3Box = BBox3d( b3Raw)
b3Box:expand( BeamData.COLL_SIC)
local ptStart = Point3d( FeatureInfo.ptDrillCenter)
local DistanceData = {}
DistanceData.vtNFace = Vector3d( FeatureInfo.vtDrillExtrusion)
DistanceData.vtMove = Vector3d( FeatureInfo.vtDrillExtrusion)
DistanceData.dToolLength = TOOLS[nToolIndex].dLength
DistanceData.dToolTotalLength = TOOLS[nToolIndex].dTotalLength
DistanceData.dToolDiameter = TOOLS[nToolIndex].dDiameter
DistanceData.sToolFamily = TOOLS[nToolIndex].sFamily
DistanceData.ptReferencePoint = ptStart + DistanceData.dToolLength * DistanceData.vtNFace
return PreSimulationLib.GetDistanceToRetractToolFromRaw( DistanceData, b3Box)
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function GetDrillingStrategy( Proc, Part) local function GetDrillingStrategy( Proc, Part)
local ToolSearchParameters = {} local ToolSearchParameters = {}
@@ -51,6 +70,7 @@ local function GetDrillingStrategy( Proc, Part)
ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance ToolSearchParameters.dDiameterTolerance = Strategy.Parameters.dDiameterTolerance
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sDrillBitList, 'Drilling') ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sDrillBitList, 'Drilling')
ToolSearchParameters.ptCheckOutStroke = { Proc.FeatureInfo.ptDrillCenter + ( EgtMdbGetGeneralParam( MCH_GP.SAFEZ) * ToolSearchParameters.vtToolDirection)} ToolSearchParameters.ptCheckOutStroke = { Proc.FeatureInfo.ptDrillCenter + ( EgtMdbGetGeneralParam( MCH_GP.SAFEZ) * ToolSearchParameters.vtToolDirection)}
ToolSearchParameters.Part = Part
Drilling.ToolInfo = {} Drilling.ToolInfo = {}
Drilling.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters) Drilling.ToolInfo = MachiningLib.FindDrill( Proc, ToolSearchParameters)
@@ -61,6 +81,7 @@ local function GetDrillingStrategy( Proc, Part)
Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion Drilling.vtToolDirection = Proc.FeatureInfo.vtDrillExtrusion
Drilling.dStep = TOOLS[Drilling.nToolIndex].dStep Drilling.dStep = TOOLS[Drilling.nToolIndex].dStep
Drilling.nSCC = GetSCC( -Drilling.vtToolDirection) Drilling.nSCC = GetSCC( -Drilling.vtToolDirection)
Drilling.dStartSafetyLength = max( BeamData.COLL_SIC, GetDrillApprochSafeDistance( Proc.FeatureInfo, Drilling.ToolInfo.nToolIndex, Part.b3Raw))
end end
-- TODO se utensile 2 che si torverà è il gemello da usare nelle lavorazioni in doppio, allora gestire di conseguenza l'applicazione delle lavorazioni in doppio -- TODO se utensile 2 che si torverà è il gemello da usare nelle lavorazioni in doppio, allora gestire di conseguenza l'applicazione delle lavorazioni in doppio
@@ -84,6 +105,7 @@ local function GetDrillingStrategy( Proc, Part)
Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion Drilling2.vtToolDirection = -Proc.FeatureInfo.vtDrillExtrusion
Drilling2.dStep = TOOLS[Drilling2.nToolIndex].dStep Drilling2.dStep = TOOLS[Drilling2.nToolIndex].dStep
Drilling2.nSCC = GetSCC( -Drilling2.vtToolDirection) Drilling2.nSCC = GetSCC( -Drilling2.vtToolDirection)
Drilling2.dStartSafetyLength = max( BeamData.COLL_SIC, GetDrillApprochSafeDistance( Proc.FeatureInfo, Drilling.ToolInfo.nToolIndex, Part.b3Raw))
end end
end end
-5
View File
@@ -577,11 +577,6 @@ local function GetDualSideCutStrategy( Proc, Part, OptionalParameters)
end end
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) -- arrivati qui si prova il taglio doppio verticale (taglio doppio orizzontale non si può fare oppure non ci arriva)
EdgeToMachine = GetEdgeToMachine( FaceToMachine.Edges, 'Vertical') EdgeToMachine = GetEdgeToMachine( FaceToMachine.Edges, 'Vertical')
local dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN local dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN
+1 -3
View File
@@ -602,9 +602,7 @@ 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 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 -- 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 Cutting.bMoveAfterSplit = Cutting.bMoveAfterSplit or Cutting.LeadIn.bMoveAfterSplit or Cutting.LeadOut.bMoveAfterSplit
local bIsTruncatingCutOnTail = Proc.AffectedFaces.bLeft and local bIsTruncatingCutOnTail = Proc.Topology and ( Proc.Topology.sName == 'Cut-1-Through' or Proc.Topology.sName == 'TailCut') and Proc.AffectedFaces.bLeft
( ( 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 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.b3Box:getDimZ() > Part.b3Raw:getDimZ() - 100 * GEO.EPS_SMALL) and
Proc.AffectedFaces.bLeft Proc.AffectedFaces.bLeft
+1 -1
View File
@@ -2,5 +2,5 @@
-- Gestione della versione di BeamNT -- Gestione della versione di BeamNT
NAME = 'BeamNT' NAME = 'BeamNT'
VERSION = '3.1g5' VERSION = '3.1g4'
MIN_EXE = '3.1g3' MIN_EXE = '3.1g3'