Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf4b504733 | |||
| 084b6758a3 | |||
| a8c2e2fe98 | |||
| e37486db1d | |||
| f9168e8380 | |||
| 9edd39305f | |||
| 0c5373700e | |||
| 098244b109 | |||
| e553197d61 | |||
| c64aaade13 | |||
| ffe2d07918 | |||
| 89c315cdd8 | |||
| e3ab0b8f35 | |||
| 40e76a23c9 | |||
| fc6b50b345 | |||
| 8d2a9955ba | |||
| 87aa2a7ce6 | |||
| 2be4a3fe0b | |||
| d76ecbc9f6 | |||
| cc8410b0c5 | |||
| 3835f6f6e0 | |||
| cf96eb7bc3 | |||
| 3287420f41 | |||
| d013e836a0 | |||
| 3a5cba1c15 | |||
| 0c8d5516e1 | |||
| e443bd5813 | |||
| 37f85bccec | |||
| 512b907aae | |||
| e9d71ab75e | |||
| ad112ca6c3 | |||
| ce7d87a5ac | |||
| 8238767f69 | |||
| ca4141515d | |||
| 6ca555efc8 |
@@ -49,6 +49,7 @@ local function GetStrategies_Egalware( Proc)
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Cut
|
||||
elseif ID.IsCut( Proc) then
|
||||
Strategies = { { sStrategyId = 'STR0005'}}
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Longitudinal Cut
|
||||
elseif ID.IsLongitudinalCut( Proc) then
|
||||
@@ -215,6 +216,7 @@ local function GetStrategies_Egalware( Proc)
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Dovetail Tenon
|
||||
elseif ID.IsDovetailTenon( Proc) then
|
||||
Strategies = { { sStrategyId = 'STR0001'}}
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Dovetail Mortise
|
||||
elseif ID.IsDovetailMortise( Proc) then
|
||||
@@ -473,6 +475,7 @@ local function GetStrategies_Essetre( Proc)
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Dovetail Tenon
|
||||
elseif ID.IsDovetailTenon( Proc) then
|
||||
Strategies = { { sStrategyId = 'STR0001'}}
|
||||
---------------------------------------------------------------------
|
||||
-- Feature : Dovetail Mortise
|
||||
elseif ID.IsDovetailMortise( Proc) then
|
||||
|
||||
+16
-13
@@ -31,6 +31,7 @@ EgtMdbSave()
|
||||
TOOLS = {} -- tabella contenente tutti gli utensili
|
||||
STRATEGIES = nil -- tabella contenente le strategie disponibili per ogni feature
|
||||
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???
|
||||
@@ -139,7 +140,7 @@ function BeamExec.GetToolsFromDB()
|
||||
Tool.dStemDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or Tool.ToolHolder.dDiameter -- se non settato, considero diametro come ToolHolder
|
||||
Tool.dSideAngle = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or 0
|
||||
-- verifico che parametri siano compatibili con una fresa a coda di rondine ( angolo di fianco standard Coda di rondine -> 15°)
|
||||
Tool.bIsDoveTail = Tool.Type == 'MILL_NOTIP' and abs( abs( Tool.dSideAngle) - SIDEANGLE_DOVETAIL) < 1
|
||||
Tool.bIsDoveTail = Tool.sType == 'MILL_NOTIP' and abs( abs( Tool.dSideAngle) - SIDEANGLE_DOVETAIL) < 1
|
||||
-- verifico che sia una fresa tipo T-Mill o BlockHaus
|
||||
Tool.dSideDepth = EgtGetValInNotes( Tool.sUserNotes, 'SIDEDEPTH', 'd') or 0 -- se non settato nell'utensile, dico che non ha massimo affondamento laterale
|
||||
Tool.bIsTMill = Tool.dSideDepth > 0
|
||||
@@ -588,6 +589,7 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CollectFeatures( Part)
|
||||
-- recupero le feature
|
||||
local nProcCount = 0
|
||||
local vProc = {}
|
||||
local LayerId = {}
|
||||
LayerId[1] = BeamLib.GetAddGroup( Part.id)
|
||||
@@ -619,12 +621,6 @@ local function CollectFeatures( Part)
|
||||
EgtOutLog( '------Feature ' .. Proc.idFeature .. '------')
|
||||
-- se esiste la geometria
|
||||
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
|
||||
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
|
||||
-- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL
|
||||
@@ -636,6 +632,7 @@ local function CollectFeatures( Part)
|
||||
else
|
||||
Proc.Topology.sFamily = 'FEATURE'
|
||||
Proc.Topology.sName = 'FEATURE'
|
||||
Proc = FeatureLib.GetAdditionalInfo( Proc, Part)
|
||||
end
|
||||
-- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa
|
||||
if Proc.Topology.sName ~= 'NOT_IMPLEMENTED' then
|
||||
@@ -650,17 +647,23 @@ local function CollectFeatures( Part)
|
||||
end
|
||||
-- se ci sono strategie disponibili, aggiungo a lista delle feature da lavorare
|
||||
if Proc.AvailableStrategies and #Proc.AvailableStrategies > 0 then
|
||||
nProcCount = nProcCount + 1
|
||||
Proc.nIndexInVProc = nProcCount
|
||||
table.insert( vProc, Proc)
|
||||
-- altrimenti errore (non ci sono strategie per lavorare la topologia riconosciuta)
|
||||
else
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies')
|
||||
end
|
||||
-- calcolo riduzione lunghezza pinzabile testa/coda
|
||||
Proc.NotClampableLength = FeatureLib.CalculateFeatureNotClampableLengths( Proc, Part)
|
||||
-- altrimenti errore (serviva riconoscimento topologico, ma non è stato possibile farlo)
|
||||
else
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' : NO available strategies')
|
||||
end
|
||||
else
|
||||
Proc.nFlg = 0
|
||||
nProcCount = nProcCount + 1
|
||||
Proc.nIndexInVProc = nProcCount
|
||||
table.insert( vProc, Proc)
|
||||
EgtOutLog( ' Feature ' .. tostring( Proc.idFeature) .. ' is empty (no geometry)')
|
||||
end
|
||||
@@ -881,7 +884,7 @@ local function CalculateStrategies( vProcSingleRot, Part)
|
||||
|
||||
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
|
||||
-- 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
|
||||
break
|
||||
end
|
||||
@@ -1006,7 +1009,7 @@ local function PrintFeatures( vProc, Part)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
function BeamExec.GetProcessings( PARTS)
|
||||
-- recupero tutti i processing di tutti i pezzi in tutte le rotazioni
|
||||
-- TODO calcolo tempi da rimuovere o lasciare solo per debug
|
||||
-- if EgtGetDebugLevel() >= 3 then
|
||||
@@ -1025,9 +1028,6 @@ function BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
-- recupero informazioni ausiliarie feature e dipendenze tra feature stesse
|
||||
-- TODO le dipendenze cambiano in base alla rotazione del pezzo? probabilmente no
|
||||
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
|
||||
-- inserisco una tabella vuota
|
||||
table.insert( vProcRot, {})
|
||||
@@ -1275,7 +1275,7 @@ local function GetBestResultFromCombinationsMatrix( ProcessingsOnPart, PartInfo)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
function BeamExec.ProcessMachinings( PARTS)
|
||||
-- ciclo sui pezzi
|
||||
local nTotErr = 0
|
||||
local Stats = {}
|
||||
@@ -1310,6 +1310,9 @@ function BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
for nPart = 1, #PARTS do
|
||||
-- calcolo della migliore strategia per ogni rotazione del pezzo
|
||||
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])
|
||||
end
|
||||
|
||||
|
||||
@@ -626,5 +626,6 @@ do
|
||||
return MergeSort( List, Compare)
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return BeamLib
|
||||
|
||||
+70
-32
@@ -97,6 +97,42 @@ function FaceData.GetFacesByAdjacencyNumber( Proc)
|
||||
return FacesByAdjacencyNumber
|
||||
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)
|
||||
EgtOutLog( '---Faces START---')
|
||||
@@ -109,6 +145,10 @@ function FaceData.GetFacesInfo( Proc, Part)
|
||||
vAdj = FaceData.GetAdjacencyMatrix( Proc)
|
||||
end
|
||||
|
||||
if not Proc.nFct then
|
||||
Proc.nFct = EgtSurfTmFacetCount( Proc.id) or 0
|
||||
end
|
||||
|
||||
-- reset eventuali visualizzazioni facce a due colori
|
||||
EgtSurfTmResetTwoColors( Proc.id)
|
||||
|
||||
@@ -125,9 +165,9 @@ function FaceData.GetFacesInfo( Proc, Part)
|
||||
local _, dLongEdgeDimension, dShortEdgeDimension = EgtSurfTmFacetMinAreaRectangle( Proc.id, i - 1, GDB_ID.ROOT)
|
||||
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].Edges = vEdges
|
||||
Faces[i].Edges = Edges
|
||||
|
||||
-- TODO valutare se fare un output unico alla fine o gestire log in altro modo
|
||||
EgtOutLog( 'Facet ' .. Faces[i].id .. ' of ' .. Proc.nFct - 1)
|
||||
@@ -242,10 +282,10 @@ local function GetBottomFaces( Proc)
|
||||
|
||||
local ClosedEdgesSortedByGreatestLength = {}
|
||||
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, {})
|
||||
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].nIndex = i
|
||||
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFaces[1].Edges[i].Len
|
||||
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFaces[1].Edges[i].dLength
|
||||
end
|
||||
end
|
||||
table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end)
|
||||
@@ -262,14 +302,13 @@ local function GetBottomFaces( Proc)
|
||||
end
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].Adj
|
||||
CurrentEdge.vtToolDirection = Vector3d( BottomFaces[1].Edges[i].Norm)
|
||||
CurrentEdge.dLength = BottomFaces[1].Edges[i].Len
|
||||
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
|
||||
CurrentEdge.dElevation = BottomFaces[1].Edges[i].Elev
|
||||
CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].Open
|
||||
CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[nPreviousEdgeIndex].Open
|
||||
CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[nNextEdgeIndex].Open
|
||||
CurrentEdge.idAdjacentFace = BottomFaces[1].Edges[i].idAdjacentFace
|
||||
CurrentEdge.vtN = BottomFaces[1].Edges[i].vtN
|
||||
CurrentEdge.dLength = BottomFaces[1].Edges[i].dLength
|
||||
CurrentEdge.bIsOpen = BottomFaces[1].Edges[i].bIsOpen
|
||||
CurrentEdge.dElevation = BottomFaces[1].Edges[i].dElevation
|
||||
CurrentEdge.bIsStartOpen = BottomFaces[1].Edges[i].bIsStartOpen
|
||||
CurrentEdge.bIsEndOpen = BottomFaces[1].Edges[i].bIsEndOpen
|
||||
|
||||
if i == nFirstLongEdgeIndex then
|
||||
BottomFaces[1].MainEdges.LongEdges[1] = CurrentEdge
|
||||
@@ -348,14 +387,13 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].Adj
|
||||
CurrentEdge.vtToolDirection = Vector3d( LongFaces[i].Edges[j].Norm)
|
||||
CurrentEdge.dLength = LongFaces[i].Edges[j].Len
|
||||
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
|
||||
CurrentEdge.dElevation = LongFaces[i].Edges[j].Elev
|
||||
CurrentEdge.bIsOpen = LongFaces[i].Edges[j].Open
|
||||
CurrentEdge.bIsStartOpen = LongFaces[i].Edges[nPreviousEdgeIndex].Open
|
||||
CurrentEdge.bIsEndOpen = LongFaces[i].Edges[nNextEdgeIndex].Open
|
||||
CurrentEdge.idAdjacentFace = LongFaces[i].Edges[j].idAdjacentFace
|
||||
CurrentEdge.vtN = LongFaces[i].Edges[j].vtN
|
||||
CurrentEdge.dLength = LongFaces[i].Edges[j].dLength
|
||||
CurrentEdge.bIsOpen = LongFaces[i].Edges[j].bIsOpen
|
||||
CurrentEdge.dElevation = LongFaces[i].Edges[j].dElevation
|
||||
CurrentEdge.bIsStartOpen = LongFaces[i].Edges[j].bIsStartOpen
|
||||
CurrentEdge.bIsEndOpen = LongFaces[i].Edges[j].bIsEndOpen
|
||||
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if CurrentEdge.idAdjacentFace > -1 then
|
||||
@@ -369,10 +407,10 @@ local function GetLongFaces( Proc, MainFaces)
|
||||
if CurrentEdge.idAdjacentFace == BottomFace.id then
|
||||
LongFaces[i].MainEdges.BottomEdge = CurrentEdge
|
||||
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].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].sType = 'Side'
|
||||
else
|
||||
@@ -435,14 +473,13 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
end
|
||||
|
||||
local CurrentEdge = {}
|
||||
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].Adj
|
||||
CurrentEdge.vtToolDirection = Vector3d( SideFaces[i].Edges[j].Norm)
|
||||
CurrentEdge.dLength = SideFaces[i].Edges[j].Len
|
||||
CurrentEdge.dLengthOnX = abs( CurrentEdge.dLength * CurrentEdge.vtToolDirection:getY())
|
||||
CurrentEdge.dElevation = SideFaces[i].Edges[j].Elev
|
||||
CurrentEdge.bIsOpen = SideFaces[i].Edges[j].Open
|
||||
CurrentEdge.bIsStartOpen = SideFaces[i].Edges[nPreviousEdgeIndex].Open
|
||||
CurrentEdge.bIsEndOpen = SideFaces[i].Edges[nNextEdgeIndex].Open
|
||||
CurrentEdge.idAdjacentFace = SideFaces[i].Edges[j].idAdjacentFace
|
||||
CurrentEdge.vtN = SideFaces[i].Edges[j].vtN
|
||||
CurrentEdge.dLength = SideFaces[i].Edges[j].dLength
|
||||
CurrentEdge.bIsOpen = SideFaces[i].Edges[j].bIsOpen
|
||||
CurrentEdge.dElevation = SideFaces[i].Edges[j].dElevation
|
||||
CurrentEdge.bIsStartOpen = SideFaces[i].Edges[j].bIsStartOpen
|
||||
CurrentEdge.bIsEndOpen = SideFaces[i].Edges[j].bIsEndOpen
|
||||
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if CurrentEdge.idAdjacentFace > -1 then
|
||||
@@ -454,10 +491,10 @@ local function GetSideFaces( Proc, MainFaces)
|
||||
if CurrentEdge.idAdjacentFace == BottomFace.id then
|
||||
SideFaces[i].MainEdges.BottomEdge = CurrentEdge
|
||||
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].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].sType = 'Long'
|
||||
else
|
||||
@@ -494,6 +531,7 @@ function FaceData.GetMainFaces( Proc, Part)
|
||||
Logs.WriteMainFacesLog( Proc, MainFaces)
|
||||
end
|
||||
else
|
||||
MainFaces = nil
|
||||
EgtOutLog( '---MainFaces NOT NEEDED---')
|
||||
end
|
||||
|
||||
|
||||
+199
-7
@@ -209,6 +209,19 @@ function FeatureLib.ClassifyTopology( Proc, Part)
|
||||
return FeatureTopology
|
||||
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)
|
||||
elseif ID.IsDovetailTenon( Proc) then
|
||||
Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter, Proc.idAddAuxGeom = FeatureLib.GetDoveTailTenonData( Proc)
|
||||
end
|
||||
|
||||
return Proc
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Recupero dati foro e adattamento se speciale
|
||||
function FeatureLib.GetDrillingData( Proc)
|
||||
@@ -230,6 +243,60 @@ function FeatureLib.GetDrillingData( Proc)
|
||||
return dDiam, dLen, nFcs, nFce
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- Recupero dati tenone a coda di rondine
|
||||
function FeatureLib.GetDoveTailTenonData( Proc)
|
||||
-- recupero e verifico l'entità curva
|
||||
local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i')
|
||||
if idAux then idAux = idAux + Proc.id end
|
||||
-- recupero i dati della curva
|
||||
local vtExtr = EgtCurveExtrusion( idAux, GDB_RT.GLOB)
|
||||
local ptBC = EgtGP( idAux, GDB_RT.GLOB)
|
||||
-- determino altezza del tenone
|
||||
local frDtTen = Frame3d( ptBC, vtExtr)
|
||||
local b3DtTen = EgtGetBBoxRef( Proc.id, GDB_BB.STANDARD, frDtTen)
|
||||
local dDtTenH = b3DtTen:getDimZ()
|
||||
-- assegno centro e normale della faccia top
|
||||
local vtN = vtExtr
|
||||
local ptC = ptBC + vtN * dDtTenH
|
||||
-- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0)
|
||||
local dMaxDist
|
||||
for i = 0, Proc.nFct - 1 do
|
||||
local ptFC, vtFN = EgtSurfTmFacetCenter( Proc.id, i, GDB_ID.ROOT)
|
||||
if not AreSameVectorApprox( vtFN, vtN) or abs( ( ptFC - ptBC) * vtN) > 100 * GEO.EPS_SMALL then
|
||||
break
|
||||
end
|
||||
local nLoopId, nLoopCnt = EgtExtractSurfTmFacetLoops( Proc.id, i, EgtGetParent( Proc.id))
|
||||
if nLoopId then
|
||||
local dUmin, dUmax = EgtCurveDomain( nLoopId)
|
||||
for dU = dUmin, dUmax do
|
||||
local ptP = EgtUP( nLoopId, dU, GDB_ID.ROOT)
|
||||
local ptNear = EgtNP( idAux, ptP, GDB_ID.ROOT)
|
||||
local dDist = dist( ptP, ptNear)
|
||||
if not dMaxDist or dDist > dMaxDist then
|
||||
dMaxDist = dDist
|
||||
end
|
||||
end
|
||||
for j = 1, nLoopCnt do
|
||||
EgtErase( nLoopId + j - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not dMaxDist then
|
||||
local b3DtAux = EgtGetBBoxRef( idAux, GDB_BB.STANDARD, frDtTen)
|
||||
dMaxDist = 2 * ( b3DtTen:getRadius() - b3DtAux:getRadius())
|
||||
end
|
||||
|
||||
Proc.dDTLength = dDtTenH
|
||||
Proc.dDTMaxDist = dMaxDist
|
||||
Proc.vtDTNormal = vtExtr
|
||||
Proc.ptDTCenter = ptC
|
||||
Proc.idAddAuxGeom = idAux
|
||||
|
||||
return Proc.dDTLength, Proc.dDTMaxDist, Proc.vtDTNormal, Proc.ptDTCenter, Proc.idAddAuxGeom
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione che restituisce indice di completamento in base alla percentuale di volume lavorato
|
||||
function FeatureLib.GetFeatureCompletionIndex( dCompletionPercentage)
|
||||
@@ -293,8 +360,8 @@ function FeatureLib.CalculateCompositeRating( StrategyResult)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, OptionalParameters)
|
||||
local bMachiningNeedsSplitting
|
||||
function FeatureLib.IsMachiningLong( dMachiningLengthOnX, Part, OptionalParameters)
|
||||
local bIsMachiningLong
|
||||
|
||||
-- parametri opzionali
|
||||
if not OptionalParameters then
|
||||
@@ -302,11 +369,12 @@ function FeatureLib.MachiningNeedsSplitting( dMachiningLengthOnX, Part, Optional
|
||||
end
|
||||
local dMaxSegmentLength = OptionalParameters.dMaxSegmentLength or BeamData.LONGCUT_MAXLEN
|
||||
|
||||
bMachiningNeedsSplitting = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL)
|
||||
or ( dMachiningLengthOnX > 0.7 * Part.b3Part:getDimX() + 10 * GEO.EPS_SMALL)
|
||||
bIsMachiningLong = ( dMachiningLengthOnX > dMaxSegmentLength + 10 * GEO.EPS_SMALL)
|
||||
or ( dMachiningLengthOnX > 0.7 * Part.b3Part:getDimX() + 10 * GEO.EPS_SMALL)
|
||||
|
||||
return bMachiningNeedsSplitting
|
||||
return bIsMachiningLong
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
|
||||
local FeatureSplittingPoints = {}
|
||||
@@ -326,7 +394,7 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
|
||||
local dToolOverlapBetweenSegments = OptionalParameters.dToolOverlapBetweenSegments or BeamData.MILL_OVERLAP
|
||||
|
||||
-- verifica spezzatura necessaria
|
||||
if not FeatureLib.MachiningNeedsSplitting( Proc.b3Box:getDimX(), Part) then
|
||||
if not FeatureLib.IsMachiningLong( Proc.b3Box:getDimX(), Part) then
|
||||
return {}
|
||||
end
|
||||
|
||||
@@ -393,6 +461,130 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
|
||||
|
||||
return FeatureSplittingPoints
|
||||
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
|
||||
+28
-13
@@ -99,6 +99,8 @@ function MachiningLib.GetMachiningSteps( dMachiningDepth, dStep)
|
||||
MachiningSteps.nCount = ceil( ( dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep)
|
||||
if MachiningSteps.nCount > 1 then
|
||||
MachiningSteps.dStep = ( dMachiningDepth - dStep) / ( MachiningSteps.nCount - 1)
|
||||
else
|
||||
MachiningSteps.nCount = 1
|
||||
end
|
||||
|
||||
return MachiningSteps
|
||||
@@ -116,7 +118,8 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part )
|
||||
end
|
||||
local dOriginalStartAddLength = Machinings[i].LeadIn.dStartAddLength
|
||||
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
|
||||
-- lo spezzone attivo è quello precedente al punto di spezzatura corrente
|
||||
for j = 1, nParts do
|
||||
@@ -156,15 +159,23 @@ function MachiningLib.GetSplitMachinings( Machinings, SplittingPoints, Part )
|
||||
end
|
||||
if not bIsLastSegment then
|
||||
Machinings[nCurrentMachiningIndex].sStage = ''
|
||||
else
|
||||
Machinings[nCurrentMachiningIndex].sStage = sOriginalStage
|
||||
end
|
||||
Machinings[nCurrentMachiningIndex].nFeatureSegment = j
|
||||
end
|
||||
-- anche le lavorazioni non splittate necessitano del segmento assegnato
|
||||
else
|
||||
local dRightAddLength = dOriginalStartAddLength
|
||||
local dLeftAddLength = dOriginalEndAddLength
|
||||
if MachiningLib.StartsLeftSide( Machinings[i]) then
|
||||
dRightAddLength, dLeftAddLength = dLeftAddLength, dRightAddLength
|
||||
local dRightAddLength = 0
|
||||
local dLeftAddLength = 0
|
||||
-- si considerano allungamenti e accorciamenti solo se la feature è orientata principalmente lungo X
|
||||
-- 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
|
||||
for j = 1, nParts do
|
||||
local dNextSplitX = dEdgeMinX
|
||||
@@ -203,7 +214,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
elseif TOOLS[i].bIsProfiledTool then
|
||||
bIsToolCompatible = false
|
||||
-- controlli standard
|
||||
elseif TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then
|
||||
elseif ToolSearchParameters.dMaxToolDiameter and TOOLS[i].dDiameter > ToolSearchParameters.dMaxToolDiameter then
|
||||
bIsToolCompatible = false
|
||||
elseif TOOLS[i].SetupInfo.bIsTopHead and ToolSearchParameters.vtToolDirection:getZ() < TOOLS[i].SetupInfo.dMaxNegativeAngle then
|
||||
bIsToolCompatible = false
|
||||
@@ -217,7 +228,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
bIsToolCompatible = false
|
||||
elseif ToolSearchParameters.sMillShape == 'PEN' and not TOOLS[i].bIsPen then
|
||||
bIsToolCompatible = false
|
||||
elseif TOOLS[i].sType ~= ToolSearchParameters.sType then
|
||||
elseif ToolSearchParameters.sType and TOOLS[i].sType ~= ToolSearchParameters.sType then
|
||||
-- se sto cercando una fresa che non può lavorare di testa, quelle che lavorano di testa sono comunque ammesse
|
||||
if TOOLS[i].sType == 'MILL_STD' and ToolSearchParameters.sType == 'MILL_NOTIP' then
|
||||
bIsToolCompatible = true
|
||||
@@ -241,7 +252,7 @@ function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
if ToolEntryAngle.dValue > 0 and ToolEntryAngle.dValue < 90 then
|
||||
dCurrentMaxMatReduction = dCurrentMaxMatReduction / ToolEntryAngle.dSin + ( ( dDimObjToCheck - TOOLS[i].dDiameter) / 2) / ToolEntryAngle.dTan
|
||||
end
|
||||
-- dCurrMachReduction = negativo -> limitare, positivo -> mm extra disponibili
|
||||
-- dCurrentResidualDepth = negativo -> mm extra disponibili, positivo -> limitare
|
||||
local dCurrentResidualDepth = ToolSearchParameters.dElevation + dCurrentMaxMatReduction - TOOLS[i].dMaxDepth
|
||||
|
||||
-- se non ancora trovato, oppure se completo e il migliore fino ad ora non è completo: corrente è il migliore
|
||||
@@ -285,6 +296,7 @@ end
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per cercare utensile tipo LAMA con certe caratteristiche
|
||||
-- TODO da completare
|
||||
-- TODO 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)
|
||||
function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
local ToolInfo = {}
|
||||
|
||||
@@ -315,6 +327,8 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
bIsToolCompatible = TOOLS[i].SetupInfo.bIsTopHead
|
||||
elseif ToolSearchParameters.bAllowBottomHead and not ToolSearchParameters.bAllowTopHead then
|
||||
bIsToolCompatible = TOOLS[i].SetupInfo.bIsBottomHead
|
||||
else
|
||||
bIsToolCompatible = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -349,16 +363,16 @@ function MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
|
||||
-- parametri obbligatori
|
||||
if type( ToolSearchParameters.vtToolDirection) ~= 'table' then
|
||||
error( 'FindBlade : missing tool direction')
|
||||
error( 'FindChainSaw : missing tool direction')
|
||||
end
|
||||
if type( ToolSearchParameters.bAllowTopHead) ~= 'boolean' then
|
||||
error( 'FindBlade : missing top head info')
|
||||
error( 'FindChainSaw : missing top head info')
|
||||
end
|
||||
if type( ToolSearchParameters.bAllowBottomHead) ~= 'boolean' then
|
||||
error( 'FindBlade : missing bottom head info')
|
||||
error( 'FindChainSaw : missing bottom head info')
|
||||
end
|
||||
if not ToolSearchParameters.bAllowTopHead and not ToolSearchParameters.bAllowBottomHead then
|
||||
error( 'FindBlade : wrong head info')
|
||||
error( 'FindChainSaw : wrong head info')
|
||||
end
|
||||
|
||||
-- parametri opzionali
|
||||
@@ -766,7 +780,8 @@ function MachiningLib.PrepareMachiningsForSorting( Part)
|
||||
local dPreviousSplitX = dPartMaxX
|
||||
if j ~= 1 then
|
||||
dPreviousSplitX = Part.SplittingPoints[j - 1]:getX()
|
||||
elseif j ~= nParts then
|
||||
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
|
||||
|
||||
+6
-8
@@ -13,7 +13,7 @@ EgtEnableDebug( true)
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua')
|
||||
-- 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\\Core\\?.lua')
|
||||
EgtAddToPackagePath( BEAM.BASEDIR .. '\\StrategyLibs\\?.lua')
|
||||
|
||||
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
|
||||
local sMachDir = EgtGetCurrMachineDir()
|
||||
@@ -43,7 +43,6 @@ _G.package.loaded.FeatureLib = nil
|
||||
_G.package.loaded.FaceData = nil
|
||||
_G.package.loaded.MachiningLib = nil
|
||||
_G.package.loaded.DiceCut = nil
|
||||
_G.package.loaded.StrategyLib = nil
|
||||
_G.package.loaded.Logs = nil
|
||||
-- strategie di base sempre presenti
|
||||
_G.package.loaded['HEADCUT\\HEADCUT'] = nil
|
||||
@@ -66,7 +65,7 @@ for i = 1, 9999 do
|
||||
_G.package.loaded[sLibraryConfigToReload] = nil
|
||||
end
|
||||
end
|
||||
local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\Strategies\\Core\\*.lua')
|
||||
local vtCoreStrategiesNames = EgtFindAllFiles( BEAM.BASEDIR .. '\\StrategyLibs\\*.lua')
|
||||
for i = 1, #vtCoreStrategiesNames do
|
||||
local sCurrentName = EgtSplitString( vtCoreStrategiesNames[i], '.')[1]
|
||||
if _G.package.loaded[sCurrentName] then
|
||||
@@ -75,14 +74,13 @@ for i = 1, #vtCoreStrategiesNames do
|
||||
end
|
||||
|
||||
|
||||
local BeamExec = require( 'BeamExec')
|
||||
|
||||
-- Variabili globali
|
||||
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
|
||||
local BeamData = require( 'BeamData')
|
||||
-- carico librerie
|
||||
local BeamExec = require( 'BeamExec')
|
||||
|
||||
-- Variabili di modulo
|
||||
local dRawW
|
||||
@@ -308,8 +306,8 @@ end
|
||||
-- *** Inserimento delle lavorazioni nelle travi ***
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MyProcessFeatures()
|
||||
local PROCESSINGS = BeamExec.GetProcessings( PROCESSINGS, PARTS)
|
||||
local bOk, Stats = BeamExec.ProcessMachinings( PROCESSINGS, PARTS)
|
||||
BeamExec.GetProcessings( PARTS)
|
||||
local bOk, Stats = BeamExec.ProcessMachinings( PARTS)
|
||||
local nErrCnt = 0
|
||||
local nWarnCnt = 0
|
||||
local sOutput = ''
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
-- Strategia: FACEBYBLADE
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione di una faccia con lama
|
||||
-- Feature: tutte
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FACEBYBLADE = {}
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CalculateLeadInOut( EdgeToMachine)
|
||||
local LeadIn = {}
|
||||
local LeadOut = {}
|
||||
LeadIn.dStartAddLength = 0
|
||||
LeadOut.dEndAddLength = 0
|
||||
LeadIn.nType = MCH_MILL_LI.LINEAR
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
-- elevazione sempre in negativo
|
||||
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then
|
||||
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
|
||||
LeadOut.dElevation = 0
|
||||
LeadIn.dCompLength = 0
|
||||
LeadOut.dCompLength = 0
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
|
||||
return LeadIn, LeadOut
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO da sistemare
|
||||
local function GetSCC( vtMachiningDirection)
|
||||
local nSCC = MCH_SCC.NONE
|
||||
|
||||
if vtMachiningDirection:getZ() < -0.9 then
|
||||
nSCC = MCH_SCC.ADIR_ZM
|
||||
elseif vtMachiningDirection:getZ() > 0.9 then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif vtMachiningDirection:getY() < -0.707 then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
elseif vtMachiningDirection:getY() > 0.707 then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif vtMachiningDirection:getX() < -0.707 then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
elseif vtMachiningDirection:getX() > 0.707 then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
end
|
||||
|
||||
return nSCC
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO da sistemare
|
||||
function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
local Cutting = {}
|
||||
|
||||
local vtMachiningDirection = EdgeToMachine.Norm
|
||||
local vtN = Proc.Faces[FaceToMachine+1].vtN
|
||||
Cutting.sDepth = OptionalParameters.sDepth or 0
|
||||
Cutting.dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0
|
||||
Cutting.dRadialOffset = OptionalParameters.dRadialOffset or 0
|
||||
|
||||
Cutting.nType = MCH_MY.MILLING
|
||||
Cutting.nToolIndex = OptionalParameters.nToolIndex
|
||||
Cutting.Geometry = {{ Proc.id, FaceToMachine}}
|
||||
Cutting.id = Proc.id
|
||||
Cutting.vtToolDirection = vtMachiningDirection
|
||||
|
||||
|
||||
-- ===== calcolo LeadIn/out =====
|
||||
if OptionalParameters.LeadIn and OptionalParameters.LeadOut then
|
||||
Cutting.LeadIn, Cutting.LeadOut = OptionalParameters.LeadIn, OptionalParameters.LeadOut
|
||||
else
|
||||
Cutting.LeadIn, Cutting.LeadOut = CalculateLeadInOut( EdgeToMachine)
|
||||
end
|
||||
|
||||
-- ===== scelta soluzione braccio C del motore =====
|
||||
Cutting.nSCC = GetSCC( vtMachiningDirection)
|
||||
|
||||
-- ===== parametri da settare in UserNotes =====
|
||||
Cutting.nFaceuse = OptionalParameters.nFaceuse
|
||||
Cutting.sUserNotes = EgtSetValInNotes( Cutting.sUserNotes, 'VtFaceUse', vtMachiningDirection)
|
||||
if OptionalParameters.sUserNotes then
|
||||
Cutting.sUserNotes = Cutting.sUserNotes .. OptionalParameters.sUserNotes
|
||||
end
|
||||
|
||||
-- ===== scelta senso di lavorazione =====
|
||||
local bIsSawCCW = TOOLS[Cutting.nToolIndex].bIsCCW
|
||||
local bInvert
|
||||
-- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento
|
||||
if bInvert == nil then
|
||||
bInvert = ( not bIsSawCCW)
|
||||
if bIsSawCCW then
|
||||
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() < 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() > 0))
|
||||
else
|
||||
bInvert = (( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_FRONT and vtN:getX() > 0) or ( Cutting.nFaceuse == MCH_MILL_FU.ORTHO_BACK and vtN:getX() < 0))
|
||||
end
|
||||
end
|
||||
Cutting.bInvert = bInvert
|
||||
Cutting.nWorkside = EgtIf( bInvert, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
||||
|
||||
return Cutting
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return FACEBYBLADE
|
||||
@@ -45,14 +45,8 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
-- elevazione sempre in negativo
|
||||
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then
|
||||
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.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
|
||||
LeadIn.dElevation = 0
|
||||
LeadOut.dElevation = 0
|
||||
LeadIn.dCompLength = 0
|
||||
@@ -72,7 +66,7 @@ end
|
||||
local function GetEdgeToMachine( Proc, vtEdge)
|
||||
local Edge
|
||||
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]
|
||||
end
|
||||
end
|
||||
@@ -257,7 +251,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local Splitting = {}
|
||||
local AuxiliaryData = {}
|
||||
|
||||
Strategy.sSplitStrategy = GetSplitStrategy( Proc, Part)
|
||||
Strategy.SplitStrategy = GetSplitStrategy( Proc, Part)
|
||||
if bAddMachining then
|
||||
-- inserimento smussi su spigoli del taglio
|
||||
if Strategy.Parameters.bMakeChamfer then
|
||||
@@ -267,35 +261,27 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
local OptionalParameters = {}
|
||||
-- applico le lavorazioni
|
||||
----------------------------------------------------------------------------------
|
||||
if Strategy.sSplitStrategy.sTypeMachining == 'BladeSideSingle' then
|
||||
if Strategy.SplitStrategy.sTypeMachining == 'BladeSideSingle' then
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeSideDouble' then
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeSideDouble' then
|
||||
-- Taglio lato frontale
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, -Y_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
|
||||
@@ -303,51 +289,39 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters = {}
|
||||
Splitting = {}
|
||||
AuxiliaryData = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_FRONT
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
EdgeToMachine = GetEdgeToMachine( Proc, Y_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_DOWN
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dRadialOffset = -BeamData.CUT_EXTRA
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dHeight + BeamData.CUT_EXTRA
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[1].ToolInfo.nToolIndex
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
|
||||
-- Taglio lato frontale
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_DOWN
|
||||
OptionalParameters.sDepth = 0
|
||||
local dExtraMaxMat = ( Strategy.sSplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + Strategy.sSplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - Part.dHeight - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.sSplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + dExtraMaxMat
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
local dExtraMaxMat = ( Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - Part.dHeight - BeamData.CUT_EXTRA_MIN) / 2
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop - dExtraMaxMat
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
local EdgeToMachine = GetEdgeToMachine( Proc, Z_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
|
||||
@@ -355,33 +329,29 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters = {}
|
||||
Splitting = {}
|
||||
AuxiliaryData = {}
|
||||
OptionalParameters.nToolIndex = Strategy.sSplitStrategy[2].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_TOP
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.sSplitStrategy[2].ToolInfo.dMaxMatBladeFromDown + dExtraMaxMat
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[2].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - dExtraMaxMat
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
EdgeToMachine = GetEdgeToMachine( Proc, -Z_AX())
|
||||
-- approccio e retrazione
|
||||
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)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
|
||||
; -- TODO
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawSideSingle' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawSideSingle' then
|
||||
; -- TODO
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawSideDouble' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawSideDouble' then
|
||||
; -- TODO
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'ChainSawPlusBlade' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawPlusBlade' then
|
||||
; -- TODO
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.sSplitStrategy.sTypeMachining == 'Mill' then
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'Mill' then
|
||||
; -- TODO
|
||||
----------------------------------------------------------------------------------
|
||||
end
|
||||
|
||||
@@ -5,18 +5,210 @@
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
-- strategie di base
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0001 = {}
|
||||
local Strategy = {}
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function STR0001.Make( AddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
StrategyLib.Config = require( 'STR0001\\STR0001Config')
|
||||
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
|
||||
StrategyParameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
function STR0001.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- carico parametri de default e li aggiorno con quelli passati dal chiamante (potrebbero non essere congruenti)
|
||||
local StrategyLib = {}
|
||||
StrategyLib.Config = require( 'STR0001\\STR0001Config')
|
||||
Strategy.sName = StrategyLib.Config.sStrategyId
|
||||
CustomParameters = BeamLib.GetUpdateCustomParameters( CustomParameters, StrategyLib.Config.Parameters)
|
||||
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( CustomParameters)
|
||||
Strategy.Machining = {}
|
||||
Strategy.Result = {}
|
||||
|
||||
|
||||
local bAreAllMachiningsAdded = true
|
||||
local ToolSearchParameters = {}
|
||||
local Milling = {}
|
||||
local Cutting = {}
|
||||
local Pocketing = {}
|
||||
|
||||
-- ===== RICERCA UTENSILE =====
|
||||
-- === ricerca utensile per taglio del tenone in lunghezza ===
|
||||
-- TODO fare funzione generale per trovare lama data una faccia?
|
||||
Cutting.bIsApplicable = false
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
ToolSearchParameters.vtToolDirection = Proc.vtDTNormal
|
||||
Cutting.ToolInfo = {}
|
||||
Cutting.ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
if Cutting.ToolInfo.nToolIndex then
|
||||
Cutting.bIsApplicable = true
|
||||
local ParametersMRR = {}
|
||||
ParametersMRR.nToolIndex = Cutting.ToolInfo.nToolIndex
|
||||
Cutting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
||||
end
|
||||
|
||||
-- === ricerca utensile per lavorare tenone coda di rondine ===
|
||||
Milling.bIsApplicable = false
|
||||
ToolSearchParameters.dElevation = Proc.dDTLength
|
||||
ToolSearchParameters.vtToolDirection = Proc.vtDTNormal
|
||||
ToolSearchParameters.sMillShape = 'DOVETAIL'
|
||||
Milling.ToolInfo = {}
|
||||
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
||||
if Milling.ToolInfo.nToolIndex then
|
||||
Milling.bIsApplicable = true
|
||||
local ParametersMRR = {}
|
||||
ParametersMRR.nToolIndex = Milling.ToolInfo.nToolIndex
|
||||
Milling.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
|
||||
end
|
||||
|
||||
-- === ricerca utensile di svuotatura (se richiesto) ===
|
||||
-- se bastano passate con sovramateriale
|
||||
local nMillingPathsNeeded = ceil( Proc.dDTMaxDist / TOOLS[Milling.ToolInfo.nToolIndex].dSideStep)
|
||||
if nMillingPathsNeeded <= Strategy.Parameters.nMaxMillingPaths then
|
||||
Pocketing.bNotNeeded = true
|
||||
Pocketing.dMRR = Milling.dMRR
|
||||
-- serve svuotatura
|
||||
else
|
||||
Pocketing.ToolInfo = {}
|
||||
-- se ammessa svuotatura con utensile DoveTail, copio i dati
|
||||
if Strategy.Parameters.bUseDTToolOnPocketing then
|
||||
Pocketing.ToolInfo = Milling.ToolInfo
|
||||
Pocketing.dMRR = Milling.dMRR
|
||||
-- altrimenti serve cercarne un altro
|
||||
else
|
||||
ToolSearchParameters = {}
|
||||
ToolSearchParameters.dElevation = Proc.dDTLength
|
||||
ToolSearchParameters.vtToolDirection = Proc.vtDTNormal
|
||||
Pocketing.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
end
|
||||
-- se trovato utensile di svuotatura
|
||||
if Pocketing.ToolInfo.nToolIndex then
|
||||
Pocketing.bIsApplicable = true
|
||||
end
|
||||
end
|
||||
|
||||
-- setto il risultato in base agli utensili trovati
|
||||
-- lavorazione completa
|
||||
if Milling.bIsApplicable and Cutting.bIsApplicable and ( Pocketing.bIsApplicable or Pocketing.bNotNeeded) then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 100)
|
||||
Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR + Pocketing.dMRR) / 3
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill,Blade,Mill')
|
||||
-- lavorazione incompleta
|
||||
elseif Cutting.bIsApplicable then
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( 50)
|
||||
Strategy.Result.dMRR = ( Milling.dMRR + Cutting.dMRR + Pocketing.dMRR) / 3
|
||||
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
||||
if not Milling.bIsApplicable then
|
||||
Strategy.Result.sInfo = 'DoveTail-Mill not found'
|
||||
else
|
||||
Strategy.Result.sInfo = 'DoveTail tenon not completed'
|
||||
end
|
||||
-- strategia non applicabile, manca il taglio di lama sulla lunghezza del tenone
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result.nCompletionIndex = 0
|
||||
Strategy.Result.dMRR = 0
|
||||
Strategy.Result.nQuality = 0
|
||||
Strategy.Result.sInfo = 'Mill not found'
|
||||
end
|
||||
|
||||
-- applicazione delle lavorazioni
|
||||
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
||||
-- creo piano di taglio sulla testa del tenone
|
||||
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
|
||||
local idTenonCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, Proc.ptDTCenter, Proc.vtDTNormal, Part.b3Part, GDB_RT.GLOB)
|
||||
if idTenonCutPlane then
|
||||
EgtSetName( idTenonCutPlane, 'AddCut_' .. tostring( Proc.id))
|
||||
EgtSetInfo( idTenonCutPlane, 'TASKID', Proc.idTask)
|
||||
end
|
||||
|
||||
-- taglio in lunghezza sul tenone
|
||||
if Cutting.bIsApplicable then
|
||||
OptionalParameters = {}
|
||||
local AuxiliaryData = {}
|
||||
OptionalParameters.nToolIndex = Cutting.ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
|
||||
OptionalParameters.sDepth = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
-- TODO
|
||||
-- Su faccia appena creata NON sono stati calcolati gli edges.
|
||||
-- La FaceByBlade si aspetta di lavorare 1 faccia di una trimesh. Fare altra funzione?
|
||||
|
||||
--local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( AddId, 0, GDB_ID.ROOT)
|
||||
--local EdgeToMachine = GetEdgeToMachine( vEdges, -Y_AX())
|
||||
-- approccio e retrazione
|
||||
--OptionalParameters.LeadIn, OptionalParameters.LeadOut = CalculateLeadInOut( Cutting, EdgeToMachine)
|
||||
--Cutting = FaceByBlade.Make( Proc, Part, AddId, EdgeToMachine, OptionalParameters)
|
||||
if Proc.AffectedFaces.bLeft then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
end
|
||||
MachiningLib.AddNewMachining( Proc, Cutting, AuxiliaryData)
|
||||
end
|
||||
|
||||
-- svuotatura
|
||||
if Pocketing.bIsApplicable then
|
||||
-- azzero eventuale contatore passaggi con sovramateriale
|
||||
nMillingPathsNeeded = 1
|
||||
end
|
||||
|
||||
-- passaggio sul profilo
|
||||
if Milling.bIsApplicable then
|
||||
local AuxiliaryData = {}
|
||||
-- aggiungo geometria
|
||||
Milling.Geometry = {{ Proc.idAddAuxGeom, -1}}
|
||||
Milling.nToolIndex = Milling.ToolInfo.nToolIndex
|
||||
Milling.nType = MCH_MY.MILLING
|
||||
Milling.vtToolDirection = Proc.vtDTNormal
|
||||
Milling.sDepth = 0
|
||||
|
||||
-- LeadIn / LeadOut
|
||||
Milling.LeadIn = {}
|
||||
Milling.LeadOut = {}
|
||||
Milling.LeadIn.nType = MCH_MILL_LI.LINEAR
|
||||
Milling.LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
Milling.LeadIn.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Milling.LeadIn.dPerpDistance = 0
|
||||
Milling.LeadOut.dTangentDistance = TOOLS[Milling.ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
||||
Milling.LeadOut.dPerpDistance = 0
|
||||
|
||||
if Proc.AffectedFaces.bLeft then
|
||||
Milling.sStage = 'AfterTail'
|
||||
end
|
||||
|
||||
-- sistemo il lato e la direzione di lavoro
|
||||
Milling.bInvert = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
|
||||
Milling.nWorkside = EgtIf( TOOLS[Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
||||
|
||||
Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.dDTLength, 1)) .. ';'
|
||||
|
||||
-- TODO calcolare SCC
|
||||
|
||||
-- passate con sovramateriale
|
||||
AuxiliaryData.Clones = {}
|
||||
for i = nMillingPathsNeeded, 1, -1 do
|
||||
-- il primo è il passaggio più esterno
|
||||
local nIndexClones = nMillingPathsNeeded - i + 1
|
||||
-- suddivido step in base al numero passate da fare
|
||||
local dRealSideStep = floor( Proc.dDTMaxDist / nMillingPathsNeeded)
|
||||
-- cambia solo sovrmateriale radiale
|
||||
AuxiliaryData.Clones[nIndexClones] = {}
|
||||
AuxiliaryData.Clones[nIndexClones].dRadialOffset = ( i - 1) * dRealSideStep
|
||||
end
|
||||
|
||||
-- aggiunge lavorazione
|
||||
bAreAllMachiningsAdded = MachiningLib.AddNewMachining( Proc, Milling, AuxiliaryData)
|
||||
end
|
||||
end
|
||||
|
||||
return bAreAllMachiningsAdded, Strategy.Result
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
-- Strategia: STR0002
|
||||
-- Descrizione
|
||||
-- Svuotatura tasca
|
||||
-- Feature tipo LapJpint
|
||||
-- Feature tipo LapJoint
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- TODO
|
||||
-- 1 - Controllare lavorazioni in caso di feature lunga spezzata
|
||||
-- 2 - Inserire antischeggia (fresa o lama)
|
||||
-- 3 - Modalità svuotatura con fresa grande e spigoli con fresa piccola
|
||||
-- 4 - Smusso a V
|
||||
-- 5 - Finitura con motosega (se la fresa non completa)
|
||||
-- 1 - Inserire antischeggia (fresa o lama)
|
||||
-- 2 - Modalità svuotatura con fresa grande e spigoli con fresa piccola
|
||||
-- 3 - Smusso a V
|
||||
-- 4 - Finitura con motosega (se la fresa non completa)
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -438,7 +437,6 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
vAddId, vAddIdTunnel = GetSplitSurfaces( Proc, Part)
|
||||
|
||||
-- si applicano le lavorazioni
|
||||
-- TODO manca la gestione delle lavorazioni dopo separazione
|
||||
for i = 1, #vAddId do
|
||||
for j = 1, #Strategy.Machining do
|
||||
if Strategy.Machining[j].bIsApplicable then
|
||||
@@ -462,14 +460,29 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
if #vAddId == 1 then
|
||||
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)
|
||||
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
|
||||
local vtNSplitFace
|
||||
local nIdTm = EgtIf( Strategy.Machining[j].bMachAppliedToTunnelFace, vAddIdTunnel[i], vAddId[i])
|
||||
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
|
||||
Pocketing.Geometry = {{ nIdTm, k - 1}}
|
||||
bAreAllMachiningsAdded = bAreAllMachiningsAdded and MachiningLib.AddNewMachining( Proc, Pocketing)
|
||||
|
||||
@@ -3,14 +3,24 @@
|
||||
-- Lama + motosega per slot
|
||||
-- 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
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
-- strategie di base
|
||||
local SlotByBlade = require( 'SLOTBYBLADE')
|
||||
local SlotByChainSaw = require( 'SLOTBYCHAINSAW')
|
||||
local FaceByBlade = require( 'FACEBYBLADE')
|
||||
local FaceByChainsaw = require( 'FACEBYCHAINSAW')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0003 = {}
|
||||
@@ -200,8 +210,8 @@ function Blade.AddMachiningAllSteps( Proc, Cutting, AuxiliaryData)
|
||||
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
|
||||
AuxiliaryData.Clones[i].LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
AuxiliaryData.Clones[i].LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
end
|
||||
bMachiningAdded = MachiningLib.AddNewMachining( Proc, Cutting, AuxiliaryData)
|
||||
|
||||
@@ -233,7 +243,6 @@ end
|
||||
|
||||
|
||||
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)
|
||||
local StrategyLib = {}
|
||||
StrategyLib.Config = require( 'STR0003\\STR0003Config')
|
||||
@@ -268,30 +277,49 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
dExtendAfterTail = 10000
|
||||
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
|
||||
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
|
||||
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
else
|
||||
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
end
|
||||
Blade.AddResult( Cutting)
|
||||
-- lato opposto del tunnel
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Blade.AddResult( Cutting)
|
||||
else
|
||||
-- se la lama non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
||||
if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Blade.AddResult( Cutting)
|
||||
end
|
||||
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
Cutting = SlotByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Blade.AddResult( Cutting)
|
||||
end
|
||||
-- la lama è arrivata sul fondo e tasca passante, non servono ulteriori lavorazioni
|
||||
@@ -303,11 +331,11 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- lama - lavorazioni raggruppate in unica lista
|
||||
Blade.Result.Sorted = MergeResults( Blade.Result)
|
||||
-- lama - aggiunta eventuali lavorazioni splittate
|
||||
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
||||
if #FeatureSplittingPoints > 0 then
|
||||
if bIsSplitFeature then
|
||||
Blade.Result.Sorted = MachiningLib.GetSplitMachinings( Blade.Result.Sorted, FeatureSplittingPoints, Part)
|
||||
end
|
||||
-- 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
|
||||
-- ordinamento
|
||||
if Strategy.Parameters.bSortBySegment then
|
||||
@@ -354,19 +382,19 @@ 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
|
||||
|
||||
if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
if not Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Bottom[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
-- si lavora tutto il fondo
|
||||
else
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
-- ancora materiale residuo - se possibile si lavora dal lato
|
||||
@@ -374,11 +402,11 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- 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 ( 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}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.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
|
||||
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
end
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
@@ -389,11 +417,11 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
dBladeResidualDepth = Blade.Result.Bottom[1].dResidualDepth
|
||||
end
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = dBladeResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
end
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
@@ -401,8 +429,8 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
elseif Proc.Topology.sName == 'Groove-3-Through' then
|
||||
if Blade.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- si lavora tutto il fondo
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Bottom[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- ancora materiale residuo - si lavorano i lati
|
||||
if Chainsaw.Result.Bottom[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
@@ -410,17 +438,17 @@ 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
|
||||
( 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}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
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}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Side[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Side[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può eliminare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
@@ -429,18 +457,18 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
-- si lavora tutto il lato
|
||||
else
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Side[1].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Side[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
@@ -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
|
||||
( 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}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
OptionalParameters = { sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
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[2].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[1].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'Start', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, sSideToMachine = 'End', dLengthToMachine = Blade.Result.Opposite[2].dBladeMarkLength, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
else
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Opposite[1].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[1].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dMaxElev = Blade.Result.Opposite[2].dResidualDepth + BeamData.CUT_EXTRA, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
end
|
||||
@@ -500,7 +528,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- sega a catena - lavorazioni raggruppate in unica lista
|
||||
Chainsaw.Result.Sorted = MergeResults( Chainsaw.Result)
|
||||
-- sega a catena - aggiunta eventuali lavorazioni splittate
|
||||
if #FeatureSplittingPoints > 0 then
|
||||
if bIsSplitFeature then
|
||||
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
|
||||
end
|
||||
|
||||
|
||||
@@ -3,13 +3,23 @@
|
||||
-- motosega per slot
|
||||
-- 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
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local FeatureLib = require( 'FeatureLib')
|
||||
-- strategie di base
|
||||
local SlotByChainSaw = require( 'SLOTBYCHAINSAW')
|
||||
local FaceByChainsaw = require( 'FACEBYCHAINSAW')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local STR0004 = {}
|
||||
@@ -122,7 +132,6 @@ end
|
||||
|
||||
|
||||
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)
|
||||
local StrategyLib = {}
|
||||
StrategyLib.Config = require( 'STR0004\\STR0004Config')
|
||||
@@ -150,49 +159,64 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
return false, Strategy.Result
|
||||
end
|
||||
|
||||
-- calcolo estensione oltre la coda
|
||||
local dExtendAfterTail = Strategy.Parameters.dExtendAfterTail or max( Part.dDistanceToNextPiece - BeamData.CUT_EXTRA, 0)
|
||||
if MachiningLib.CanExtendAfterTail( Strategy.Parameters.sCanDamageNextPiece, Part) then
|
||||
dExtendAfterTail = 10000
|
||||
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
|
||||
local Mortising = {}
|
||||
local 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
|
||||
-- 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 = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- 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 Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
elseif Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
OptionalParameters.bOppositeToolDirection = true
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
elseif Proc.Topology.sName == 'Groove-3-Through' then
|
||||
-- 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)
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- 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
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- ancora materiale residuo - si lavora da entrambi i lati
|
||||
if Chainsaw.Result.Side[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Side[1].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lavorando dai due lati non c'è materiale residuo - si può disabilitare la lavorazione del fondo
|
||||
if Chainsaw.Result.Side[2].dResidualDepth < 10 * GEO.EPS_SMALL then
|
||||
@@ -201,17 +225,17 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
end
|
||||
elseif Proc.Topology.sName == 'Tunnel-4-Through' then
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail}
|
||||
Mortising = SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
Mortising = FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
if Chainsaw.Result.Opposite[1].dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Chainsaw.Result.Opposite[1].bIsApplicable = false
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
local OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail}
|
||||
SlotByChainSaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
OptionalParameters = { bStopAtHalfElevation = true, dExtendAfterTail = dExtendAfterTail, dPocketHeight = dPocketHeight, bOppositeToolDirection = true, bIsSplitFeature = bIsSplitFeature}
|
||||
FaceByChainsaw.Make( Proc, Part, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], OptionalParameters)
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
end
|
||||
@@ -235,8 +259,7 @@ function STR0004.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
|
||||
-- aggiunta eventuali lavorazioni splittate
|
||||
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
||||
if #FeatureSplittingPoints > 0 then
|
||||
if bIsSplitFeature then
|
||||
Chainsaw.Result.Sorted = MachiningLib.GetSplitMachinings( Chainsaw.Result.Sorted, FeatureSplittingPoints, Part)
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
-- 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 FaceByBlade = require( 'FACEBYBLADE')
|
||||
|
||||
-- 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 = {}
|
||||
|
||||
-- estensione oltre la coda
|
||||
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 dMRRBlade = 0
|
||||
|
||||
if bFeatureHindersClamping or bLeaveWasteAttached then
|
||||
-- TODO valutare se estrapolare in funzione a sè stante in StrategyLibs
|
||||
-- TODO verificare funzionamento con lama da sotto
|
||||
-- attenzione perchè se l'inclinazione della faccia la fa finire oltre lo spigolo questo riduce il massimo (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)
|
||||
|
||||
local Cutting1 = {}
|
||||
local Cutting2 = {}
|
||||
|
||||
-- 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
|
||||
|
||||
-- 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, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail}
|
||||
Cutting1 = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgesSorted[1], OptionalParameters)
|
||||
Blade.AddResult( Cutting1)
|
||||
-- secondo lato
|
||||
Cutting2 = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgesSorted[2], OptionalParameters)
|
||||
Blade.AddResult( Cutting2)
|
||||
|
||||
-- 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)
|
||||
|
||||
-- parametri per il calcolo della velocità di asportazione
|
||||
MRRParameters1 = {
|
||||
dStep = TOOLS[Cutting1.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting1.nToolIndex].dSideStep, dDepthToMachine),
|
||||
dFeed = TOOLS[Cutting1.nToolIndex].Feeds.dFeed}
|
||||
|
||||
MRRParameters2 = {
|
||||
dStep = TOOLS[Cutting2.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting2.nToolIndex].dSideStep, dDepthToMachine),
|
||||
dFeed = TOOLS[Cutting2.nToolIndex].Feeds.dFeed}
|
||||
|
||||
local dMRRBlade1 = MachiningLib.GetToolMRR( MRRParameters1)
|
||||
local dMRRBlade2 = MachiningLib.GetToolMRR( MRRParameters2)
|
||||
dMRRBlade = ( dMRRBlade1 + dMRRBlade2) / 2
|
||||
|
||||
Cutting = Cutting2
|
||||
-- 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
|
||||
-- TODO calcolo migliore area lavorata; se ho il codolo ha senso l'incompleta? se incompleta con codolo faccio i cubetti??
|
||||
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')
|
||||
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
|
||||
@@ -7,7 +7,7 @@
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
local StrategyLib = require( 'StrategyLib')
|
||||
local SPLITCUT = require( 'SPLITCUT')
|
||||
local DiceCut = require( 'DiceCut')
|
||||
|
||||
-- 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
|
||||
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
|
||||
else
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
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
|
||||
else
|
||||
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
|
||||
if Strategy.bSplit then
|
||||
Strategy.dOffset = 0
|
||||
MachiningsToAdd = StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
-- se devo rimuovere tutto il restante
|
||||
else
|
||||
-- se abilitato, faccio tagli di PRECUT a zero (come SPLIT)
|
||||
if Strategy.Parameters.bExecutePreCut then
|
||||
Strategy.dOffset = Part.dRestLength
|
||||
MachiningsToAdd = StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
MachiningsToAdd = SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
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 Face1 = {}
|
||||
local Face2 = {}
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
STR0001 = Tenone a coda di rondine. Lama + fresa a coda di rondine
|
||||
STR0002 = Topologia tipo LapJoint. Svuotatura con fresa
|
||||
STR0003 = Topologia tipo LapJoint. Lama + motosega
|
||||
STR0004 = Topologia tipo LapJoint. Motosega
|
||||
STR0005 = Faccia singola o doppia. Lama, se necessario cubetti.
|
||||
|
||||
[Strategies]
|
||||
; Processing , Gruppo , Topologia , Strategie
|
||||
;Feature : Cut
|
||||
10,1,Feature,
|
||||
10,1,Feature,STR0005
|
||||
;Feature : Longitudinal Cut
|
||||
10,0,Feature,
|
||||
;Feature : Double Cut
|
||||
|
||||
@@ -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
|
||||
@@ -1,4 +1,4 @@
|
||||
-- Strategia: SLOTBYBLADE
|
||||
-- Strategia: FACEBYBLADE
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione delle slot o tasche con lama
|
||||
-- Feature: tipo lapjoint
|
||||
@@ -9,7 +9,7 @@ local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local SLOTBYBLADE = {}
|
||||
local FACEBYBLADE = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -31,12 +31,12 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
|
||||
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
|
||||
if AreSameVectorApprox( Machining.vtToolDirection, EdgeToMachine.vtN) then
|
||||
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC - Machining.dRadialOffset
|
||||
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC - Machining.dRadialOffset
|
||||
else
|
||||
LeadIn.dPerpDistance = BeamData.CUT_SIC
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC
|
||||
LeadIn.dPerpDistance = BeamData.CUT_SIC - Machining.dRadialOffset
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC - Machining.dRadialOffset
|
||||
end
|
||||
LeadIn.dElevation = 0
|
||||
LeadOut.dElevation = 0
|
||||
@@ -84,13 +84,13 @@ end
|
||||
|
||||
|
||||
-- TODO calcolo area lavorata per completamento
|
||||
function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
local Cutting = {}
|
||||
Cutting.bIsApplicable = true
|
||||
Cutting.dDepthToMachine = 0
|
||||
Cutting.sMessage = ''
|
||||
Cutting.idProc = Proc.id
|
||||
Cutting.dResidualDepth = abs( EdgeToMachine.dElevation)
|
||||
Cutting.dResidualDepth = EdgeToMachine.dElevation
|
||||
Cutting.dBladeMarkLength = 0
|
||||
Cutting.sEdgeType = EdgeToMachine.sType
|
||||
Cutting.nFeatureSegment = 1
|
||||
@@ -101,39 +101,47 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
local bForceLongcutBlade = OptionalParameters.bForceLongcutBlade or false
|
||||
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
|
||||
local sDepth = OptionalParameters.sDepth or 0
|
||||
local nToolIndex = OptionalParameters.nToolIndex
|
||||
local dLongitudinalOffset = OptionalParameters.dLongitudinalOffset or 0
|
||||
if OptionalParameters.dPocketHeight then
|
||||
dLongitudinalOffset = 0
|
||||
end
|
||||
local sUserNotes = OptionalParameters.sUserNotes or ''
|
||||
|
||||
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato
|
||||
Cutting.dLengthToMachine = EdgeToMachine.dLength
|
||||
Cutting.dLengthOnX = abs( EdgeToMachine.dLength * EdgeToMachine.vtToolDirection:getY())
|
||||
Cutting.dEdgeLength = EdgeToMachine.dLength
|
||||
Cutting.ptEdge1, _, Cutting.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT)
|
||||
Cutting.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
if EdgeToMachine.bIsOpen then
|
||||
Cutting.vtEdgeDirection = -EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
|
||||
if bOppositeToolDirection then
|
||||
Cutting.vtToolDirection = -EdgeToMachine.vtN
|
||||
else
|
||||
Cutting.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
|
||||
end
|
||||
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
|
||||
else
|
||||
if FaceToMachine.sType == 'Long' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
|
||||
elseif FaceToMachine.sType == 'Side' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
|
||||
end
|
||||
Cutting.vtToolDirection = EdgeToMachine.vtN
|
||||
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
|
||||
local ToolSearchParameters = {}
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation)
|
||||
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade
|
||||
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
Cutting.nToolIndex = ToolInfo.nToolIndex
|
||||
if nToolIndex then
|
||||
Cutting.nToolIndex = nToolIndex
|
||||
else
|
||||
local ToolSearchParameters = {}
|
||||
ToolSearchParameters.dElevation = dDepthToMachine
|
||||
ToolSearchParameters.vtToolDirection = Cutting.vtToolDirection
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
-- TODO bisognerà implementare anche la lama da sotto
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
ToolSearchParameters.bForceLongcutBlade = bForceLongcutBlade
|
||||
local ToolInfo = MachiningLib.FindBlade( Proc, ToolSearchParameters)
|
||||
Cutting.nToolIndex = ToolInfo.nToolIndex
|
||||
end
|
||||
Cutting.nType = MCH_OY.MILLING
|
||||
if not TOOLS[Cutting.nToolIndex].sName then
|
||||
Cutting.sMessage = 'Blade not found'
|
||||
@@ -144,13 +152,13 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- 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.bIsApplicable = false
|
||||
EgtOutLog( Cutting.sMessage)
|
||||
return Cutting, EdgeToMachine.dElevation
|
||||
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
|
||||
if TOOLS[Cutting.nToolIndex].dDiameter > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
|
||||
Cutting.sMessage = 'Pocket too narrow for blade diameter'
|
||||
@@ -161,8 +169,8 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
|
||||
-- parametri della lavorazione
|
||||
-- profondità (parametro DEPTH) non usata
|
||||
Cutting.sDepth = 0
|
||||
-- profondità (parametro DEPTH)
|
||||
Cutting.sDepth = sDepth
|
||||
-- inizio e fine aperti o chiusi
|
||||
Cutting.bIsStartClosed = not EdgeToMachine.bIsStartOpen
|
||||
Cutting.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
||||
@@ -174,7 +182,7 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.nWorkside = MCH_MILL_WS.LEFT
|
||||
Cutting.bInvert = false
|
||||
end
|
||||
if EdgeToMachine.dElevation < -10 * GEO.EPS_SMALL then
|
||||
if bOppositeToolDirection then
|
||||
Cutting.bInvert = not Cutting.bInvert
|
||||
end
|
||||
-- TODO gestire lama da sotto e lama downUp
|
||||
@@ -185,22 +193,22 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.bToolInvert = false
|
||||
end
|
||||
-- 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
|
||||
Cutting.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
||||
Cutting.dDepthToMachine = dDepthToMachine
|
||||
Cutting.dResidualDepth = 0
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Cutting.dRadialOffset = 0
|
||||
if bOppositeToolDirection then
|
||||
Cutting.dRadialOffset = -dDepthToMachine
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
|
||||
end
|
||||
else
|
||||
Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1
|
||||
Cutting.dResidualDepth = abs( EdgeToMachine.dElevation) - Cutting.dDepthToMachine
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
|
||||
else
|
||||
Cutting.dResidualDepth = EdgeToMachine.dElevation - Cutting.dDepthToMachine
|
||||
if bOppositeToolDirection then
|
||||
Cutting.dRadialOffset = -Cutting.dDepthToMachine
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
|
||||
end
|
||||
end
|
||||
-- completamento
|
||||
@@ -212,20 +220,20 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
if Cutting.bToolInvert and Cutting.Steps.nCount > 1 then
|
||||
Cutting.dLongitudinalOffset = - dPocketHeight
|
||||
else
|
||||
Cutting.dLongitudinalOffset = 0
|
||||
Cutting.dLongitudinalOffset = dLongitudinalOffset
|
||||
end
|
||||
-- distanza di sicurezza
|
||||
Cutting.dStartSafetyLength = 10
|
||||
-- overlap
|
||||
Cutting.dOverlap = 0
|
||||
-- faceuse
|
||||
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then
|
||||
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( EdgeToMachine.vtToolDirection)
|
||||
if bOppositeToolDirection then
|
||||
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( -Cutting.vtToolDirection)
|
||||
else
|
||||
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( -EdgeToMachine.vtToolDirection)
|
||||
Cutting.nFaceuse = BeamLib.GetNearestOrthoOpposite( Cutting.vtToolDirection)
|
||||
end
|
||||
-- SCC
|
||||
Cutting.nSCC = GetSCC( EdgeToMachine.vtToolDirection)
|
||||
Cutting.nSCC = GetSCC( Cutting.vtToolDirection)
|
||||
-- asse bloccato
|
||||
Cutting.sBlockedAxis = BeamLib.GetBlockedAxis( Cutting.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN, EgtIf( FaceToMachine.vtN:getX() > 0, X_AX(), -X_AX()))
|
||||
-- approccio e retrazione
|
||||
@@ -247,27 +255,34 @@ function SLOTBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.dBladeMarkLength = abs( Cutting.LeadOut.dEndAddLength)
|
||||
end
|
||||
-- geometria
|
||||
Cutting.Geometry = {{Proc.id, FaceToMachine.id}}
|
||||
Cutting.Geometry = {{Cutting.idProc, FaceToMachine.id}}
|
||||
-- note utente
|
||||
Cutting.sUserNotes = sUserNotes
|
||||
-- nome operazione
|
||||
Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
|
||||
|
||||
-- se lavorazione aperta sulla coda, eventuali aggiustamenti
|
||||
-- TODO valutare se fare funzione a parte
|
||||
if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( EdgeToMachine.vtToolDirection:getX() < 10 * GEO.EPS_SMALL)) 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 dAddLengthLeftSide = Cutting.LeadOut.dEndAddLength
|
||||
local dAddLengthToReduce = sqrt( Cutting.dDepthToMachine * TOOLS[Cutting.nToolIndex].dDiameter - Cutting.dDepthToMachine * Cutting.dDepthToMachine)
|
||||
if bStartLeft then
|
||||
dAddLengthLeftSide = Cutting.LeadIn.dStartAddLength
|
||||
end
|
||||
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then
|
||||
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtN, Y_AX()) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
else
|
||||
Cutting.bIsApplicable = false
|
||||
end
|
||||
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
|
||||
if MachiningLib.CanMoveAfterSplitcut( Cutting.dLengthOnX, Part) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Cutting.sStage = 'AfterTail'
|
||||
else
|
||||
if bStartLeft then
|
||||
@@ -285,4 +300,4 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return SLOTBYBLADE
|
||||
return FACEBYBLADE
|
||||
@@ -1,4 +1,4 @@
|
||||
-- Strategia: SLOTBYCHAINSAW
|
||||
-- Strategia: FACEBYCHAINSAW
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione delle slot o tasche con sega a catena
|
||||
-- Feature: tipo lapjoint
|
||||
@@ -9,7 +9,7 @@ local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local SLOTBYCHAINSAW = {}
|
||||
local FACEBYCHAINSAW = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,11 +48,11 @@ end
|
||||
|
||||
|
||||
-- TODO calcolo area lavorata per completamento
|
||||
function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
function FACEBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
local Mortising = {}
|
||||
Mortising.bIsApplicable = true
|
||||
Mortising.dDepthToMachine = 0
|
||||
Mortising.dResidualDepth = abs( EdgeToMachine.dElevation)
|
||||
Mortising.dResidualDepth = EdgeToMachine.dElevation
|
||||
Mortising.sMessage = ''
|
||||
Mortising.idProc = Proc.id
|
||||
Mortising.sEdgeType = EdgeToMachine.sType
|
||||
@@ -65,33 +65,27 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
local bUseZigZagMortising = OptionalParameters.bUseZigZagMortising or false
|
||||
local sSideToMachine = OptionalParameters.sSideToMachine or ''
|
||||
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 dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
|
||||
local dPocketHeight = OptionalParameters.dPocketHeight or 0
|
||||
local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false
|
||||
local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false
|
||||
local sDepth = OptionalParameters.sDepth or 'TH'
|
||||
|
||||
-- lunghezze e punti caratteristici della lavorazione e del lato lavorato
|
||||
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.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -EdgeToMachine.vtToolDirection, GDB_ID.ROOT)
|
||||
Mortising.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
if EdgeToMachine.bIsOpen then
|
||||
Mortising.vtEdgeDirection = -EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
|
||||
if bOppositeToolDirection then
|
||||
Mortising.vtToolDirection = -EdgeToMachine.vtN
|
||||
else
|
||||
Mortising.vtEdgeDirection = EdgeToMachine.vtToolDirection ^ FaceToMachine.vtN
|
||||
end
|
||||
|
||||
-- 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
|
||||
if FaceToMachine.sType == 'Long' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
|
||||
elseif FaceToMachine.sType == 'Side' then
|
||||
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
|
||||
end
|
||||
Mortising.vtToolDirection = EdgeToMachine.vtN
|
||||
end
|
||||
Mortising.vtEdgeDirection = EdgeToMachine.vtN ^ FaceToMachine.vtN
|
||||
Mortising.ptEdge1, _, Mortising.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Mortising.vtToolDirection, GDB_ID.ROOT)
|
||||
|
||||
-- ricerca utensile
|
||||
local bExtendWithCornerRadius = false
|
||||
@@ -100,17 +94,17 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
( EdgeToMachine.sType == 'Opposite' and Proc.Topology.sFamily == 'Tunnel') then
|
||||
|
||||
bExtendWithCornerRadius = true
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
Mortising.dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA
|
||||
else
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
||||
Mortising.dDepthToMachine = EdgeToMachine.dElevation
|
||||
end
|
||||
else
|
||||
bExtendWithCornerRadius = true
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
Mortising.dDepthToMachine = EdgeToMachine.dElevation / 2 + BeamData.CUT_EXTRA_MIN
|
||||
end
|
||||
local ToolSearchParameters = {}
|
||||
local ToolInfo = {}
|
||||
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
ToolSearchParameters.vtToolDirection = Mortising.vtToolDirection
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = true
|
||||
ToolSearchParameters.dElevation = Mortising.dDepthToMachine
|
||||
@@ -127,13 +121,13 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- 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.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising
|
||||
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
|
||||
if TOOLS[Mortising.nToolIndex].dWidth > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
|
||||
Mortising.sMessage = 'Pocket too narrow for chainsaw width'
|
||||
@@ -152,12 +146,12 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
Mortising.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
||||
-- lato di lavoro e inversioni
|
||||
Mortising.bInvert = false
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
Mortising.nWorkside = MCH_MILL_WS.RIGHT
|
||||
Mortising.bToolInvert = false
|
||||
else
|
||||
if bOppositeToolDirection then
|
||||
Mortising.nWorkside = MCH_MILL_WS.LEFT
|
||||
Mortising.bToolInvert = true
|
||||
else
|
||||
Mortising.nWorkside = MCH_MILL_WS.RIGHT
|
||||
Mortising.bToolInvert = false
|
||||
end
|
||||
-- profondità e offset longitudinale
|
||||
if bExtendWithCornerRadius then
|
||||
@@ -165,19 +159,19 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
end
|
||||
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dResidualDepth = 0
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL 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
|
||||
if bOppositeToolDirection then
|
||||
Mortising.dLongitudinalOffset = EdgeToMachine.dElevation - Mortising.dDepthToMachine
|
||||
else
|
||||
Mortising.dLongitudinalOffset = 0
|
||||
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) .. ')'
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
end
|
||||
@@ -202,21 +196,21 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
end
|
||||
Mortising.Steps.dStep = TOOLS[Mortising.nToolIndex].dStep
|
||||
-- faceuse
|
||||
if EdgeToMachine.dElevation > - 10 * GEO.EPS_SMALL then
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( EdgeToMachine.vtToolDirection)
|
||||
if bOppositeToolDirection then
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -Mortising.vtToolDirection)
|
||||
else
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( -EdgeToMachine.vtToolDirection)
|
||||
Mortising.nFaceuse = BeamLib.GetNearestParalOpposite( Mortising.vtToolDirection)
|
||||
end
|
||||
-- SCC
|
||||
Mortising.SCC = MCH_SCC.NONE
|
||||
-- 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
|
||||
Mortising.sBlockedAxis = BeamLib.GetBlockedAxis( Mortising.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 1)
|
||||
elseif EdgeToMachine.vtToolDirection:getZ() < 10 * GEO.EPS_SMALL then
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtN, 1)
|
||||
elseif EdgeToMachine.vtN:getZ() < 10 * GEO.EPS_SMALL then
|
||||
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
|
||||
-- approccio e retrazione
|
||||
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine, sSideToMachine, dLengthToMachine)
|
||||
@@ -229,20 +223,25 @@ function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, Optional
|
||||
|
||||
-- se lavorazione aperta sulla coda, eventuali aggiustamenti
|
||||
-- TODO valutare se fare funzione a parte
|
||||
if Proc.AffectedFaces.bLeft and ( EdgeToMachine.sType == 'Bottom' or ( EdgeToMachine.vtToolDirection:getX() < 10 * GEO.EPS_SMALL)) 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 dAddLengthLeftSide = Mortising.LeadOut.dEndAddLength
|
||||
if bStartLeft then
|
||||
dAddLengthLeftSide = Mortising.LeadIn.dStartAddLength
|
||||
end
|
||||
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtToolDirection, Y_AX()) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then
|
||||
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtN, Y_AX()) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Mortising.sStage = 'AfterTail'
|
||||
else
|
||||
Mortising.bIsApplicable = false
|
||||
end
|
||||
elseif dAddLengthLeftSide + TOOLS[Mortising.nToolIndex].dDiameter / 2 > dExtendAfterTail then
|
||||
if MachiningLib.CanMoveAfterSplitcut( Mortising.dLengthOnX, Part) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Mortising.sStage = 'AfterTail'
|
||||
else
|
||||
if bStartLeft then
|
||||
@@ -259,4 +258,4 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return SLOTBYCHAINSAW
|
||||
return FACEBYCHAINSAW
|
||||
@@ -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.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local StrategyLib = {}
|
||||
local SPLITCUT = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
@@ -14,14 +14,13 @@ local MachiningLib = require( 'MachiningLib')
|
||||
-- strategie di base
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
|
||||
EgtOutLog( ' StrategyLib started', 1)
|
||||
EgtOutLog( ' SPLITCUT started', 1)
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
---------------------- FUNZIONI DI SPLIT ------------------------------------------
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
StrategyLib.SplitStrategy = {}
|
||||
function StrategyLib.SplitStrategy.Get( Proc, Part, OptionalParameters)
|
||||
function SPLITCUT.GetStrategy( Proc, Part, OptionalParameters)
|
||||
local Machining = {}
|
||||
local Result = {}
|
||||
-- sTypeMachining = BladeSideSingle\ BladeSideDouble\ BladeHorizontalSingle\ BladeHorizontalDouble\ ChainSawHorizontal\ ChainSawSideSingle\ ChainSawSideDouble\ ChainSawPlusBlade\ Mill\ None
|
||||
@@ -183,10 +182,10 @@ function StrategyLib.SplitStrategy.Get( Proc, Part, OptionalParameters)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, vtEdge)
|
||||
function SPLITCUT.GetEdgeToMachine( Proc, vtEdge)
|
||||
local Edge
|
||||
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]
|
||||
end
|
||||
end
|
||||
@@ -194,7 +193,7 @@ function StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, vtEdge)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
function SPLITCUT.CalculateLeadInOut( EdgeToMachine)
|
||||
|
||||
local LeadIn = {}
|
||||
local LeadOut = {}
|
||||
@@ -204,14 +203,8 @@ function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
-- elevazione sempre in negativo
|
||||
if EdgeToMachine.Elev < 10 * GEO.EPS_SMALL then
|
||||
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.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC + EdgeToMachine.dElevation
|
||||
LeadIn.dElevation = 0
|
||||
LeadOut.dElevation = 0
|
||||
LeadIn.dCompLength = 0
|
||||
@@ -223,7 +216,7 @@ function StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
local Machinings = {}
|
||||
|
||||
-- applico le lavorazioni
|
||||
@@ -234,17 +227,13 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
Machining.AuxiliaryData = {}
|
||||
local OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Y_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Y_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
@@ -255,16 +244,12 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
local OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
-- Taglio lato frontale
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_BACK
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;')
|
||||
|
||||
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Y_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Y_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
|
||||
-- Taglio lato dietro
|
||||
@@ -273,18 +258,14 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
Machining.AuxiliaryData = {}
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_FRONT
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dRadialOffset = ( Part.dWidth - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Y_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Y_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalSingle' then
|
||||
@@ -293,39 +274,31 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
Machining.AuxiliaryData = {}
|
||||
local OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_DOWN
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dRadialOffset = -BeamData.CUT_EXTRA
|
||||
OptionalParameters.dDepthToMachine = Part.dHeight + BeamData.CUT_EXTRA
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Z_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Z_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'BladeHorizontalDouble' then
|
||||
-- Taglio lato frontale
|
||||
local Machining = {}
|
||||
Machining.Splitting = {}
|
||||
Machining.AuxiliaryData = {}
|
||||
local OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
-- Taglio lato frontale
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_DOWN
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
local dExtraMaxMat = ( Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - Part.dHeight - BeamData.CUT_EXTRA) / 2
|
||||
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + dExtraMaxMat
|
||||
local dExtraMaxMat = ( Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop + Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - Part.dHeight - BeamData.CUT_EXTRA_MIN) / 2
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[1].ToolInfo.dMaxMatBladeFromTop - dExtraMaxMat
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;')
|
||||
|
||||
|
||||
local EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, Z_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Z_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
|
||||
-- Taglio lato dietro
|
||||
@@ -334,18 +307,14 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
Machining.AuxiliaryData = {}
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[2].ToolInfo.nToolIndex
|
||||
OptionalParameters.nFaceuse = MCH_MILL_FU.ORTHO_TOP
|
||||
OptionalParameters.sDepth = 0
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dRadialOffset = Part.dHeight - Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown + dExtraMaxMat
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - dExtraMaxMat
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
EdgeToMachine = StrategyLib.SplitStrategy.GetEdgeToMachine( Proc, -Z_AX())
|
||||
-- approccio e retrazione
|
||||
OptionalParameters.LeadIn, OptionalParameters.LeadOut = StrategyLib.SplitStrategy.CalculateLeadInOut( EdgeToMachine)
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1].id, EdgeToMachine, OptionalParameters)
|
||||
EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Z_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
table.insert( Machinings, Machining)
|
||||
----------------------------------------------------------------------------------
|
||||
elseif Strategy.SplitStrategy.sTypeMachining == 'ChainSawHorizontal' then
|
||||
@@ -365,4 +334,4 @@ function StrategyLib.SplitStrategy.Execute( Proc, Part, Strategy)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return StrategyLib
|
||||
return SPLITCUT
|
||||
Reference in New Issue
Block a user