Compare commits

..

34 Commits

Author SHA1 Message Date
luca.mazzoleni 9edd39305f - STR0005 con codolo funzionante e con ordinamento lavorazioni 2025-01-24 17:21:19 +01:00
luca.mazzoleni 0c5373700e - in STR0003, 4 e 5 corretta gestione spezzatura 2025-01-24 15:17:10 +01:00
luca.mazzoleni 098244b109 - in SLOTBYBLADE e SLOTBYCHAINSAW corrette direzioni utensile 2025-01-24 12:26:22 +01:00
luca.mazzoleni e553197d61 - in Edges l'elevazione si tiene sempre positiva e la normale guarda sempre verso il centro.
- alle funzioni di base si può passare il parametro opzionale bOppositeToolDirection per invertire la direzione di lavoro dell'utensile
2025-01-23 16:39:43 +01:00
luca.mazzoleni c64aaade13 - in FaceData MainFaces non si crea se è vuota
- in SLOTBYBLADE e SLOTBYCHAINSAW piccole correzioni
2025-01-23 12:28:48 +01:00
luca.mazzoleni ffe2d07918 - negli egde vtToolDirection sostituita con vtN 2025-01-23 12:13:30 +01:00
luca.mazzoleni 89c315cdd8 - in MachiningLib corretta l'assegnazione del nFeatureSegment nei casi in cui la lavorazione non ha quasi componenti in X 2025-01-22 12:33:19 +01:00
luca.mazzoleni e3ab0b8f35 - correzione in SLOTBYCHAINSAW 2025-01-21 16:03:19 +01:00
luca.mazzoleni 40e76a23c9 - in FaceData Elevation è sempre positiva nelle facce standard (non MainFaces)
- in MachiningLib in GetSplitMachinings correzioni alla definizione dello stage della lavorazione; correzione a FindBlade
- in SLOTBYBLADE e SLOTBYCHAINSAW correzioni per poter passare la profondità di lavoro
- in STR0005 primo implemento di lavorazione con codolo
2025-01-21 15:27:33 +01:00
luca.mazzoleni fc6b50b345 - in FaceData struttura dati degli Edges della faccia uniformata a quella degli Edges della MainFaces
- tutte le chiamate a Edges aggiornate di conseguenza
2025-01-17 18:06:37 +01:00
luca.mazzoleni 8d2a9955ba - in MachiningLib GetMachiningSteps il numero minimo di step è sempre 1
- STR0004 corretta per passare altezza tasca alla SlotByChainsaw
- in SLOTBYBLADE e SLOTBYCHAINSAW si controlla se la tasca è meno spessa della lama solo nel caso in cui venga passata un'altezza tasca
2025-01-17 13:05:35 +01:00
luca.mazzoleni 87aa2a7ce6 - in SLOTBYCHAINSAW e SLOTBYBLADE spostato calcolo altezza tasca fuori; si deve passare come parametro opzionale: se non presente, si lavora la faccia senza step verticali
- STR0003 modificata per rispecchiare le modifiche sopra; STR0004 DA FARE
2025-01-16 18:28:52 +01:00
luca.mazzoleni 2be4a3fe0b - PROCESSINGS spostata in BeamExec
- aggiunte a STR0005, da completare
2025-01-16 12:52:15 +01:00
luca.mazzoleni d76ecbc9f6 - in Process require di BeamExec spostato dopo la dichiarazione delle variabili globali
- in BeamExec -> CollectFeatures si salva l'indice della Proc nel vProc
- in FeatureLib aggiunta funzione GetFeatureMaxNotClampableLengths
- correzioni e migliorie GetFeatureMaxNotClampableLengths
2025-01-14 15:17:18 +01:00
luca.mazzoleni cc8410b0c5 - in BeamExec -> CollectFeatures inserito calcolo riduzione lunghezza pinzabile
- in FeatureLib aggiunte funzioni GetFeatureVolume e CalculateFeatureNotClampableLengths
- in STR0005 aggiunta scelta strategie di taglio; al momento non contemplato massimo materiale lama
- aggiunta BLADETOWASTE, solo intestazione
2025-01-10 18:13:39 +01:00
luca.mazzoleni 3835f6f6e0 - in Strategies.ini e BasicCustomerStrategies aggiunta STR0005 2025-01-08 09:15:44 +01:00
luca.mazzoleni cf96eb7bc3 - aggiunta STR0005 - BladeToWaste 2025-01-07 17:30:47 +01:00
luca.mazzoleni 3287420f41 - in FaceData -> GetFacesInfo contemplato il caso in cui arrivi una Proc senza nFct 2025-01-07 15:27:25 +01:00
andrea.villa 3a5cba1c15 In FaceByBlade, il parametro 'FaceToMachine' deve essere una tabella, formattata tipo una Proc. 2025-01-07 12:52:16 +01:00
andrea.villa e443bd5813 - Tutte le librerie 'core' relative alle strategie sono state spostate nella cartella STRATEGYLIBS
- StrategyLib.lua che conteneva solo funzioni per lo split, è stata rinominata in SPLITCUT.lua e sarà relativa solo al taglio di seoparazione
2025-01-07 12:27:31 +01:00
andrea.villa ce7d87a5ac Aggiunta funzione GetAdditionalInfo in FeatureLib per recupero informazioni aggiuntive di feature che non richiedono topologia 2025-01-02 15:55:28 +01:00
andrea.villa 8238767f69 Piccola modifica STR0002 per spostare svuotatura dopo taglio di separazione 2025-01-02 14:51:15 +01:00
luca.mazzoleni ca4141515d - piccole correzioni varie 2024-12-24 11:13:32 +01:00
luca.mazzoleni 6ca555efc8 Merge branch 'SortingMachinings' into develop 2024-12-24 08:45:13 +01:00
luca.mazzoleni b882f23d3e - commenti 2024-12-24 08:44:46 +01:00
luca.mazzoleni 8c39c6a94f - in MachiningLib -> GetSplitMachinings correzione al calcolo FeatureSegment nel caso di lavorazione non spezzata 2024-12-23 18:25:30 +01:00
luca.mazzoleni e126e3f389 - in BeamLib introdotto algoritmo di sorting STABILE (merge sorting)
- piccole correzioni in SLOTBYBLADE e SLOTBYCHAINSAW
2024-12-23 16:11:25 +01:00
luca.mazzoleni 3bce7b5fd6 implementato sorting lavorazioni ma non corretto, serve un algoritmo di STABLE SORTING 2024-12-23 09:08:03 +01:00
luca.mazzoleni 99e0bd27d9 - funzioni di Sorting spostate in MachiningLib
- Sorting di base funzionante
2024-12-19 18:33:39 +01:00
luca.mazzoleni 456d8e903a - in BeamExec completata la funzione PrepareMachiningsForSorting
- in FaceData la lunghezza rispetto a X è ora in valore assoluto
- in MachiningLib -> GetSplitMachinings aggiunta la scrittura del centro della lavorazione
- in STR0003, STR0004, SlotByChainSaw e SlotByBLade nSegment diventa nFeatureSegment per distinguerla da nPartSegment
2024-12-19 15:04:17 +01:00
luca.mazzoleni 14f81da3df - in Process e BeamExec reinserito calcolo parte dopo spostamento pezzo 2024-12-18 12:23:04 +01:00
luca.mazzoleni eb4a5e521f - in BeamExec si evita di ricalcolare senza motivo il box del pezzo
- tutti i riferimenti a PARTS[i].b3Box o Part.b3Solid diventano Part.b3Part
- in BeamExec aggiunte funzioni PrepareMachiningsForSorting e SortMachiningsBySegment, da completare
- in BeamLib aggiunta funzione GetSplittingPoints
- nelle lavorazioni introdotta la variabile sStage che rappresenta la fase di lavoro a cui la lavorazione stessa appartiene (Head, Tail, AfterTail oppure vuota che significa sezione centrale, quella divisa in segments)
- piccole correzioni ad alcuni nomi di variabile
2024-12-18 11:59:08 +01:00
luca.mazzoleni 233a928dcd - in DiceCut modificati i commenti 2024-12-16 13:18:10 +01:00
luca.mazzoleni db88c7bb8d Merge branch 'feature/NewStrategyLib' into develop 2024-12-16 11:19:59 +01:00
21 changed files with 1267 additions and 371 deletions
+1
View File
@@ -49,6 +49,7 @@ local function GetStrategies_Egalware( Proc)
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Feature : Cut -- Feature : Cut
elseif ID.IsCut( Proc) then elseif ID.IsCut( Proc) then
Strategies = { { sStrategyId = 'STR0005'}}
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- Feature : Longitudinal Cut -- Feature : Longitudinal Cut
elseif ID.IsLongitudinalCut( Proc) then elseif ID.IsLongitudinalCut( Proc) then
+71 -26
View File
@@ -31,6 +31,7 @@ EgtMdbSave()
TOOLS = {} -- tabella contenente tutti gli utensili TOOLS = {} -- tabella contenente tutti gli utensili
STRATEGIES = nil -- tabella contenente le strategie disponibili per ogni feature STRATEGIES = nil -- tabella contenente le strategie disponibili per ogni feature
MACHININGS = {} -- tabella contenente le lavorazioni da applicare MACHININGS = {} -- tabella contenente le lavorazioni da applicare
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- *** COSTANTI *** TODO -> DA SPOSTARE IN BEAMDATA??? -- *** COSTANTI *** TODO -> DA SPOSTARE IN BEAMDATA???
@@ -146,11 +147,13 @@ function BeamExec.GetToolsFromDB()
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero metà del tagliente Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or ( Tool.dMaxMaterial / 3) -- se non settato nell'utensile, considero metà del tagliente
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or floor( Tool.dDiameter / 3) -- se non settato nell'utensile, considero metà del diametro Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or floor( Tool.dDiameter / 3) -- se non settato nell'utensile, considero metà del diametro
Tool.bIsPen = abs( Tool.dSpeed) < 5 Tool.bIsPen = abs( Tool.dSpeed) < 5
Tool.dPerformanceIndex = ( Tool.dDiameter * Tool.dMaxMaterial) / Tool.dLength
-- recupero parametri propri delle lame -- recupero parametri propri delle lame
elseif sToolFamily == 'SAWBLADE' then elseif sToolFamily == 'SAWBLADE' then
Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false come valore di default Tool.bIsUsedForLongCut = EgtGetValInNotes( Tool.sUserNotes, 'LONGCUT') == 1 or false -- false come valore di default
Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama Tool.dStep = EgtGetValInNotes( Tool.sUserNotes, 'STEP', 'd') or Tool.dThickness -- se non settato nell'utensile, considero lo spessore lama
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or Tool.dMaxMaterial -- se non settato nell'utensile, considero un quarto del diametro
Tool.dPerformanceIndex = 1 / ( Tool.dDiameter * Tool.dLength)
-- recupero parametri propri delle motoseghe -- recupero parametri propri delle motoseghe
elseif sToolFamily == 'MORTISE' then elseif sToolFamily == 'MORTISE' then
Tool.dDistance = EgtTdbGetCurrToolParam( MCH_TP.DIST) or 90 -- 90mm dimensione standard aggregato catena Tool.dDistance = EgtTdbGetCurrToolParam( MCH_TP.DIST) or 90 -- 90mm dimensione standard aggregato catena
@@ -160,7 +163,11 @@ function BeamExec.GetToolsFromDB()
Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or ( Tool.dThickness - 1) -- se non settato nell'utensile, considero spessore catena meno 1mm di sicurezza Tool.dSideStep = EgtGetValInNotes( Tool.sUserNotes, 'SIDESTEP', 'd') or ( Tool.dThickness - 1) -- se non settato nell'utensile, considero spessore catena meno 1mm di sicurezza
Tool.dCornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD) Tool.dCornerRadius = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD)
Tool.dWidth = Tool.dDiameter Tool.dWidth = Tool.dDiameter
Tool.dPerformanceIndex = 1 / Tool.dLength
end end
-- drillbit
else
Tool.dPerformanceIndex = Tool.dDiameter / Tool.dLength
end end
-- se tutti i dati necessari sono disponibili, inserisco utensile nella lista globale degli utensili disponibili -- se tutti i dati necessari sono disponibili, inserisco utensile nella lista globale degli utensili disponibili
@@ -375,13 +382,13 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
local dDeltaE = BeamData.OVM_MID local dDeltaE = BeamData.OVM_MID
for i = 1, #PARTS do for i = 1, #PARTS do
-- dati del pezzo -- dati del pezzo
local b3Part = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT) local b3BoxExact = EgtGetBBoxGlob( PARTS[i].id or GDB_ID.NULL, GDB_BB.EXACT)
if b3Part:isEmpty() or PARTS[i].b3Box:isEmpty() then break end if b3BoxExact:isEmpty() or PARTS[i].b3PartOriginal:isEmpty() then break end
EgtOutLog( 'PartSez=' .. EgtNumToString( b3Part:getDimY(), 1) .. 'x' .. EgtNumToString( b3Part:getDimZ(), 1), 3) EgtOutLog( 'PartSez=' .. EgtNumToString( b3BoxExact:getDimY(), 1) .. 'x' .. EgtNumToString( b3BoxExact:getDimZ(), 1), 3)
-- se sezione compatibile e lunghezza disponibile sufficiente -- se sezione compatibile e lunghezza disponibile sufficiente
local dPartLen = PARTS[i].b3Box:getDimX() local dPartLen = PARTS[i].b3PartOriginal:getDimX()
local dPartWidth = PARTS[i].b3Box:getDimY() local dPartWidth = PARTS[i].b3PartOriginal:getDimY()
local dPartHeight = PARTS[i].b3Box:getDimZ() local dPartHeight = PARTS[i].b3PartOriginal:getDimZ()
local dNextLen = dLen - EgtIf( i == 1, dDeltaS, 0) - dPartLen - dDeltaE local dNextLen = dLen - EgtIf( i == 1, dDeltaS, 0) - dPartLen - dDeltaE
if (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or if (( abs( dPartWidth - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartHeight - dRawH) < 100 * GEO.EPS_SMALL) or
( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and ( abs( dPartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( dPartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and
@@ -411,7 +418,7 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
return false, sOut return false, sOut
end end
-- aggiungo faccia per taglio iniziale al pezzo -- aggiungo faccia per taglio iniziale al pezzo
BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3Box) BeamLib.AddPartStartFace( PARTS[i].id, PARTS[i].b3PartOriginal)
-- se sovramateriale di testa, lo notifico -- se sovramateriale di testa, lo notifico
if dDeltaS > 0.09 then if dDeltaS > 0.09 then
EgtSetInfo( PARTS[i].idRaw, 'HOVM', dDeltaS) EgtSetInfo( PARTS[i].idRaw, 'HOVM', dDeltaS)
@@ -423,16 +430,16 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
EgtSetInfo( PARTS[i].idRaw, 'TOVM', dDeltaE) EgtSetInfo( PARTS[i].idRaw, 'TOVM', dDeltaE)
end end
-- aggiungo faccia per taglio finale al pezzo -- aggiungo faccia per taglio finale al pezzo
BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3Box) BeamLib.AddPartEndFace( PARTS[i].id, PARTS[i].b3PartOriginal)
-- inserisco il pezzo nel grezzo -- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( PARTS[i].id) EgtDeselectPartObjs( PARTS[i].id)
local ptPos = b3Part:getMin() - PARTS[i].b3Box:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2) local ptPos = b3BoxExact:getMin() - PARTS[i].b3PartOriginal:getMin() + Vector3d( dDelta, ( dRawW - dPartWidth) / 2, ( dRawH - dPartHeight) / 2)
EgtAddPartToRawPart( PARTS[i].id, ptPos, PARTS[i].idRaw) EgtAddPartToRawPart( PARTS[i].id, ptPos, PARTS[i].idRaw)
if abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL then if abs( dPartWidth - dRawW) > 100 * GEO.EPS_SMALL then
-- rotazione attorno a centro geometria complessiva del pezzo -- rotazione attorno a centro geometria complessiva del pezzo
EgtRotatePartInRawPart( PARTS[i].id, X_AX(), 90) EgtRotatePartInRawPart( PARTS[i].id, X_AX(), 90)
-- correggo per eccentricità solido rispetto a geometria complessiva del pezzo -- correggo per eccentricità solido rispetto a geometria complessiva del pezzo
local vtEccOri = PARTS[i].b3Box:getCenter() - b3Part:getCenter() local vtEccOri = PARTS[i].b3PartOriginal:getCenter() - b3BoxExact:getCenter()
local vtEccRot = Vector3d( vtEccOri) local vtEccRot = Vector3d( vtEccOri)
vtEccRot:rotate( X_AX(), 90) vtEccRot:rotate( X_AX(), 90)
EgtMovePartInRawPart( PARTS[i].id, ( vtEccOri - vtEccRot)) EgtMovePartInRawPart( PARTS[i].id, ( vtEccOri - vtEccRot))
@@ -450,9 +457,10 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, PARTS)
PARTS[i].dWidth = PARTS[i].b3Raw:getDimY() PARTS[i].dWidth = PARTS[i].b3Raw:getDimY()
PARTS[i].dHeight = PARTS[i].b3Raw:getDimZ() PARTS[i].dHeight = PARTS[i].b3Raw:getDimZ()
PARTS[i].bSquareSection = abs( PARTS[i].dWidth - PARTS[i].dHeight) < 100 * GEO.EPS_SMALL PARTS[i].bSquareSection = abs( PARTS[i].dWidth - PARTS[i].dHeight) < 100 * GEO.EPS_SMALL
PARTS[i].b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) PARTS[i].b3Part = EgtGetBBoxGlob( EgtGetFirstNameInGroup( PARTS[i].id, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD)
PARTS[i].nIndexInParts = i PARTS[i].nIndexInParts = i
PARTS[i].CombinationList = GetAvailableCombinations( PARTS[i]) PARTS[i].CombinationList = GetAvailableCombinations( PARTS[i])
PARTS[i].SplittingPoints = BeamLib.GetPartSplittingPoints( PARTS[i])
else else
local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')' local sOut = 'Error: part L(' .. EgtNumToString( dPartLen, 1) .. ') too big for raw part L(' .. EgtNumToString( dLen - 0.1, 1) .. ')'
return false, sOut return false, sOut
@@ -581,6 +589,7 @@ end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function CollectFeatures( Part) local function CollectFeatures( Part)
-- recupero le feature -- recupero le feature
local nProcCount = 0
local vProc = {} local vProc = {}
local LayerId = {} local LayerId = {}
LayerId[1] = BeamLib.GetAddGroup( Part.id) LayerId[1] = BeamLib.GetAddGroup( Part.id)
@@ -612,12 +621,6 @@ local function CollectFeatures( Part)
EgtOutLog( '------Feature ' .. Proc.idFeature .. '------') EgtOutLog( '------Feature ' .. Proc.idFeature .. '------')
-- se esiste la geometria -- se esiste la geometria
if Proc.b3Box and not Proc.b3Box:isEmpty() then if Proc.b3Box and not Proc.b3Box:isEmpty() then
-- TODO fare una funzione per recuperare i dati delle feature che non passano dal calcolo della topologia?
-- se foro calcolo altri dati
if ID.IsDrilling( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.dDiam, Proc.dLen, Proc.nFcs, Proc.nFce = FeatureLib.GetDrillingData( Proc)
end
-- informazioni facce e topologia -- informazioni facce e topologia
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part) Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
-- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL -- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL
@@ -629,6 +632,7 @@ local function CollectFeatures( Part)
else else
Proc.Topology.sFamily = 'FEATURE' Proc.Topology.sFamily = 'FEATURE'
Proc.Topology.sName = 'FEATURE' Proc.Topology.sName = 'FEATURE'
Proc = FeatureLib.GetAdditionalInfo( Proc, Part)
end end
-- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa -- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa
if Proc.Topology.sName ~= 'NOT_IMPLEMENTED' then if Proc.Topology.sName ~= 'NOT_IMPLEMENTED' then
@@ -643,17 +647,23 @@ local function CollectFeatures( Part)
end end
-- se ci sono strategie disponibili, aggiungo a lista delle feature da lavorare -- se ci sono strategie disponibili, aggiungo a lista delle feature da lavorare
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
nProcCount = nProcCount + 1
Proc.nIndexInVProc = nProcCount
table.insert( vProc, Proc) table.insert( vProc, Proc)
-- altrimenti errore (non ci sono strategie per lavorare la topologia riconosciuta) -- altrimenti errore (non ci sono strategie per lavorare la topologia riconosciuta)
else else
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies') EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies')
end end
-- calcolo riduzione lunghezza pinzabile testa/coda
Proc.NotClampableLength = FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
-- altrimenti errore (serviva riconoscimento topologico, ma non è stato possibile farlo) -- altrimenti errore (serviva riconoscimento topologico, ma non è stato possibile farlo)
else else
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies') EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies')
end end
else else
Proc.nFlg = 0 Proc.nFlg = 0
nProcCount = nProcCount + 1
Proc.nIndexInVProc = nProcCount
table.insert( vProc, Proc) table.insert( vProc, Proc)
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)') EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)')
end end
@@ -874,7 +884,7 @@ local function CalculateStrategies( vProcSingleRot, Part)
Proc.AvailableStrategies[nIndexCurrentStrategy].Result = FeatureLib.CalculateCompositeRating( Proc.AvailableStrategies[nIndexCurrentStrategy].Result) Proc.AvailableStrategies[nIndexCurrentStrategy].Result = FeatureLib.CalculateCompositeRating( Proc.AvailableStrategies[nIndexCurrentStrategy].Result)
-- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa -- se scelta strategia in modalità base o standard, esco subito alla prima che trovo completa
-- TODO serve paraemtro da Beam&Wall ( oppure da confirgurazione) !!!!!!!! -- TODO serve parametro da Beam&Wall ( oppure da confirgurazione) !!!!!!!!
if BEAM.GetFirstCompletedStrategy and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then if BEAM.GetFirstCompletedStrategy and Proc.AvailableStrategies[nIndexCurrentStrategy].Result.sStatus == 'Complete' then
break break
end end
@@ -981,6 +991,7 @@ local function CalculateMachinings( vProc, Part)
bAreAllApplyOk, _ = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy.Parameters) bAreAllApplyOk, _ = StrategyScript.Make( true, Proc, Part, Proc.ChosenStrategy.Parameters)
end end
end end
return MACHININGS return MACHININGS
end end
@@ -998,7 +1009,7 @@ local function PrintFeatures( vProc, Part)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.GetProcessings( PROCESSINGS, PARTS) function BeamExec.GetProcessings( PARTS)
-- recupero tutti i processing di tutti i pezzi in tutte le rotazioni -- recupero tutti i processing di tutti i pezzi in tutte le rotazioni
-- TODO calcolo tempi da rimuovere o lasciare solo per debug -- TODO calcolo tempi da rimuovere o lasciare solo per debug
-- if EgtGetDebugLevel() >= 3 then -- if EgtGetDebugLevel() >= 3 then
@@ -1017,9 +1028,6 @@ function BeamExec.GetProcessings( PROCESSINGS, PARTS)
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse -- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no -- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
vProcRot[dRotIndex] = GetFeatureInfoAndDependency( vProcRot[dRotIndex], PARTS[nPart]) vProcRot[dRotIndex] = GetFeatureInfoAndDependency( vProcRot[dRotIndex], PARTS[nPart])
-- calcola le strategie applicabili ( presenti nella tabella vProcRot[dRotIndex].AvailableStrategies)
vProcRot[dRotIndex] = CalculateStrategies( vProcRot[dRotIndex], PARTS[nPart])
else else
-- inserisco una tabella vuota -- inserisco una tabella vuota
table.insert( vProcRot, {}) table.insert( vProcRot, {})
@@ -1267,7 +1275,7 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamExec.ProcessMachinings( PROCESSINGS, PARTS) function BeamExec.ProcessMachinings( PARTS)
-- ciclo sui pezzi -- ciclo sui pezzi
local nTotErr = 0 local nTotErr = 0
local Stats = {} local Stats = {}
@@ -1302,6 +1310,9 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
for nPart = 1, #PARTS do for nPart = 1, #PARTS do
-- calcolo della migliore strategia per ogni rotazione del pezzo -- calcolo della migliore strategia per ogni rotazione del pezzo
for dRotIndex = 1, 4 do for dRotIndex = 1, 4 do
-- calcola le strategie applicabili
PROCESSINGS[nPart].Rotation[dRotIndex] = CalculateStrategies( PROCESSINGS[nPart].Rotation[dRotIndex], PARTS[nPart])
-- tra le calcolate, sceglie la migliore
PROCESSINGS[nPart].Rotation[dRotIndex] = GetBestStrategy( PROCESSINGS[nPart].Rotation[dRotIndex]) PROCESSINGS[nPart].Rotation[dRotIndex] = GetBestStrategy( PROCESSINGS[nPart].Rotation[dRotIndex])
end end
@@ -1326,11 +1337,45 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
-- esegue le strategie migliori che ha precedentemente scelto e salva le lavorazioni nella lista globale -- esegue le strategie migliori che ha precedentemente scelto e salva le lavorazioni nella lista globale
MACHININGS = CalculateMachinings( vProc, PARTS[nPart]) MACHININGS = CalculateMachinings( vProc, PARTS[nPart])
MACHININGS = MachiningLib.PrepareMachiningsForSorting( PARTS[nPart])
-- TODO riordinare lavorazioni ottimizzando cambio utensile/spezzone ecc..., mantenendo dipendenze definite prima --TODO - rimuovere o mettere in Log, serve solo per test
-- ordino le lavorazioni -- TEST
-- MACHININGS = OrderMachining( MACHININGS, PARTS[nPart]) local MachiningPropertiesBeforeSorting = {}
for i =1, #MACHININGS do
MachiningPropertiesBeforeSorting[i] = {}
MachiningPropertiesBeforeSorting[i] = {
ptCenter = MACHININGS[i].Machining.ptCenter,
nStage = MACHININGS[i].Machining.nStage,
nPartSegment = MACHININGS[i].Machining.nPartSegment,
sToolFamily = TOOLS[ MACHININGS[i].Machining.nToolIndex].sFamily,
dToolPerformanceIndex = TOOLS[ MACHININGS[i].Machining.nToolIndex].dPerformanceIndex,
sToolName = TOOLS[ MACHININGS[i].Machining.nToolIndex].sName,
vtToolDirection = MACHININGS[i].Machining.vtToolDirection
}
end
-- fine TEST
-- TODO completare ordinamento. Mancano le dipendenze.
MACHININGS = BeamLib.StableSort( MACHININGS, MachiningLib.CompareMachinings)
--TODO - rimuovere o mettere in Log, serve solo per test
-- TEST
local MachiningPropertiesAfterSorting = {}
for i =1, #MACHININGS do
MachiningPropertiesAfterSorting[i] = {}
MachiningPropertiesAfterSorting[i] = {
ptCenter = MACHININGS[i].Machining.ptCenter,
nStage = MACHININGS[i].Machining.nStage,
nPartSegment = MACHININGS[i].Machining.nPartSegment,
sToolFamily = TOOLS[ MACHININGS[i].Machining.nToolIndex].sFamily,
dToolPerformanceIndex = TOOLS[ MACHININGS[i].Machining.nToolIndex].dPerformanceIndex,
sToolName = TOOLS[ MACHININGS[i].Machining.nToolIndex].sName,
vtToolDirection = MACHININGS[i].Machining.vtToolDirection
}
end
-- fine TEST
-- aggiungo la fase, se non è la prima -- aggiungo la fase, se non è la prima
if nOrd == 1 then if nOrd == 1 then
EgtSetCurrPhase( 1) EgtSetCurrPhase( 1)
+100 -6
View File
@@ -90,6 +90,48 @@ function BeamLib.AddPartEndFace( PartId, b3Solid)
return true return true
end end
-------------------------------------------------------------------------------------------------------------
function BeamLib.GetPartSplittingPoints( Part, OptionalParameters)
local PartSplittingPoints = {}
local dPartLength = Part.b3Part:getDimX()
-- parametri opzionali
if not OptionalParameters then
OptionalParameters = {}
end
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
local dMaxSegmentLengthOnEdges = OptionalParameters.dMaxSegmentLengthOnEdges or BeamData.LONGCUT_ENDLEN
if dPartLength < dMaxSegmentLength + 10 * GEO.EPS_SMALL then
return {}
elseif dPartLength >= dMaxSegmentLength + 10 * GEO.EPS_SMALL
and dPartLength < 3 * dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then
local dXPartCentralPoint = ( Part.b3Part:getMax():getX() - Part.b3Part:getMin():getX()) / 2
table.insert( PartSplittingPoints, Point3d( dXPartCentralPoint, 0, 0))
else
-- punto estremo destro
local dSplitXRight = Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges
table.insert( PartSplittingPoints, Point3d( dSplitXRight, 0, 0))
-- punti centrali
local dPartCentralLength = dPartLength - 2 * dMaxSegmentLengthOnEdges
local nSplitParts = max( ceil( dPartCentralLength / dMaxSegmentLength + 10 * GEO.EPS_SMALL), 1)
local dSplitPartsLen = dPartCentralLength / nSplitParts
for i = 1, ( nSplitParts - 1) do
local ptOn
local dCurrentPointX = dSplitXRight - i * dSplitPartsLen
ptOn = Point3d( dCurrentPointX, 0, 0)
table.insert( PartSplittingPoints, ptOn)
end
-- punto estremo sinistro
local dSplitXLeft = Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges
table.insert( PartSplittingPoints, Point3d( dSplitXLeft, 0, 0))
end
return PartSplittingPoints
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function BeamLib.AddPhaseWithRawParts( nRawId, OriXR, PosXR, dDeltaSucc) function BeamLib.AddPhaseWithRawParts( nRawId, OriXR, PosXR, dDeltaSucc)
EgtAddPhase() EgtAddPhase()
@@ -193,22 +235,22 @@ end
function BeamLib.GetAffectedFaces( Proc, Part) function BeamLib.GetAffectedFaces( Proc, Part)
local vtFacesAffected = { bTop = false, bBottom = false, bFront = false, bBack = false, bLeft = false, bRight = false} local vtFacesAffected = { bTop = false, bBottom = false, bFront = false, bBack = false, bLeft = false, bRight = false}
if Proc.b3Box and not Proc.b3Box:isEmpty() then if Proc.b3Box and not Proc.b3Box:isEmpty() then
if Proc.b3Box:getMax():getZ() > Part.b3Solid:getMax():getZ() - 500 * GEO.EPS_SMALL then if Proc.b3Box:getMax():getZ() > Part.b3Part:getMax():getZ() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bTop = true vtFacesAffected.bTop = true
end end
if Proc.b3Box:getMin():getZ() < Part.b3Solid:getMin():getZ() + 500 * GEO.EPS_SMALL then if Proc.b3Box:getMin():getZ() < Part.b3Part:getMin():getZ() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bBottom = true vtFacesAffected.bBottom = true
end end
if Proc.b3Box:getMin():getY() < Part.b3Solid:getMin():getY() + 500 * GEO.EPS_SMALL then if Proc.b3Box:getMin():getY() < Part.b3Part:getMin():getY() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bFront = true vtFacesAffected.bFront = true
end end
if Proc.b3Box:getMax():getY() > Part.b3Solid:getMax():getY() - 500 * GEO.EPS_SMALL then if Proc.b3Box:getMax():getY() > Part.b3Part:getMax():getY() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bBack = true vtFacesAffected.bBack = true
end end
if Proc.b3Box:getMin():getX() < Part.b3Solid:getMin():getX() + 500 * GEO.EPS_SMALL then if Proc.b3Box:getMin():getX() < Part.b3Part:getMin():getX() + 500 * GEO.EPS_SMALL then
vtFacesAffected.bLeft = true vtFacesAffected.bLeft = true
end end
if Proc.b3Box:getMax():getX() > Part.b3Solid:getMax():getX() - 500 * GEO.EPS_SMALL then if Proc.b3Box:getMax():getX() > Part.b3Part:getMax():getX() - 500 * GEO.EPS_SMALL then
vtFacesAffected.bRight = true vtFacesAffected.bRight = true
end end
end end
@@ -533,5 +575,57 @@ function BeamLib.TableCopyDeep( OriginalTable)
return CopiedTable return CopiedTable
end end
---------------------------------------------------------------------
-- Merge sorting - algoritmo di sorting stabile, ossia che mantiene l'ordine relativo se gli elementi sono equivalenti
-- TODO vedere come riordinare (tutto in tabella MergeSort??)
-- TODO libreria Sorting??
do
-- unisce due liste ordinate
local function MergeHalves(Left, Right, Compare)
local result = {}
local i, j = 1, 1
while i <= #Left and j <= #Right do
if Compare( Left[i], Right[j]) then
table.insert( result, Left[i])
i = i + 1
else
table.insert( result, Right[j])
j = j + 1
end
end
-- Append degli elementi rimanenti a sinistra o destra
while i <= #Left do
table.insert( result, Left[i])
i = i + 1
end
while j <= #Right do
table.insert( result, Right[j])
j = j + 1
end
return result
end
-- Merge sort
local function MergeSort( List, Compare)
if #List <= 1 then
return List
end
local mid = floor( #List / 2)
local Left = MergeSort( { table.unpack( List, 1, mid)}, Compare)
local Right = MergeSort( { table.unpack( List, mid + 1)}, Compare)
return MergeHalves( Left, Right, Compare)
end
-- chiamata accessibile dall'esterno
function BeamLib.StableSort( List, Compare)
return MergeSort( List, Compare)
end
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return BeamLib return BeamLib
+4 -4
View File
@@ -386,9 +386,9 @@ end
--------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------
-- DiceCut.GetDice : -- DiceCut.GetDice :
-- Part : pezzo -- Part : pezzo
-- MainFace : lista. Contiene tutti i dati della faccia principale. Obblogatori i campi '.ptCenter' e '.vtNormal' -- Face1 : table. Contiene tutti i dati della faccia principale. Obbligatori i campi '.ptCenter' e '.vtNormal'
-- SubordinateFace : lista. Contiene tutti i dati della faccia secondaria. Se non esiste, la lista è vuota. Se esiste, obblogatori i campi '.ptCenter' e '.vtNormal' -- Face2 : table. Contiene tutti i dati della faccia secondaria. Se non esiste, la table è vuota ({}). Se esiste, obbligatori i campi '.ptCenter' e '.vtNormal'
-- OptionaParameters : eventuali parametri opzionali -- OptionaParameters : eventuali parametri opzionali
--------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------
function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters) function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters)
@@ -403,7 +403,7 @@ function DiceCut.GetDice( Part, Face1, Face2, OptionalParameters)
-- recupero gruppo per geometria addizionale -- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( Part.id) local nAddGrpId = BeamLib.GetAddGroup( Part.id)
-- se il box non è passato tra i parametri opzionali, faccio i calcoli sul SOLID del Part -- se il box non è passato tra i parametri opzionali, faccio i calcoli sul SOLID del Part
local b3BoxToDicing = OptionalParameters.b3BoxToDicing or Part.b3Solid local b3BoxToDicing = OptionalParameters.b3BoxToDicing or Part.b3Part
-- copio dati passati su variabili locali -- copio dati passati su variabili locali
local ptCMainFace, vtNMainFace, ptCSubordinateFace, vtNSubordinateFace, bGetOrtoPlanes local ptCMainFace, vtNMainFace, ptCSubordinateFace, vtNSubordinateFace, bGetOrtoPlanes
if Face1.ptCenter and Face1.vtNormal then if Face1.ptCenter and Face1.vtNormal then
+72 -34
View File
@@ -97,6 +97,42 @@ function FaceData.GetFacesByAdjacencyNumber( Proc)
return FacesByAdjacencyNumber return FacesByAdjacencyNumber
end end
-------------------------------------------------------------------------------------------------------------
local function GetEdgesInfo( Proc, idFace )
local Edges = {}
local nFaceType, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( Proc.id, idFace, GDB_ID.ROOT)
for i = 1, #EdgesEgt do
local nPreviousEdgeIndex = i - 1
if i == 1 then
nPreviousEdgeIndex = #EdgesEgt
end
local nNextEdgeIndex = i + 1
if i == #EdgesEgt then
nNextEdgeIndex = 1
end
-- l'elevazione si tiene sempre positiva e la normale sempre diretta verso l'interno della faccia
-- per sapere se il lato è aperto c'è la proprietà apposita bIsOpen
local CurrentEdge = {}
CurrentEdge.idAdjacentFace = EdgesEgt[i].Adj
CurrentEdge.dLength = EdgesEgt[i].Len
CurrentEdge.dElevation = abs( EdgesEgt[i].Elev)
CurrentEdge.bIsOpen = EdgesEgt[i].Open
CurrentEdge.vtN = Vector3d( EdgesEgt[i].Norm)
if CurrentEdge.bIsOpen then
CurrentEdge.vtN = -CurrentEdge.vtN
end
CurrentEdge.bIsStartOpen = EdgesEgt[nPreviousEdgeIndex].Open
CurrentEdge.bIsEndOpen = EdgesEgt[nNextEdgeIndex].Open
CurrentEdge.sType = 'Standard'
table.insert( Edges, CurrentEdge)
end
return nFaceType, Edges
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function FaceData.GetFacesInfo( Proc, Part) function FaceData.GetFacesInfo( Proc, Part)
EgtOutLog( '---Faces START---') EgtOutLog( '---Faces START---')
@@ -109,6 +145,10 @@ function FaceData.GetFacesInfo( Proc, Part)
vAdj = FaceData.GetAdjacencyMatrix( Proc) vAdj = FaceData.GetAdjacencyMatrix( Proc)
end end
if not Proc.nFct then
Proc.nFct = EgtSurfTmFacetCount( Proc.id) or 0
end
-- reset eventuali visualizzazioni facce a due colori -- reset eventuali visualizzazioni facce a due colori
EgtSurfTmResetTwoColors( Proc.id) EgtSurfTmResetTwoColors( Proc.id)
@@ -120,14 +160,14 @@ function FaceData.GetFacesInfo( Proc, Part)
-- frame OCS faccia -- frame OCS faccia
Faces[i].vtFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN) Faces[i].vtFrameHV = Frame3d( Faces[i].ptCenter, Faces[i].vtN)
-- elevazione calcolata rispetto al box della parte -- elevazione calcolata rispetto al box della parte
Faces[i].dElevation = EgtSurfTmFacetElevationInBBox( Proc.id, i - 1, Part.b3Solid, true, GDB_ID.ROOT) Faces[i].dElevation = EgtSurfTmFacetElevationInBBox( Proc.id, i - 1, Part.b3Part, true, GDB_ID.ROOT)
-- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo -- TODO qui sarebbe meglio l'area vera e non quella del rettangolo minimo
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.id, i - 1, GDB_ID.ROOT) local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.id, i - 1, GDB_ID.ROOT)
Faces[i].dArea = dShortEdgeDimension * dLongEdgeDimension Faces[i].dArea = dShortEdgeDimension * dLongEdgeDimension
local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.id, i - 1, GDB_ID.ROOT) local nFaceType, Edges = GetEdgesInfo( Proc, i - 1)
Faces[i].bIsOkForMachining = nFaceType < 1 Faces[i].bIsOkForMachining = nFaceType < 1
Faces[i].Edges = vEdges Faces[i].Edges = Edges
-- TODO valutare se fare un output unico alla fine o gestire log in altro modo -- TODO valutare se fare un output unico alla fine o gestire log in altro modo
EgtOutLog( 'Facet ' .. Faces[i].id .. ' of ' .. Proc.nFct - 1) EgtOutLog( 'Facet ' .. Faces[i].id .. ' of ' .. Proc.nFct - 1)
@@ -180,7 +220,7 @@ local function GetTunnelFaces( Proc, Part)
end end
-- faccia centrale -- faccia centrale
local nMiddleTmId = EgtSurfTmPlaneInBBox( nAddGrpId, ptTunnelCenter, vtTunnelDirection, Part.b3Solid, GDB_ID.ROOT) local nMiddleTmId = EgtSurfTmPlaneInBBox( nAddGrpId, ptTunnelCenter, vtTunnelDirection, Part.b3Part, GDB_ID.ROOT)
-- TODO se non si riesce a costruire la faccia bisogna dare errore o semplicemente non ritornarla?? -- TODO se non si riesce a costruire la faccia bisogna dare errore o semplicemente non ritornarla??
for i = 1, Proc.nFct do for i = 1, Proc.nFct do
EgtCutSurfTmPlane( nMiddleTmId, Proc.Faces[i].ptCenter, -Proc.Faces[i].vtN, false, GDB_ID.ROOT) EgtCutSurfTmPlane( nMiddleTmId, Proc.Faces[i].ptCenter, -Proc.Faces[i].vtN, false, GDB_ID.ROOT)
@@ -242,10 +282,10 @@ local function GetBottomFaces( Proc)
local ClosedEdgesSortedByGreatestLength = {} local ClosedEdgesSortedByGreatestLength = {}
for i = 1, #BottomFaces[1].Edges do for i = 1, #BottomFaces[1].Edges do
if not BottomFaces[1].Edges[i].Open then if not BottomFaces[1].Edges[i].bIsOpen then
table.insert( ClosedEdgesSortedByGreatestLength, {}) table.insert( ClosedEdgesSortedByGreatestLength, {})
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].nIndex = i ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].nIndex = i
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFaces[1].Edges[i].Len ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFaces[1].Edges[i].dLength
end end
end end
table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end) table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end)
@@ -262,14 +302,13 @@ local function GetBottomFaces( Proc)
end end
local CurrentEdge = {} local CurrentEdge = {}
CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].Adj CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].idAdjacentFace
CurrentEdge.vtToolDirection = Vector3d( BottomFaces[1].Edges[i].Norm) CurrentEdge.vtN = BottomFaces[1].Edges[i].vtN
CurrentEdge.dLength = BottomFaces[1].Edges[i].Len CurrentEdge.dLength = BottomFaces[1].Edges[i].dLength
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].bIsOpen
CurrentEdge.dElevation = BottomFaces[1].Edges[i].Elev CurrentEdge.dElevation = BottomFaces[1].Edges[i].dElevation
CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].Open CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[i].bIsStartOpen
CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[nPreviousEdgeIndex].Open CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[i].bIsEndOpen
CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[nNextEdgeIndex].Open
if i == nFirstLongEdgeIndex then if i == nFirstLongEdgeIndex then
BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge
@@ -348,14 +387,13 @@ local function GetLongFaces( Proc, MainFaces)
end end
local CurrentEdge = {} local CurrentEdge = {}
CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].Adj CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].idAdjacentFace
CurrentEdge.vtToolDirection = Vector3d( LongFaces[i].Edges[j].Norm) CurrentEdge.vtN = LongFaces[i].Edges[j].vtN
CurrentEdge.dLength = LongFaces[i].Edges[j].Len CurrentEdge.dLength = LongFaces[i].Edges[j].dLength
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.bIsOpen = LongFaces[i].Edges[j].bIsOpen
CurrentEdge.dElevation = LongFaces[i].Edges[j].Elev CurrentEdge.dElevation = LongFaces[i].Edges[j].dElevation
CurrentEdge.bIsOpen = LongFaces[i].Edges[j].Open CurrentEdge.bIsStartOpen = LongFaces[i].Edges[j].bIsStartOpen
CurrentEdge.bIsStartOpen = LongFaces[i].Edges[nPreviousEdgeIndex].Open CurrentEdge.bIsEndOpen = LongFaces[i].Edges[j].bIsEndOpen
CurrentEdge.bIsEndOpen = LongFaces[i].Edges[nNextEdgeIndex].Open
if Proc.Topology.sFamily == 'Tunnel' then if Proc.Topology.sFamily == 'Tunnel' then
if CurrentEdge.idAdjacentFace > -1 then if CurrentEdge.idAdjacentFace > -1 then
@@ -369,10 +407,10 @@ local function GetLongFaces( Proc, MainFaces)
if CurrentEdge.idAdjacentFace == BottomFace.id then if CurrentEdge.idAdjacentFace == BottomFace.id then
LongFaces[i].MainEdges.BottomEdge = CurrentEdge LongFaces[i].MainEdges.BottomEdge = CurrentEdge
LongFaces[i].MainEdges.BottomEdge.sType = 'Bottom' LongFaces[i].MainEdges.BottomEdge.sType = 'Bottom'
elseif LongFaces[i].Edges[nNextEdgeIndex].Adj == BottomFace.id then elseif LongFaces[i].Edges[nNextEdgeIndex].idAdjacentFace == BottomFace.id then
LongFaces[i].MainEdges.SideEdges[1] = CurrentEdge LongFaces[i].MainEdges.SideEdges[1] = CurrentEdge
LongFaces[i].MainEdges.SideEdges[1].sType = 'Side' LongFaces[i].MainEdges.SideEdges[1].sType = 'Side'
elseif LongFaces[i].Edges[nPreviousEdgeIndex].Adj == BottomFace.id then elseif LongFaces[i].Edges[nPreviousEdgeIndex].idAdjacentFace == BottomFace.id then
LongFaces[i].MainEdges.SideEdges[2] = CurrentEdge LongFaces[i].MainEdges.SideEdges[2] = CurrentEdge
LongFaces[i].MainEdges.SideEdges[2].sType = 'Side' LongFaces[i].MainEdges.SideEdges[2].sType = 'Side'
else else
@@ -435,14 +473,13 @@ local function GetSideFaces( Proc, MainFaces)
end end
local CurrentEdge = {} local CurrentEdge = {}
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].Adj CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].idAdjacentFace
CurrentEdge.vtToolDirection = Vector3d( SideFaces[i].Edges[j].Norm) CurrentEdge.vtN = SideFaces[i].Edges[j].vtN
CurrentEdge.dLength = SideFaces[i].Edges[j].Len CurrentEdge.dLength = SideFaces[i].Edges[j].dLength
CurrentEdge.dLengthOnX = CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY() CurrentEdge.bIsOpen = SideFaces[i].Edges[j].bIsOpen
CurrentEdge.dElevation = SideFaces[i].Edges[j].Elev CurrentEdge.dElevation = SideFaces[i].Edges[j].dElevation
CurrentEdge.bIsOpen = SideFaces[i].Edges[j].Open CurrentEdge.bIsStartOpen = SideFaces[i].Edges[j].bIsStartOpen
CurrentEdge.bIsStartOpen = SideFaces[i].Edges[nPreviousEdgeIndex].Open CurrentEdge.bIsEndOpen = SideFaces[i].Edges[j].bIsEndOpen
CurrentEdge.bIsEndOpen = SideFaces[i].Edges[nNextEdgeIndex].Open
if Proc.Topology.sFamily == 'Tunnel' then if Proc.Topology.sFamily == 'Tunnel' then
if CurrentEdge.idAdjacentFace > -1 then if CurrentEdge.idAdjacentFace > -1 then
@@ -454,10 +491,10 @@ local function GetSideFaces( Proc, MainFaces)
if CurrentEdge.idAdjacentFace == BottomFace.id then if CurrentEdge.idAdjacentFace == BottomFace.id then
SideFaces[i].MainEdges.BottomEdge = CurrentEdge SideFaces[i].MainEdges.BottomEdge = CurrentEdge
SideFaces[i].MainEdges.BottomEdge.sType = 'Bottom' SideFaces[i].MainEdges.BottomEdge.sType = 'Bottom'
elseif SideFaces[i].Edges[nNextEdgeIndex].Adj == BottomFace.id then elseif SideFaces[i].Edges[nNextEdgeIndex].idAdjacentFace == BottomFace.id then
SideFaces[i].MainEdges.LongEdges[1] = CurrentEdge SideFaces[i].MainEdges.LongEdges[1] = CurrentEdge
SideFaces[i].MainEdges.LongEdges[1].sType = 'Long' SideFaces[i].MainEdges.LongEdges[1].sType = 'Long'
elseif SideFaces[i].Edges[nPreviousEdgeIndex].Adj == BottomFace.id then elseif SideFaces[i].Edges[nPreviousEdgeIndex].idAdjacentFace == BottomFace.id then
SideFaces[i].MainEdges.LongEdges[2] = CurrentEdge SideFaces[i].MainEdges.LongEdges[2] = CurrentEdge
SideFaces[i].MainEdges.LongEdges[2].sType = 'Long' SideFaces[i].MainEdges.LongEdges[2].sType = 'Long'
else else
@@ -494,6 +531,7 @@ function FaceData.GetMainFaces( Proc, Part)
Logs.WriteMainFacesLog( Proc, MainFaces) Logs.WriteMainFacesLog( Proc, MainFaces)
end end
else else
MainFaces = nil
EgtOutLog( '---MainFaces NOT NEEDED---') EgtOutLog( '---MainFaces NOT NEEDED---')
end end
+149 -26
View File
@@ -98,14 +98,12 @@ end
--------------------------------------------------------------------- ---------------------------------------------------------------------
-- restituisce true se almeno una delle dimensioni della feature è maggiore o uguale ad una delle dimensioni principali del pezzo (tolleranza 1 mm) -- restituisce true se almeno una delle dimensioni della feature è maggiore o uguale ad una delle dimensioni principali del pezzo (tolleranza 1 mm)
local function IsAnyDimensionLongAsPart( Proc) local function IsAnyDimensionLongAsPart( Proc, Part)
local bResult = false local bResult = false
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.idPart or GDB_ID.NULL, 'Box')
local b3Solid = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
if Proc.b3Box:getDimX() > b3Solid:getDimX() - 1000 * GEO.EPS_SMALL or if Proc.b3Box:getDimX() > Part.b3Part:getDimX() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimY() > b3Solid:getDimY() - 1000 * GEO.EPS_SMALL or Proc.b3Box:getDimY() > Part.b3Part:getDimY() - 1000 * GEO.EPS_SMALL or
Proc.b3Box:getDimZ() > b3Solid:getDimZ() - 1000 * GEO.EPS_SMALL then Proc.b3Box:getDimZ() > Part.b3Part:getDimZ() - 1000 * GEO.EPS_SMALL then
bResult = true bResult = true
end end
@@ -141,7 +139,7 @@ function FeatureLib.ClassifyTopology( Proc, Part)
local bIsFeatureCuttingEntireSection = IsFeatureCuttingEntireSection( Proc.b3Box, Part) local bIsFeatureCuttingEntireSection = IsFeatureCuttingEntireSection( Proc.b3Box, Part)
local bIsFeatureCuttingEntireLength = IsFeatureCuttingEntireLength( Proc.b3Box, Part) local bIsFeatureCuttingEntireLength = IsFeatureCuttingEntireLength( Proc.b3Box, Part)
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc) local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc, Part)
local vAdj = Proc.AdjacencyMatrix local vAdj = Proc.AdjacencyMatrix
local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj) local bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( vAdj)
local vTriangularFaces = FaceData.GetTriangularFaces( Proc) local vTriangularFaces = FaceData.GetTriangularFaces( Proc)
@@ -295,8 +293,8 @@ function FeatureLib.CalculateCompositeRating( StrategyResult)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, OptionalParameters) function FeatureLib.IsMachiningLong( dMachiningLengthOnX, Part, OptionalParameters)
local bMachiningNeedsSplitting local bIsMachiningLong
-- parametri opzionali -- parametri opzionali
if not OptionalParameters then if not OptionalParameters then
@@ -304,14 +302,15 @@ function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, Optional
end end
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
bMachiningNeedsSplitting = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL) bIsMachiningLong = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL)
or ( dMachiningLengthOnX > 0.7 * Part.b3Solid:getDimX() + 10 * GEO.EPS_SMALL) or ( dMachiningLengthOnX > 0.7 * Part.b3Part:getDimX() + 10 * GEO.EPS_SMALL)
return bMachiningNeedsSplitting return bIsMachiningLong
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters) function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
local vFeatureSplittingPoints = {} local FeatureSplittingPoints = {}
local bFeatureStartsOnEdgeLeft = false local bFeatureStartsOnEdgeLeft = false
local bFeatureStartsOnEdgeRight = false local bFeatureStartsOnEdgeRight = false
local dSplitXLeft = Proc.b3Box:getMin():getX() local dSplitXLeft = Proc.b3Box:getMin():getX()
@@ -328,15 +327,15 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
local dToolOverlapBetweenSegments = OptionalParameters.dToolOverlapBetweenSegments or BeamData.MILL_OVERLAP local dToolOverlapBetweenSegments = OptionalParameters.dToolOverlapBetweenSegments or BeamData.MILL_OVERLAP
-- verifica spezzatura necessaria -- verifica spezzatura necessaria
if not FeatureLib.MachiningNeedsSplitting( Proc.b3Box:getDimX(), Part) then if not FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part) then
return {} return {}
end end
-- verifica se necessari spezzoni differenti sugli estremi -- verifica se necessari spezzoni differenti sugli estremi
if Proc.b3Box:getMin():getX() < Part.b3Solid:getMin():getX() + dMaxSegmentLengthOnEdges - 10 * GEO.EPS_SMALL then if Proc.b3Box:getMin():getX() < Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges - 10 * GEO.EPS_SMALL then
bFeatureStartsOnEdgeLeft = true bFeatureStartsOnEdgeLeft = true
end end
if Proc.b3Box:getMax():getX() > Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then if Proc.b3Box:getMax():getX() > Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges + 10 * GEO.EPS_SMALL then
bFeatureStartsOnEdgeRight = true bFeatureStartsOnEdgeRight = true
end end
@@ -345,13 +344,13 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
if bFeatureStartsOnEdgeLeft then if bFeatureStartsOnEdgeLeft then
-- decido punto spezzatura verso la coda -- decido punto spezzatura verso la coda
if Proc.b3Box:getDimX() > dMaxSegmentLengthOnEdges * 2 then if Proc.b3Box:getDimX() > dMaxSegmentLengthOnEdges * 2 then
dSplitXLeft = max( Part.b3Solid:getMin():getX() + dMaxSegmentLengthOnEdges, Proc.b3Box:getMin():getX() + dMinSegmentLength) dSplitXLeft = max( Part.b3Part:getMin():getX() + dMaxSegmentLengthOnEdges, Proc.b3Box:getMin():getX() + dMinSegmentLength)
else else
-- se pezzo abbastanza piccolo, spezzo in mezzo al 'pezzo + grezzo restante' -- se pezzo abbastanza piccolo, spezzo in mezzo al 'pezzo + grezzo restante'
if Part.dRestLength + Part.b3Solid:getDimX() < BeamData.dMinRaw * 1.5 then if Part.dRestLength + Part.b3Part:getDimX() < BeamData.dMinRaw * 1.5 then
dSplitXLeft = Part.b3Solid:getMax():getX() - ( ( Part.dRestLength + Part.b3Solid:getDimX()) / 2) dSplitXLeft = Part.b3Part:getMax():getX() - ( ( Part.dRestLength + Part.b3Part:getDimX()) / 2)
else else
dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw)/2 + 150, Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges) dSplitXLeft = max( Proc.b3Box:getMin():getX() + ( BeamData.dMinRaw)/2 + 150, Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges)
end end
end end
dFeatureCentralLength = abs( dSplitXRight - dSplitXLeft) dFeatureCentralLength = abs( dSplitXRight - dSplitXLeft)
@@ -361,7 +360,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
-- calcolo punto estremo destro -- calcolo punto estremo destro
local ptSplitXRight local ptSplitXRight
if bFeatureStartsOnEdgeRight then if bFeatureStartsOnEdgeRight then
dSplitXRight = min( ( Proc.b3Box:getMax():getX() - dMinSegmentLength), Part.b3Solid:getMax():getX() - dMaxSegmentLengthOnEdges) dSplitXRight = min( ( Proc.b3Box:getMax():getX() - dMinSegmentLength), Part.b3Part:getMax():getX() - dMaxSegmentLengthOnEdges)
if dSplitXRight - dSplitXLeft < 500 * GEO.EPS_SMALL then if dSplitXRight - dSplitXLeft < 500 * GEO.EPS_SMALL then
dSplitXRight = dSplitXLeft - dToolOverlapBetweenSegments dSplitXRight = dSplitXLeft - dToolOverlapBetweenSegments
dFeatureCentralLength = 0 dFeatureCentralLength = 0
@@ -373,7 +372,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
-- aggiungo eventuale punto estremo destro -- aggiungo eventuale punto estremo destro
if bFeatureStartsOnEdgeRight then if bFeatureStartsOnEdgeRight then
table.insert( vFeatureSplittingPoints, ptSplitXRight) table.insert( FeatureSplittingPoints, ptSplitXRight)
end end
-- aggiungo punti centrali della feature -- aggiungo punti centrali della feature
@@ -384,17 +383,141 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
local ptOn local ptOn
local dCurrentPointX = dSplitXRight - i * dSplitPartsLen local dCurrentPointX = dSplitXRight - i * dSplitPartsLen
ptOn = Point3d( dCurrentPointX, 0, 0) ptOn = Point3d( dCurrentPointX, 0, 0)
table.insert( vFeatureSplittingPoints, ptOn) table.insert( FeatureSplittingPoints, ptOn)
end end
end end
-- aggiungo eventuale punto estemo sinistro -- aggiungo eventuale punto estemo sinistro
if bFeatureStartsOnEdgeLeft then if bFeatureStartsOnEdgeLeft then
table.insert( vFeatureSplittingPoints, ptSplitXLeft) table.insert( FeatureSplittingPoints, ptSplitXLeft)
end end
return vFeatureSplittingPoints return FeatureSplittingPoints
end end
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
function FeatureLib.GetAdditionalInfo( Proc, Part)
-- se foro calcolo altri dati
if ID.IsDrilling( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.dDiam, Proc.dLen, Proc.nFcs, Proc.nFce = FeatureLib.GetDrillingData( Proc)
end
return Proc
end
-------------------------------------------------------------------------------------------------------------
function FeatureLib.GetFeatureVolume( Proc, Part)
local dProcVolume = 0
local nAddGrpId = BeamLib.GetAddGroup( Proc.idPart)
if not nAddGrpId then
-- TODO gestire meglio questo errore. Non conviene creare e verificare all'inizio se il gruppo esiste?
EgtOutLog( 'Error : missing AddGroup')
return 0
end
local idProcCopy = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local b3PartCopy = BBox3d( Part.b3Part)
b3PartCopy:expand( -100 * GEO.EPS_SMALL)
local idPartCopy = EgtSurfTmBBox( nAddGrpId, b3PartCopy , false, GDB_RT.GLOB)
EgtSurfTmSubtract( idPartCopy, idProcCopy)
dProcVolume = EgtSurfVolume( idPartCopy)
EgtErase( { idProcCopy, idPartCopy})
return dProcVolume
end
-------------------------------------------------------------------------------------------------------------
-- TODO funzione copiata direttamente da automatismo vecchio, da migliorare / completare
function FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
local NotClampableLength = {}
-- verifico siano una o due facce
if Proc.nFct > 2 then return end
-- eventuale segnalazione ingombro di testa o coda
local dMinHIng = min( 0.5 * BeamData.VICE_MINH, 0.5 * Part.b3Raw:getDimZ())
local dMinZ = max( BeamData.MIN_HEIGHT, 0.35 * Part.b3Raw:getDimZ())
-- calcolo punto massimo in Z fino a dove considerare il pinzaggio. Minimo tra pinzaggio massimo e altezza pezzo
local dMaxHZ = Part.b3Raw:getMin():getZ() + min( BeamData.VICE_MAXH or BeamData.MAX_HEIGHT, Part.b3Raw:getDimZ())
-- punto massimo in Z considerando anche la Z della feature
local dMaxHZFeat = min( dMaxHZ, Proc.b3Box:getMax():getZ())
-- dimensione Z del pinzaggio (differenza massima Z pinzabile e box feature)
local dDeltaZClamp = ( ( dMaxHZ - Part.b3Raw:getMin():getZ()) - max( 0, dMaxHZFeat - Proc.b3Box:getMin():getZ()))
-- se pinzaggio minimo è come il massimo (oppure come l'altezza massima del pezzo) significa che è verticale
local bIsVertClamps = BeamData.VICE_MINH > BeamData.MAX_HEIGHT - 100 * GEO.EPS_SMALL
-- condizioni per limitare pinzaggio testa/coda
local bUpdateIng = true
-- se dimensione del box della feature maggiore di metà pinzaggio minimo o metà spessore pezzo
bUpdateIng = bUpdateIng and Proc.b3Box:getDimZ() > dMinHIng
-- se la feature si trova più in basso del minimo pinzabile in Z o il 35% dello spessore pezzo
bUpdateIng = bUpdateIng and Proc.b3Box:getMin():getZ() < Part.b3Raw:getMin():getZ() + dMinZ
-- se feature è al di sotto del pinzaggio massimo
bUpdateIng = bUpdateIng and Proc.b3Box:getMin():getZ() < dMaxHZ
-- se ho le morse verticali, o se la feature è in centro o verso alto, controllo se non prendo abbastanza.
if bIsVertClamps or ( Proc.b3Box:getMin():getZ() - Part.b3Raw:getMin():getZ()) > BeamData.MIN_HEIGHT then
bUpdateIng = bUpdateIng and dDeltaZClamp < BeamData.VICE_MINH
end
local dNotClampableLengthHead = 0
local dNotClampableLengthTail = 0
if bUpdateIng then
if Proc.AffectedFaces.bRight then
local dOffs = Part.b3Part:getMax():getX() - Proc.b3Box:getMin():getX()
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
if not bIsVertClamps and dDeltaZClamp > BeamData.VICE_MINH and BeamData.VICE_MAXH then
dOffs = min( dOffs, BeamData.VICE_MAXH - BeamData.VICE_MINH)
end
dNotClampableLengthHead = dOffs
elseif Proc.AffectedFaces.bLeft then
local dOffs = Proc.b3Box:getMax():getX() - Part.b3Part:getMin():getX()
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
if not bIsVertClamps and dDeltaZClamp > BeamData.VICE_MINH and BeamData.VICE_MAXH then
dOffs = min( dOffs, BeamData.VICE_MAXH - BeamData.VICE_MINH)
end
dNotClampableLengthTail = dOffs
elseif Proc.b3Box:getCenter():getX() > Part.b3Part:getCenter():getX() then
local dOffs = Part.b3Part:getMax():getX() - Proc.b3Box:getMin():getX()
local dDist = Part.b3Part:getMax():getX() - Proc.b3Box:getMax():getX()
-- se pinze a 45° e pinza abbastanza materiale, compenso comunque, ma solo inclinazione morse
if not bIsVertClamps and dDeltaZClamp > BeamData.VICE_MINH and BeamData.VICE_MAXH then
dOffs = min( dOffs, BeamData.VICE_MAXH - BeamData.VICE_MINH)
end
-- dDist serve??
dNotClampableLengthHead = dOffs
end
end
NotClampableLength.dNotClampableLengthHead = dNotClampableLengthHead
NotClampableLength.dNotClampableLengthTail = dNotClampableLengthTail
return NotClampableLength
end
-------------------------------------------------------------------------------------------------------------
function FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
local nPartIndex = Part.nIndexInParts
local nProcIndex = Proc.nIndexInVProc
local Rotations = PROCESSINGS[nPartIndex].Rotation
local dMaxOnHead = 0
local dMaxOnTail = 0
for i = 1, #Part.CombinationList do
for j = 1, 4 do
-- controllo che la rotazione sia attiva
if string.sub( Part.CombinationList[i].sBitIndexCombination, j, j) == '1' then
dMaxOnHead = max( Rotations[j][nProcIndex].NotClampableLength.dNotClampableLengthHead, dMaxOnHead)
dMaxOnTail = max( Rotations[j][nProcIndex].NotClampableLength.dNotClampableLengthTail, dMaxOnTail)
end
end
end
return dMaxOnHead, dMaxOnTail
end
-------------------------------------------------------------------------------------------------------------
return FeatureLib return FeatureLib
+262 -28
View File
@@ -99,15 +99,17 @@ function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep) MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
if MachiningSteps.nCount > 1 then if MachiningSteps.nCount > 1 then
MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1) MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
else
MachiningSteps.nCount = 1
end end
return MachiningSteps return MachiningSteps
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part ) function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part )
for i = #Machinings, 1, -1 do for i = #Machinings, 1, -1 do
local nParts = #vSplittingPoints + 1 local nParts = #SplittingPoints + 1
local dEdgeMaxX = Machinings[i].ptEdge1:getX() local dEdgeMaxX = Machinings[i].ptEdge1:getX()
local dEdgeMinX = Machinings[i].ptEdge2:getX() local dEdgeMinX = Machinings[i].ptEdge2:getX()
if Machinings[i].ptEdge1:getX() < Machinings[i].ptEdge2:getX() - 10 * GEO.EPS_SMALL then if Machinings[i].ptEdge1:getX() < Machinings[i].ptEdge2:getX() - 10 * GEO.EPS_SMALL then
@@ -116,16 +118,17 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
end end
local dOriginalStartAddLength = Machinings[i].LeadIn.dStartAddLength local dOriginalStartAddLength = Machinings[i].LeadIn.dStartAddLength
local dOriginalEndAddLength = Machinings[i].LeadOut.dEndAddLength local dOriginalEndAddLength = Machinings[i].LeadOut.dEndAddLength
if FeatureLib.MachiningNeedsSplitting( Machinings[i].dLengthOnX, Part) then local sOriginalStage = Machinings[i].sStage
if FeatureLib.IsMachiningLong( Machinings[i].dLengthOnX, Part) then
local nCurrentMachiningIndex = i local nCurrentMachiningIndex = i
-- lo spezzone attivo è quello precedente al punto di spezzatura corrente -- lo spezzone attivo è quello precedente al punto di spezzatura corrente
for j = 1, nParts do for j = 1, nParts do
-- check ultimo segmento della lavorazione (NON della feature) -- check ultimo segmento della lavorazione (NON della feature)
local bIsLastSegment = ( nParts == 1) local bIsLastSegment = ( nParts == 1)
or ( ( ( j ~= 1) and vSplittingPoints[j - 1]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL) or ( ( ( j ~= 1) and SplittingPoints[j - 1]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL)
and ( j == nParts or vSplittingPoints[j]:getX() < dEdgeMinX + 10 * GEO.EPS_SMALL)) and ( j == nParts or SplittingPoints[j]:getX() < dEdgeMinX + 10 * GEO.EPS_SMALL))
-- se non è l'ultimo segmento della lavorazione, il punto di spezzatura deve essere all'interno del lato che si sta lavorando -- se non è l'ultimo segmento della lavorazione, il punto di spezzatura deve essere all'interno del lato che si sta lavorando
if ( j ~= nParts and ( vSplittingPoints[j]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL and vSplittingPoints[j]:getX() < dEdgeMaxX - 10 * GEO.EPS_SMALL)) if ( j ~= nParts and ( SplittingPoints[j]:getX() > dEdgeMinX + 10 * GEO.EPS_SMALL and SplittingPoints[j]:getX() < dEdgeMaxX - 10 * GEO.EPS_SMALL))
or bIsLastSegment then or bIsLastSegment then
if j > 1 then if j > 1 then
nCurrentMachiningIndex = nCurrentMachiningIndex + 1 nCurrentMachiningIndex = nCurrentMachiningIndex + 1
@@ -137,12 +140,15 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
end end
if j == 1 then if j == 1 then
dEndAddLength = - ( vSplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( SplittingPoints[j]:getX() + ( dEdgeMaxX - SplittingPoints[j]:getX()) / 2, 0, 0)
elseif j == nParts then elseif j == nParts then
dStartAddLength = - ( dEdgeMaxX - vSplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( dEdgeMinX + ( SplittingPoints[j - 1]:getX() - dEdgeMinX) / 2, 0, 0)
else else
dStartAddLength = - ( dEdgeMaxX - vSplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP dStartAddLength = - ( dEdgeMaxX - SplittingPoints[j - 1]:getX()) + BeamData.MILL_OVERLAP
dEndAddLength = - ( vSplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP dEndAddLength = - ( SplittingPoints[j]:getX() - dEdgeMinX) + BeamData.MILL_OVERLAP
Machinings[nCurrentMachiningIndex].ptCenter = Point3d( SplittingPoints[j]:getX() + ( SplittingPoints[j - 1]:getX() - SplittingPoints[j]:getX()) / 2, 0, 0)
end end
if MachiningLib.StartsLeftSide( Machinings[nCurrentMachiningIndex]) then if MachiningLib.StartsLeftSide( Machinings[nCurrentMachiningIndex]) then
dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength dStartAddLength, dEndAddLength = dEndAddLength, dStartAddLength
@@ -152,27 +158,37 @@ function MachiningLib.GetSplitMachinings( Machinings, vSplittingPoints, Part )
Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength = dEndAddLength Machinings[nCurrentMachiningIndex].LeadOut.dEndAddLength = dEndAddLength
end end
if not bIsLastSegment then if not bIsLastSegment then
Machinings[nCurrentMachiningIndex].bMoveAfterSplitcut = false Machinings[nCurrentMachiningIndex].sStage = ''
else
Machinings[nCurrentMachiningIndex].sStage = sOriginalStage
end end
Machinings[nCurrentMachiningIndex].nSegment = j Machinings[nCurrentMachiningIndex].nFeatureSegment = j
end end
-- anche le lavorazioni non splittate necessitano del segmento assegnato -- anche le lavorazioni non splittate necessitano del segmento assegnato
else else
local dRightAddLength = dOriginalStartAddLength local dRightAddLength = 0
local dLeftAddLength = dOriginalEndAddLength local dLeftAddLength = 0
if MachiningLib.StartsLeftSide( Machinings[i]) then -- si considerano allungamenti e accorciamenti solo se la feature è orientata principalmente lungo X
dRightAddLength, dLeftAddLength = dLeftAddLength, dRightAddLength -- TODO il modo corretto è proiettare tutto, allungamenti e accorciamenti compresi, sulla faccia frontale
if abs( Machinings[i].vtToolDirection:getX()) < 0.707 then
dRightAddLength = dOriginalStartAddLength
dLeftAddLength = dOriginalEndAddLength
if MachiningLib.StartsLeftSide( Machinings[i]) then
dRightAddLength, dLeftAddLength = dLeftAddLength, dRightAddLength
end
end end
for j = 1, nParts do for j = 1, nParts do
local dNextSplitX = dEdgeMinX local dNextSplitX = dEdgeMinX
local dPreviousSplitX = dEdgeMaxX local dPreviousSplitX = dEdgeMaxX
if j ~= 1 then if j ~= 1 then
dPreviousSplitX = vSplittingPoints[j - 1]:getX() dPreviousSplitX = SplittingPoints[j - 1]:getX()
elseif j ~= nParts then
dNextSplitX = vSplittingPoints[j]:getX()
end end
if ( dEdgeMinX - dLeftAddLength) > dNextSplitX - 10 * GEO.EPS_SMALL and ( dEdgeMaxX + dRightAddLength) < dPreviousSplitX + 10 * GEO.EPS_SMALL then if j ~= nParts then
Machinings[i].nSegment = j dNextSplitX = SplittingPoints[j]:getX()
end
if ( dEdgeMinX - dLeftAddLength) > dNextSplitX - 10 * GEO.EPS_SMALL and ( dEdgeMinX - dLeftAddLength) < dPreviousSplitX + 10 * GEO.EPS_SMALL then
Machinings[i].nFeatureSegment = j
Machinings[i].ptCenter = Point3d( dNextSplitX + ( dPreviousSplitX - dNextSplitX) / 2, 0, 0)
end end
end end
end end
@@ -254,7 +270,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
-- se hanno stesso montaggio -- se hanno stesso montaggio
elseif TOOLS[i].SetupInfo.bToolOnAggregate == TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then elseif TOOLS[i].SetupInfo.bToolOnAggregate == TOOLS[nBestToolIndex].SetupInfo.bToolOnAggregate then
-- scelgo utensile con indice di bontà utensile calcolato come: lunghezza / massimo materiale / diametro -- scelgo utensile con indice di bontà utensile calcolato come: lunghezza / massimo materiale / diametro
if ( TOOLS[i].dLength / TOOLS[i].dMaxMaterial) / TOOLS[i].dDiameter < ( TOOLS[nBestToolIndex].dLength / TOOLS[nBestToolIndex].dMaxMaterial) / TOOLS[nBestToolIndex].dDiameter then if TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
nBestToolIndex = i nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth dBestToolResidualDepth = dCurrentResidualDepth
end end
@@ -310,6 +326,8 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
bIsToolCompatible = TOOLS[i].SetupInfo.bIsTopHead bIsToolCompatible = TOOLS[i].SetupInfo.bIsTopHead
elseif ToolSearchParameters.bAllowBottomHead and not ToolSearchParameters.bAllowTopHead then elseif ToolSearchParameters.bAllowBottomHead and not ToolSearchParameters.bAllowTopHead then
bIsToolCompatible = TOOLS[i].SetupInfo.bIsBottomHead bIsToolCompatible = TOOLS[i].SetupInfo.bIsBottomHead
else
bIsToolCompatible = true
end end
end end
@@ -344,16 +362,16 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
-- parametri obbligatori -- parametri obbligatori
if type( ToolSearchParameters.vtToolDirection) ~= 'table' then if type( ToolSearchParameters.vtToolDirection) ~= 'table' then
error( 'FindBlade : missing tool direction') error( 'FindChainSaw : missing tool direction')
end end
if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then
error( 'FindBlade : missing top head info') error( 'FindChainSaw : missing top head info')
end end
if type( ToolSearchParameters.bAllowBottomHead) ~= 'boolean' then if type( ToolSearchParameters.bAllowBottomHead) ~= 'boolean' then
error( 'FindBlade : missing bottom head info') error( 'FindChainSaw : missing bottom head info')
end end
if not ToolSearchParameters.bAllowTopHead and not ToolSearchParameters.bAllowBottomHead then if not ToolSearchParameters.bAllowTopHead and not ToolSearchParameters.bAllowBottomHead then
error( 'FindBlade : wrong head info') error( 'FindChainSaw : wrong head info')
end end
-- parametri opzionali -- parametri opzionali
@@ -391,7 +409,7 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
-- se entrambi completi -- se entrambi completi
if dBestToolResidualDepth <= 0 and dCurrentResidualDepth <= 0 then if dBestToolResidualDepth <= 0 and dCurrentResidualDepth <= 0 then
-- scelgo utensile con rapporto lunghezza / diametro minore -- scelgo utensile con rapporto lunghezza / diametro minore
if ( TOOLS[i].dLength / pow( TOOLS[i].dDiameter, 1.5)) < ( TOOLS[nBestToolIndex].dLength / pow( TOOLS[nBestToolIndex].dDiameter, 1.5)) then if TOOLS[i].dPerformanceIndex > TOOLS[nBestToolIndex].dPerformanceIndex then
nBestToolIndex = i nBestToolIndex = i
dBestToolResidualDepth = dCurrentResidualDepth dBestToolResidualDepth = dCurrentResidualDepth
end end
@@ -642,7 +660,7 @@ function MachiningLib.AddOperations( vProc, Part, sRotation)
-- TODO è giusto inserire queste info alla fine della lavorazione? oppure conviene creare un record in MACHININGS apposito per la disposizione? -- TODO è giusto inserire queste info alla fine della lavorazione? oppure conviene creare un record in MACHININGS apposito per la disposizione?
-- se era taglio di separazione, aggiungo nuova fase -- se era taglio di separazione, aggiungo nuova fase
if MACHININGS[i].AuxiliaryData.bAddNewPhase then if MACHININGS[i].AuxiliaryData.bIsSplitOrCut then
bSplitExecuted = true bSplitExecuted = true
BeamLib.AddPhaseWithRawParts( MACHININGS[i].Proc.idRaw, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET) BeamLib.AddPhaseWithRawParts( MACHININGS[i].Proc.idRaw, BeamData.ptOriXR, BeamData.dPosXR, BeamData.RAW_OFFSET)
-- se grezzo successivo senza pezzi e finale, va tolto -- se grezzo successivo senza pezzi e finale, va tolto
@@ -711,5 +729,221 @@ function MachiningLib.GetToolMRR( Parameters)
return dMRR / pow( 10, 6) return dMRR / pow( 10, 6)
end end
-------------------------------------------------------------------------------------------------------------
function MachiningLib.PrepareMachiningsForSorting( Part)
local nFeatureInternalIndex = 1
for i = 1, #MACHININGS do
local MachiningCurrent = MACHININGS[i].Machining
local ProcCurrent = MACHININGS[i].Proc
if not MachiningCurrent.ptCenter then
MachiningCurrent.ptCenter = Point3d( ProcCurrent.b3Box:getCenter():getX(), 0, 0)
end
-- conversione campo sStage in nStage, numerico e ordinabile
if not MachiningCurrent.sStage or MachiningCurrent.sStage == '' then
MachiningCurrent.sStage = 'Middle'
end
if MachiningCurrent.sStage == 'Head' then
MachiningCurrent.nStage = 1
elseif MachiningCurrent.sStage == 'Tail' then
MachiningCurrent.nStage = 3
elseif MachiningCurrent.sStage == 'AfterTail' then
MachiningCurrent.nStage = 4
else
MachiningCurrent.nStage = 2
end
if i > 1 then
local MachiningPrevious = MACHININGS[i - 1].Machining
local ProcPrevious = MACHININGS[i - 1].Proc
if ProcCurrent.id == ProcPrevious.id then
-- nStage devono essere sempre uguali o crescenti nella stessa feature
if MachiningCurrent.nStage < MachiningPrevious.nStage then
MachiningCurrent.nStage = MachiningPrevious.nStage
end
-- assegnazione indice interno alla feature
nFeatureInternalIndex = nFeatureInternalIndex + 1
else
nFeatureInternalIndex = 1
end
end
MachiningCurrent.nFeatureInternalIndex = nFeatureInternalIndex
-- se fase di lavoro standard, assegnazione dello spezzone
if MachiningCurrent.nStage == 2 then
local nParts = #Part.SplittingPoints + 1
local dPartMinX = Part.b3Part:getMin():getX()
local dPartMaxX = Part.b3Part:getMax():getX()
for j = 1, nParts do
local dNextSplitX = dPartMinX
local dPreviousSplitX = dPartMaxX
if j ~= 1 then
dPreviousSplitX = Part.SplittingPoints[j - 1]:getX()
end
if j ~= nParts then
dNextSplitX = Part.SplittingPoints[j]:getX()
end
if MachiningCurrent.ptCenter:getX() > dNextSplitX - 10 * GEO.EPS_SMALL and MachiningCurrent.ptCenter:getX() < dPreviousSplitX + 10 * GEO.EPS_SMALL then
MachiningCurrent.nPartSegment = j
end
end
else
MachiningCurrent.nPartSegment = -1
end
end
return MACHININGS
end
-- TODO convertire in tabella in cui si chiamano direttamente i nomi delle funzioni, in modo da poter cambiare l'ordine facilmente
-- TODO libreria Sorting??
-------------------------------------------------------------------------------------------------------------
local SortingComparisonRules = {
-- ordine interno alla feature
function( MachiningA, MachiningB)
if MachiningA.Proc.id == MachiningB.Proc.id then
if MachiningA.Machining.nFeatureInternalIndex < MachiningB.Machining.nFeatureInternalIndex then
return 1
elseif MachiningA.Machining.nFeatureInternalIndex > MachiningB.Machining.nFeatureInternalIndex then
return -1
end
end
return 0
end,
-- dipendenze solo spostamento stage 2->4
-- TODO da fare
-- stage
function( MachiningA, MachiningB)
if MachiningA.Machining.nStage < MachiningB.Machining.nStage then
return 1
elseif MachiningA.Machining.nStage > MachiningB.Machining.nStage then
return -1
else
return 0
end
end,
-- dipendenze
-- TODO da fare
-- segment
function ( MachiningA, MachiningB)
if MachiningA.Machining.nPartSegment < MachiningB.Machining.nPartSegment then
return 1
elseif MachiningA.Machining.nPartSegment > MachiningB.Machining.nPartSegment then
return -1
else
return 0
end
end,
-- testa
-- TODO da fare
-- famiglia utensile
function ( MachiningA, MachiningB)
-- TODO tirare fuori da qua??
local ToolFamilyOrder = {
SAWBLADE = 1,
DRILLBIT = 2,
MILL = 3,
MORTISE = 4
}
local nToolFamilyOrderA = ToolFamilyOrder[ TOOLS[ MachiningA.Machining.nToolIndex].sFamily]
local nToolFamilyOrderB = ToolFamilyOrder[ TOOLS[ MachiningB.Machining.nToolIndex].sFamily]
if nToolFamilyOrderA < nToolFamilyOrderB then
return 1
elseif nToolFamilyOrderA > nToolFamilyOrderB then
return -1
else
return 0
end
end,
-- performance utensile
function( MachiningA, MachiningB)
local dToolPerformanceIndexA = TOOLS[MachiningA.Machining.nToolIndex].dPerformanceIndex
local dToolPerformanceIndexB = TOOLS[MachiningB.Machining.nToolIndex].dPerformanceIndex
if dToolPerformanceIndexA > dToolPerformanceIndexB then
return 1
elseif dToolPerformanceIndexA < dToolPerformanceIndexB then
return -1
else
return 0
end
end,
-- probabilmente arrivati qui significa che gli utensili A e B sono gli stessi
-- se così non fosse e tutte le caratteristiche sopra sono uguali, ordine alfabetico
function( MachiningA, MachiningB)
local sToolNameA = TOOLS[MachiningA.Machining.nToolIndex].sName
local sToolNameB = TOOLS[MachiningB.Machining.nToolIndex].sName
if sToolNameA < sToolNameB then
return 1
elseif sToolNameA > sToolNameB then
return -1
else
return 0
end
end,
-- lato di lavoro
-- TODO questo, insieme all'ordinamento X, andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
function( MachiningA, MachiningB)
if MachiningA.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL and MachiningB.Machining.vtToolDirection:getY() >= 10 * GEO.EPS_SMALL then
return 1
elseif MachiningA.Machining.vtToolDirection:getY() >= 10 * GEO.EPS_SMALL and MachiningB.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL then
return -1
else
return 0
end
end,
-- ordinamento X
-- TODO questo andrà sostituito dallo shortest path pesato sulla quantità di rotazione della testa
function( MachiningA, MachiningB)
local bIsMachiningOnFront = MachiningA.Machining.vtToolDirection:getY() < 10 * GEO.EPS_SMALL
local nResult = 0
-- se lavorazione davanti ordine testa->coda
if bIsMachiningOnFront then
if MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
nResult = 1
elseif MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
nResult = -1
end
-- se lavorazione dietro ordine coda->testa
else
if MachiningA.Machining.ptCenter:getX() < MachiningB.Machining.ptCenter:getX() - 10 * GEO.EPS_SMALL then
nResult = 1
elseif MachiningA.Machining.ptCenter:getX() > MachiningB.Machining.ptCenter:getX() + 10 * GEO.EPS_SMALL then
nResult = -1
end
end
return nResult
end
}
-------------------------------------------------------------------------------------------------------------
function MachiningLib.CompareMachinings( MachiningA, MachiningB)
-- itera le SortingComparisonRules una per volta. Se non vi è alcuna scelta va avanti (result = 0), altrimenti ritorna true/false in base al risultato
for i = 1, #SortingComparisonRules do
local CompareFunction = SortingComparisonRules[i]
local result = CompareFunction( MachiningA, MachiningB)
if result ~= 0 then
return result > 0
end
end
return false
end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return MachiningLib return MachiningLib
+15 -17
View File
@@ -13,7 +13,7 @@ EgtEnableDebug( true)
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
-- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre -- Imposto direttorio strategie. N.B. Le strategie dovranno essere caricate con il nome del direttorio padre
EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\Standard\\?.lua') EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\Standard\\?.lua')
EgtAddToPackagePath( BEAM.BASEDIR .. '\\Strategies\\Core\\?.lua') EgtAddToPackagePath( BEAM.BASEDIR .. '\\StrategyLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi -- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir() local sMachDir = EgtGetCurrMachineDir()
@@ -43,7 +43,6 @@ _G.package.loaded.FeatureLib = nil
_G.package.loaded.FaceData = nil _G.package.loaded.FaceData = nil
_G.package.loaded.MachiningLib = nil _G.package.loaded.MachiningLib = nil
_G.package.loaded.DiceCut = nil _G.package.loaded.DiceCut = nil
_G.package.loaded.StrategyLib = nil
_G.package.loaded.Logs = nil _G.package.loaded.Logs = nil
-- strategie di base sempre presenti -- strategie di base sempre presenti
_G.package.loaded['HEADCUT\\HEADCUT'] = nil _G.package.loaded['HEADCUT\\HEADCUT'] = nil
@@ -66,7 +65,7 @@ for i = 1, 9999 do
_G.package.loaded[sLibraryConfigToReload] = nil _G.package.loaded[sLibraryConfigToReload] = nil
end end
end end
local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\Strategies\\Core\\*.lua') local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\StrategyLibs\\*.lua')
for i = 1, #vtCoreStrategiesNames do for i = 1, #vtCoreStrategiesNames do
local sCurrentName = EgtSplitString( vtCoreStrategiesNames[i], '.')[1] local sCurrentName = EgtSplitString( vtCoreStrategiesNames[i], '.')[1]
if _G.package.loaded[sCurrentName] then if _G.package.loaded[sCurrentName] then
@@ -75,14 +74,13 @@ for i = 1, #vtCoreStrategiesNames do
end end
local BeamExec = require( 'BeamExec')
-- Variabili globali -- Variabili globali
PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo PARTS = {} -- tabella contenente tutte le informazioni di ogni pezzo
PROCESSINGS = {} -- tabella contenente tutte le informazioni di ogni feature, processate per ogni rotazione
-- Carico i dati globali -- Carico i dati globali
local BeamData = require( 'BeamData') local BeamData = require( 'BeamData')
-- carico librerie
local BeamExec = require( 'BeamExec')
-- Variabili di modulo -- Variabili di modulo
local dRawW local dRawW
@@ -131,15 +129,15 @@ local function MyProcessInputData()
EgtOutBox( 'Box non definito per la trave ' .. PARTS[i].sName, 'Lavora Travi', 'ERROR') EgtOutBox( 'Box non definito per la trave ' .. PARTS[i].sName, 'Lavora Travi', 'ERROR')
return false return false
else else
PARTS[i].b3Box = b3Solid PARTS[i].b3PartOriginal = b3Solid
end end
end end
dRawW = PARTS[1].b3Box:getDimY() dRawW = PARTS[1].b3PartOriginal:getDimY()
dRawH = PARTS[1].b3Box:getDimZ() dRawH = PARTS[1].b3PartOriginal:getDimZ()
local vBeamErr = {} local vBeamErr = {}
for i = 2, #PARTS do for i = 2, #PARTS do
local dDimW = PARTS[i].b3Box:getDimY() local dDimW = PARTS[i].b3PartOriginal:getDimY()
local dDimH = PARTS[i].b3Box:getDimZ() local dDimH = PARTS[i].b3PartOriginal:getDimZ()
if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and if ( abs( dDimW - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL) and
( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then ( abs( dDimH - dRawW) > 10 * GEO.EPS_SMALL or abs( dDimW - dRawH) > 10 * GEO.EPS_SMALL) then
table.insert( vBeamErr, i) table.insert( vBeamErr, i)
@@ -186,9 +184,9 @@ local function MyProcessBeams()
-- Lunghezza totale delle travi -- Lunghezza totale delle travi
local dTotLen = 0 local dTotLen = 0
for i = 1, #PARTS - 1 do for i = 1, #PARTS - 1 do
dTotLen = dTotLen + PARTS[i].b3Box:getDimX() dTotLen = dTotLen + PARTS[i].b3PartOriginal:getDimX()
end end
dTotLen = dTotLen + max( PARTS[#PARTS].b3Box:getDimX(), BeamData.dMinRaw) dTotLen = dTotLen + max( PARTS[#PARTS].b3PartOriginal:getDimX(), BeamData.dMinRaw)
local dAddLen = BeamData.OVM_HEAD + ( #PARTS - 1) * BeamData.OVM_MID local dAddLen = BeamData.OVM_HEAD + ( #PARTS - 1) * BeamData.OVM_MID
EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BeamData.dMinRaw + BeamData.OVM_MID, 1), 1) EgtOutLog( 'Ltot : '..EgtNumToString( dTotLen, 1) .. ' Lagg : '..EgtNumToString( dAddLen, 1)..' MinUnloadRaw : '.. EgtNumToString( BeamData.dMinRaw + BeamData.OVM_MID, 1), 1)
@@ -277,10 +275,10 @@ local function MyProcessBeams()
local bOrd = ( vsVal[5] == 'true') local bOrd = ( vsVal[5] == 'true')
if bOrd then if bOrd then
table.sort( PARTS, function( B1, B2) table.sort( PARTS, function( B1, B2)
if abs( B1.b3Box:getDimX() - B2.b3Box:getDimX()) < 1 then if abs( B1.b3PartOriginal:getDimX() - B2.b3PartOriginal:getDimX()) < 1 then
return B1.nInd < B2.nInd return B1.nInd < B2.nInd
else else
return B1.b3Box:getDimX() < B2.b3Box:getDimX() return B1.b3PartOriginal:getDimX() < B2.b3PartOriginal:getDimX()
end end
end) end)
end end
@@ -308,8 +306,8 @@ end
-- *** Inserimento delle lavorazioni nelle travi *** -- *** Inserimento delle lavorazioni nelle travi ***
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
local function MyProcessFeatures() local function MyProcessFeatures()
local PROCESSINGS = BeamExec.GetProcessings( PROCESSINGS, PARTS) BeamExec.GetProcessings( PARTS)
local bOk, Stats = BeamExec.ProcessMachinings( PROCESSINGS, PARTS) local bOk, Stats = BeamExec.ProcessMachinings( PARTS)
local nErrCnt = 0 local nErrCnt = 0
local nWarnCnt = 0 local nWarnCnt = 0
local sOutput = '' local sOutput = ''
+15 -15
View File
@@ -45,14 +45,8 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
LeadOut.nType = MCH_MILL_LI.LINEAR LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0 LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0 LeadOut.dTangentDistance = 0
-- elevazione sempre in negativo LeadIn.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then LeadOut.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
LeadIn.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
LeadOut.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0 LeadIn.dElevation = 0
LeadOut.dElevation = 0 LeadOut.dElevation = 0
LeadIn.dCompLength = 0 LeadIn.dCompLength = 0
@@ -72,7 +66,7 @@ end
local function GetEdgeToMachine( Proc, vtEdge) local function GetEdgeToMachine( Proc, vtEdge)
local Edge local Edge
for i = 1, #Proc.Faces[1].Edges do for i = 1, #Proc.Faces[1].Edges do
if AreSameVectorApprox( Proc.Faces[1].Edges[i].Norm, vtEdge) then if AreSameVectorApprox( Proc.Faces[1].Edges[i].vtN, vtEdge) then
Edge = Proc.Faces[1].Edges[i] Edge = Proc.Faces[1].Edges[i]
end end
end end
@@ -278,7 +272,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX()) local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeSideDouble' then elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeSideDouble' then
@@ -294,7 +289,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX()) local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
-- Taglio lato dietro -- Taglio lato dietro
@@ -311,7 +307,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
EdgeToMachine = GetEdgeToMachine( Proc, Y_AX()) EdgeToMachine = GetEdgeToMachine( Proc, Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
@@ -326,7 +323,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX()) local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
@@ -343,7 +341,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX()) local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
-- Taglio lato dietro -- Taglio lato dietro
@@ -360,7 +359,8 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
EdgeToMachine = GetEdgeToMachine( Proc, -Z_AX()) EdgeToMachine = GetEdgeToMachine( Proc, -Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Splitting, EdgeToMachine)
Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
Splitting.sStage = 'Head'
MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData) MachiningLib.AddNewMachining( Proc, Splitting, AuxiliaryData)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawHorizontal' then elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
+31 -15
View File
@@ -1,16 +1,15 @@
-- Strategia: STR0002 -- Strategia: STR0002
-- Descrizione -- Descrizione
-- Svuotatura tasca -- Svuotatura tasca
-- Feature tipo LapJpint -- Feature tipo LapJoint
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
-- TODO -- TODO
-- 1 - Controllare lavorazioni in caso di feature lunga spezzata -- 1 - Inserire antischeggia (fresa o lama)
-- 2 - Inserire antischeggia (fresa o lama) -- 2 - Modalità svuotatura con fresa grande e spigoli con fresa piccola
-- 3 - Modalità svuotatura con fresa grande e spigoli con fresa piccola -- 3 - Smusso a V
-- 4 - Smusso a V -- 4 - Finitura con motosega (se la fresa non completa)
-- 5 - Finitura con motosega (se la fresa non completa)
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
@@ -360,29 +359,29 @@ local function GetSplitSurfaces( Proc, Part)
end end
-- recupero punti di spezzatura - da destra a sinistra -- recupero punti di spezzatura - da destra a sinistra
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part) local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
if #vFeatureSplittingPoints == 0 then if #FeatureSplittingPoints == 0 then
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
table.insert( vAddId, nAddId) table.insert( vAddId, nAddId)
table.insert( vAddIdTunnel, nAddIdTunnel) table.insert( vAddIdTunnel, nAddIdTunnel)
else else
for i = 1, #vFeatureSplittingPoints do for i = 1, #FeatureSplittingPoints do
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
if i == 1 then if i == 1 then
-- prima superficie, va tagliata solo a sinistra -- prima superficie, va tagliata solo a sinistra
local ptSplit = vFeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0) local ptSplit = FeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB)
else else
-- taglio della superficie corrente - lato sinistro -- taglio della superficie corrente - lato sinistro
local ptSplit = vFeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0) local ptSplit = FeatureSplittingPoints[i] + Vector3d( -BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddId, ptSplit, -X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, -X_AX(), true, GDB_RT.GLOB)
-- taglio della superficie corrente - lato destro -- taglio della superficie corrente - lato destro
ptSplit = vFeatureSplittingPoints[i - 1] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0) ptSplit = FeatureSplittingPoints[i - 1] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB)
end end
@@ -392,7 +391,7 @@ local function GetSplitSurfaces( Proc, Part)
-- taglio ultima superficie, va tagliata solo a destra -- taglio ultima superficie, va tagliata solo a destra
local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL local nAddId = EgtCopyGlob( Proc.id, nAddGrpId) or GDB_ID.NULL
local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL local nAddIdTunnel = EgtCopyGlob( nOriginalTmIdTunnel, nAddGrpId) or GDB_ID.NULL
local ptSplit = vFeatureSplittingPoints[#vFeatureSplittingPoints] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0) local ptSplit = FeatureSplittingPoints[#FeatureSplittingPoints] + Vector3d( BeamData.MILL_OVERLAP / 2, 0, 0)
EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddId, ptSplit, X_AX(), true, GDB_RT.GLOB)
EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB) EgtCutSurfTmPlane( nAddIdTunnel, ptSplit, X_AX(), true, GDB_RT.GLOB)
table.insert( vAddId, nAddId) table.insert( vAddId, nAddId)
@@ -460,13 +459,30 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
-- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima -- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima
if #vAddId == 1 then if #vAddId == 1 then
Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}} Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}}
Pocketing.vtToolDirection = Proc.Faces[ Strategy.Machining[j].idFaceToMachine + 1].vtN
if Pocketing.bToolInvert then
Pocketing.vtToolDirection = -Pocketing.vtToolDirection
end
-- TODO controllare parametro danneggiamento ammesso per decidere se spostare dopo taglio seprazione
-- se è aperta sulla coda, dico che deve essere fatta dopo la separazione
if Proc.AffectedFaces.bLeft then
Pocketing.sStage = 'AfterTail'
end
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Pocketing) bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Pocketing)
else else
-- TODO settare parametro per indicare qual è lo spezzone che deve essere fatto dopo il taglio di separazione -- TODO controllare parametro danneggiamento ammesso per decidere se spostare dopo taglio seprazione
-- se è aperta sulla coda, dico che deve essere fatta dopo la separazione
if Proc.AffectedFaces.bLeft and i == #vAddId then
Pocketing.sStage = 'AfterTail'
end
for k = 1, Proc.nFct do for k = 1, Proc.nFct do
local vtNSplitFace local vtNSplitFace
local nIdTm = EgtIf( Strategy.Machining[j].bMachAppliedToTunnelFace, vAddIdTunnel[i], vAddId[i]) local nIdTm = EgtIf( Strategy.Machining[j].bMachAppliedToTunnelFace, vAddIdTunnel[i], vAddId[i])
vtNSplitFace = EgtSurfTmFacetNormVersor( nIdTm, k - 1, GDB_ID.ROOT) Pocketing.ptCenter, vtNSplitFace = EgtSurfTmFacetCenter( nIdTm, k - 1, GDB_ID.ROOT)
Pocketing.vtToolDirection = vtNSplitFace
if Pocketing.bToolInvert then
Pocketing.vtToolDirection = -Pocketing.vtToolDirection
end
if vtNSplitFace and AreSameVectorApprox( vtNSplitFace * EgtIf( Pocketing.bToolInvert, -1, 1), Strategy.Machining[j].vtFaceNormal) then if vtNSplitFace and AreSameVectorApprox( vtNSplitFace * EgtIf( Pocketing.bToolInvert, -1, 1), Strategy.Machining[j].vtFaceNormal) then
Pocketing.Geometry = {{ nIdTm, k - 1}} Pocketing.Geometry = {{ nIdTm, k - 1}}
bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddNewMachining( Proc, Pocketing) bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddNewMachining( Proc, Pocketing)
+64 -36
View File
@@ -3,6 +3,16 @@
-- Lama + motosega per slot -- Lama + motosega per slot
-- Feature: tipo lapjoint -- Feature: tipo lapjoint
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- TODO
-- 1 - Gestire lavorazioni da sotto
-- 2 - Inserire antischeggia (fresa o lama)
-- 3 - Smusso a V
-- 4 - Implementare lavorazione di geometrie inclinate
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- carico librerie -- carico librerie
local BeamLib = require( 'BeamLib') local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData') local BeamData = require( 'BeamData')
@@ -62,9 +72,9 @@ end
-- TODO si può unificare con eguale funzione in STR0004 -- TODO si può unificare con eguale funzione in STR0004
local function SortMachiningsBySegment( MachiningA, MachiningB) local function SortMachiningsBySegment( MachiningA, MachiningB)
if MachiningA.nSegment > MachiningB.nSegment then if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false return false
elseif MachiningB.nSegment > MachiningA.nSegment then elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true return true
else else
if TOOLS[ MachiningA.nToolIndex].sFamily == 'SAWBLADE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'MORTISE' then if TOOLS[ MachiningA.nToolIndex].sFamily == 'SAWBLADE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'MORTISE' then
@@ -88,9 +98,9 @@ local function SortMachiningsByTool( MachiningA, MachiningB)
elseif TOOLS[ MachiningA.nToolIndex].sFamily == 'MORTISE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'SAWBLADE' then elseif TOOLS[ MachiningA.nToolIndex].sFamily == 'MORTISE' and TOOLS[ MachiningB.nToolIndex].sFamily == 'SAWBLADE' then
return false return false
else else
if MachiningA.nSegment > MachiningB.nSegment then if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false return false
elseif MachiningB.nSegment > MachiningA.nSegment then elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true return true
else else
if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then
@@ -233,7 +243,6 @@ end
function STR0003.Make( bAddMachining, Proc, Part, CustomParameters) function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- TODO da implementare gestione feature lunghe e spezzatura
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) -- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
local StrategyLib = {} local StrategyLib = {}
StrategyLib.Config = require( 'STR0003\\STR0003Config') StrategyLib.Config = require( 'STR0003\\STR0003Config')
@@ -268,10 +277,26 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
dExtendAfterTail = 10000 dExtendAfterTail = 10000
end end
-- eventuali punti di spezzatura
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
local bIsSplitFeature = false
if #FeatureSplittingPoints > 0 then
bIsSplitFeature = true
end
-- altezza tasca
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
end
-- lama - calcolo lavorazioni -- lama - calcolo lavorazioni
local Cutting = {} local Cutting = {}
local OptionalParameters = { bForceLongcutBlade = Strategy.Parameters.bForceLongcutBlade, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bForceLongcutBlade = Strategy.Parameters.bForceLongcutBlade, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
if Proc.Topology.sFamily == 'Tunnel' then if Proc.Topology.sFamily == 'Tunnel' then
OptionalParameters.bOppositeToolDirection = true
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
else else
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
@@ -279,6 +304,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
Blade.AddResult( Cutting) Blade.AddResult( Cutting)
-- lato opposto del tunnel -- lato opposto del tunnel
if Proc.Topology.sFamily == 'Tunnel' then if Proc.Topology.sFamily == 'Tunnel' then
OptionalParameters.bOppositeToolDirection = true
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters) Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
Blade.AddResult( Cutting) Blade.AddResult( Cutting)
else else
@@ -286,11 +312,13 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione -- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
OptionalParameters.bOppositeToolDirection = true
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Blade.AddResult( Cutting) Blade.AddResult( Cutting)
end end
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione -- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
OptionalParameters.bOppositeToolDirection = true
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
Blade.AddResult( Cutting) Blade.AddResult( Cutting)
end end
@@ -303,11 +331,11 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- lama - lavorazioni raggruppate in unica lista -- lama - lavorazioni raggruppate in unica lista
Blade.Result.Sorted = MergeResults( Blade.Result) Blade.Result.Sorted = MergeResults( Blade.Result)
-- lama - aggiunta eventuali lavorazioni splittate -- lama - aggiunta eventuali lavorazioni splittate
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part) if bIsSplitFeature then
if #vFeatureSplittingPoints > 0 then Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, FeatureSplittingPoints, Part)
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, vFeatureSplittingPoints, Part)
end end
-- lama - nessuna lavorazione successiva - aggiunta lavorazioni e calcolo risultati -- lama - nessuna lavorazione successiva - aggiunta lavorazioni e calcolo risultati
-- TODO bisogna uscire se la lama non può fare alcuna lavorazione; non ha senso che STR0003 lama+catena sia scelta se la lama non può lavorare, in quel caso deve essere scelta la STR0004 solo catena
if not Strategy.Parameters.bFinishWithChainSaw then if not Strategy.Parameters.bFinishWithChainSaw then
-- ordinamento -- ordinamento
if Strategy.Parameters.bSortBySegment then if Strategy.Parameters.bSortBySegment then
@@ -354,18 +382,18 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.dLength > 3 * Blade.Result.Bottom[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.dLength > 3 * Blade.Result.Bottom[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
-- si lavora tutto il fondo -- si lavora tutto il fondo
else else
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
@@ -374,10 +402,10 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- si lavora solamente l'impronta lama sul fondo -- si lavora solamente l'impronta lama sul fondo
if ( #Blade.Result.Side > 0) and Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL then if ( #Blade.Result.Side > 0) and Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL then
if ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then if ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
elseif ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then elseif ( Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
end end
-- si lavora tutto il lato -- si lavora tutto il lato
@@ -389,10 +417,10 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
dBladeResidualDepth = Blade.Result.Bottom[1].dResidualDepth dBladeResidualDepth = Blade.Result.Bottom[1].dResidualDepth
end end
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
end end
end end
@@ -401,7 +429,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
elseif Proc.Topology.sName == 'Groove-3-Through' then elseif Proc.Topology.sName == 'Groove-3-Through' then
if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
-- si lavora tutto il fondo -- si lavora tutto il fondo
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- ancora materiale residuo - si lavorano i lati -- ancora materiale residuo - si lavorano i lati
@@ -410,16 +438,16 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if ( Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and if ( Blade.Result.Side[1].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength > 3 * Blade.Result.Side[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
( Blade.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result.Side[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then ( Blade.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2].dLength > 3 * Blade.Result.Side[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- ancora materiale residuo - si lavora da entrambi i lati -- ancora materiale residuo - si lavora da entrambi i lati
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo -- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo
@@ -429,17 +457,17 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
end end
-- si lavora tutto il lato -- si lavora tutto il lato
else else
local OptionalParameters = { dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- ancora materiale residuo - si lavora da entrambi i lati -- ancora materiale residuo - si lavora da entrambi i lati
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
Chainsaw.Result.Side[1].bIsApplicable = false Chainsaw.Result.Side[1].bIsApplicable = false
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo -- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
@@ -455,44 +483,44 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if ( Blade.Result.Opposite[1].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1].dLength > 3 * Blade.Result.Opposite[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and if ( Blade.Result.Opposite[1].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1].dLength > 3 * Blade.Result.Opposite[1].dBladeMarkLength - 10 * GEO.EPS_SMALL) and
( Blade.Result.Opposite[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2].dLength > 3 * Blade.Result.Opposite[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then ( Blade.Result.Opposite[2].dResidualDepth < 10 * GEO.EPS_SMALL and Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2].dLength > 3 * Blade.Result.Opposite[2].dBladeMarkLength - 10 * GEO.EPS_SMALL) then
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL or Chainsaw.Result.Opposite[2].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL or Chainsaw.Result.Opposite[2].dResidualDepth > 10 * GEO.EPS_SMALL then
Chainsaw.Result.Opposite[1].bIsApplicable = false Chainsaw.Result.Opposite[1].bIsApplicable = false
Chainsaw.Result.Opposite[2].bIsApplicable = false Chainsaw.Result.Opposite[2].bIsApplicable = false
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
else else
local OptionalParameters = { dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then
Chainsaw.Result.Opposite[1].bIsApplicable = false Chainsaw.Result.Opposite[1].bIsApplicable = false
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
end end
@@ -500,8 +528,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
-- sega a catena - lavorazioni raggruppate in unica lista -- sega a catena - lavorazioni raggruppate in unica lista
Chainsaw.Result.Sorted = MergeResults( Chainsaw.Result) Chainsaw.Result.Sorted = MergeResults( Chainsaw.Result)
-- sega a catena - aggiunta eventuali lavorazioni splittate -- sega a catena - aggiunta eventuali lavorazioni splittate
if #vFeatureSplittingPoints > 0 then if bIsSplitFeature then
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, vFeatureSplittingPoints, Part) Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
end end
-- tutte le lavorazioni di tutti gli utensili in unica lista -- tutte le lavorazioni di tutti gli utensili in unica lista
+41 -17
View File
@@ -3,6 +3,16 @@
-- motosega per slot -- motosega per slot
-- Feature: tipo lapjoint -- Feature: tipo lapjoint
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- TODO
-- 1 - Inserire antischeggia (fresa o lama)
-- 2 - Smusso a V
-- 3 - Implementare lavorazione di geometrie inclinate
-- 4 - Gestire lavorazioni da sotto (ove possibile, in generale la motosega non lavora da sotto)
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
-- carico librerie -- carico librerie
local BeamLib = require( 'BeamLib') local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData') local BeamData = require( 'BeamData')
@@ -57,10 +67,11 @@ local function GetCompletionPercentage( Proc, Result)
end end
-- TODO si può unificare con Sorting generale
local function SortMachiningsBySegment( MachiningA, MachiningB) local function SortMachiningsBySegment( MachiningA, MachiningB)
if MachiningA.nSegment > MachiningB.nSegment then if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false return false
elseif MachiningB.nSegment > MachiningA.nSegment then elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true return true
else else
if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then if MachiningA.sEdgeType == 'Side' and MachiningB.sEdgeType ~= 'Side' then
@@ -121,7 +132,6 @@ end
function STR0004.Make( bAddMachining, Proc, Part, CustomParameters) function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
-- TODO da implementare gestione feature lunghe e spezzatura
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti) -- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
local StrategyLib = {} local StrategyLib = {}
StrategyLib.Config = require( 'STR0004\\STR0004Config') StrategyLib.Config = require( 'STR0004\\STR0004Config')
@@ -149,48 +159,63 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
return false, Strategy.Result return false, Strategy.Result
end end
-- calcolo estensione oltre la coda
local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0) local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0)
if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then
dExtendAfterTail = 10000 dExtendAfterTail = 10000
end end
-- eventuali punti di spezzatura
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
local bIsSplitFeature = false
if #FeatureSplittingPoints > 0 then
bIsSplitFeature = true
end
-- altezza tasca
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
end
-- calcolo lavorazioni -- calcolo lavorazioni
local Mortising = {} local Mortising = {}
OptionalParameters = { dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
if Proc.Topology.sName == 'Groove-4-Blind' or Proc.Topology.sName == 'Pocket-5-Blind' then if Proc.Topology.sName == 'Groove-4-Blind' or Proc.Topology.sName == 'Pocket-5-Blind' then
-- si lavora tutto il fondo -- si lavora tutto il fondo
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- materiale residuo - se possibile si lavora dal lato -- materiale residuo - se possibile si lavora dal lato
if ( Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].dResidualDepth > 10 * GEO.EPS_SMALL or not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) and #Proc.MainFaces.SideFaces == 1 then if ( Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].dResidualDepth > 10 * GEO.EPS_SMALL or not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) and #Proc.MainFaces.SideFaces == 1 then
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail} OptionalParameters.bOppositeToolDirection = true
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail} OptionalParameters.bOppositeToolDirection = true
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
end end
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
elseif Proc.Topology.sName == 'Groove-3-Through' then elseif Proc.Topology.sName == 'Groove-3-Through' then
-- si lavora tutto il fondo -- si lavora tutto il fondo
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- materiale residuo - si lavorano i lati -- materiale residuo - si lavorano i lati
if ( Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL or not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) then if ( Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL or not Chainsaw.Result.Bottom[#Chainsaw.Result.Bottom].bIsApplicable) then
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- ancora materiale residuo - si lavora da entrambi i lati -- ancora materiale residuo - si lavora da entrambi i lati
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
Chainsaw.Result.Side[1].bIsApplicable = false Chainsaw.Result.Side[1].bIsApplicable = false
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo -- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
@@ -200,16 +225,16 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
end end
end end
elseif Proc.Topology.sName == 'Tunnel-4-Through' then elseif Proc.Topology.sName == 'Tunnel-4-Through' then
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then
Chainsaw.Result.Opposite[1].bIsApplicable = false Chainsaw.Result.Opposite[1].bIsApplicable = false
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail} local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters) SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
OptionalParameters = {} OptionalParameters = {}
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail} OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters) SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
Chainsaw.AddResult( Mortising) Chainsaw.AddResult( Mortising)
end end
@@ -234,9 +259,8 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
end end
-- aggiunta eventuali lavorazioni splittate -- aggiunta eventuali lavorazioni splittate
local vFeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part) if bIsSplitFeature then
if #vFeatureSplittingPoints > 0 then Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, vFeatureSplittingPoints, Part)
end end
-- ordinamento -- ordinamento
+241
View File
@@ -0,0 +1,241 @@
-- Strategia: STR0005
-- Descrizione
-- lama per taglio facce con cubetti se necessario
-- Feature: tagli singoli con eventuali cubetti
-- carico librerie
local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
local FeatureLib = require( 'FeatureLib')
-- strategie di base
local BladeToWaste = require( 'BLADETOWASTE')
local SlotByBlade = require( 'SLOTBYBLADE')
-- Tabella per definizione modulo
local STR0005 = {}
local Strategy = {}
local Blade = {}
Blade.Result = {}
-------------------------------------------------------------------------------------------------------------
local function CompareEdges( EdgeA, EdgeB)
-- prima i lati orientati lungo X
if abs( EdgeA.vtN:getX()) < abs( EdgeB.vtN:getX()) - 10 * GEO.EPS_SMALL then
return true
elseif abs( EdgeA.vtN:getX()) > abs( EdgeB.vtN:getX()) + 10 * GEO.EPS_SMALL then
return false
-- se stessa X si preferiscono i lati più in basso
else
if EdgeA.vtN:getZ() > EdgeB.vtN:getZ() + 10 * GEO.EPS_SMALL then
return true
elseif EdgeA.vtN:getZ() < EdgeB.vtN:getZ() - 10 * GEO.EPS_SMALL then
return false
-- se stessa Z si preferiscono i lati verso il fronte della trave
else
if EdgeA.vtN:getY() > EdgeB.vtN:getY() + 10 * GEO.EPS_SMALL then
return true
elseif EdgeA.vtN:getY() < EdgeB.vtN:getY() - 10 * GEO.EPS_SMALL then
return false
else
return false
end
end
end
end
local function SortMachiningsBySegment( MachiningA, MachiningB)
if MachiningA.nFeatureSegment > MachiningB.nFeatureSegment then
return false
elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
return true
-- se segmento uguale, si minimizzano i cambi di lato
else
local bIsOddSegment = ( MachiningA.nFeatureSegment % 2 ~= 0)
if MachiningA.vtToolDirection:getY() < MachiningB.vtToolDirection:getY() - 10 * GEO.EPS_SMALL then
if bIsOddSegment then
return true
else
return false
end
elseif MachiningA.vtToolDirection:getY() > MachiningB.vtToolDirection:getY() + 10 * GEO.EPS_SMALL then
if bIsOddSegment then
return false
else
return true
end
else
return false
end
end
end
function Blade.AddResult( Cutting)
table.insert( Blade.Result, Cutting)
return Blade.Result
end
function Blade.AddMachiningAllSteps( Proc, Cutting, AuxiliaryData)
local bMachiningAdded = false
if not AuxiliaryData then
AuxiliaryData = {}
end
AuxiliaryData.Clones = {}
local dOriginalRadialOffset = Cutting.dRadialOffset
local dOriginalLeadInPerpDistance = Cutting.LeadIn.dPerpDistance
local dOriginalLeadOutPerpDistance = Cutting.LeadOut.dPerpDistance
for i = 1, Cutting.HorizontalSteps.nCount do
AuxiliaryData.Clones[i] = {}
AuxiliaryData.Clones[i].LeadIn = {}
AuxiliaryData.Clones[i].LeadOut = {}
AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.dStep * ( Cutting.HorizontalSteps.nCount - i)
-- update distanza perpendicolare attacco per contemplare l'offset applicato
AuxiliaryData.Clones[i].LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - Cutting.dRadialOffset
AuxiliaryData.Clones[i].LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - Cutting.dRadialOffset
end
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Cutting, AuxiliaryData)
return bMachiningAdded
end
function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
-- carico parametri da default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
local StrategyLib = {}
StrategyLib.Config = require( 'STR0005\\STR0005Config')
Strategy.sName = StrategyLib.Config.sStrategyId
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
Strategy.Result = {}
Strategy.Result.sInfo = ''
Blade.Result = {}
local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0)
if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then
dExtendAfterTail = 10000
end
local dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail = FeatureLib.GetFeatureMaxNotClampableLengths( Proc, Part)
local bLeaveWasteAttached = Strategy.Parameters.sCuttingStrategy == 'LEAVE_WASTE_ATTACHED'
local bFeatureHindersClamping = FeatureLib.IsMachiningLong( max( dFeatureMaxNotClampableLengthHead, dFeatureMaxNotClampableLengthTail), Part, { dMaxSegmentLength = BeamData.LONGCUT_ENDLEN})
local Cutting = {}
local MRRParametersBlade = {}
if bFeatureHindersClamping or bLeaveWasteAttached then
-- TODO Lavorazione con codolo
-- attenzione perchè se l'inclinazione della faccia la fa finire oltre lo spigolo questo riduce il massimo calcolare (come calcolare????)
-- il FindBlade dovrà restituire di utilizzare sempre la lama sopra se l'angolo lo permette, ma avendo un'altezza massima (da macchina) oltre cui il DownUp non sarà fattibile (evita collisioni tra asse e pezzo)
-- si trovano i lati da lavorare
local EdgesSorted = {}
for i = 1, #Proc.Faces[1].Edges do
table.insert( EdgesSorted, Proc.Faces[1].Edges[i])
end
table.sort( EdgesSorted, CompareEdges)
local dDepthToMachine = EdgesSorted[1].dElevation / 2 - Strategy.Parameters.dStripWidth / 2
-- ricerca utensile
local ToolSearchParameters = {}
ToolSearchParameters.dElevation = dDepthToMachine
ToolSearchParameters.vtToolDirection = EdgesSorted[1].vtN
ToolSearchParameters.bAllowTopHead = true
ToolSearchParameters.bAllowBottomHead = true
ToolSearchParameters.bForceLongcutBlade = Strategy.Parameters.bForceLongcutBlade
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
Cutting.nToolIndex = ToolInfo.nToolIndex
Cutting.nType = MCH_OY.MILLING
if not TOOLS[Cutting.nToolIndex].sName then
Cutting.sMessage = 'Blade not found'
Cutting.bIsApplicable = false
EgtOutLog( Cutting.sMessage)
return Cutting, EdgesSorted[1].dElevation
end
-- parametri per il calcolo della velocità di asportazione
MRRParametersBlade = {
dStep = min( TOOLS[Cutting.nToolIndex].dStep, EdgesSorted[1].dElevation),
dSideStep = TOOLS[Cutting.nToolIndex].dThickness,
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed
}
-- eventuali punti di spezzatura
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
local bIsSplitFeature = false
if #FeatureSplittingPoints > 0 then
bIsSplitFeature = true
end
-- primo lato
local OptionalParameters = { dDepthToMachine = dDepthToMachine, nToolIndex = Cutting.nToolIndex, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail}
Cutting = SlotByBlade.Make( Proc, Part, Proc.Faces[1], EdgesSorted[1], OptionalParameters)
Blade.AddResult( Cutting)
-- secondo lato
Cutting = SlotByBlade.Make( Proc, Part, Proc.Faces[1], EdgesSorted[2], OptionalParameters)
Blade.AddResult( Cutting)
-- lavorazioni raggruppate in unica lista
Blade.Result.Sorted = {}
for i = 1, #Blade.Result do
if Blade.Result[i].bIsApplicable then
table.insert( Blade.Result.Sorted, Blade.Result[i])
end
end
-- aggiunta eventuali lavorazioni splittate
if bIsSplitFeature then
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, FeatureSplittingPoints, Part)
end
table.sort( Blade.Result.Sorted, SortMachiningsBySegment)
-- se la lavorazione con codolo fallisce o non è possibile si proseguirà a quella con cubetti
end
if #Blade.Result == 0 and not bLeaveWasteAttached then
-- BladeToWaste
end
-- aggiunta lavorazioni
local nIsApplicableCount = 0
local dFinalCompletionPercentage = 100
local bAreAllMachiningsAdded = true
for i = 1, #Blade.Result.Sorted do
if Blade.Result.Sorted[i].bIsApplicable then
nIsApplicableCount = nIsApplicableCount + 1
if bAddMachining then
local bIsMachiningAdded = Blade.AddMachiningAllSteps( Proc, Blade.Result.Sorted[i])
if not bIsMachiningAdded then
bAreAllMachiningsAdded = false
end
end
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Blade.Result.Sorted[i].sMessage
end
end
if nIsApplicableCount > 0 then
if Cutting.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
Strategy.Result.sStatus = 'Completed'
else
Strategy.Result.sStatus = 'Not-Completed'
-- TODO al momento si assume che la percentuale di completamento dell'ultima lavorazione sia quella rilevante
dFinalCompletionPercentage = Cutting.dCompletionPercentage
end
else
Strategy.Result.sStatus = 'Not-Applicable'
end
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( dFinalCompletionPercentage)
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Blade')
local dMRRBlade = MachiningLib.GetToolMRR( MRRParametersBlade)
Strategy.Result.dMRR = dMRRBlade
return bAreAllMachiningsAdded, Strategy.Result
end
-------------------------------------------------------------------------------------------------------------
return STR0005
@@ -0,0 +1,24 @@
-- Parametri configurabili da cliente per strategia: STR0004
-- TODO - sostituire dMaxWasteVolume con dMaxWasteWeight? Dove prendere la densità del materiale?
local STR0005Data = {
sStrategyId = 'STR0005',
Parameters = {
{ sName = 'bForceLongcutBlade', sNameNge = 'USE_LONGCUT_BLADE', sValue = 'false', sDescriptionShort = 'Force ripping blade', sDescriptionLong = 'Force the use of ripping blade, designed for cuts parallel to the grain', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dExtendAfterTail', sNameNge = 'EXTEND_AFTER_TAIL', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'sCanDamageNextPiece', sNameNge = 'DAMAGE_NEXT_PIECE', sValue = 'NEVER', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'NEVER', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ONLY_IF_RAWPART', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'ALWAYS', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
{ sName = 'sCuttingStrategy', sNameNge = 'CUTTING_STRATEGY', sValue = 'AUTO', sType = 'combo', sMinUserLevel = '1',
Choices = { sValue = 'AUTO', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'DROP_WHOLE_WASTE', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'LEAVE_WASTE_ATTACHED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}},
{ sName = 'dMaxWasteLength', sNameNge = 'MAX_WASTE_LENGTH', sValue = '300', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dMaxWasteVolume', sNameNge = 'MAX_WASTE_VOLUME', sValue = '6000000', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
{ sName = 'dStripWidth', sNameNge = 'STRIP_WIDTH', sValue = '5', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
}
}
return STR0005Data
+10 -7
View File
@@ -7,7 +7,7 @@
local BeamLib = require( 'BeamLib') local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData') local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib') local MachiningLib = require( 'MachiningLib')
local StrategyLib = require( 'StrategyLib') local SPLITCUT = require( 'SPLITCUT')
local DiceCut = require( 'DiceCut') local DiceCut = require( 'DiceCut')
-- Tabella per definizione modulo -- Tabella per definizione modulo
@@ -38,13 +38,13 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo -- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
if Strategy.bSplit then if Strategy.bSplit then
Strategy.SplitStrategy, Strategy.Result = StrategyLib.SplitStrategy.Get( Proc, Part, Strategy.Parameters) Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetStrategy( Proc, Part, Strategy.Parameters)
-- se devo rimuovere tutto il restante -- se devo rimuovere tutto il restante
else else
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT) -- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
if Strategy.Parameters.bExecutePreCut then if Strategy.Parameters.bExecutePreCut then
Strategy.SplitStrategy, Strategy.Result = StrategyLib.SplitStrategy.Get( Proc, Part, Strategy.Parameters) Strategy.SplitStrategy, Strategy.Result = SPLITCUT.GetStrategy( Proc, Part, Strategy.Parameters)
-- se non faccio tagli PRECUT, imposto tabella Result direttamente. Non serve verificare che riesca a rimuovere il materiale extra -- se non faccio tagli PRECUT, imposto tabella Result direttamente. Non serve verificare che riesca a rimuovere il materiale extra
else else
Strategy.Result.sStatus = 'Completed' Strategy.Result.sStatus = 'Completed'
@@ -67,16 +67,18 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo -- se devo fare split perchè c'è un grezzo da scaricare o un altro pezzo
if Strategy.bSplit then if Strategy.bSplit then
Strategy.dOffset = 0 Strategy.dOffset = 0
MachiningsToAdd = StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy) MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
-- se devo rimuovere tutto il restante -- se devo rimuovere tutto il restante
else else
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT) -- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
if Strategy.Parameters.bExecutePreCut then if Strategy.Parameters.bExecutePreCut then
Strategy.dOffset = Part.dRestLength Strategy.dOffset = Part.dRestLength
MachiningsToAdd = StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy) MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
end end
-- rimuovo tutto il restante
-- table.insert( MachiningsToAdd, StrategyLib.BladeToWasteOneFace( Proc, Part)) -- TODO: funzione che calcola tagli data una faccia
-- BladeToWaste( Proc, Part)
local Faces = {} local Faces = {}
local Face1 = {} local Face1 = {}
local Face2 = {} local Face2 = {}
@@ -89,6 +91,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
-- aggiungo lavorazioni trovate alla lista generale -- aggiungo lavorazioni trovate alla lista generale
for i = 1, #MachiningsToAdd do for i = 1, #MachiningsToAdd do
MachiningsToAdd[i].Splitting.sStage = 'Tail'
MachiningLib.AddNewMachining( Proc, MachiningsToAdd[i].Splitting, MachiningsToAdd[i].AuxiliaryData) MachiningLib.AddNewMachining( Proc, MachiningsToAdd[i].Splitting, MachiningsToAdd[i].AuxiliaryData)
end end
+3 -1
View File
@@ -3,11 +3,13 @@
STR0001 = Tenone a coda di rondine. Lama + fresa a coda di rondine STR0001 = Tenone a coda di rondine. Lama + fresa a coda di rondine
STR0002 = Topologia tipo LapJoint. Svuotatura con fresa STR0002 = Topologia tipo LapJoint. Svuotatura con fresa
STR0003 = Topologia tipo LapJoint. Lama + motosega STR0003 = Topologia tipo LapJoint. Lama + motosega
STR0004 = Topologia tipo LapJoint. Motosega
STR0005 = Faccia singola o doppia. Lama, se necessario cubetti.
[Strategies] [Strategies]
; Processing , Gruppo , Topologia , Strategie ; Processing , Gruppo , Topologia , Strategie
;Feature : Cut ;Feature : Cut
10,1,Feature, 10,1,Feature,STR0005
;Feature : Longitudinal Cut ;Feature : Longitudinal Cut
10,0,Feature, 10,0,Feature,
;Feature : Double Cut ;Feature : Double Cut
+26
View File
@@ -0,0 +1,26 @@
-- BLADETOWASTE.lua by Egalware s.r.l. 2025/01/08
-- Libreria di supporto a strategie con funzioni comune a strategie diverse.
-- Tabella per definizione modulo
local BLADETOWASTE = {}
-- Include
require( 'EgtBase')
-- Carico i dati globali
local BeamData = require( 'BeamData')
local FeatureLib = require( 'FeatureLib')
local MachiningLib = require( 'MachiningLib')
-- strategie di base
local FaceByBlade = require('FACEBYBLADE')
EgtOutLog( ' BLADETOWASTE started', 1)
-- if dFeatureVolume < StrategyParameters.dMaxWasteVolume + 10 * GEO.EPS_SMALL
-- and dFeatureMaxDimension < StrategyParameters.dMaxWasteLength + 10 * GEO.EPS_SMALL then
-- end
@@ -23,13 +23,8 @@ local function CalculateLeadInOut( EdgeToMachine)
LeadIn.dTangentDistance = 0 LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0 LeadOut.dTangentDistance = 0
-- elevazione sempre in negativo -- elevazione sempre in negativo
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then LeadIn.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
LeadIn.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev LeadOut.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
LeadOut.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0 LeadIn.dElevation = 0
LeadOut.dElevation = 0 LeadOut.dElevation = 0
LeadIn.dCompLength = 0 LeadIn.dCompLength = 0
@@ -67,17 +62,19 @@ end
function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters) function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
local Cutting = {} local Cutting = {}
local vtMachiningDirection = EdgeToMachine.Norm local vtMachiningDirection = EdgeToMachine.vtN
local vtN = Proc.Faces[FaceToMachine+1].vtN local vtN = Proc.Faces[FaceToMachine.id+1].vtN
Cutting.sDepth = OptionalParameters.sDepth or 0 Cutting.sDepth = OptionalParameters.sDepth or 0
Cutting.dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0 Cutting.dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0
Cutting.dRadialOffset = OptionalParameters.dRadialOffset or 0 Cutting.dRadialOffset = OptionalParameters.dRadialOffset or 0
Cutting.nType = MCH_MY.MILLING Cutting.nType = MCH_MY.MILLING
Cutting.nToolIndex = OptionalParameters.nToolIndex Cutting.nToolIndex = OptionalParameters.nToolIndex
Cutting.Geometry = {{ Proc.id, FaceToMachine}} Cutting.Geometry = {{ Proc.id, FaceToMachine.id}}
Cutting.id = Proc.id Cutting.id = Proc.id
Cutting.vtToolDirection = vtMachiningDirection
-- TODO se l'utensile non arriva dai parametri opzionali va cercato!!
-- ===== calcolo LeadIn/out ===== -- ===== calcolo LeadIn/out =====
if OptionalParameters.LeadIn and OptionalParameters.LeadOut then if OptionalParameters.LeadIn and OptionalParameters.LeadOut then
@@ -31,7 +31,7 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
LeadOut.nType = MCH_MILL_LI.LINEAR LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0 LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0 LeadOut.dTangentDistance = 0
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then if AreSameVectorApprox( Machining.vtToolDirection, EdgeToMachine.vtN) then
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
else else
@@ -90,10 +90,10 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.dDepthToMachine = 0 Cutting.dDepthToMachine = 0
Cutting.sMessage = '' Cutting.sMessage = ''
Cutting.idProc = Proc.id Cutting.idProc = Proc.id
Cutting.dResidualDepth = abs( EdgeToMachine.dElevation) Cutting.dResidualDepth = EdgeToMachine.dElevation
Cutting.dBladeMarkLength = 0 Cutting.dBladeMarkLength = 0
Cutting.sEdgeType = EdgeToMachine.sType Cutting.sEdgeType = EdgeToMachine.sType
Cutting. nSegment = 1 Cutting.nFeatureSegment = 1
-- parametri opzionali -- parametri opzionali
if not OptionalParameters then if not OptionalParameters then
@@ -101,29 +101,30 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
end end
local bForceLongcutBlade = OptionalParameters.bForceLongcutBlade or false local bForceLongcutBlade = OptionalParameters.bForceLongcutBlade or false
local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
local dPocketHeight = OptionalParameters.dPocketHeight or 0
local dDepthToMachine = min( OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation, EdgeToMachine.dElevation)
local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false
local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato -- lunghezze e punti caratteristici della lavorazione e del lato lavorato
Cutting.dLengthToMachine = EdgeToMachine.dLength Cutting.dLengthToMachine = EdgeToMachine.dLength
Cutting.dLengthOnX = abs( EdgeToMachine.dLength * EdgeToMachine.vtToolDirection:getY())
Cutting.dEdgeLength = EdgeToMachine.dLength Cutting.dEdgeLength = EdgeToMachine.dLength
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT) if bOppositeToolDirection then
Cutting.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN Cutting.vtToolDirection = -EdgeToMachine.vtN
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else else
if FaceToMachine.sType == 'Long' then Cutting.vtToolDirection = EdgeToMachine.vtN
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
elseif FaceToMachine.sType == 'Side' then
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
end
end end
Cutting.vtEdgeDirection = EdgeToMachine.vtN ^ FaceToMachine.vtN
-- TODO conviene spostare questi calcoli nel FaceData?
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Cutting.vtToolDirection, GDB_ID.ROOT)
local b3BoxEdge = BBox3d( Cutting.ptEdge1, Cutting.ptEdge2)
Cutting.dLengthOnX = b3BoxEdge:getDimX()
--
-- ricerca utensile -- ricerca utensile
local ToolSearchParameters = {} local ToolSearchParameters = {}
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) ToolSearchParameters.dElevation = EdgeToMachine.dElevation
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection ToolSearchParameters.vtToolDirection = Cutting.vtToolDirection
ToolSearchParameters.bAllowTopHead = true ToolSearchParameters.bAllowTopHead = true
ToolSearchParameters.bAllowBottomHead = false ToolSearchParameters.bAllowBottomHead = false
ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade
@@ -139,13 +140,13 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
-- verifica dimensioni tasca compatibili -- verifica dimensioni tasca compatibili
-- se tasca meno spessa della lama la strategia non è applicabile -- se tasca meno spessa della lama la strategia non è applicabile
if TOOLS[Cutting.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL then if OptionalParameters.dPocketHeight and ( TOOLS[Cutting.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL) then
Cutting.sMessage = 'Pocket too narrow for blade thickness' Cutting.sMessage = 'Pocket too narrow for blade thickness'
Cutting.bIsApplicable = false Cutting.bIsApplicable = false
EgtOutLog( Cutting.sMessage) EgtOutLog( Cutting.sMessage)
return Cutting, EdgeToMachine.dElevation return Cutting, EdgeToMachine.dElevation
end end
if #( Proc.MainFaces.SideFaces) > 1 then if Proc.MainFaces and #( Proc.MainFaces.SideFaces) > 1 then
-- se tasca più stretta della lama la strategia non è applicabile -- se tasca più stretta della lama la strategia non è applicabile
if TOOLS[Cutting.nToolIndex].dDiameter > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then if TOOLS[Cutting.nToolIndex].dDiameter > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
Cutting.sMessage = 'Pocket too narrow for blade diameter' Cutting.sMessage = 'Pocket too narrow for blade diameter'
@@ -169,7 +170,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.nWorkside = MCH_MILL_WS.LEFT Cutting.nWorkside = MCH_MILL_WS.LEFT
Cutting.bInvert = false Cutting.bInvert = false
end end
if EdgeToMachine.dElevation < -10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Cutting.bInvert = not Cutting.bInvert Cutting.bInvert = not Cutting.bInvert
end end
-- TODO gestire lama da sotto e lama downUp -- TODO gestire lama da sotto e lama downUp
@@ -180,22 +181,22 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.bToolInvert = false Cutting.bToolInvert = false
end end
-- profondità da lavorare e offset radiale -- profondità da lavorare e offset radiale
if TOOLS[Cutting.nToolIndex].dMaxDepth > abs( EdgeToMachine.dElevation) - 10 * GEO.EPS_SMALL then if TOOLS[Cutting.nToolIndex].dMaxDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then
-- TODO la depth dovrebbe essere quella del machining -- TODO la depth dovrebbe essere quella del machining
Cutting.dDepthToMachine = abs( EdgeToMachine.dElevation) Cutting.dDepthToMachine = dDepthToMachine
Cutting.dResidualDepth = 0 Cutting.dResidualDepth = 0
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Cutting.dRadialOffset = 0 Cutting.dRadialOffset = -dDepthToMachine
else else
Cutting.dRadialOffset = EdgeToMachine.dElevation Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
end end
else else
Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1 Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1
Cutting.dResidualDepth = abs( EdgeToMachine.dElevation) - Cutting.dDepthToMachine Cutting.dResidualDepth = EdgeToMachine.dElevation - Cutting.dDepthToMachine
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
else
Cutting.dRadialOffset = -Cutting.dDepthToMachine Cutting.dRadialOffset = -Cutting.dDepthToMachine
else
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
end end
end end
-- completamento -- completamento
@@ -214,13 +215,13 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
-- overlap -- overlap
Cutting.dOverlap = 0 Cutting.dOverlap = 0
-- faceuse -- faceuse
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( EdgeToMachine.vtToolDirection) Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( -Cutting.vtToolDirection)
else else
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( -EdgeToMachine.vtToolDirection) Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( Cutting.vtToolDirection)
end end
-- SCC -- SCC
Cutting.nSCC = GetSCC( EdgeToMachine.vtToolDirection) Cutting.nSCC = GetSCC( Cutting.vtToolDirection)
-- asse bloccato -- asse bloccato
Cutting.sBlockedAxis = BeamLib.GetBlockedAxis( Cutting.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN, EgtIf( FaceToMachine.vtN:getX() > 0, X_AX(), -X_AX())) Cutting.sBlockedAxis = BeamLib.GetBlockedAxis( Cutting.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN, EgtIf( FaceToMachine.vtN:getX() > 0, X_AX(), -X_AX()))
-- approccio e retrazione -- approccio e retrazione
@@ -242,28 +243,33 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
Cutting.dBladeMarkLength = abs( Cutting.LeadOut.dEndAddLength) Cutting.dBladeMarkLength = abs( Cutting.LeadOut.dEndAddLength)
end end
-- geometria -- geometria
Cutting.Geometry = {{Proc.id, FaceToMachine.id}} Cutting.Geometry = {{Cutting.idProc, FaceToMachine.id}}
-- nome operazione -- nome operazione
Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1) Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
-- se lavorazione aperta sulla coda, eventuali aggiustamenti -- se lavorazione aperta sulla coda, eventuali aggiustamenti
-- TODO valutare se fare funzione a parte -- TODO valutare se fare funzione a parte
if Proc.AffectedFaces.bLeft then if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( Cutting.vtToolDirection:getX() < 0.707)) then
local dLengthOnX = Cutting.dLengthOnX
-- se feature splittata non si considera la lunghezza della feature per il check spostamento dopo separazione
if bIsSplitFeature then
dLengthOnX = 0
end
local bStartLeft = MachiningLib.StartsLeftSide( Cutting) local bStartLeft = MachiningLib.StartsLeftSide( Cutting)
local dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength local dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength
local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine) local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine)
if bStartLeft then if bStartLeft then
dAddLengthLeftSide = Cutting.LeadIn.dStartAddLength dAddLengthLeftSide = Cutting.LeadIn.dStartAddLength
end end
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtN, Y_AX()) then
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
Cutting.bMoveAfterSplitcut = true Cutting.sStage = 'AfterTail'
else else
Cutting.bIsApplicable = false Cutting.bIsApplicable = false
end end
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
Cutting.bMoveAfterSplitcut = true Cutting.sStage = 'AfterTail'
else else
if bStartLeft then if bStartLeft then
Cutting.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail Cutting.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail
@@ -52,11 +52,11 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
local Mortising = {} local Mortising = {}
Mortising.bIsApplicable = true Mortising.bIsApplicable = true
Mortising.dDepthToMachine = 0 Mortising.dDepthToMachine = 0
Mortising.dResidualDepth = abs( EdgeToMachine.dElevation) Mortising.dResidualDepth = EdgeToMachine.dElevation
Mortising.sMessage = '' Mortising.sMessage = ''
Mortising.idProc = Proc.id Mortising.idProc = Proc.id
Mortising.sEdgeType = EdgeToMachine.sType Mortising.sEdgeType = EdgeToMachine.sType
Mortising.nSegment = 1 Mortising.nFeatureSegment = 1
-- parametri opzionali -- parametri opzionali
if not OptionalParameters then if not OptionalParameters then
@@ -65,28 +65,26 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
local bUseZigZagMortising = OptionalParameters.bUseZigZagMortising or false local bUseZigZagMortising = OptionalParameters.bUseZigZagMortising or false
local sSideToMachine = OptionalParameters.sSideToMachine or '' local sSideToMachine = OptionalParameters.sSideToMachine or ''
local dLengthToMachine = OptionalParameters.dLengthToMachine or EdgeToMachine.dLength local dLengthToMachine = OptionalParameters.dLengthToMachine or EdgeToMachine.dLength
local dCustomMaxElev = OptionalParameters.dMaxElev or abs( EdgeToMachine.dElevation) local dCustomMaxElev = OptionalParameters.dMaxElev or EdgeToMachine.dElevation
local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false
local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000 local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
local dPocketHeight = OptionalParameters.dPocketHeight or 0
local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false
local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato -- lunghezze e punti caratteristici della lavorazione e del lato lavorato
Mortising.dLengthToMachine = dLengthToMachine Mortising.dLengthToMachine = dLengthToMachine
Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtToolDirection:getY()) -- TODO serve un modo migliore di calcolare la lunghezza lungo X; attenzione che serve la lunghezza reale di lavoro, non quella del lato
-- TODO andrà aggiornata dopo il calcolo LeadIn/Out
Mortising.dLengthOnX = abs( dLengthToMachine * EdgeToMachine.vtN:getY())
Mortising.dEdgeLength = EdgeToMachine.dLength Mortising.dEdgeLength = EdgeToMachine.dLength
Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT) if bOppositeToolDirection then
Mortising.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN Mortising.vtToolDirection = -EdgeToMachine.vtN
-- altezza tasca, in base alla topologia
local dPocketHeight = 0
if Proc.Topology.sFamily == 'Tunnel' then
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else else
if FaceToMachine.sType == 'Long' then Mortising.vtToolDirection = EdgeToMachine.vtN
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
elseif FaceToMachine.sType == 'Side' then
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
end
end end
Mortising.vtEdgeDirection = EdgeToMachine.vtN ^ FaceToMachine.vtN
Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Mortising.vtToolDirection, GDB_ID.ROOT)
-- ricerca utensile -- ricerca utensile
local bExtendWithCornerRadius = false local bExtendWithCornerRadius = false
@@ -95,17 +93,17 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
( EdgeToMachine.sType == 'Opposite' and Proc.Topology.sFamily == 'Tunnel') then ( EdgeToMachine.sType == 'Opposite' and Proc.Topology.sFamily == 'Tunnel') then
bExtendWithCornerRadius = true bExtendWithCornerRadius = true
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA Mortising.dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA
else else
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) Mortising.dDepthToMachine = EdgeToMachine.dElevation
end end
else else
bExtendWithCornerRadius = true bExtendWithCornerRadius = true
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN Mortising.dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN
end end
local ToolSearchParameters = {} local ToolSearchParameters = {}
local ToolInfo = {} local ToolInfo = {}
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection ToolSearchParameters.vtToolDirection = Mortising.vtToolDirection
ToolSearchParameters.bAllowTopHead = true ToolSearchParameters.bAllowTopHead = true
ToolSearchParameters.bAllowBottomHead = true ToolSearchParameters.bAllowBottomHead = true
ToolSearchParameters.dElevation = Mortising.dDepthToMachine ToolSearchParameters.dElevation = Mortising.dDepthToMachine
@@ -122,13 +120,13 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
-- verifica dimensioni tasca compatibili -- verifica dimensioni tasca compatibili
-- se tasca meno spessa della sega a catena la strategia non è applicabile -- se tasca meno spessa della sega a catena la strategia non è applicabile
if TOOLS[Mortising.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL then if OptionalParameters.dPocketHeight and ( TOOLS[Mortising.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL) then
Mortising.sMessage = 'Pocket too narrow for chainsaw thickness' Mortising.sMessage = 'Pocket too narrow for chainsaw thickness'
Mortising.bIsApplicable = false Mortising.bIsApplicable = false
EgtOutLog( Mortising.sMessage) EgtOutLog( Mortising.sMessage)
return Mortising return Mortising
end end
if #( Proc.MainFaces.SideFaces) > 1 then if Proc.MainFaces and #( Proc.MainFaces.SideFaces) > 1 then
-- se tasca più stretta della sega a catena la strategia non è applicabile -- se tasca più stretta della sega a catena la strategia non è applicabile
if TOOLS[Mortising.nToolIndex].dWidth > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then if TOOLS[Mortising.nToolIndex].dWidth > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
Mortising.sMessage = 'Pocket too narrow for chainsaw width' Mortising.sMessage = 'Pocket too narrow for chainsaw width'
@@ -147,12 +145,12 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen
-- lato di lavoro e inversioni -- lato di lavoro e inversioni
Mortising.bInvert = false Mortising.bInvert = false
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Mortising.nWorkside = MCH_MILL_WS.RIGHT
Mortising.bToolInvert = false
else
Mortising.nWorkside = MCH_MILL_WS.LEFT Mortising.nWorkside = MCH_MILL_WS.LEFT
Mortising.bToolInvert = true Mortising.bToolInvert = true
else
Mortising.nWorkside = MCH_MILL_WS.RIGHT
Mortising.bToolInvert = false
end end
-- profondità e offset longitudinale -- profondità e offset longitudinale
if bExtendWithCornerRadius then if bExtendWithCornerRadius then
@@ -160,19 +158,19 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
end end
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
Mortising.dResidualDepth = 0 Mortising.dResidualDepth = 0
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Mortising.dLongitudinalOffset = 0
else
Mortising.dLongitudinalOffset = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
end
else
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1
Mortising.dResidualDepth = abs( EdgeToMachine.dElevation) - Mortising.dDepthToMachine
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
else else
Mortising.dLongitudinalOffset = 0 Mortising.dLongitudinalOffset = 0
end end
else
Mortising.dDepthToMachine = TOOLS[Mortising.nToolIndex].dMaxMaterial - 1
Mortising.dResidualDepth = EdgeToMachine.dElevation - Mortising.dDepthToMachine
if bOppositeToolDirection then
Mortising.dLongitudinalOffset = 0
else
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
end
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.dElevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.dDepthToMachine, 1) .. ')' Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.dElevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.dDepthToMachine, 1) .. ')'
EgtOutLog( Mortising.sMessage) EgtOutLog( Mortising.sMessage)
end end
@@ -185,7 +183,7 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
-- offset radiale -- offset radiale
Mortising.dRadialOffset = 0 Mortising.dRadialOffset = 0
-- distanza di sicurezza -- distanza di sicurezza
Mortising.dStartSafetyLength = max( EdgeToMachine.dElevation, 10) Mortising.dStartSafetyLength = max( EdgeToMachine.dElevation, ( TOOLS[Mortising.nToolIndex].SetupInfo.dZSafeDelta or 60) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ))
-- overlap -- overlap
Mortising.dOverlap = 0 Mortising.dOverlap = 0
-- step -- step
@@ -197,21 +195,21 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
end end
Mortising.Steps.dStep = TOOLS[Mortising.nToolIndex].dStep Mortising.Steps.dStep = TOOLS[Mortising.nToolIndex].dStep
-- faceuse -- faceuse
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then if bOppositeToolDirection then
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( EdgeToMachine.vtToolDirection) Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -Mortising.vtToolDirection)
else else
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -EdgeToMachine.vtToolDirection) Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( Mortising.vtToolDirection)
end end
-- SCC -- SCC
Mortising.SCC = MCH_SCC.NONE Mortising.SCC = MCH_SCC.NONE
-- asse bloccato e angoli suggeriti -- asse bloccato e angoli suggeriti
local vtRes = FaceToMachine.vtN ^ EdgeToMachine.vtToolDirection local vtRes = FaceToMachine.vtN ^ EdgeToMachine.vtN
if abs( vtRes:getZ()) < 10 * GEO.EPS_SMALL then if abs( vtRes:getZ()) < 10 * GEO.EPS_SMALL then
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN) Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN)
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 1) Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtN, 1)
elseif EdgeToMachine.vtToolDirection:getZ() < 10 * GEO.EPS_SMALL then elseif EdgeToMachine.vtN:getZ() < 10 * GEO.EPS_SMALL then
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'parallel', Part.b3Raw, FaceToMachine.vtN) Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'parallel', Part.b3Raw, FaceToMachine.vtN)
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 2) Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtN, 2)
end end
-- approccio e retrazione -- approccio e retrazione
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine, sSideToMachine, dLengthToMachine) Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine, sSideToMachine, dLengthToMachine)
@@ -224,21 +222,26 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
-- se lavorazione aperta sulla coda, eventuali aggiustamenti -- se lavorazione aperta sulla coda, eventuali aggiustamenti
-- TODO valutare se fare funzione a parte -- TODO valutare se fare funzione a parte
if Proc.AffectedFaces.bLeft then if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( Mortising.vtToolDirection:getX() < 0.707)) then
local dLengthOnX = Mortising.dLengthOnX
-- se feature splittata non si considera la lunghezza della feature per il check spostamento dopo separazione
if bIsSplitFeature then
dLengthOnX = 0
end
local bStartLeft = MachiningLib.StartsLeftSide( Mortising) local bStartLeft = MachiningLib.StartsLeftSide( Mortising)
local dAddLengthLeftSide = Mortising.LeadOut.dEndAddLength local dAddLengthLeftSide = Mortising.LeadOut.dEndAddLength
if bStartLeft then if bStartLeft then
dAddLengthLeftSide = Mortising.LeadIn.dStartAddLength dAddLengthLeftSide = Mortising.LeadIn.dStartAddLength
end end
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtN, Y_AX()) then
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
Mortising.bMoveAfterSplitcut = true Mortising.sStage = 'AfterTail'
else else
Mortising.bIsApplicable = false Mortising.bIsApplicable = false
end end
elseif dAddLengthLeftSide + TOOLS[Mortising.nToolIndex].dDiameter / 2 > dExtendAfterTail then elseif dAddLengthLeftSide + TOOLS[Mortising.nToolIndex].dDiameter / 2 > dExtendAfterTail then
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
Mortising.bMoveAfterSplitcut = true Mortising.sStage = 'AfterTail'
else else
if bStartLeft then if bStartLeft then
Mortising.LeadIn.dStartAddLength = - TOOLS[Mortising.nToolIndex].dDiameter / 2 + dExtendAfterTail Mortising.LeadIn.dStartAddLength = - TOOLS[Mortising.nToolIndex].dDiameter / 2 + dExtendAfterTail
@@ -1,8 +1,8 @@
-- StrategyLib.lua by Egalware s.r.l. 2024/04/02 -- SPLITCUT.lua by Egalware s.r.l. 2024/04/02
-- Libreria di supporto a strategie con funzioni comune a strategie diverse. -- Libreria di supporto a strategie con funzioni comune a strategie diverse.
-- Tabella per definizione modulo -- Tabella per definizione modulo
local StrategyLib = {} local SPLITCUT = {}
-- Include -- Include
require( 'EgtBase') require( 'EgtBase')
@@ -14,14 +14,13 @@ local MachiningLib = require( 'MachiningLib')
-- strategie di base -- strategie di base
local FaceByBlade = require('FACEBYBLADE') local FaceByBlade = require('FACEBYBLADE')
EgtOutLog( ' StrategyLib started', 1) EgtOutLog( ' SPLITCUT started', 1)
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
---------------------- FUNZIONI DI SPLIT ------------------------------------------ ---------------------- FUNZIONI DI SPLIT ------------------------------------------
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
StrategyLib.SplitStrategy = {} function SPLITCUT.GetStrategy( Proc, Part, OptionalParameters)
function StrategyLib.SplitStrategy.Get( Proc, Part, OptionalParameters)
local Machining = {} local Machining = {}
local Result = {} local Result = {}
-- sTypeMachining = BladeSideSingle\ BladeSideDouble\ BladeHorizontalSingle\ BladeHorizontalDouble\ ChainSawHorizontal\ ChainSawSideSingle\ ChainSawSideDouble\ ChainSawPlusBlade\ Mill\ None -- sTypeMachining = BladeSideSingle\ BladeSideDouble\ BladeHorizontalSingle\ BladeHorizontalDouble\ ChainSawHorizontal\ ChainSawSideSingle\ ChainSawSideDouble\ ChainSawPlusBlade\ Mill\ None
@@ -183,10 +182,10 @@ function StrategyLib.SplitStrategy.Get( Proc, Part, OptionalParameters)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, vtEdge) function SPLITCUT.GetEdgeToMachine( Proc, vtEdge)
local Edge local Edge
for i = 1, #Proc.Faces[1].Edges do for i = 1, #Proc.Faces[1].Edges do
if AreSameVectorApprox( Proc.Faces[1].Edges[i].Norm, vtEdge) then if AreSameVectorApprox( Proc.Faces[1].Edges[i].vtN, vtEdge) then
Edge = Proc.Faces[1].Edges[i] Edge = Proc.Faces[1].Edges[i]
end end
end end
@@ -194,7 +193,7 @@ function StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, vtEdge)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) function SPLITCUT.CalculateLeadInOut( EdgeToMachine)
local LeadIn = {} local LeadIn = {}
local LeadOut = {} local LeadOut = {}
@@ -204,14 +203,8 @@ function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
LeadOut.nType = MCH_MILL_LI.LINEAR LeadOut.nType = MCH_MILL_LI.LINEAR
LeadIn.dTangentDistance = 0 LeadIn.dTangentDistance = 0
LeadOut.dTangentDistance = 0 LeadOut.dTangentDistance = 0
-- elevazione sempre in negativo LeadIn.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then LeadOut.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
LeadIn.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
LeadOut.dPerpDistance = BeamData.CUT_SIC - EdgeToMachine.Elev
else
LeadIn.dPerpDistance = BeamData.CUT_SIC
LeadOut.dPerpDistance = BeamData.CUT_SIC
end
LeadIn.dElevation = 0 LeadIn.dElevation = 0
LeadOut.dElevation = 0 LeadOut.dElevation = 0
LeadIn.dCompLength = 0 LeadIn.dCompLength = 0
@@ -223,7 +216,7 @@ function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
end end
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy) function SPLITCUT.Execute( Proc, Part, Strategy)
local Machinings = {} local Machinings = {}
-- applico le lavorazioni -- applico le lavorazioni
@@ -239,12 +232,12 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0 OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true Machining.AuxiliaryData.bIsSplitOrCut = true
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Y_AX()) local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
@@ -261,10 +254,10 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2 OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;')
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Y_AX()) local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
-- Taglio lato dietro -- Taglio lato dietro
@@ -279,12 +272,12 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2 OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true Machining.AuxiliaryData.bIsSplitOrCut = true
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Y_AX()) EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Y_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
@@ -299,12 +292,12 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = -BeamData.CUT_EXTRA OptionalParameters.dRadialOffset = -BeamData.CUT_EXTRA
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true Machining.AuxiliaryData.bIsSplitOrCut = true
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Z_AX()) local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
@@ -322,10 +315,10 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;')
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Z_AX()) local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
-- Taglio lato dietro -- Taglio lato dietro
@@ -340,12 +333,12 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown + dExtraMaxMat OptionalParameters.dRadialOffset = Part.dHeight - Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown + dExtraMaxMat
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;') OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
Machining.AuxiliaryData.bAddNewPhase = true Machining.AuxiliaryData.bIsSplitOrCut = true
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Z_AX()) EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Z_AX())
-- approccio e retrazione -- approccio e retrazione
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine) OptionalParameters.LeadIn, OptionalParameters.LeadOut = SPLITCUT.CalculateLeadInOut( EdgeToMachine)
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters) Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
table.insert( Machinings, Machining) table.insert( Machinings, Machining)
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawHorizontal' then elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
@@ -365,4 +358,4 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
end end
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
return StrategyLib return SPLITCUT