Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bee171cef | |||
| 6dad1e14c4 | |||
| 32227ce33b | |||
| 1a25ebff1a | |||
| 35dc783c10 | |||
| 9cadb26603 | |||
| 37ab3b3bd2 | |||
| 4837173ba1 | |||
| fb06c85aa5 | |||
| dd56772f63 | |||
| b28cdf488d | |||
| e1564c4995 | |||
| 0b9ebbb15c | |||
| b9037b28f7 | |||
| aa7e0ae4c1 | |||
| 88bf36667d | |||
| 763f1200f5 | |||
| f5a526f6bf | |||
| 7b6066d47d |
@@ -5,8 +5,14 @@ set LUAC=C:\EgtProg\Dll32\luac54.exe
|
||||
set ROOT=%cd%\
|
||||
set OUTBASE=bin
|
||||
|
||||
rmdir /s /q "%ROOT%\%OUTBASE%"
|
||||
|
||||
if not exist %OUTBASE% mkdir %OUTBASE%
|
||||
|
||||
xcopy "%ROOT%\Images" "%ROOT%\%OUTBASE%\Images" /E /H /C /I /Y
|
||||
|
||||
xcopy "%ROOT%\Messages" "%ROOT%\%OUTBASE%\Messages" /E /H /C /I /Y
|
||||
|
||||
REM Compile all .lua files excluding bin\ and any dot folders/files
|
||||
for /f "delims=" %%F in ('dir /b /s /a-d *.lua ^| findstr /v /i /c:"\%OUTBASE%\"') do (
|
||||
set FULL=%%F
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
+69
-36
@@ -731,6 +731,8 @@ local function CollectFeatures( Part, dRotIndex)
|
||||
end
|
||||
-- calcolo riduzione lunghezza pinzabile testa/coda
|
||||
Proc.NotClampableLength = FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
-- si verifica se la feature, lavorata in questa fase, compromette il pinzaggio
|
||||
Proc.bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( Proc.NotClampableLength.dNotClampableLengthHead, Proc.NotClampableLength.dNotClampableLengthTail), Part)
|
||||
-- si verifica se la feature, lavorata in questa fase, compromette lettura misura laser
|
||||
Proc.bHindersLaserMeasure = FeatureLib.CalculateFeatureHindersLaserMeasure( Proc, Part)
|
||||
-- altrimenti errore (serviva riconoscimento topologico, ma non è stato possibile farlo)
|
||||
@@ -1498,7 +1500,6 @@ function BeamExec.GetProcessings( PARTS, bIsFlipRot)
|
||||
local nOffsetIndex = EgtIf( nInvertIndex == 2, 4, 0)
|
||||
-- le rotazioni sono 1,2,3,4 (0, 90, 180, 270) e 5,6,7,8 (le stesse invertite)
|
||||
local nIndex = nRotIndex + nOffsetIndex
|
||||
local HeadcutInfo, TailcutInfo
|
||||
-- si calcolano le feature solo se la rotazione può essere presa in considerazione
|
||||
if PARTS[nPart].CombinationList.Rotations[nRotIndex] == 1 then
|
||||
-- recupero le feature di lavorazione della trave
|
||||
@@ -1697,17 +1698,19 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione che calcola le combinazioni di rotazione per lavorare la trave e sceglie la migliore
|
||||
local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bReProcessEmptyChosenStrategy, BitCombinationListToReprocess)
|
||||
local function GetCombinationListFromMatrix( ProcessingsOnPart, Part, bReProcessEmptyChosenStrategy, BitCombinationListToReprocess)
|
||||
local CombinationsList = { dAllCombinationsTotalTime = 0}
|
||||
|
||||
-- calcolo per tutte le combinazioni disponibili precedentemente verificate
|
||||
for i = 1, #PartInfo.CombinationList do
|
||||
for i = 1, #Part.CombinationList do
|
||||
local bToProcess = false
|
||||
-- controllo se debbano essere ricalcolate solo alcune soluzioni
|
||||
local nSingleCombinationToReprocessIndex
|
||||
if BitCombinationListToReprocess and #BitCombinationListToReprocess > 0 then
|
||||
for c = 1, #BitCombinationListToReprocess do
|
||||
if PartInfo.CombinationList[i].sBitIndexCombination == BitCombinationListToReprocess[c].sBitIndexCombination and
|
||||
PartInfo.CombinationList[i].bPartInCombiIsInverted == BitCombinationListToReprocess[c].bPartInCombiIsInverted then
|
||||
if Part.CombinationList[i].sBitIndexCombination == BitCombinationListToReprocess[c].sBitIndexCombination and
|
||||
Part.CombinationList[i].bPartInCombiIsInverted == BitCombinationListToReprocess[c].bPartInCombiIsInverted then
|
||||
nSingleCombinationToReprocessIndex = c
|
||||
bToProcess = true
|
||||
end
|
||||
end
|
||||
@@ -1718,7 +1721,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
if bToProcess then
|
||||
local bRot90, bRot180
|
||||
local SingleCombination = {}
|
||||
local nUnloadPos = PartInfo.CombinationList[i].nUnloadPos
|
||||
local nUnloadPos = Part.CombinationList[i].nUnloadPos
|
||||
SingleCombination.nRotations = 0
|
||||
SingleCombination.dTotalTimeToMachine = 0
|
||||
SingleCombination.dTotalQuality = 0
|
||||
@@ -1726,9 +1729,12 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
SingleCombination.nComplete = 0
|
||||
SingleCombination.nNotComplete = 0
|
||||
SingleCombination.nNotExecute = 0
|
||||
SingleCombination.sBitIndexCombination = PartInfo.CombinationList[i].sBitIndexCombination
|
||||
SingleCombination.sBitIndexCombination = Part.CombinationList[i].sBitIndexCombination
|
||||
if nSingleCombinationToReprocessIndex then
|
||||
SingleCombination.sBitIndexCombinationToNest = BitCombinationListToReprocess[nSingleCombinationToReprocessIndex].sBitIndexCombinationToNest
|
||||
end
|
||||
-- TODO se pezzo invertito bisogna considerare le rotazioni nell'array dalla 5 alla 8
|
||||
SingleCombination.bPartInCombiIsInverted = PartInfo.CombinationList[i].bPartInCombiIsInverted
|
||||
SingleCombination.bPartInCombiIsInverted = Part.CombinationList[i].bPartInCombiIsInverted
|
||||
SingleCombination.nUnloadPos = nUnloadPos
|
||||
-- creo liste dei proc suddivisi per rotazione
|
||||
SingleCombination.Rot0 = {}
|
||||
@@ -1749,19 +1755,38 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
else
|
||||
if not ( ( ID.IsHeadCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) and ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc].bIsOriginalHeadcut)
|
||||
or ( ID.IsTailCut( ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc]) and ProcessingsOnPart.Rotation[1+nOffsetIndex][nProc].bIsOriginalTailcut)) then
|
||||
-- primo ciclo sulle rotazioni per vedere se la feature interferisce con il pinzaggio, in una qualunque rotazione
|
||||
local dMaxNotClampableLengthHead = 0
|
||||
local dMaxNotClampableLengthTail = 0
|
||||
local dMaxNotClampableLength = 0
|
||||
for nRotation = 1, 4 do
|
||||
-- si considera solo rotazione attiva
|
||||
if string.sub( Part.CombinationList[i].sBitIndexCombination, nRotation, nRotation) == '1' and ( ProcessingsOnPart.Rotation[nRotation+nOffsetIndex][nProc].nFlg > 0) then
|
||||
dMaxNotClampableLengthHead = max( ProcessingsOnPart.Rotation[nRotation+nOffsetIndex][nProc].NotClampableLength.dNotClampableLengthHead, dMaxNotClampableLengthHead)
|
||||
dMaxNotClampableLengthTail = max( ProcessingsOnPart.Rotation[nRotation+nOffsetIndex][nProc].NotClampableLength.dNotClampableLengthTail, dMaxNotClampableLengthTail)
|
||||
end
|
||||
end
|
||||
dMaxNotClampableLength = max( dMaxNotClampableLengthHead, dMaxNotClampableLengthTail)
|
||||
-- ciclo sulle rotazioni
|
||||
local nNextRot = nUnloadPos
|
||||
local ResultsList = {}
|
||||
local bExecInLastRotation = false
|
||||
for nRotation = 1, 3 do
|
||||
-- se rotazione abilitata da combinazione
|
||||
if string.sub( PartInfo.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then
|
||||
if string.sub( Part.CombinationList[i].sBitIndexCombination, nNextRot, nNextRot) == '1' then
|
||||
local CurrProc = ProcessingsOnPart.Rotation[nNextRot+nOffsetIndex][nProc]
|
||||
-- se è ultima rotazione oppure se feature non impatta su misura laser, allora è valida e può essere effettivamente considerata
|
||||
if nNextRot == nUnloadPos or not( CurrProc.bHindersLaserMeasure) then
|
||||
-- se non è settata la ChosenStrtegy, provo a cercare comunque tra quelle disponibili
|
||||
if not CurrProc.ChosenStrategy and bReProcessEmptyChosenStrategy then
|
||||
CurrProc = GetFeatureBestStrategy( CurrProc, PartInfo)
|
||||
end
|
||||
-- se non è settata la ChosenStrategy, provo a cercare comunque tra quelle disponibili
|
||||
if not CurrProc.ChosenStrategy and bReProcessEmptyChosenStrategy then
|
||||
CurrProc = GetFeatureBestStrategy( CurrProc, Part)
|
||||
end
|
||||
-- si verifica se la feature compromette il pinzaggio
|
||||
local bIgnoreNotClampableLength = false
|
||||
if CurrProc.ChosenStrategy then
|
||||
bIgnoreNotClampableLength = CurrProc.ChosenStrategy.Result.bIgnoreNotClampableLength
|
||||
end
|
||||
bExecInLastRotation = ( not bIgnoreNotClampableLength) and FeatureLib.IsMachiningLong( dMaxNotClampableLength, Part)
|
||||
-- se la feature impatta sulla lettura laser o compromette il pinzaggio è valida solo se fatta in ultima rotazione; negli altri casi è sempre valida
|
||||
if nNextRot == nUnloadPos or not( CurrProc.bHindersLaserMeasure or bExecInLastRotation) then
|
||||
-- controllo se è stata scelta una strategia
|
||||
if CurrProc.ChosenStrategy then
|
||||
local Proc = {}
|
||||
@@ -1781,7 +1806,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
SingleCombination.nIndexTailCutInVProc = nProc
|
||||
else
|
||||
if #ResultsList > 0 then
|
||||
local Proc, Data = GetProcBestMachRotationFromList( ResultsList, PartInfo)
|
||||
local Proc, Data = GetProcBestMachRotationFromList( ResultsList, Part)
|
||||
Proc.nIndexRotation = Data.nIndexRotation
|
||||
-- inserisco la Proc nell'apposita lista
|
||||
if Data.nIndexRotation == nUnloadPos then
|
||||
@@ -1832,7 +1857,7 @@ local function GetCombinationListFromMatrix( ProcessingsOnPart, PartInfo, bRePro
|
||||
end
|
||||
|
||||
-- si calsola il total rating
|
||||
CombinationsList = FeatureLib.CalculateCombinationsCompositeRating( CombinationsList, PartInfo.GeneralParameters.GEN_sMachiningStrategy)
|
||||
CombinationsList = FeatureLib.CalculateCombinationsCompositeRating( CombinationsList, Part.GeneralParameters.GEN_sMachiningStrategy)
|
||||
|
||||
return CombinationsList
|
||||
end
|
||||
@@ -2278,36 +2303,47 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
end
|
||||
|
||||
-- se serve calcolare posizione per ottimizzazione tagli in nesting (le soluzioni non possono avere ribaltamenti)
|
||||
-- il pezzo è il posizione 0 in questo momento, ma l'automatismo ha già fatto la prerotazione, se abilitata
|
||||
-- le combinazioni vanno testate considerando come 0 la posizione preruotata
|
||||
-- allo stesso modo, le alternative devono considerare come 0 quello preruotato
|
||||
if PARTS[nPart].GeneralParameters.GEN_bGetAlternativesNesting2D then
|
||||
-- POSIZIONE 0 (e invertito)
|
||||
local sCombinationToCheck = BeamLib.StringReplaceChar( '0000', PARTS[nPart].nInitialPosition, "1")
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck}, bIsNesting2D = true})
|
||||
local sBitIndexCombinationToCheck = BeamLib.StringReplaceChar( '0000', PARTS[nPart].nInitialPosition, "1")
|
||||
local sBitIndexCombinationToNest = '1000'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
if PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion then
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck, bPartInCombiIsInverted = true}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToNest = '1000_INV'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = not PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
end
|
||||
|
||||
-- POSIZIONE 180 (e invertito)
|
||||
if PARTS[nPart].GeneralParameters.GEN_sPiecesLoadingPosition == 'STD_PRE_ROTATION' then
|
||||
local nOtherPosition = EgtIf( PARTS[nPart].nInitialPosition + 2 > 4, PARTS[nPart].nInitialPosition + 2 - 4, PARTS[nPart].nInitialPosition + 2)
|
||||
sCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
sBitIndexCombinationToNest = '0010'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
if PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion then
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck, bPartInCombiIsInverted = true}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToNest = '0010_INV'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = not PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
end
|
||||
end
|
||||
-- POSIZIONE 90/270 (e invertito)
|
||||
if PARTS[nPart].GeneralParameters.GEN_sPiecesLoadingPosition == 'FULL_PRE_ROTATION' then
|
||||
local nOtherPosition = EgtIf( PARTS[nPart].nInitialPosition + 1 > 4, PARTS[nPart].nInitialPosition + 1 - 4, PARTS[nPart].nInitialPosition + 1)
|
||||
sCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
sBitIndexCombinationToNest = '0100'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
if PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion then
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck, bPartInCombiIsInverted = true}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToNest = '0100_INV'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = not PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
end
|
||||
nOtherPosition = EgtIf( PARTS[nPart].nInitialPosition + 3 > 4, PARTS[nPart].nInitialPosition + 3 - 4, PARTS[nPart].nInitialPosition + 3)
|
||||
sCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToCheck = BeamLib.StringReplaceChar( '0000', nOtherPosition, "1")
|
||||
sBitIndexCombinationToNest = '0001'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
if PARTS[nPart].GeneralParameters.GEN_bAllowPieceInversion then
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sCombinationToCheck, bPartInCombiIsInverted = true}, bIsNesting2D = true})
|
||||
sBitIndexCombinationToNest = '0001_INV'
|
||||
table.insert( TotalCombiToTest, {{ sBitIndexCombination = sBitIndexCombinationToCheck, sBitIndexCombinationToNest = sBitIndexCombinationToNest, bPartInCombiIsInverted = not PARTS[nPart].bPartInCombiIsInverted}, bIsNesting2D = true})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2435,13 +2471,12 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
|
||||
-- aggiornamento info testa/coda per Nesting
|
||||
local nRotation = BeamLib.ConvertBitIndexToRotationIndex( BestCombination.sBitIndexCombination)
|
||||
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
||||
local HeadcutInfo, TailcutInfo = GetHeadTailInfoForNesting( HeadCutOnFirstRotation, TailCutOnFirstRotation, PARTS[nPart])
|
||||
if HeadcutInfo then
|
||||
-- offset e vettori vanno adeguati alla rotazione attuale (inversione è già corretta)
|
||||
BeamLib.RotateTableFromIndexInPlace( HeadcutInfo.OffsetX, nRotation)
|
||||
HeadcutInfo.vtN:rotate( X_AX(), ( nRotation - 1) * 90)
|
||||
PARTS[nPart].HeadcutInfo[sBitIndexCombinationWithInvert] = {
|
||||
PARTS[nPart].HeadcutInfo[BestCombination.sBitIndexCombinationToNest] = {
|
||||
OffsetX = HeadcutInfo.OffsetX,
|
||||
vtN = HeadcutInfo.vtN
|
||||
}
|
||||
@@ -2450,7 +2485,7 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
-- offset e vettori vanno adeguati alla rotazione attuale (inversione è già corretta)
|
||||
BeamLib.RotateTableFromIndexInPlace( TailcutInfo.OffsetX, nRotation)
|
||||
TailcutInfo.vtN:rotate( X_AX(), ( nRotation - 1) * 90)
|
||||
PARTS[nPart].TailcutInfo[sBitIndexCombinationWithInvert] = {
|
||||
PARTS[nPart].TailcutInfo[BestCombination.sBitIndexCombinationToNest] = {
|
||||
OffsetX = TailcutInfo.OffsetX,
|
||||
vtN = TailcutInfo.vtN
|
||||
}
|
||||
@@ -2586,11 +2621,10 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
local bApplOk, _, _ = EgtApplyAllMachinings()
|
||||
-- se non ci sono errori, soluzione alternativa valida: scrittura variabili globali per interfaccia
|
||||
if bApplOk then
|
||||
local sBitIndexCombinationWithInvert = BestCombination.sBitIndexCombination .. EgtIf( BestCombination.bPartInCombiIsInverted, '_INV', '')
|
||||
if TotalCombiToTest[z].bIsNesting2D then
|
||||
table.insert( AlternativesNest2D, sBitIndexCombinationWithInvert)
|
||||
table.insert( AlternativesNest2D, BestCombination.sBitIndexCombinationToNest)
|
||||
else
|
||||
table.insert( Alternatives, sBitIndexCombinationWithInvert)
|
||||
table.insert( Alternatives, BestCombination.sBitIndexCombinationToNest)
|
||||
end
|
||||
end
|
||||
-- se ultima combinazione, si esce e non si riporta in posizione iniziale. Verrà infatti cancellata
|
||||
@@ -2609,7 +2643,6 @@ function BeamExec.ProcessAlternatives( PARTS)
|
||||
|
||||
-- passaggio info a interfaccia da scrivere sul pezzo
|
||||
BEAM.INFONGEPART = {}
|
||||
table.insert( BEAM.INFONGEPART, 'INITIALPOSITION=' .. PARTS[nPart].nInitialPosition)
|
||||
for i = 1, #AlternativesNest2D do
|
||||
if PARTS[nPart].HeadcutInfo then
|
||||
local sOffsetX = table.concat( PARTS[nPart].HeadcutInfo[AlternativesNest2D[i]].OffsetX, ',')
|
||||
|
||||
+4
-12
@@ -940,22 +940,14 @@ end
|
||||
function BeamLib.ConvertBitIndexToRotationIndex( sBitIndexCombination)
|
||||
local nRotationIndex
|
||||
|
||||
if sBitIndexCombination == '1000' then
|
||||
if EgtStartsWith( sBitIndexCombination, '1000') then
|
||||
return 1
|
||||
elseif sBitIndexCombination == '0100' then
|
||||
elseif EgtStartsWith( sBitIndexCombination, '0100') then
|
||||
return 2
|
||||
elseif sBitIndexCombination == '0010' then
|
||||
elseif EgtStartsWith( sBitIndexCombination, '0010') then
|
||||
return 3
|
||||
elseif sBitIndexCombination == '0001' then
|
||||
elseif EgtStartsWith( sBitIndexCombination, '0001') then
|
||||
return 4
|
||||
elseif sBitIndexCombination == '1000_INV' then
|
||||
return 5
|
||||
elseif sBitIndexCombination == '0100_INV' then
|
||||
return 6
|
||||
elseif sBitIndexCombination == '0010_INV' then
|
||||
return 7
|
||||
elseif sBitIndexCombination == '0001_INV' then
|
||||
return 8
|
||||
end
|
||||
|
||||
return nRotationIndex
|
||||
|
||||
@@ -219,7 +219,7 @@ function LeadInOutLib.CalculateLeadInOut( sLeadInOutType, Parameters, OptionalPa
|
||||
elseif sLeadInOutType == 'SpecialTangent' then
|
||||
|
||||
-- uscita con componente aggiuntiva perpendicolare
|
||||
LeadIn.nType = MCH_MILL_LO.PERP_TG
|
||||
LeadOut.nType = MCH_MILL_LO.PERP_TG
|
||||
local dStartEndOffset = 10
|
||||
local ptEndAtDepthWithOffset = ptEndAtDepth + Edge.vtN * dStartEndOffset
|
||||
local ptEndBladeCenterWithOffset = ptEndBladeCenter + Edge.vtN * dStartEndOffset
|
||||
@@ -277,6 +277,8 @@ function LeadInOutLib.InvertLeadInOut( LeadIn, LeadOut)
|
||||
|
||||
local dOriginalStartAddLength = LeadIn.dStartAddLength
|
||||
local dOriginalEndAddLength = LeadOut.dEndAddLength
|
||||
local nOriginalLeadInType = LeadIn.nType
|
||||
local nOriginalLeadOutType = LeadOut.nType
|
||||
|
||||
LeadIn, LeadOut = LeadOut, LeadIn
|
||||
|
||||
@@ -284,6 +286,12 @@ function LeadInOutLib.InvertLeadInOut( LeadIn, LeadOut)
|
||||
LeadOut.dEndAddLength = dOriginalStartAddLength
|
||||
LeadIn.dEndAddLength = nil
|
||||
LeadOut.dStartAddLength = nil
|
||||
if nOriginalLeadInType == MCH_MILL_LI.TG_PERP then
|
||||
LeadOut.nType = MCH_MILL_LO.PERP_TG
|
||||
end
|
||||
if nOriginalLeadOutType == MCH_MILL_LO.PERP_TG then
|
||||
LeadIn.nType = MCH_MILL_LI.TG_PERP
|
||||
end
|
||||
|
||||
return LeadIn, LeadOut
|
||||
end
|
||||
|
||||
@@ -96,16 +96,6 @@ function MachiningLib.CanExtendAfterTail( sCanDamageNextPiece, Part)
|
||||
return bCanExtendAfterTail
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function MachiningLib.IsFeatureHinderingClamping( Proc, Part)
|
||||
local bFeatureHindersClamping
|
||||
|
||||
local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
|
||||
bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN})
|
||||
|
||||
return bFeatureHindersClamping
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function MachiningLib.GetMachiningSteps( bIsSlot, dMachiningDepth, dStep)
|
||||
local MachiningSteps = {}
|
||||
@@ -203,14 +193,16 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part)
|
||||
end
|
||||
if not bIsLastSegment then
|
||||
Machinings[nCurrentMachiningIndex].sStage = ''
|
||||
Machinings[nCurrentMachiningIndex].nSCC = MCH_SCC.ADIR_XP
|
||||
else
|
||||
Machinings[nCurrentMachiningIndex].sStage = sOriginalStage
|
||||
Machinings[nCurrentMachiningIndex].nSCC = MCH_SCC.ADIR_XM
|
||||
end
|
||||
Machinings[nCurrentMachiningIndex].nFeatureSegment = j
|
||||
Machinings[nCurrentMachiningIndex].dLengthToMachine = Machinings[nCurrentMachiningIndex].dEdgeLength + Machinings[nCurrentMachiningIndex].LeadIn.dStartAddLength + Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength
|
||||
Machinings[nCurrentMachiningIndex].dTimeToMachine = MachiningLib.GetTimeToMachineAllStepsWithLeadInOut( Machinings[nCurrentMachiningIndex], Part)
|
||||
Machinings[nCurrentMachiningIndex].bIsFirstSegment = ( j == 1)
|
||||
Machinings[nCurrentMachiningIndex].bIsLastSegment = ( j == nParts)
|
||||
Machinings[nCurrentMachiningIndex].bIsLastSegment = bIsLastSegment
|
||||
Machinings[nCurrentMachiningIndex].bIsMachiningSplitted = true
|
||||
end
|
||||
-- anche le lavorazioni non splittate necessitano del segmento assegnato
|
||||
|
||||
@@ -403,6 +403,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
local sRestLengthSideForPreSimulation = OptionalParameters.sRestLengthSideForPreSimulation or 'Tail'
|
||||
local bCannotSplitRestLength = OptionalParameters.bCannotSplitRestLength or false
|
||||
local vtAux = OptionalParameters.vtAux
|
||||
local bCheckFlange = OptionalParameters.bCheckFlange
|
||||
|
||||
-- se normale faccia non parallela a direzione testa c'è qualcosa che non va
|
||||
if not AreSameOrOppositeVectorApprox( vtNFace, vtHead) then
|
||||
@@ -426,7 +427,7 @@ local function CheckCollisionWithAxis( sAxis, MachiningParameters, OptionalParam
|
||||
|
||||
-- se lama con flangia si aggiunge quest'ultima ai solidi di collisione, ipotizzandola grande fino al dMaxDepth + sicurezza
|
||||
local idAddedCollisionSurfTm
|
||||
if Tool.sType == 'SAW_FLAT' then
|
||||
if bCheckFlange and Tool.sType == 'SAW_FLAT' then
|
||||
local ptCenterFlange = PointsOnToolTipCenter[i] + vtHead * Tool.dThickness
|
||||
local frHead = Frame3d( ptCenterFlange, vtHead)
|
||||
local dExtraSafety = 2 -- valore empirico che serve nei casi molto inclinati, ci potrebbero essere casi in cui va aumentato
|
||||
@@ -532,7 +533,10 @@ function PreSimulationLib.CheckCollision( Parameters, OptionalParameters)
|
||||
local sR1 = AxesNames[4]
|
||||
|
||||
-- ultimo asse lineare prima dei rotativi (solitamente Z) si controlla sempre
|
||||
-- qui si controlla anche la collisione con flangia lama, se necessario
|
||||
OptionalParametersCheckCollisionWithAxis.bCheckFlange = true
|
||||
bCollisionFound, bMoveAfterSplitL3 = CheckCollisionWithAxis( sL3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||
OptionalParametersCheckCollisionWithAxis.bCheckFlange = false
|
||||
|
||||
if sR3 and not bCollisionFound then
|
||||
bCollisionFound, bMoveAfterSplitR3 = CheckCollisionWithAxis( sR3, Parameters, OptionalParametersCheckCollisionWithAxis)
|
||||
|
||||
+107
-5
@@ -538,6 +538,102 @@ local function CommitBestMove( BestMove)
|
||||
Job.bNested = true
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
-- Dump diagnostico Input/Output
|
||||
function RawInventory:DumpNestingData()
|
||||
EgtOutLog("\n##########################################################################################")
|
||||
EgtOutLog("### EGALWARE NESTING - DIAGNOSTIC DUMP ###")
|
||||
EgtOutLog("##########################################################################################\n")
|
||||
|
||||
-- 1. AMBIENTE & CONFIGURAZIONE
|
||||
EgtOutLog("--- [1. NESTING ENVIRONMENT & PARAMETERS] ---")
|
||||
EgtOutLog(string.format("NEST.STARTOFFSET = %s", tostring(NEST.STARTOFFSET)))
|
||||
EgtOutLog(string.format("NEST.MATERIAL = %s", tostring(NEST.MATERIAL)))
|
||||
EgtOutLog(string.format("NEST.MACHINE = %s", tostring(NEST.MACHINE)))
|
||||
for k, v in pairs(CONFIG) do
|
||||
EgtOutLog(string.format("CONFIG.%s = %s", tostring(k), tostring(v)))
|
||||
end
|
||||
|
||||
-- 2. MATERIALE DISPONIBILE (STOCK)
|
||||
EgtOutLog("\n--- [2. RAW STOCK INVENTORY INPUTS] ---")
|
||||
for i = 1, #self.Stock do
|
||||
EgtOutLog(string.format("Stock Index %d: Length = %.4f mm | Qty Available = %d", i, self.Stock[i].dLength, self.Stock[i].nCount))
|
||||
end
|
||||
|
||||
-- 3. COMMESSA PEZZI RICHIESTI (DEMANDED PARTS)
|
||||
EgtOutLog("\n--- [3. DEMANDED PARTS (PART TABLE)] ---")
|
||||
for id, count in pairs(PART) do
|
||||
local sInitialPos = tostring(EgtGetInfo(id, 'INITIALPOSITION', 'i') or 0)
|
||||
local sManualRot = tostring(EgtGetInfo(id, 'MANUALROT', 'i') or 0)
|
||||
local sManualFlip = tostring(EgtGetInfo(id, 'MANUALFLIP', 'i') or 0)
|
||||
EgtOutLog(string.format("Part ID: %5s | Demand Count: %d | CAD Base Length: %.4f mm | InitialPos: %s | ManualRot: %s | ManualFlip: %s",
|
||||
tostring(id), count, EgtGetInfo(id, 'L', 'd') or 0, sInitialPos, sManualRot, sManualFlip))
|
||||
end
|
||||
|
||||
-- 4. DATABASE GEOMETRICO COMPLETO (PART TEMPLATES)
|
||||
EgtOutLog("\n--- [4. DETAILED GEOMETRIC TEMPLATES (ALL READABLE STATES)] ---")
|
||||
for id, Template in pairs(PartTemplates) do
|
||||
if type(Template) == "table" and Template.dLength then
|
||||
EgtOutLog(string.format("\nPART ID: %s | Math Length: %.4f | MaxGlobalTailRecess: %.4f", tostring(id), Template.dLength, Template.dMaxGlobalTailRecess))
|
||||
for sState, State in pairs(Template.States) do
|
||||
EgtOutLog(string.format(" -> State [%s]:", sState))
|
||||
-- Stringhe Grezze lette dal CAD
|
||||
EgtOutLog(string.format(" Raw ALT_H String: %s", tostring(EgtGetInfo(id, 'ALT'..sState..'_H'))))
|
||||
EgtOutLog(string.format(" Raw ALT_T String: %s", tostring(EgtGetInfo(id, 'ALT'..sState..'_T'))))
|
||||
-- Valori matematici interpretati dal Nesting
|
||||
local hOX = table.concat(State.Head.OffsetX, ", ")
|
||||
local tOX = table.concat(State.Tail.OffsetX, ", ")
|
||||
EgtOutLog(string.format(" HEAD Math -> OffsetX: [%s] | vtN: [X:%.6f, Y:%.6f, Z:%.6f] | vtNXabs: %.6f | dMaxHeadRecess: %.4f",
|
||||
hOX, State.Head.vtN:getX(), State.Head.vtN:getY(), State.Head.vtN:getZ(), State.Head.vtNXabs, State.dMaxHeadRecess))
|
||||
EgtOutLog(string.format(" TAIL Math -> OffsetX: [%s] | vtN: [X:%.6f, Y:%.6f, Z:%.6f] | vtNXabs: %.6f | dMaxTailRecess: %.4f",
|
||||
tOX, State.Tail.vtN:getX(), State.Tail.vtN:getY(), State.Tail.vtN:getZ(), State.Tail.vtNXabs, State.dMaxTailRecess))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 5. ANALISI DETTAGLIATA DELL'OUTPUT FINALE SULLE BARRE (ACTIVE BEAMS)
|
||||
EgtOutLog("\n--- [5. FINAL NESTING SOLUTIONS AND SPATIAL COORDS] ---")
|
||||
for i = 1, #self.ActiveBeams do
|
||||
local Beam = self.ActiveBeams[i]
|
||||
local dStartOffset = NEST.STARTOFFSET or 0
|
||||
EgtOutLog(string.format("\n=========================================================================================="))
|
||||
EgtOutLog(string.format("ACTIVE BEAM [%d] -> Total Length: %.4f mm | Nesting Residual Space: %.4f mm",
|
||||
i, Beam.dTotalLength, Beam.dResidualLength))
|
||||
EgtOutLog(string.format("=========================================================================================="))
|
||||
|
||||
-- Ordine di Nesting (dall'ultimo appoggio a destra fino a sinistra)
|
||||
EgtOutLog(" A. Array Storage Order (Nesting Logic - from Right to Left):")
|
||||
for j = 1, #Beam.NestedParts do
|
||||
local Part = Beam.NestedParts[j]
|
||||
EgtOutLog(string.format(" [%d] ID: %5s | State: %12s | Length: %9.4f | Math PosX: %9.4f | Overlap: %9.4f | SharedCut: %s",
|
||||
j, tostring(Part.id), tostring(Part.sState), Part.dLength, Part.dPosX, Part.dSafeOverlap, tostring(Part.bSharedCut)))
|
||||
end
|
||||
|
||||
-- Ordine di posizionamento sul Gruppo Macchina (da Sinistra X=0 a Destra)
|
||||
EgtOutLog(" B. CAD Positioning Order (Output Macro - from Left X=0 to Right):")
|
||||
local nIndex = 1
|
||||
for j = #Beam.NestedParts, 1, -1 do
|
||||
local Part = Beam.NestedParts[j]
|
||||
local dPosX = Part.dPosX - Beam.dResidualLength + dStartOffset
|
||||
|
||||
-- Distanza dal pezzo precedente a sinistra (se esiste)
|
||||
local sPrevDist = "N/A (First Part on Left)"
|
||||
if j < #Beam.NestedParts then
|
||||
local PrevPart = Beam.NestedParts[j+1]
|
||||
local dPrevPosX = PrevPart.dPosX - Beam.dResidualLength + dStartOffset
|
||||
sPrevDist = string.format("%.4f mm", dPosX - dPrevPosX)
|
||||
end
|
||||
|
||||
EgtOutLog(string.format(" PART%d -> ID: %5s | Chosen State: %12s | CAD Target PosX: %9.4f mm | Gap from left: %s",
|
||||
nIndex, tostring(Part.id), tostring(Part.sState), dPosX, sPrevDist))
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
EgtOutLog("\n##########################################################################################")
|
||||
EgtOutLog("### END OF DUMP ###")
|
||||
EgtOutLog("##########################################################################################\n")
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
-- script principale
|
||||
|
||||
@@ -633,7 +729,6 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
|
||||
for j = #Beam.NestedParts, 1, -1 do
|
||||
local Part = Beam.NestedParts[j]
|
||||
local nInitialPosition = EgtGetInfo( Part.id, 'INITIALPOSITION', 'i')
|
||||
|
||||
-- spostamento verso la testa della barra
|
||||
local dPosX = Part.dPosX - Beam.dResidualLength + dStartOffset
|
||||
@@ -647,8 +742,8 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
end
|
||||
|
||||
-- eventuale rotazione
|
||||
if ( EgtStartsWith( Part.sState, '0010') and nInitialPosition == 1)
|
||||
or ( EgtStartsWith( Part.sState, '1000') and nInitialPosition == 3) then
|
||||
local bIsRotationNeeded = EgtStartsWith( Part.sState, '0010')
|
||||
if bIsRotationNeeded then
|
||||
local idSurfTmBoxDuplo = EgtGetFirstNameInGroup( idDuplo, "Box")
|
||||
local b3Duplo = EgtGetBBoxGlob( idSurfTmBoxDuplo, GDB_BB.STANDARD)
|
||||
EgtRotate( idDuplo, b3Duplo:getCenter(), X_AX(), 180, GDB_RT.GLOB)
|
||||
@@ -656,7 +751,9 @@ for i = 1, #RawInventory.ActiveBeams do
|
||||
end
|
||||
|
||||
-- eventuale inversione
|
||||
if EgtEndsWith( Part.sState, 'INV') then
|
||||
-- TODO conta anche l'ordine rotazione-inversione?
|
||||
local bIsInversionNeeded = EgtEndsWith( Part.sState, 'INV')
|
||||
if bIsInversionNeeded then
|
||||
local idSurfTmBoxDuplo = EgtGetFirstNameInGroup( idDuplo, "Box")
|
||||
local b3Duplo = EgtGetBBoxGlob( idSurfTmBoxDuplo, GDB_BB.STANDARD)
|
||||
EgtRotate( idDuplo, b3Duplo:getCenter(), Z_AX(), 180, GDB_RT.GLOB)
|
||||
@@ -706,4 +803,9 @@ EgtResetCurrMachGroup()
|
||||
NEST.ERR = 0
|
||||
|
||||
-- calcolo bontà soluzione
|
||||
RawInventory:PrintDiagnosticReport()
|
||||
RawInventory:PrintDiagnosticReport()
|
||||
|
||||
-- Dump diagnostico - solo per debug
|
||||
if EgtGetDebugLevel() >= 3 then
|
||||
RawInventory:DumpNestingData()
|
||||
end
|
||||
@@ -91,7 +91,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Result.dQuality = FeatureLib.GetStrategyQuality( 'SAWBLADE')
|
||||
|
||||
-- se settato da saltare o coincide con inizio grezzo, non va fatto
|
||||
--local bSkipHeadCut = ( EgtGetInfo( Part.id, "SKIP_HEADCUT", 'i') or 0) == 1
|
||||
local bSkipHeadCut = ( EgtGetInfo( Part.id, "SKIP_HEADCUT", 'i') or 0) == 1
|
||||
if bSkipHeadCut or ( abs( Proc.b3Box:getCenter():getX() - Part.b3Raw:getMax():getX()) < 10 * GEO.EPS_SMALL) then
|
||||
return true, Strategy.Result
|
||||
end
|
||||
|
||||
@@ -596,7 +596,7 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
return false, Strategy.Result
|
||||
end
|
||||
-- se la lavorazione ostacola il pinzaggio, non posso farla, serve una lavorazioen che lasci il testimone
|
||||
if MachiningLib.IsFeatureHinderingClamping( Proc, Part) then
|
||||
if Proc.bFeatureHindersClamping then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. StrategyLib.Config.sStrategyId .. ' not applicable ( Feature hinders clamping)'
|
||||
EgtOutLog( sErr)
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( sErr)
|
||||
|
||||
@@ -360,10 +360,15 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- non ha senso che STR0003 lama+catena sia applicabile se la lama non può lavorare, in quel caso deve essere scelta la STR0004 solo catena
|
||||
else
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable()
|
||||
Strategy.Parameters.bFinishWithChainSaw = false
|
||||
end
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
else
|
||||
-- non ha senso che STR0003 lama+catena sia applicabile se la lama non può lavorare, in quel caso deve essere scelta la STR0004 solo catena
|
||||
if #Blade.Result.Sorted == 0 then
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable()
|
||||
return false, Strategy.Result
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO funzione separata
|
||||
@@ -406,12 +411,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- si lavora tutto il fondo
|
||||
else
|
||||
OptionalParameters.dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dMaxElev = nil
|
||||
end
|
||||
|
||||
-- ancora materiale residuo - se possibile si lavora dal lato
|
||||
@@ -452,14 +453,12 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
if BottomEdge.bIsStartOpen then
|
||||
OptionalParameters.dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA
|
||||
OptionalParameters.OppositeToolDirectionMode = 'Enabled'
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
|
||||
elseif BottomEdge.bIsEndOpen then
|
||||
OptionalParameters.dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA
|
||||
OptionalParameters.OppositeToolDirectionMode = 'Enabled'
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
@@ -475,12 +474,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
|
||||
-- si lavora tutto il fondo
|
||||
OptionalParameters.dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dMaxElev = nil
|
||||
|
||||
-- ancora materiale residuo - si lavorano i lati
|
||||
if Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
@@ -531,7 +526,6 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
else
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge1.dElevation + BeamData.CUT_EXTRA
|
||||
OptionalParameters.dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
OptionalParameters.OppositeToolDirectionMode = 'Enabled'
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
@@ -544,14 +538,12 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Chainsaw.Result.Side[1].bIsApplicable = false
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge1, OptionalParameters)
|
||||
Mortising.dAreaToMachine = Mortising.dDepthToMachine * ( Mortising.dEdgeLength - Chainsaw.Result.Bottom[1].dDepthToMachine)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = SideEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, SideEdge2, OptionalParameters)
|
||||
Mortising.dAreaToMachine = 0
|
||||
@@ -633,7 +625,6 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation + BeamData.CUT_EXTRA
|
||||
OptionalParameters.dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
@@ -643,13 +634,11 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Chainsaw.Result.Opposite[1].bIsApplicable = false
|
||||
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge1.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge1, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
OptionalParameters.dDepthToMachine = OppositeEdge2.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA
|
||||
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, LongFace, OppositeEdge2, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
|
||||
@@ -100,7 +100,6 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- considerazioni necessarie a determinare se lavorare con codolo oppure no
|
||||
local bKeepWasteAttached = ( Strategy.Parameters.sCuttingStrategy == 'KEEP_WASTE_ATTACHED')
|
||||
local bDropWaste = ( Strategy.Parameters.sCuttingStrategy == 'DROP_WASTE')
|
||||
local bFeatureHindersClamping = MachiningLib.IsFeatureHinderingClamping( Proc, Part)
|
||||
local dLengthLimitToDropWaste = Strategy.Parameters.dLengthLimitToDropWaste
|
||||
|
||||
local bIsFeatureLong = FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN})
|
||||
@@ -108,7 +107,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
|
||||
-- lavorazione con codolo
|
||||
if ( Proc.nFct > 2 and bIsFeatureLong)
|
||||
or ( bFeatureHindersClamping and not bDropWaste)
|
||||
or ( Proc.bFeatureHindersClamping and not bDropWaste)
|
||||
or ( dLengthLimitToDropWaste and Proc.b3Box:getDimX() > dLengthLimitToDropWaste)
|
||||
or bKeepWasteAttached then
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ function STR0010.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
end
|
||||
|
||||
-- se la lavorazione ostacola il pinzaggio, non posso farla, serve una lavorazioen che lasci il testimone
|
||||
if MachiningLib.IsFeatureHinderingClamping( Proc, Part) then
|
||||
-- se la lavorazione ostacola il pinzaggio non posso farla, serve una lavorazioen che lasci il testimone
|
||||
if Proc.bFeatureHindersClamping then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. StrategyLib.Config.sStrategyId .. ' not applicable ( Feature hinders clamping)'
|
||||
EgtOutLog( sErr)
|
||||
Strategy.Result = FeatureLib.GetStrategyResultNotApplicable( sErr)
|
||||
|
||||
@@ -94,11 +94,10 @@ function STR0012.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- considerazioni necessarie a determinare se lavorare con codolo oppure no
|
||||
local bKeepWasteAttached = ( Strategy.Parameters.sCuttingStrategy == 'KEEP_WASTE_ATTACHED')
|
||||
local bDropWaste = ( Strategy.Parameters.sCuttingStrategy == 'DROP_WASTE')
|
||||
local bFeatureHindersClamping = MachiningLib.IsFeatureHinderingClamping( NewProc, Part)
|
||||
local dLengthLimitToDropWaste = Strategy.Parameters.dLengthLimitToDropWaste
|
||||
|
||||
-- lavorazione con codolo
|
||||
if ( bFeatureHindersClamping and not bDropWaste)
|
||||
if ( Proc.bFeatureHindersClamping and not bDropWaste)
|
||||
or ( dLengthLimitToDropWaste and Proc.b3Box:getDimX() > dLengthLimitToDropWaste)
|
||||
or bKeepWasteAttached then
|
||||
|
||||
|
||||
@@ -234,12 +234,6 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
if Proc.nFct > 3 and Proc.Topology.sFamily ~= 'DoubleBevel' then
|
||||
Result = FeatureLib.GetStrategyResultNotApplicable( 'BladeKeepWaste : max 3 faces supported')
|
||||
return Machinings, Result
|
||||
elseif Proc.nFct == 2 then
|
||||
-- per angolo tra le facce >= 90deg (feature convessa) non applicabile
|
||||
if Proc.AdjacencyMatrix[1][2] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[1][2] < -91 then
|
||||
Result = FeatureLib.GetStrategyResultNotApplicable()
|
||||
return Machinings, Result
|
||||
end
|
||||
elseif Proc.nFct == 3 then
|
||||
-- caso speciale RidgeLap - per angolo tra le facce >= 90deg (feature convessa) non applicabile
|
||||
if Proc.AdjacencyMatrix[1][2] > 10 * GEO.EPS_SMALL or Proc.AdjacencyMatrix[1][2] < -91 then
|
||||
@@ -383,7 +377,6 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
end
|
||||
end
|
||||
local OptionalParametersMilling = {
|
||||
bIsSplitFeature = bIsSplitFeature,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
dRadialStepSpan = dToolMarkLength,
|
||||
dDepthToMachine = dDepthToMachine
|
||||
@@ -413,7 +406,6 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
end
|
||||
end
|
||||
local OptionalParametersMilling = {
|
||||
bIsSplitFeature = bIsSplitFeature,
|
||||
dExtendAfterTail = dExtendAfterTail,
|
||||
dRadialStepSpan = dToolMarkLength,
|
||||
dDepthToMachine = dDepthToMachine
|
||||
@@ -447,29 +439,24 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
-- se codoli perpendicolari, si accorciano LeadIn/LeadOut
|
||||
if bAllowPerpendicularStrip then
|
||||
for j = 1, #Machinings do
|
||||
if Machinings[j].bIsMachiningSplitted then
|
||||
-- se primo spezzone
|
||||
if Machinings[j].bIsFirstSegment then
|
||||
if MachiningLib.StartsLeftSide( Machinings[j]) then
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - dStripWidth
|
||||
else
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - dStripWidth
|
||||
end
|
||||
-- se ultimo spezzone
|
||||
elseif Machinings[j].bIsLastSegment then
|
||||
if MachiningLib.StartsLeftSide( Machinings[j]) then
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - dStripWidth
|
||||
else
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - dStripWidth
|
||||
end
|
||||
-- se spezzoni centrali
|
||||
else
|
||||
Machinings[j].LeadIn.dStartAddLength = Machinings[j].LeadIn.dStartAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
Machinings[j].LeadOut.dEndAddLength = Machinings[j].LeadOut.dEndAddLength - Machinings[j].dToolMarkLength - dStripWidth
|
||||
local Machining = Machinings[j]
|
||||
if Machining.bIsMachiningSplitted then
|
||||
local dOriginalStartAddLength = Machining.LeadIn.dStartAddLength
|
||||
local dOriginalEndAddLength = Machining.LeadOut.dEndAddLength
|
||||
local bStartsLeftSide = MachiningLib.StartsLeftSide( Machining)
|
||||
Machining.LeadIn.dStartAddLength = dOriginalStartAddLength - Machining.dToolMarkLength - dStripWidth
|
||||
Machining.LeadOut.dEndAddLength = dOriginalEndAddLength - Machining.dToolMarkLength - dStripWidth
|
||||
if Machining.bIsStartClosed and
|
||||
( ( Machining.bIsLastSegment and bStartsLeftSide) or
|
||||
( Machining.bIsFirstSegment and not bStartsLeftSide)) then
|
||||
|
||||
Machining.LeadIn.dStartAddLength = dOriginalStartAddLength - dStripWidth
|
||||
end
|
||||
if Machining.bIsEndClosed and
|
||||
( ( Machining.bIsFirstSegment and bStartsLeftSide) or
|
||||
( Machining.bIsLastSegment and not bStartsLeftSide)) then
|
||||
|
||||
Machining.LeadOut.dEndAddLength = dOriginalEndAddLength - dStripWidth
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -485,6 +472,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
Result.dQuality = FeatureLib.GetStrategyQuality( Machinings)
|
||||
Result.dTimeToMachine = FeatureLib.GetStrategyTimeToMachine( Machinings)
|
||||
Result.dMRR = ( dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6)
|
||||
-- il codolo non compromette mai il pinzaggio
|
||||
Result.bIgnoreNotClampableLength = true
|
||||
if Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
Result.sStatus = 'Completed'
|
||||
if bForced then
|
||||
|
||||
@@ -596,12 +596,19 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
|
||||
|
||||
-- se lavorazione aperta sulla coda, eventuali aggiustamenti
|
||||
-- TODO valutare se fare funzione a parte
|
||||
-- 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.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)) then
|
||||
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
|
||||
|
||||
local dLengthOnX = Cutting.dLengthOnX
|
||||
-- se feature splittata non si considera la lunghezza della feature per il check spostamento dopo separazione
|
||||
if bIsSplitFeature then
|
||||
@@ -635,7 +642,7 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
|
||||
return Cutting
|
||||
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
-- Version.lua by EgalWare s.r.l. 2024/04/02
|
||||
-- Gestione della versione di Beam
|
||||
-- Version.lua by EgalWare s.r.l. 2026/07/16
|
||||
-- Gestione della versione di BeamNT
|
||||
|
||||
NAME = 'Beam'
|
||||
VERSION = '3.1e1'
|
||||
MIN_EXE = '3.1e1'
|
||||
NAME = 'BeamNT'
|
||||
VERSION = '3.1g1'
|
||||
MIN_EXE = '3.1g1'
|
||||
|
||||
Reference in New Issue
Block a user