Merge branch 'STR0005_MultipleFaces' into develop
This commit is contained in:
@@ -199,6 +199,7 @@ end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
-- funzione per cercare utensile tipo FRESA con certe caratteristiche
|
||||
-- TODO qui vtToolDirection è in realtà vtN
|
||||
function MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
local ToolInfo = {}
|
||||
|
||||
@@ -541,12 +542,14 @@ function MachiningLib.AddMachinings( Proc, Machining, AuxiliaryData)
|
||||
local dOriginalLeadOutPerpDistance = Machining.LeadOut.dPerpDistance
|
||||
for i = 1, Machining.CloneStepsHorizontal.nCount do
|
||||
AuxiliaryData.Clones[i] = {}
|
||||
AuxiliaryData.Clones[i].LeadIn = {}
|
||||
AuxiliaryData.Clones[i].LeadOut = {}
|
||||
AuxiliaryData.Clones[i].dRadialOffset = dOriginalRadialOffset + Machining.CloneStepsHorizontal.dStep * ( Machining.CloneStepsHorizontal.nCount - i)
|
||||
-- update distanza perpendicolare attacco per contemplare l'offset applicato
|
||||
AuxiliaryData.Clones[i].LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
AuxiliaryData.Clones[i].LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
if abs( dOriginalLeadInPerpDistance) > 10 * GEO.EPS_SMALL and abs( dOriginalLeadOutPerpDistance) > 10 * GEO.EPS_SMALL then
|
||||
AuxiliaryData.Clones[i].LeadIn = {}
|
||||
AuxiliaryData.Clones[i].LeadOut = {}
|
||||
AuxiliaryData.Clones[i].LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
AuxiliaryData.Clones[i].LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - AuxiliaryData.Clones[i].dRadialOffset + dOriginalRadialOffset
|
||||
end
|
||||
end
|
||||
elseif Machining.CloneStepsVertical and Machining.CloneStepsVertical.nCount > 1 then
|
||||
if not AuxiliaryData then
|
||||
|
||||
@@ -240,7 +240,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
if Strategy.SplitStrategy.sTypeMachining == 'BladeSideSingle' then
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
@@ -254,7 +254,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
@@ -269,7 +269,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
AuxiliaryData = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
@@ -282,7 +282,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
OptionalParameters = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Part.dHeight + BeamData.CUT_EXTRA
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
@@ -297,7 +297,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
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
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
@@ -312,7 +312,7 @@ function HEADCUT.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
AuxiliaryData = {}
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[2].ToolInfo.nToolIndex
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - dExtraMaxMat
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
-- TODO gestire lavorazione a cubetti
|
||||
|
||||
|
||||
@@ -114,7 +114,9 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
-- se arrivati qui non è stata ancora applicata alcuna lavorazione, si prova la lavorazione con codolo
|
||||
if #Blade.Result == 0 and not bKeepWasteAttached then
|
||||
local BladeKeepWasteResult
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dStripWidth = Strategy.Parameters.dStripWidth}
|
||||
local OptionalParameters = { dExtendAfterTail = dExtendAfterTail, dStripWidth = Strategy.Parameters.dStripWidth,
|
||||
dMillingOffsetFromSide = Strategy.Parameters.dMillingOffsetFromSide
|
||||
}
|
||||
Blade.Result, BladeKeepWasteResult = BladeKeepWaste.Make( Proc, Part, OptionalParameters)
|
||||
dMRRBlade = BladeKeepWasteResult.dMRR
|
||||
dCompletionPercentage = BladeKeepWasteResult.dCompletionPercentage
|
||||
@@ -164,6 +166,7 @@ function STR0005.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
end
|
||||
-- TODO migliorare calcolo area lavorata; se ho il codolo ha senso l'incompleta? se incompleta con codolo faccio i cubetti??
|
||||
-- TODO settare che il codolo restituisce incompleta tranne quando è forzato
|
||||
if nIsApplicableCount > 0 then
|
||||
if dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
|
||||
@@ -19,7 +19,9 @@ local STR0005Data = {
|
||||
{ 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'},
|
||||
{ sName = 'dMinZAngleTopBlade', sNameNge = 'MIN_Z_ANGLE_TOP_BLADE', sValue = '', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'dMaxYAngleTopBlade', sNameNge = 'MAX_Y_ANGLE_TOP_BLADE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
|
||||
{ sName = 'dMaxYAngleTopBlade', sNameNge = 'MAX_Y_ANGLE_TOP_BLADE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'bFinishWithMill', sNameNge = 'ALLOW_FINISH_MILL', sValue = '1', sDescriptionShort = 'Clean blade radius with mill', sDescriptionLong = 'Clean blade radius with mill', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'dMillingOffsetFromSide', sNameNge = 'MILLING_OFFSET_SIDE', sValue = '1', sDescriptionShort = '', sDescriptionLong = '', sType = 'd', sMessageId = '', sMinUserLevel = '1'}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ local FaceData = require( 'FaceData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
-- strategie di base
|
||||
local FaceByBlade = require('FACEBYBLADE')
|
||||
local FaceByMill = require('FACEBYMILL')
|
||||
|
||||
-- tabella per definizione modulo
|
||||
|
||||
local Machinings = {}
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function CompareEdges( EdgeA, EdgeB)
|
||||
-- prima i lati orientati lungo X
|
||||
@@ -56,23 +57,30 @@ local function SortMachiningsBySegment( MachiningA, MachiningB)
|
||||
return false
|
||||
elseif MachiningB.nFeatureSegment > MachiningA.nFeatureSegment then
|
||||
return true
|
||||
-- se segmento uguale, si minimizzano i cambi di lato
|
||||
-- se segmento uguale, si guarda la priorità
|
||||
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
|
||||
if MachiningA.nInternalSortingPriority > MachiningB.nInternalSortingPriority then
|
||||
return false
|
||||
elseif MachiningB.nInternalSortingPriority > MachiningA.nInternalSortingPriority then
|
||||
return true
|
||||
-- se priorità 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
|
||||
end
|
||||
@@ -84,8 +92,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
-- 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 Result = {}
|
||||
local Blade = {}
|
||||
Blade.Result = {}
|
||||
Machinings = {}
|
||||
local CreatedMachinings = {}
|
||||
local Cutting1 = {}
|
||||
local Cutting2 = {}
|
||||
|
||||
@@ -108,16 +116,30 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
end
|
||||
end
|
||||
|
||||
-- parametri opzionali e default
|
||||
if not OptionalParameters then
|
||||
OptionalParameters = {}
|
||||
end
|
||||
local nToolIndex = OptionalParameters.nToolIndex
|
||||
local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
|
||||
local bFinishWithMill
|
||||
if OptionalParameters.bFinishWithMill == nil then
|
||||
bFinishWithMill = true
|
||||
else
|
||||
bFinishWithMill = OptionalParameters.bFinishWithMill
|
||||
end
|
||||
local dMillingOffsetFromSide = OptionalParameters.dMillingOffsetFromSide or 1
|
||||
|
||||
-- si trovano le facce da lavorare
|
||||
local FaceToMachine = {}
|
||||
local BottomFace = {}
|
||||
local LongFaces = {}
|
||||
if Proc.nFct == 1 then
|
||||
FaceToMachine = Proc.Faces[1]
|
||||
BottomFace = Proc.Faces[1]
|
||||
else
|
||||
if not Proc.MainFaces then
|
||||
Proc.MainFaces = FaceData.GetMainFaces( Proc, Part)
|
||||
end
|
||||
FaceToMachine = Proc.MainFaces.BottomFaces[1]
|
||||
BottomFace = Proc.MainFaces.BottomFaces[1]
|
||||
LongFaces = Proc.MainFaces.LongFaces
|
||||
end
|
||||
|
||||
@@ -125,8 +147,8 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
-- si trova il lato da lavorare
|
||||
local EdgeToMachine = {}
|
||||
local EdgesSorted = {}
|
||||
for i = 1, #FaceToMachine.Edges do
|
||||
table.insert( EdgesSorted, FaceToMachine.Edges[i])
|
||||
for i = 1, #BottomFace.Edges do
|
||||
table.insert( EdgesSorted, BottomFace.Edges[i])
|
||||
end
|
||||
table.sort( EdgesSorted, CompareEdges)
|
||||
EdgeToMachine = EdgesSorted[1]
|
||||
@@ -141,27 +163,43 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
end
|
||||
|
||||
-- calcolo lavorazioni
|
||||
-- taglio eventuali facce di chiusura
|
||||
for i = 1, #LongFaces do
|
||||
local Cutting = {}
|
||||
local OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
|
||||
Cutting = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[i], Proc.MainFaces.LongFaces[i].MainEdges.BottomEdge, OptionalParametersFaceByBlade)
|
||||
Cutting.nInternalSortingPriority = 1
|
||||
table.insert( CreatedMachinings, Cutting)
|
||||
end
|
||||
-- faccia di fondo
|
||||
-- primo lato
|
||||
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = OptionalParameters.dExtendAfterTail}
|
||||
Cutting1 = FaceByBlade.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
table.insert( Blade.Result, Cutting1)
|
||||
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine, bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail, nToolIndex = nToolIndex}
|
||||
Cutting1 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
Cutting1.nInternalSortingPriority = 3
|
||||
table.insert( CreatedMachinings, Cutting1)
|
||||
-- secondo lato
|
||||
OptionalParametersFaceByBlade.bOppositeToolDirection = true
|
||||
Cutting2 = FaceByBlade.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
table.insert( Blade.Result, Cutting2)
|
||||
-- eventuali facce di chiusura
|
||||
for i = 1, #LongFaces do
|
||||
local CuttingLongFace = {}
|
||||
OptionalParametersFaceByBlade = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = OptionalParameters.dExtendAfterTail}
|
||||
CuttingLongFace = FaceByBlade.Make( Proc, Part, Proc.MainFaces.LongFaces[i], Proc.MainFaces.LongFaces[i].MainEdges.BottomEdge, OptionalParametersFaceByBlade)
|
||||
table.insert( Blade.Result, CuttingLongFace)
|
||||
Cutting2 = FaceByBlade.Make( Proc, Part, BottomFace, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
Cutting2.nInternalSortingPriority = 3
|
||||
table.insert( CreatedMachinings, Cutting2)
|
||||
-- eventuale pulitura raggio lama
|
||||
if bFinishWithMill then
|
||||
for i = 1, #LongFaces do
|
||||
local dDepthToMachineMill = BottomFace.MainEdges.LongEdges[i].dElevation - dMillingOffsetFromSide
|
||||
local dBladeMarkLength = max( Cutting1.dBladeMarkLength, Cutting2.dBladeMarkLength)
|
||||
local OptionalParametersFaceByMill = { bIsSplitFeature = bIsSplitFeature, dExtendAfterTail = dExtendAfterTail,
|
||||
dHorizontalStepSpan = dBladeMarkLength, dDepthToMachine = dDepthToMachineMill
|
||||
}
|
||||
local Milling = FaceByMill.Make( Proc, Part, BottomFace, BottomFace.MainEdges.LongEdges[i], OptionalParametersFaceByMill)
|
||||
Milling.nInternalSortingPriority = 2
|
||||
table.insert( CreatedMachinings, Milling)
|
||||
end
|
||||
end
|
||||
|
||||
-- lavorazioni raggruppate in unica lista
|
||||
local Machinings = {}
|
||||
for i = 1, #Blade.Result do
|
||||
if Blade.Result[i].bIsApplicable then
|
||||
table.insert( Machinings, Blade.Result[i])
|
||||
for i = 1, #CreatedMachinings do
|
||||
if CreatedMachinings[i].bIsApplicable then
|
||||
table.insert( Machinings, CreatedMachinings[i])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -175,7 +213,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
|
||||
-- calcolo parametri per la stima della velocità di asportazione
|
||||
-- TODO non è corretto: come si stima la velocità di asportazione con il codolo? è come se avesse rimosso tutto il volume feature nel tempo di percorrenza
|
||||
if Cutting1.bIsApplicable and Cutting2.bIsApplicable then
|
||||
if Cutting1.bIsApplicable or Cutting2.bIsApplicable then
|
||||
MRRParameters1 = {
|
||||
dStep = TOOLS[Cutting1.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting1.nToolIndex].dSideStep, dDepthToMachine),
|
||||
@@ -189,7 +227,7 @@ function BLADEKEEPWASTE.Make( Proc, Part, OptionalParameters)
|
||||
local dMRRBlade1 = MachiningLib.GetToolMRR( MRRParameters1)
|
||||
local dMRRBlade2 = MachiningLib.GetToolMRR( MRRParameters2)
|
||||
Result.dMRR = ( dMRRBlade1 + dMRRBlade2) / 2
|
||||
Result.dCompletionPercentage = Cutting2.dCompletionPercentage
|
||||
Result.dCompletionPercentage = 0.5 * Cutting1.dCompletionPercentage + 0.5 * Cutting2.dCompletionPercentage
|
||||
if Result.dCompletionPercentage > 100 - 10 * GEO.EPS_SMALL then
|
||||
Result.sStatus = 'Completed'
|
||||
else
|
||||
|
||||
@@ -476,7 +476,7 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters)
|
||||
local dDepthToMachine = EdgeToMachine.dElevation + BeamData.CUT_EXTRA
|
||||
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine,
|
||||
nToolIndex = nToolIndex,
|
||||
bDisableHorizontalSteps = true,
|
||||
dHorizontalStepSpan = 0,
|
||||
dExtendAfterTail = dExtendAfterTail
|
||||
}
|
||||
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
@@ -516,7 +516,7 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters)
|
||||
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine,
|
||||
nToolIndex = nToolIndex,
|
||||
EdgeToMachineAlternative = EdgeToMachineAlternative,
|
||||
bDisableHorizontalSteps = true,
|
||||
dHorizontalStepSpan = 0,
|
||||
dExtendAfterTail = dExtendAfterTail
|
||||
}
|
||||
Cutting = FaceByBlade.Make( ProcTrimesh, Part, FaceToMachine, EdgeToMachine, OptionalParametersFaceByBlade)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
-- Strategia: FACEBYBLADE
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione delle slot o tasche con lama
|
||||
-- Feature: tipo lapjoint
|
||||
-- Strategia di base per la lavorazione delle facce con lama
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
@@ -20,7 +19,7 @@ local function GetLeadInOutType( Machining)
|
||||
else
|
||||
-- testa sopra
|
||||
if TOOLS[Machining.nToolIndex].SetupInfo.HeadType.bTop then
|
||||
if Machining.vtToolDirection:getX() < 0.7 then
|
||||
if abs( Machining.vtToolDirection:getX()) < 0.7 then
|
||||
if Machining.vtToolDirection:getZ() > -0.087
|
||||
or abs( Machining.vtToolDirection:getX()) < 0.34202 then
|
||||
sLeadInOutType = 'Perpendicular'
|
||||
@@ -35,7 +34,7 @@ local function GetLeadInOutType( Machining)
|
||||
end
|
||||
-- testa sotto
|
||||
elseif TOOLS[Machining.nToolIndex].SetupInfo.HeadType.bBottom then
|
||||
if Machining.vtToolDirection:getX() < 0.7 then
|
||||
if abs( Machining.vtToolDirection:getX()) < 0.7 then
|
||||
if Machining.vtToolDirection:getZ() < -GEO.EPS_SMALL
|
||||
or abs( Machining.vtToolDirection:getX()) < 0.34202 then
|
||||
sLeadInOutType = 'Perpendicular'
|
||||
@@ -79,10 +78,9 @@ local function CalculateLeadInOut( Machining, EdgeToMachine, Part)
|
||||
LeadOut.dPerpDistance = 0
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
-- TODO da rimuovere controllo numero step quando si sistema la funzione che crea i cloni
|
||||
if Machining.bIsStartClosed
|
||||
or Machining.bIsEndClosed
|
||||
or Machining.CloneStepsHorizontal.nCount > 1 then
|
||||
or Machining.Steps.nCount > 1 then
|
||||
|
||||
Machining.sLeadInOutType = 'Perpendicular'
|
||||
if AreSameVectorApprox( Machining.vtToolDirection, EdgeToMachine.vtN) then
|
||||
@@ -172,13 +170,13 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
local dDepthToMachine = OptionalParameters.dDepthToMachine or EdgeToMachine.dElevation
|
||||
local bIsSplitFeature = OptionalParameters.bIsSplitFeature or false
|
||||
local bOppositeToolDirection = OptionalParameters.bOppositeToolDirection or false
|
||||
local bDisableHorizontalSteps = OptionalParameters.bDisableHorizontalSteps 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 dHorizontalStepSpan = OptionalParameters.dHorizontalStepSpan
|
||||
local dMinNzDownUp = OptionalParameters.dMinNzDownUp
|
||||
local sUserNotes = OptionalParameters.sUserNotes or ''
|
||||
|
||||
@@ -204,7 +202,6 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
end
|
||||
if dMinNzDownUp and FaceToMachine.vtN:getZ() < dMinNzDownUp then
|
||||
Cutting.bToolInvert = true
|
||||
Cutting.bInvert = not Cutting.bInvert
|
||||
else
|
||||
Cutting.bToolInvert = false
|
||||
end
|
||||
@@ -230,7 +227,6 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Cutting.vtToolDirection)
|
||||
if FaceToMachine.vtN:getZ() < dMinNzDownUp then
|
||||
Cutting.bToolInvert = true
|
||||
Cutting.bInvert = not Cutting.bInvert
|
||||
end
|
||||
end
|
||||
Cutting.nToolIndex = ToolInfo.nToolIndex
|
||||
@@ -282,8 +278,26 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.bInvert = not Cutting.bInvert
|
||||
end
|
||||
-- profondità da lavorare e offset radiale
|
||||
if TOOLS[Cutting.nToolIndex].dMaxDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
-- TODO la depth dovrebbe essere quella del machining
|
||||
if OptionalParameters.dPocketHeight then
|
||||
if TOOLS[Cutting.nToolIndex].dMaxDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
-- TODO la depth dovrebbe essere quella del machining
|
||||
Cutting.dDepthToMachine = dDepthToMachine
|
||||
Cutting.dResidualDepth = 0
|
||||
if bOppositeToolDirection then
|
||||
Cutting.dRadialOffset = -dDepthToMachine
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
|
||||
end
|
||||
else
|
||||
Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1
|
||||
Cutting.dResidualDepth = dDepthToMachine - Cutting.dDepthToMachine
|
||||
if bOppositeToolDirection then
|
||||
Cutting.dRadialOffset = -Cutting.dDepthToMachine
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
|
||||
end
|
||||
end
|
||||
else
|
||||
Cutting.dDepthToMachine = dDepthToMachine
|
||||
Cutting.dResidualDepth = 0
|
||||
if bOppositeToolDirection then
|
||||
@@ -291,14 +305,6 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
|
||||
end
|
||||
else
|
||||
Cutting.dDepthToMachine = TOOLS[Cutting.nToolIndex].dMaxDepth - 1
|
||||
Cutting.dResidualDepth = dDepthToMachine - Cutting.dDepthToMachine
|
||||
if bOppositeToolDirection then
|
||||
Cutting.dRadialOffset = -Cutting.dDepthToMachine
|
||||
else
|
||||
Cutting.dRadialOffset = EdgeToMachine.dElevation - Cutting.dDepthToMachine
|
||||
end
|
||||
end
|
||||
-- completamento
|
||||
Cutting.dCompletionPercentage = 100 - Cutting.dResidualDepth / Cutting.dDepthToMachine
|
||||
@@ -333,8 +339,11 @@ function FACEBYBLADE.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalPar
|
||||
Cutting.sBlockedAxis = BeamLib.GetBlockedAxis( Cutting.nToolIndex, 'perpendicular', Part.b3Raw, FaceToMachine.vtN, EgtIf( FaceToMachine.vtN:getX() > 0, X_AX(), -X_AX()))
|
||||
-- eventuale step orizzontale
|
||||
Cutting.CloneStepsHorizontal = {}
|
||||
if not bDisableHorizontalSteps and TOOLS[Cutting.nToolIndex].dSideStep then
|
||||
Cutting.CloneStepsHorizontal = MachiningLib.GetMachiningSteps( Cutting.dDepthToMachine, TOOLS[Cutting.nToolIndex].dSideStep)
|
||||
if not dHorizontalStepSpan then
|
||||
dHorizontalStepSpan = Cutting.dDepthToMachine
|
||||
end
|
||||
if dHorizontalStepSpan > 10 * GEO.EPS_SMALL and TOOLS[Cutting.nToolIndex].dSideStep then
|
||||
Cutting.CloneStepsHorizontal = MachiningLib.GetMachiningSteps( dHorizontalStepSpan, TOOLS[Cutting.nToolIndex].dSideStep)
|
||||
else
|
||||
Cutting.CloneStepsHorizontal.nCount = 1
|
||||
Cutting.CloneStepsHorizontal.dStep = 0
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
-- Strategia: FACEBYCHAINSAW
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione delle slot o tasche con sega a catena
|
||||
-- Feature: tipo lapjoint
|
||||
-- Strategia di base per la lavorazione delle facce con sega a catena
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
|
||||
@@ -0,0 +1,415 @@
|
||||
-- Strategia: FACEBYMILL
|
||||
-- Descrizione
|
||||
-- Strategia di base per la lavorazione delle facce con fresa
|
||||
|
||||
-- carico librerie
|
||||
local BeamLib = require( 'BeamLib')
|
||||
local BeamData = require( 'BeamData')
|
||||
local MachiningLib = require( 'MachiningLib')
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local FACEBYMILL = {}
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function GetLeadInOutType( Machining)
|
||||
local sLeadInOutType = ''
|
||||
|
||||
if Machining.bIsStartClosed or Machining.bIsEndClosed then
|
||||
sLeadInOutType = 'Perpendicular'
|
||||
else
|
||||
-- testa sopra
|
||||
if TOOLS[Machining.nToolIndex].SetupInfo.HeadType.bTop then
|
||||
if abs( Machining.vtToolDirection:getX()) < 0.7 then
|
||||
if Machining.vtToolDirection:getZ() > -0.087
|
||||
or abs( Machining.vtToolDirection:getX()) < 0.34202 then
|
||||
sLeadInOutType = 'Perpendicular'
|
||||
else
|
||||
sLeadInOutType = 'Tangent'
|
||||
end
|
||||
elseif abs( Machining.vtEdgeDirection:getZ()) < 0.7 then
|
||||
sLeadInOutType = 'Tangent'
|
||||
else
|
||||
-- TODO qui attacco tangenziale speciale tutto da un lato
|
||||
sLeadInOutType = 'Tangent'
|
||||
end
|
||||
-- testa sotto
|
||||
elseif TOOLS[Machining.nToolIndex].SetupInfo.HeadType.bBottom then
|
||||
if abs( Machining.vtToolDirection:getX()) < 0.7 then
|
||||
if Machining.vtToolDirection:getZ() < -GEO.EPS_SMALL
|
||||
or abs( Machining.vtToolDirection:getX()) < 0.34202 then
|
||||
sLeadInOutType = 'Perpendicular'
|
||||
else
|
||||
sLeadInOutType = 'Tangent'
|
||||
end
|
||||
elseif abs( Machining.vtEdgeDirection:getZ()) > 0.7 then
|
||||
sLeadInOutType = 'Tangent'
|
||||
else
|
||||
-- TODO qui attacco tangenziale speciale tutto da un lato
|
||||
sLeadInOutType = 'Tangent'
|
||||
end
|
||||
-- se testa senza preferenza Top e Bottom si fa sempre attacco tangenziale
|
||||
else
|
||||
sLeadInOutType = 'Tangent'
|
||||
end
|
||||
end
|
||||
|
||||
return sLeadInOutType
|
||||
end
|
||||
|
||||
|
||||
local function CalculateLeadInOut( Machining, EdgeToMachine, Part)
|
||||
-- TODO implementare le funzioni di Tool Collision Avoidance (vedi wiki e FacesBysaw -> CalcLeadInOutPerpGeom)
|
||||
|
||||
-- si determina l'eventuale riduzione da applicare in caso di inizio o fine chiusi
|
||||
local dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine)
|
||||
|
||||
if Machining.bInvert then
|
||||
Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed
|
||||
end
|
||||
|
||||
local LeadIn = {}
|
||||
local LeadOut = {}
|
||||
Machining.sLeadInOutType = ''
|
||||
LeadIn.dStartAddLength = 0
|
||||
LeadOut.dEndAddLength = 0
|
||||
LeadIn.nType = MCH_MILL_LI.LINEAR
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dPerpDistance = 0
|
||||
LeadOut.dPerpDistance = 0
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
if Machining.bIsStartClosed
|
||||
or Machining.bIsEndClosed
|
||||
or Machining.Steps.nCount > 1 then
|
||||
|
||||
Machining.sLeadInOutType = 'Perpendicular'
|
||||
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 - Machining.dRadialOffset
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC - Machining.dRadialOffset
|
||||
end
|
||||
else
|
||||
Machining.sLeadInOutType = GetLeadInOutType( Machining)
|
||||
if Machining.sLeadInOutType == 'Perpendicular' then
|
||||
LeadIn.dPerpDistance = 1
|
||||
LeadOut.dPerpDistance = 1
|
||||
else
|
||||
LeadIn.dTangentDistance = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
LeadOut.dTangentDistance = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
end
|
||||
end
|
||||
LeadIn.dElevation = 0
|
||||
LeadOut.dElevation = 0
|
||||
LeadIn.dCompLength = 0
|
||||
LeadOut.dCompLength = 0
|
||||
if Machining.bIsStartClosed and Machining.bIsEndClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
elseif Machining.bIsStartClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadOut.dEndAddLength = max( -LeadIn.dStartAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
elseif Machining.bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadIn.dStartAddLength = max( -LeadOut.dEndAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
else
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
|
||||
return LeadIn, LeadOut
|
||||
end
|
||||
|
||||
|
||||
local function GetSCC( vtMachiningDirection)
|
||||
-- TODO implementare SCC come per FacesBySaw
|
||||
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 calcolo area lavorata per completamento
|
||||
-- TODO EdgeToMachineAlternative da gestire
|
||||
function FACEBYMILL.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
local Milling = {}
|
||||
Milling.bIsApplicable = true
|
||||
Milling.dDepthToMachine = 0
|
||||
Milling.sMessage = ''
|
||||
Milling.idProc = Proc.id
|
||||
Milling.dResidualDepth = EdgeToMachine.dElevation
|
||||
Milling.dBladeMarkLength = 0
|
||||
Milling.sEdgeType = EdgeToMachine.sType
|
||||
Milling.nFeatureSegment = 1
|
||||
|
||||
-- parametri opzionali
|
||||
if not OptionalParameters then
|
||||
OptionalParameters = {}
|
||||
end
|
||||
local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
|
||||
local dPocketHeight = OptionalParameters.dPocketHeight or 0
|
||||
local dDepthToMachine = OptionalParameters.dDepthToMachine or 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 dHorizontalStepSpan = OptionalParameters.dHorizontalStepSpan
|
||||
local dMinNzDownUp = OptionalParameters.dMinNzDownUp
|
||||
local sUserNotes = OptionalParameters.sUserNotes or ''
|
||||
|
||||
-- lunghezze, direzioni e punti caratteristici della lavorazione e del lato lavorato
|
||||
Milling.dLengthToMachine = EdgeToMachine.dLength
|
||||
Milling.dEdgeLength = EdgeToMachine.dLength
|
||||
if bOppositeToolDirection then
|
||||
Milling.vtToolDirection = -EdgeToMachine.vtN
|
||||
else
|
||||
Milling.vtToolDirection = EdgeToMachine.vtN
|
||||
end
|
||||
Milling.vtEdgeDirection = EdgeToMachine.vtN ^ FaceToMachine.vtN
|
||||
-- TODO conviene spostare questi calcoli nel FaceData?
|
||||
Milling.ptEdge1, _, Milling.ptEdge2 = EgtSurfTmFacetOppositeSide( Proc.id, FaceToMachine.id, -Milling.vtToolDirection, GDB_ID.ROOT)
|
||||
local b3BoxEdge = BBox3d( Milling.ptEdge1, Milling.ptEdge2)
|
||||
Milling.dLengthOnX = b3BoxEdge:getDimX()
|
||||
|
||||
-- se si conosce il limite downUp (utensile forzato o downUp forzato) si decide se invertire (ToolInvert)
|
||||
if nToolIndex and not dMinNzDownUp then
|
||||
dMinNzDownUp = TOOLS[nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection)
|
||||
end
|
||||
if dMinNzDownUp and FaceToMachine.vtN:getZ() < dMinNzDownUp then
|
||||
Milling.bToolInvert = true
|
||||
else
|
||||
Milling.bToolInvert = false
|
||||
end
|
||||
|
||||
-- ricerca utensile
|
||||
if nToolIndex then
|
||||
Milling.nToolIndex = nToolIndex
|
||||
else
|
||||
local ToolSearchParameters = {}
|
||||
if OptionalParameters.dPocketHeight then
|
||||
ToolSearchParameters.sMillShape = 'TSHAPEMILL'
|
||||
else
|
||||
ToolSearchParameters.sMillShape = 'STANDARD'
|
||||
end
|
||||
ToolSearchParameters.dElevation = FaceToMachine.dElevation
|
||||
-- TODO qui ToolSearchParameters.vtToolDirection andrà sosituito con vtN!!
|
||||
if Milling.bToolInvert then
|
||||
ToolSearchParameters.vtToolDirection = -FaceToMachine.vtN
|
||||
else
|
||||
ToolSearchParameters.vtToolDirection = FaceToMachine.vtN
|
||||
end
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
-- TODO bisognerà implementare anche la lama da sotto
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
local ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
||||
-- ora che l'utensile è scelto, se non era definito l'angolo di DownUp lo verifico per decidere se invertire
|
||||
if ToolInfo.nToolIndex and not dMinNzDownUp then
|
||||
dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, Milling.vtToolDirection)
|
||||
if FaceToMachine.vtN:getZ() < dMinNzDownUp then
|
||||
Milling.bToolInvert = true
|
||||
end
|
||||
end
|
||||
Milling.nToolIndex = ToolInfo.nToolIndex
|
||||
end
|
||||
Milling.nType = MCH_OY.MILLING
|
||||
if not TOOLS[Milling.nToolIndex] or not TOOLS[Milling.nToolIndex].sName then
|
||||
Milling.sMessage = 'Mill not found'
|
||||
Milling.bIsApplicable = false
|
||||
EgtOutLog( Milling.sMessage)
|
||||
return Milling, EdgeToMachine.dElevation
|
||||
end
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- se tasca meno spessa della fresa la lavorazione non è applicabile
|
||||
if OptionalParameters.dPocketHeight and TOOLS[Milling.nToolIndex].dMaxMaterial > dPocketHeight + 10 * GEO.EPS_SMALL then
|
||||
Milling.sMessage = 'Pocket too narrow for blade thickness'
|
||||
Milling.bIsApplicable = false
|
||||
EgtOutLog( Milling.sMessage)
|
||||
return Milling, EdgeToMachine.dElevation
|
||||
end
|
||||
-- se tasca chiusa da entrambi i lati e più stretta della fresa la lavorazione non è applicabile
|
||||
if not ( EdgeToMachine.bIsStartOpen or EdgeToMachine.bIsEndOpen) then
|
||||
if TOOLS[Milling.nToolIndex].dDiameter > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
|
||||
Milling.sMessage = 'Pocket too narrow for blade diameter'
|
||||
Milling.bIsApplicable = false
|
||||
EgtOutLog( Milling.sMessage)
|
||||
return Milling, EdgeToMachine.dElevation
|
||||
end
|
||||
end
|
||||
|
||||
-- parametri della lavorazione
|
||||
-- profondità (parametro DEPTH)
|
||||
Milling.sDepth = sDepth
|
||||
-- inizio e fine aperti o chiusi
|
||||
Milling.bIsStartClosed = not EdgeToMachine.bIsStartOpen
|
||||
Milling.bIsEndClosed = not EdgeToMachine.bIsEndOpen
|
||||
-- lato di lavoro e inversione
|
||||
if TOOLS[Milling.nToolIndex].bIsCCW then
|
||||
Milling.nWorkside = MCH_MILL_WS.RIGHT
|
||||
Milling.bInvert = true
|
||||
else
|
||||
Milling.nWorkside = MCH_MILL_WS.LEFT
|
||||
Milling.bInvert = false
|
||||
end
|
||||
if bOppositeToolDirection then
|
||||
Milling.bInvert = not Milling.bInvert
|
||||
end
|
||||
if Milling.bToolInvert then
|
||||
Milling.bInvert = not Milling.bInvert
|
||||
end
|
||||
-- profondità da lavorare e offset radiale
|
||||
if OptionalParameters.dPocketHeight then
|
||||
if TOOLS[Milling.nToolIndex].dSideDepth > dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
-- TODO la depth dovrebbe essere quella del machining
|
||||
Milling.dDepthToMachine = dDepthToMachine
|
||||
Milling.dResidualDepth = 0
|
||||
if bOppositeToolDirection then
|
||||
Milling.dRadialOffset = -dDepthToMachine
|
||||
else
|
||||
Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
|
||||
end
|
||||
else
|
||||
Milling.dDepthToMachine = TOOLS[Milling.nToolIndex].dSideDepth - 1
|
||||
Milling.dResidualDepth = dDepthToMachine - Milling.dDepthToMachine
|
||||
if bOppositeToolDirection then
|
||||
Milling.dRadialOffset = -Milling.dDepthToMachine
|
||||
else
|
||||
Milling.dRadialOffset = EdgeToMachine.dElevation - Milling.dDepthToMachine
|
||||
end
|
||||
end
|
||||
else
|
||||
Milling.dDepthToMachine = dDepthToMachine
|
||||
Milling.dResidualDepth = 0
|
||||
if bOppositeToolDirection then
|
||||
Milling.dRadialOffset = -dDepthToMachine
|
||||
else
|
||||
Milling.dRadialOffset = EdgeToMachine.dElevation - dDepthToMachine
|
||||
end
|
||||
end
|
||||
-- completamento
|
||||
Milling.dCompletionPercentage = 100 - Milling.dResidualDepth / Milling.dDepthToMachine
|
||||
-- step verticale e offset longitudinale
|
||||
if OptionalParameters.dPocketHeight then
|
||||
Milling.Steps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Milling.nToolIndex].dMaxMaterial)
|
||||
Milling.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
||||
Milling.dMaxElev = Milling.Steps.dStep * Milling.Steps.nCount - 10 * GEO.EPS_SMALL
|
||||
else
|
||||
Milling.Steps = {}
|
||||
Milling.Steps.nCount = 1
|
||||
Milling.Steps.dStep = TOOLS[Milling.nToolIndex].dStep
|
||||
Milling.Steps.nStepType = MCH_MILL_ST.ZIGZAG
|
||||
Milling.dMaxElev = FaceToMachine.dElevation
|
||||
end
|
||||
if Milling.bToolInvert then
|
||||
if Milling.Steps.nCount > 1 then
|
||||
Milling.dLongitudinalOffset = - dPocketHeight
|
||||
else
|
||||
Milling.dLongitudinalOffset = - TOOLS[Milling.nToolIndex].dMaxMaterial - dLongitudinalOffset
|
||||
end
|
||||
else
|
||||
Milling.dLongitudinalOffset = dLongitudinalOffset
|
||||
end
|
||||
-- distanza di sicurezza
|
||||
Milling.dStartSafetyLength = BeamData.CUT_SIC
|
||||
-- overlap
|
||||
Milling.dOverlap = 0
|
||||
-- faceuse e frame lavorazione
|
||||
if bOppositeToolDirection then
|
||||
Milling.nFaceuse = BeamLib.GetNearestOrthoOpposite( -Milling.vtToolDirection)
|
||||
Milling.vtFaceUse = -Milling.vtToolDirection
|
||||
else
|
||||
Milling.nFaceuse = BeamLib.GetNearestOrthoOpposite( Milling.vtToolDirection)
|
||||
Milling.vtFaceUse = Milling.vtToolDirection
|
||||
end
|
||||
-- SCC
|
||||
Milling.nSCC = GetSCC( Milling.vtToolDirection)
|
||||
-- asse bloccato
|
||||
Milling.sBlockedAxis = ''
|
||||
-- eventuale step orizzontale
|
||||
Milling.CloneStepsHorizontal = {}
|
||||
if not dHorizontalStepSpan then
|
||||
dHorizontalStepSpan = Milling.dDepthToMachine
|
||||
end
|
||||
if dHorizontalStepSpan > 10 * GEO.EPS_SMALL and TOOLS[Milling.nToolIndex].dSideStep then
|
||||
Milling.CloneStepsHorizontal = MachiningLib.GetMachiningSteps( dHorizontalStepSpan, TOOLS[Milling.nToolIndex].dSideStep)
|
||||
else
|
||||
Milling.CloneStepsHorizontal.nCount = 1
|
||||
Milling.CloneStepsHorizontal.dStep = 0
|
||||
end
|
||||
-- approccio e retrazione
|
||||
Milling.LeadIn, Milling.LeadOut = CalculateLeadInOut( Milling, EdgeToMachine, Part)
|
||||
-- lunghezza impronta lama
|
||||
if Milling.bIsStartClosed and Milling.bIsEndClosed then
|
||||
Milling.dBladeMarkLength = abs( min( Milling.LeadIn.dStartAddLength, Milling.LeadOut.dEndAddLength))
|
||||
elseif Milling.bIsStartClosed then
|
||||
Milling.dBladeMarkLength = abs( Milling.LeadIn.dStartAddLength)
|
||||
elseif Milling.bIsEndClosed then
|
||||
Milling.dBladeMarkLength = abs( Milling.LeadOut.dEndAddLength)
|
||||
end
|
||||
-- geometria
|
||||
Milling.Geometry = {{Milling.idProc, FaceToMachine.id}}
|
||||
-- note utente
|
||||
Milling.sUserNotes = sUserNotes
|
||||
-- nome operazione
|
||||
Milling.sOperationName = 'Milling_' .. ( EgtGetName( Milling.idProc) or tostring( Milling.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 ( Milling.vtToolDirection:getX() < 0.707)) then
|
||||
local dLengthOnX = Milling.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( Milling)
|
||||
local dAddLengthLeftSide = Milling.LeadOut.dEndAddLength
|
||||
local dAddLengthToReduce = sqrt( Milling.dDepthToMachine * TOOLS[Milling.nToolIndex].dDiameter - Milling.dDepthToMachine * Milling.dDepthToMachine)
|
||||
if bStartLeft then
|
||||
dAddLengthLeftSide = Milling.LeadIn.dStartAddLength
|
||||
end
|
||||
if not AreSameOrOppositeVectorApprox( EdgeToMachine.vtN, Y_AX()) then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Milling.sStage = 'AfterTail'
|
||||
else
|
||||
Milling.bIsApplicable = false
|
||||
end
|
||||
elseif dAddLengthLeftSide + dAddLengthToReduce > dExtendAfterTail then
|
||||
if MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part) then
|
||||
Milling.sStage = 'AfterTail'
|
||||
else
|
||||
if bStartLeft then
|
||||
Milling.LeadIn.dStartAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
else
|
||||
Milling.LeadOut.dEndAddLength = - dAddLengthToReduce + dExtendAfterTail
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Milling
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return FACEBYMILL
|
||||
@@ -206,7 +206,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
OptionalParameters.nToolIndex = Strategy.SplitStrategy[1].ToolInfo.nToolIndex
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
@@ -225,7 +225,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Presplit;', 'Precut;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, -Y_AX())
|
||||
Machining.Splitting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParameters)
|
||||
@@ -240,7 +240,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dDepthToMachine = Part.dWidth / 2 + BeamData.CUT_EXTRA_MIN
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
@@ -257,7 +257,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dDepthToMachine = Part.dHeight + BeamData.CUT_EXTRA
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
@@ -276,7 +276,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
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;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
|
||||
local EdgeToMachine = SPLITCUT.GetEdgeToMachine( Proc, Z_AX())
|
||||
@@ -292,7 +292,7 @@ function SPLITCUT.Execute( Proc, Part, Strategy)
|
||||
OptionalParameters.dLongitudinalOffset = Strategy.dOffset or 0
|
||||
OptionalParameters.dDepthToMachine = Strategy.SplitStrategy[2].ToolInfo.dMaxMatBladeFromDown - dExtraMaxMat
|
||||
OptionalParameters.sUserNotes = EgtIf( Strategy.bSplit, 'Split;', 'Cut;')
|
||||
OptionalParameters.bDisableHorizontalSteps = true
|
||||
OptionalParameters.dHorizontalStepSpan = 0
|
||||
|
||||
Machining.AuxiliaryData.bIsSplitOrCut = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user