|
|
|
@@ -0,0 +1,457 @@
|
|
|
|
|
-- Strategia: STR0015
|
|
|
|
|
-- Descrizione
|
|
|
|
|
-- Fresatura di contorno
|
|
|
|
|
-- Feature tipo Profilo arcuato, Convesso, Concavo, Arco
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- carico librerie
|
|
|
|
|
local BeamLib = require( 'BeamLib')
|
|
|
|
|
local BeamData = require( 'BeamData')
|
|
|
|
|
local MachiningLib = require( 'MachiningLib')
|
|
|
|
|
local FeatureLib = require( 'FeatureLib')
|
|
|
|
|
local ID = require( 'Identity')
|
|
|
|
|
|
|
|
|
|
-- strategie di base
|
|
|
|
|
local BladeToWaste = require('BLADETOWASTE')
|
|
|
|
|
|
|
|
|
|
-- Tabella per definizione modulo
|
|
|
|
|
local STR0015 = {}
|
|
|
|
|
local Strategy = {}
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
local function GetSawCutData( AuxId, vtNF)
|
|
|
|
|
-- comincio con la normale a 45deg
|
|
|
|
|
local vtNP = Vector3d( vtNF)
|
|
|
|
|
for i = 1, 3 do
|
|
|
|
|
if vtNP[i] > GEO.EPS_SMALL then
|
|
|
|
|
vtNP[i] = 1
|
|
|
|
|
elseif vtNP[i] < -GEO.EPS_SMALL then
|
|
|
|
|
vtNP[i] = -1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
vtNP:normalize()
|
|
|
|
|
-- assegno un punto di passaggio
|
|
|
|
|
local ptStart = EgtSP( AuxId, GDB_ID.ROOT) + vtNP * 5.0
|
|
|
|
|
-- determino asse di rotazione
|
|
|
|
|
local vtRot = - Y_AX()
|
|
|
|
|
if vtNF:getX() < 0 then vtRot = - vtRot end
|
|
|
|
|
if vtNF:getZ() < -0.1 then
|
|
|
|
|
vtRot = - vtRot
|
|
|
|
|
elseif vtNF:getY() < -0.1 then
|
|
|
|
|
vtRot:rotate( X_AX(), 90)
|
|
|
|
|
elseif vtNF:getY() > 0.1 then
|
|
|
|
|
vtRot:rotate( X_AX(), -90)
|
|
|
|
|
end
|
|
|
|
|
-- miglioro l'inclinazione (ripartendo da faccia perpendicolare asse trave)
|
|
|
|
|
vtNP[2] = 0 vtNP[3] = 0
|
|
|
|
|
local dRot = 45
|
|
|
|
|
for i = 1, 4 do
|
|
|
|
|
local vtNP2 = Vector3d( vtNP)
|
|
|
|
|
vtNP2:rotate( vtRot, dRot)
|
|
|
|
|
local frRef = Frame3d( ptStart, vtNP2)
|
|
|
|
|
local b3Box = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frRef)
|
|
|
|
|
if b3Box:getMax():getZ() < -3 then
|
|
|
|
|
vtNP = Vector3d( vtNP2)
|
|
|
|
|
end
|
|
|
|
|
dRot = dRot / 2
|
|
|
|
|
end
|
|
|
|
|
-- restituisco i dati del piano
|
|
|
|
|
return ptStart, vtNP
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function GetRoughStrategy( Proc, Part, bSaveAddedGeometries)
|
|
|
|
|
local Machining = {}
|
|
|
|
|
local Result = {}
|
|
|
|
|
|
|
|
|
|
-- ====== Taglio di sgrossatura generale su tutto il profilo ======
|
|
|
|
|
local vtNF = EgtSurfTmFacetNormVersor( Proc.id, Proc.nFct-1, GDB_ID.ROOT)
|
|
|
|
|
local nAddGroupId = BeamLib.GetAddGroup( Part.id)
|
|
|
|
|
-- aggiungo piano di sgrossatura e lo lavoro
|
|
|
|
|
local ptStart, vtNP = GetSawCutData( Proc.idAddAuxGeom, vtNF)
|
|
|
|
|
local AddId = EgtSurfTmPlaneInBBox( nAddGroupId, ptStart, vtNP, Part.b3Part, GDB_RT.GLOB)
|
|
|
|
|
if not bSaveAddedGeometries then
|
|
|
|
|
EgtSetLevel( AddId, GDB_LV.TEMP)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- creo piano di taglio sulla testa del tenone
|
|
|
|
|
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
|
|
|
|
|
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
|
|
|
|
|
bReduceBladePath = Strategy.Parameters.bReduceBladePath
|
|
|
|
|
}
|
|
|
|
|
Machining, Result = BladeToWaste.Make( AddId, Part, OptionalParameters)
|
|
|
|
|
|
|
|
|
|
-- se non ci sono lavorazioni, provo con fresa
|
|
|
|
|
if not Machining then
|
|
|
|
|
-- TODO
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Machining, Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function GetEdgeWithCornerStrategy( Proc, Part)
|
|
|
|
|
local Machining = {}
|
|
|
|
|
local Result = {}
|
|
|
|
|
|
|
|
|
|
if Strategy.Parameters.sConcaveFaceStrategy == 'AUTO' or Strategy.Parameters.sConcaveFaceStrategy == 'BLADE_FORCED' then
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Machining, Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function GetChamferStrategy( Proc, Part)
|
|
|
|
|
local Machining = {}
|
|
|
|
|
local Result = {}
|
|
|
|
|
|
|
|
|
|
if Strategy.Parameters.dDepthChamfer > 100 * GEO.EPS_SMALL then
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Machining, Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
-- TODO gestire il caso in cui non si trova l'utensile
|
|
|
|
|
local function GetArcStrategy( Proc, Part)
|
|
|
|
|
local Machining = {}
|
|
|
|
|
local Result = {}
|
|
|
|
|
local ToolSearchParameters = {}
|
|
|
|
|
|
|
|
|
|
-- recupero i dati della curva e del profilo
|
|
|
|
|
local dDepth = abs( EgtCurveThickness( Proc.idAddAuxGeom))
|
|
|
|
|
local vtExtr = EgtCurveExtrusion( Proc.idAddAuxGeom, GDB_RT.GLOB)
|
|
|
|
|
local bToolInvert = ( vtExtr:getZ() < -0.1)
|
|
|
|
|
local bIsHorizontal = abs( vtExtr:getZ()) < 10 * GEO.EPS_SMALL
|
|
|
|
|
local bIsFeatureDown = Proc.AffectedFaces.bBottom and not Proc.AffectedFaces.bTop
|
|
|
|
|
local bIsFeatureBack = Proc.AffectedFaces.bBack and not Proc.AffectedFaces.bFront
|
|
|
|
|
local bForceStrip = Strategy.Parameters.bForceStrip
|
|
|
|
|
local dDimStrip = EgtIf( Strategy.Parameters.dStripWidth < 100 * GEO.EPS_SMALL, nil, Strategy.Parameters.dStripWidth)
|
|
|
|
|
|
|
|
|
|
local bExecStrip = false
|
|
|
|
|
-- se la lavorazione si trova nella parte inferiore o in battuta dietro, il codolo va sempre lasciato
|
|
|
|
|
if bIsFeatureDown or bIsFeatureBack or bForceStrip then
|
|
|
|
|
if bIsFeatureDown or bIsFeatureBack then
|
|
|
|
|
dDimStrip = dDimStrip or max( BeamData.DIM_STRIP or 5, 5)
|
|
|
|
|
else
|
|
|
|
|
dDimStrip = dDimStrip or max( BeamData.DIM_STRIP_SMALL or 5, 1)
|
|
|
|
|
end
|
|
|
|
|
bExecStrip = true
|
|
|
|
|
end
|
|
|
|
|
if not bExecStrip then
|
|
|
|
|
dDimStrip = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- la passata di finitura c'è sempre
|
|
|
|
|
local nPassages = 1
|
|
|
|
|
-- si verifica se fare passaggio di sgrossatura con fresa
|
|
|
|
|
if not bExecStrip and Strategy.Parameters.dOverMaterial > 100 * GEO.EPS_SMALL then
|
|
|
|
|
nPassages = 2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- ciclo su numero passate (2 in caso di sgrossatura + finitura)
|
|
|
|
|
for nCycle = nPassages, 1, -1 do
|
|
|
|
|
local nMaxDiamMill = EgtIf( nCycle == 1, Strategy.Parameters.dMaxCornerRadius * 2, nil)
|
|
|
|
|
local sTypeTool = EgtIf( nCycle == 1 and nPassages == 2, 'MillingFinish', 'Milling')
|
|
|
|
|
-- se lavorazione orizzontale
|
|
|
|
|
if bIsHorizontal then
|
|
|
|
|
local bDouble
|
|
|
|
|
local Milling = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
|
|
|
|
|
Milling.bIsApplicable = false
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
|
|
|
ToolSearchParameters.dElevation = EgtIf( bExecStrip, ( dDepth - dDimStrip) / 2, dDepth + BeamData.MILL_OVERLAP)
|
|
|
|
|
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
|
|
|
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
|
|
|
|
|
Milling.ToolInfo = {}
|
|
|
|
|
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
-- se posso lavorare in una passata, ma utensile trovato non completa la lavorazione,
|
|
|
|
|
-- allora provo a cercare utensile con massimo materiale sufficiente per fare le due passate, magari trova un utensile più prestante
|
|
|
|
|
if Milling.ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL and not bExecStrip then
|
|
|
|
|
bDouble = true
|
|
|
|
|
ToolSearchParameters.dElevation = ( dDepth + BeamData.MILL_OVERLAP) / 2
|
|
|
|
|
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
|
|
|
|
|
Milling.ToolInfo = {}
|
|
|
|
|
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
end
|
|
|
|
|
Milling.vtToolDirection = ToolSearchParameters.vtToolDirection
|
|
|
|
|
|
|
|
|
|
if nCycle == 2 then
|
|
|
|
|
Milling.dRadialOffset = Strategy.Parameters.dOverMaterial
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if bDouble or bExecStrip then
|
|
|
|
|
if bDouble then
|
|
|
|
|
Milling.sDepth = ( dDepth + BeamData.MILL_OVERLAP) / 2
|
|
|
|
|
else
|
|
|
|
|
Milling.sDepth = ( dDepth - dDimStrip) / 2
|
|
|
|
|
end
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
local Milling2 = BeamLib.TableCopyDeep( Milling)
|
|
|
|
|
Milling2.bOtherDirection = true
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
else
|
|
|
|
|
Milling.sDepth = dDepth + BeamData.MILL_OVERLAP
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
end
|
|
|
|
|
-- se lavorazione verticale
|
|
|
|
|
else
|
|
|
|
|
-- si cerca utensile 1
|
|
|
|
|
local Milling = {}
|
|
|
|
|
Milling.bIsApplicable = false
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
|
|
|
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
|
|
|
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
|
|
|
|
|
Milling.ToolInfo = {}
|
|
|
|
|
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
if nCycle == 2 then
|
|
|
|
|
Milling.dRadialOffset = Strategy.Parameters.dOverMaterial
|
|
|
|
|
end
|
|
|
|
|
Milling.vtToolDirection = ToolSearchParameters.vtToolDirection
|
|
|
|
|
|
|
|
|
|
-- si cerca utensile 2
|
|
|
|
|
local Milling2 = {}
|
|
|
|
|
Milling2.bIsApplicable = false
|
|
|
|
|
ToolSearchParameters = {}
|
|
|
|
|
ToolSearchParameters.sMillShape = 'STANDARD'
|
|
|
|
|
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
|
|
|
|
|
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, vtExtr, -vtExtr)
|
|
|
|
|
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
|
|
|
|
|
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
|
|
|
|
|
Milling2.ToolInfo = {}
|
|
|
|
|
Milling2.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
|
|
|
|
|
Milling2.bOtherDirection = true
|
|
|
|
|
if nCycle == 2 then
|
|
|
|
|
Milling2.dRadialOffset = Strategy.Parameters.dOverMaterial
|
|
|
|
|
end
|
|
|
|
|
Milling2.vtToolDirection = ToolSearchParameters.vtToolDirection
|
|
|
|
|
|
|
|
|
|
-- se serve codolo
|
|
|
|
|
if bExecStrip then
|
|
|
|
|
-- se a disposizione entrambi gli utensili
|
|
|
|
|
if Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
-- se disponibile solo primo utensile
|
|
|
|
|
elseif Milling.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
-- se disponibile solo secondo utensile
|
|
|
|
|
elseif Milling2.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
-- nessun utensile disponibile
|
|
|
|
|
else
|
|
|
|
|
-- non si fa nulla
|
|
|
|
|
end
|
|
|
|
|
-- altrimenti senza codolo
|
|
|
|
|
else
|
|
|
|
|
-- se utensile 1 esegue completamente
|
|
|
|
|
if Milling.ToolInfo.nToolIndex and Milling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
-- se utensile 2 esegue completamente
|
|
|
|
|
elseif Milling2.ToolInfo.nToolIndex and Milling2.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
-- se possono lavorare entrambi
|
|
|
|
|
elseif Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
-- se utensile 1 non completo
|
|
|
|
|
elseif Milling.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling)
|
|
|
|
|
-- se utensile 2 non completo
|
|
|
|
|
elseif Milling2.ToolInfo.nToolIndex then
|
|
|
|
|
table.insert( Machining, Milling2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- TODO VOTO DA FARE!!!!
|
|
|
|
|
Result.sStatus = 'Completed'
|
|
|
|
|
Result.nCompletionIndex = 5
|
|
|
|
|
Result.dMRR = 1
|
|
|
|
|
Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
|
|
|
|
Result.sInfo = ''
|
|
|
|
|
|
|
|
|
|
return Machining, Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
local function GetFeatureResult()
|
|
|
|
|
local Result = {}
|
|
|
|
|
|
|
|
|
|
Result.sStatus = 'Completed'
|
|
|
|
|
Result.nCompletionIndex = 5
|
|
|
|
|
Result.dMRR = 1
|
|
|
|
|
Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
|
|
|
|
|
Result.sInfo = ''
|
|
|
|
|
|
|
|
|
|
return Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
function STR0015.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 = STRATEGIES_CONFIG[CustomParameters.sStrategyId]
|
|
|
|
|
Strategy.sName = StrategyLib.Config.sStrategyId
|
|
|
|
|
Strategy.Parameters = BeamLib.LoadCustomParametersInStrategy( Proc, CustomParameters, StrategyLib.Config)
|
|
|
|
|
Strategy.Chamfer = {}
|
|
|
|
|
Strategy.Chamfer.Machinings = {}
|
|
|
|
|
Strategy.Chamfer.Result = {}
|
|
|
|
|
Strategy.Result = {}
|
|
|
|
|
|
|
|
|
|
local bAreAllMachiningsAdded = true
|
|
|
|
|
|
|
|
|
|
-- calcolo se la lavorazione del tenone può essere spostata dopo taglio di coda
|
|
|
|
|
local dLengthOnX = Proc.b3Box:getDimX()
|
|
|
|
|
Strategy.bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
|
|
|
|
|
|
|
|
|
|
-- recupero e verifico l'entità curva
|
|
|
|
|
local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i')
|
|
|
|
|
if idAux then idAux = idAux + Proc.id end
|
|
|
|
|
if not idAux or ( EgtGetType( idAux) & GDB_FY.GEO_CURVE) == 0 then
|
|
|
|
|
local sErr = 'Error on process ' .. tostring( Proc.id) .. ' missing profile geometry'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
Proc.idAddAuxGeom = idAux
|
|
|
|
|
|
|
|
|
|
-- lavorazione smussi
|
|
|
|
|
Strategy.Chamfer.Machinings, Strategy.Chamfer.Result = GetChamferStrategy( Proc, Part)
|
|
|
|
|
|
|
|
|
|
-- se non bisogna fare solo gli smussi, si calcolano le altre lavorazioni
|
|
|
|
|
if not Strategy.Parameters.bOnlyChamfer then
|
|
|
|
|
-- per tutti tranne che per feature RoundArc
|
|
|
|
|
if not ID.IsRoundArch( Proc) then
|
|
|
|
|
Strategy.RoughCut = {}
|
|
|
|
|
Strategy.RoughCut.Machinings = {}
|
|
|
|
|
Strategy.RoughCut.Result = {}
|
|
|
|
|
Strategy.EdgeWithCorner = {}
|
|
|
|
|
Strategy.EdgeWithCorner.Machinings = {}
|
|
|
|
|
Strategy.EdgeWithCorner.Result = {}
|
|
|
|
|
-- lavorazione taglio per sgrossare
|
|
|
|
|
Strategy.RoughCut.Machinings, Strategy.RoughCut.Result = GetRoughStrategy( Proc, Part, bAddMachining)
|
|
|
|
|
-- lavorazione degli estremi con angoli interni
|
|
|
|
|
Strategy.EdgeWithCorner.Machinings, Strategy.EdgeWithCorner.Result = GetEdgeWithCornerStrategy( Proc, Part)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lavorazione profilo (a meno che non si facciano solo smussi)
|
|
|
|
|
Strategy.Profile = {}
|
|
|
|
|
Strategy.Profile.Machinings = {}
|
|
|
|
|
Strategy.Profile.Result = {}
|
|
|
|
|
Strategy.Profile.Machinings, Strategy.Profile.Result = GetArcStrategy( Proc, Part)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Strategy.Result = GetFeatureResult()
|
|
|
|
|
|
|
|
|
|
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
|
|
|
|
|
-- eventuali punti di spezzatura
|
|
|
|
|
local FeatureSplittingPoints = FeatureLib.GetFeatureSplittingPoints( Proc, Part)
|
|
|
|
|
|
|
|
|
|
-- lavorazione degli smussi
|
|
|
|
|
if Strategy.Chamfer.Machinings then
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lavorazione di sgrezzatura di lama
|
|
|
|
|
if Strategy.RoughCut.Machinings then
|
|
|
|
|
-- se cutting da fare come svuotatura
|
|
|
|
|
if Strategy.RoughCut.Machinings.bCuttingWithMill then
|
|
|
|
|
-- TODO
|
|
|
|
|
-- taglio di lama
|
|
|
|
|
else
|
|
|
|
|
for i = 1, #Strategy.RoughCut.Machinings do
|
|
|
|
|
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
|
|
|
|
Strategy.RoughCut.Machinings[i].sStage = 'AfterTail'
|
|
|
|
|
end
|
|
|
|
|
local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Strategy.RoughCut.Machinings[i])
|
|
|
|
|
if not bIsMachiningAdded then
|
|
|
|
|
bAreAllMachiningsAdded = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lavorazione degli angoli interni
|
|
|
|
|
if Strategy.EdgeWithCorner.Machinings then
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- lavorazione del profilo
|
|
|
|
|
if Strategy.Profile.Machinings then
|
|
|
|
|
for i = 1, #Strategy.Profile.Machinings do
|
|
|
|
|
|
|
|
|
|
Strategy.Profile.Machinings[i].Geometry = {{ Proc.idAddAuxGeom, -1}}
|
|
|
|
|
Strategy.Profile.Machinings[i].nToolIndex = Strategy.Profile.Machinings[i].ToolInfo.nToolIndex
|
|
|
|
|
Strategy.Profile.Machinings[i].nType = MCH_MY.MILLING
|
|
|
|
|
Strategy.Profile.Machinings[i].dStartSafetyLength = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].Steps = {}
|
|
|
|
|
Strategy.Profile.Machinings[i].Steps.dStep = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dStep
|
|
|
|
|
Strategy.Profile.Machinings[i].Steps = MachiningLib.GetMachiningSteps( tonumber( Strategy.Profile.Machinings[i].sDepth), TOOLS[Strategy.Profile.Machinings[i].nToolIndex].dStep)
|
|
|
|
|
|
|
|
|
|
-- LeadIn / LeadOut
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadIn = {}
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOut = {}
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadIn.nType = MCH_MILL_LI.TANGENT
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOut.nType = MCH_MILL_LI.TANGENT
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadIn.dTangentDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadIn.dPerpDistance = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadIn.dStartAddLength = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOut.dTangentDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOut.dPerpDistance = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOut.dEndAddLength = 0
|
|
|
|
|
|
|
|
|
|
local dLengthOnX = Proc.b3Box:getDimX()
|
|
|
|
|
Strategy.bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
|
|
|
|
|
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
|
|
|
|
|
Strategy.Profile.Machinings[i].sStage = 'AfterTail'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- preparo attacco/uscita in caso di spezzatura arco
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadInForSplit = BeamLib.TableCopyDeep( Strategy.Profile.Machinings[i].LeadIn)
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOutForSplit = BeamLib.TableCopyDeep( Strategy.Profile.Machinings[i].LeadOut)
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadInForSplit.nType = MCH_MILL_LI.LINEAR
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOutForSplit.nType = MCH_MILL_LI.LINEAR
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadInForSplit.dTangentDistance = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadInForSplit.dPerpDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOutForSplit.dTangentDistance = 0
|
|
|
|
|
Strategy.Profile.Machinings[i].LeadOutForSplit.dPerpDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
|
|
|
|
|
|
|
|
|
|
-- sistemo il lato e la direzione di lavoro
|
|
|
|
|
if Strategy.Profile.Machinings[i].bOtherDirection then
|
|
|
|
|
Strategy.Profile.Machinings[i].bToolInvert = true
|
|
|
|
|
Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, true, false)
|
|
|
|
|
Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
|
|
|
|
else
|
|
|
|
|
Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, false, true)
|
|
|
|
|
Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
|
|
|
|
|
end
|
|
|
|
|
Strategy.Profile.Machinings[i].ptEdge1 = EgtSP( Proc.idAddAuxGeom, GDB_ID.ROOT)
|
|
|
|
|
Strategy.Profile.Machinings[i].ptEdge2 = EgtEP( Proc.idAddAuxGeom, GDB_ID.ROOT)
|
|
|
|
|
Strategy.Profile.Machinings[i].dEdgeLength = EgtCurveLength( Proc.idAddAuxGeom)
|
|
|
|
|
Strategy.Profile.Machinings[i].vtEdgeDirection = EgtSV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtMV( Proc.idAddAuxGeom, GDB_ID.ROOT) + EgtEV( Proc.idAddAuxGeom, GDB_ID.ROOT)
|
|
|
|
|
Strategy.Profile.Machinings[i].dLengthOnX = Proc.b3Box:getDimX()
|
|
|
|
|
|
|
|
|
|
local MachiningToSplit = {}
|
|
|
|
|
table.insert( MachiningToSplit, Strategy.Profile.Machinings[i])
|
|
|
|
|
local MachiningResult = MachiningLib.GetSplitMachinings( MachiningToSplit, FeatureSplittingPoints, Part)
|
|
|
|
|
-- aggiunge lavorazione
|
|
|
|
|
for j = 1, #MachiningResult do
|
|
|
|
|
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, MachiningResult[j])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
bAreAllMachiningsAdded = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return bAreAllMachiningsAdded, Strategy.Result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
return STR0015
|