- refactoring e migliorie varie
This commit is contained in:
+78
-61
@@ -4733,19 +4733,19 @@ function SawPlusChain.GetToolFromMachining( sMachiningName)
|
||||
return Tool
|
||||
end
|
||||
|
||||
function SawPlusChain.GetSCC( vMachiningDirection)
|
||||
function SawPlusChain.GetSCC( vtMachiningDirection)
|
||||
local nSCC = MCH_SCC.NONE
|
||||
if AreSameVectorApprox( vMachiningDirection, Z_AX()) then
|
||||
if AreSameVectorApprox( vtMachiningDirection, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_ZP
|
||||
elseif AreOppositeVectorApprox( vMachiningDirection, Z_AX()) then
|
||||
elseif AreOppositeVectorApprox( vtMachiningDirection, Z_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_ZM
|
||||
elseif AreSameVectorApprox( vMachiningDirection, Y_AX()) then
|
||||
elseif AreSameVectorApprox( vtMachiningDirection, Y_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YP
|
||||
elseif AreOppositeVectorApprox( vMachiningDirection, Y_AX()) then
|
||||
elseif AreOppositeVectorApprox( vtMachiningDirection, Y_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_YM
|
||||
elseif AreSameVectorApprox( vMachiningDirection, X_AX()) then
|
||||
elseif AreSameVectorApprox( vtMachiningDirection, X_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_XP
|
||||
elseif AreOppositeVectorApprox( vMachiningDirection, X_AX()) then
|
||||
elseif AreOppositeVectorApprox( vtMachiningDirection, X_AX()) then
|
||||
nSCC = MCH_SCC.ADIR_XM
|
||||
end
|
||||
|
||||
@@ -4765,7 +4765,7 @@ function SawPlusChain.GetVerticalSteps( Proc, Machining)
|
||||
return VerticalSteps
|
||||
end
|
||||
|
||||
function SawPlusChain.GetHorizontalSteps( Proc, Machining)
|
||||
function SawPlusChain.GetHorizontalSteps( Machining)
|
||||
HorizontalSteps = {}
|
||||
HorizontalSteps.StepLength = 0
|
||||
HorizontalSteps.Count = 1
|
||||
@@ -4779,6 +4779,60 @@ function SawPlusChain.GetHorizontalSteps( Proc, Machining)
|
||||
return HorizontalSteps
|
||||
end
|
||||
|
||||
function SawPlusChain.GetLeadInOut( Proc, Machining)
|
||||
-- si determina se l'inizio o la fine della lavorazione sono chiusi e l'eventuale riduzione da applicare
|
||||
local bIsStartClosed = false
|
||||
local bIsEndClosed = false
|
||||
local dAddLengthToReduce = sqrt( Machining.Depth * Machining.Tool.Diameter - Machining.Depth * Machining.Depth)
|
||||
if #( Proc.Pocket.SideFaces) == 2 then
|
||||
bIsStartClosed = true
|
||||
bIsEndClosed = true
|
||||
elseif #( Proc.Pocket.SideFaces) == 1 then
|
||||
local CCWDirection = ( Machining.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
|
||||
if Machining.ToolInvert then
|
||||
CCWDirection = - CCWDirection
|
||||
end
|
||||
if CCWDirection * Proc.Pocket.SideFaces[1].VtN > 10 * GEO.EPS_SMALL then
|
||||
if Machining.Tool.IsCCW then
|
||||
bIsStartClosed = true
|
||||
else
|
||||
bIsEndClosed = true
|
||||
end
|
||||
else
|
||||
if Machining.Tool.IsCCW then
|
||||
bIsEndClosed = true
|
||||
else
|
||||
bIsStartClosed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
LeadIn = {}
|
||||
LeadOut = {}
|
||||
LeadIn.Type = MCH_MILL_LI.LINEAR
|
||||
LeadOut.Type = MCH_MILL_LI.LINEAR
|
||||
LeadIn.TangentDistance = 0
|
||||
LeadOut.TangentDistance = 0
|
||||
LeadIn.Elevation = 0
|
||||
LeadOut.Elevation = 0
|
||||
LeadIn.CompLength = 0
|
||||
LeadOut.CompLength = 0
|
||||
LeadIn.StartAddLength = 0
|
||||
LeadOut.EndAddLength = 0
|
||||
LeadIn.PerpDistance = 0
|
||||
LeadOut.PerpDistance = 0
|
||||
if bIsStartClosed then
|
||||
LeadIn.StartAddLength = -dAddLengthToReduce
|
||||
LeadIn.PerpDistance = 1
|
||||
end
|
||||
if bIsEndClosed then
|
||||
LeadOut.EndAddLength = -dAddLengthToReduce
|
||||
LeadOut.PerpDistance = 1
|
||||
end
|
||||
|
||||
return LeadIn, LeadOut
|
||||
end
|
||||
|
||||
function SawPlusChain.ApplyMachining( Machining, sOperationNamePrefix, b3Raw)
|
||||
local sOperationName = sOperationNamePrefix .. ( EgtGetName( Machining.ProcId) or tostring( Machining.ProcId)) .. '_' .. tostring( Machining.FaceToMachine.Id + 1)
|
||||
local nOperationId = EgtAddMachining( sOperationName, Machining.Name)
|
||||
@@ -4810,11 +4864,8 @@ function SawPlusChain.ApplyMachining( Machining, sOperationNamePrefix, b3Raw)
|
||||
if Machining.VerticalSteps.MaxElev then
|
||||
sNotes = EgtSetValInNotes( sNotes, 'MaxElev', Machining.VerticalSteps.MaxElev)
|
||||
end
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, Machining.BlockedAxis.Orientation, b3Raw, Machining.FaceToMachine.VtN, Machining.BlockedAxis.VtOut))
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- imposto angolo 3° asse rot
|
||||
local sBlockedAxis = 'perpendicular'
|
||||
local vtOut = EgtIf( Machining.FaceToMachine.VtN:getX() > 0, X_AX(), -X_AX())
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( Machining.Name, sBlockedAxis, b3Raw, Machining.FaceToMachine.VtN, vtOut))
|
||||
|
||||
local bIsApplyOk = ML.ApplyMachining( true, false)
|
||||
if not bIsApplyOk then
|
||||
@@ -4854,6 +4905,10 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
local Cutting = {}
|
||||
Cutting.ProcId = Proc.Id
|
||||
Cutting.Name = ML.FindCutting( 'HeadSide', true, false)
|
||||
if not Cutting.Name then
|
||||
local sErr = 'Feature '.. Proc.FeatureId .. ': Strategy ' .. Proc.Pocket.Strategy .. ' not applicable - saw blade not found'
|
||||
return false, sErr
|
||||
end
|
||||
Cutting.Tool = SawPlusChain.GetToolFromMachining( Cutting.Name)
|
||||
Cutting.FaceToMachine = Proc.Pocket.FaceToMachine
|
||||
|
||||
@@ -4861,6 +4916,10 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
local Chainsawing = {}
|
||||
Chainsawing.ProcId = Proc.Id
|
||||
Chainsawing.Name = ML.FindSawing( 'Sawing')
|
||||
if not Chainsawing.Name then
|
||||
local sErr = 'Feature '.. Proc.FeatureId .. ': Strategy ' .. Proc.Pocket.Strategy .. ' not applicable - chainsaw not found'
|
||||
return false, sErr
|
||||
end
|
||||
Chainsawing.Tool = SawPlusChain.GetToolFromMachining( Chainsawing.Name)
|
||||
Chainsawing.FaceToMachine = Proc.Pocket.FaceToMachine
|
||||
|
||||
@@ -4916,6 +4975,10 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
Cutting.Faceuse = BL.GetNearestOrthoOpposite( Proc.Pocket.Direction)
|
||||
-- SCC
|
||||
Cutting.SCC = SawPlusChain.GetSCC( Proc.Pocket.Direction)
|
||||
-- asse bloccato
|
||||
Cutting.BlockedAxis = {}
|
||||
Cutting.BlockedAxis.Orientation = 'perpendicular'
|
||||
Cutting.BlockedAxis.VtOut = EgtIf( Cutting.FaceToMachine.VtN:getX() > 0, X_AX(), -X_AX())
|
||||
-- step verticale e offset longitudinale
|
||||
Cutting.VerticalSteps = SawPlusChain.GetVerticalSteps( Proc, Cutting)
|
||||
if Cutting.ToolInvert and Cutting.VerticalSteps.Count > 1 then
|
||||
@@ -4924,56 +4987,9 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
Cutting.LongitudinalOffset = 0
|
||||
end
|
||||
-- step orizzontale
|
||||
Cutting.HorizontalSteps = SawPlusChain.GetHorizontalSteps( Proc, Cutting)
|
||||
Cutting.HorizontalSteps = SawPlusChain.GetHorizontalSteps( Cutting)
|
||||
-- approccio e retrazione
|
||||
Cutting.LeadIn = {}
|
||||
Cutting.LeadOut = {}
|
||||
Cutting.LeadIn.Type = MCH_MILL_LI.LINEAR
|
||||
Cutting.LeadOut.Type = MCH_MILL_LI.LINEAR
|
||||
Cutting.LeadIn.TangentDistance = 0
|
||||
Cutting.LeadOut.TangentDistance = 0
|
||||
Cutting.LeadIn.Elevation = 0
|
||||
Cutting.LeadOut.Elevation = 0
|
||||
Cutting.LeadIn.CompLength = 0
|
||||
Cutting.LeadOut.CompLength = 0
|
||||
Cutting.IsStartClosed = false
|
||||
Cutting.IsEndClosed = false
|
||||
Cutting.LeadIn.StartAddLength = 0
|
||||
Cutting.LeadOut.EndAddLength = 0
|
||||
Cutting.LeadIn.PerpDistance = 0
|
||||
Cutting.LeadOut.PerpDistance = 0
|
||||
if #( Proc.Pocket.SideFaces) == 2 then
|
||||
Cutting.IsStartClosed = true
|
||||
Cutting.IsEndClosed = true
|
||||
elseif #( Proc.Pocket.SideFaces) == 1 then
|
||||
if not Cutting.ToolInvert then
|
||||
Cutting.FaceToMachine.CCWDirection = ( Cutting.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
|
||||
else
|
||||
Cutting.FaceToMachine.CCWDirection = - ( Cutting.FaceToMachine.VtN ^ Proc.Pocket.BottomFace.VtN)
|
||||
end
|
||||
if Cutting.FaceToMachine.CCWDirection * Proc.Pocket.SideFaces[1].VtN > 10 * GEO.EPS_SMALL then
|
||||
if Cutting.Tool.IsCCW then
|
||||
Cutting.IsStartClosed = true
|
||||
else
|
||||
Cutting.IsEndClosed = true
|
||||
end
|
||||
else
|
||||
if Cutting.Tool.IsCCW then
|
||||
Cutting.IsEndClosed = true
|
||||
else
|
||||
Cutting.IsStartClosed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
local dAddLengthToReduce = sqrt( Cutting.Depth * Cutting.Tool.Diameter - Cutting.Depth * Cutting.Depth)
|
||||
if Cutting.IsStartClosed then
|
||||
Cutting.LeadIn.StartAddLength = -dAddLengthToReduce
|
||||
Cutting.LeadIn.PerpDistance = 1
|
||||
end
|
||||
if Cutting.IsEndClosed then
|
||||
Cutting.LeadOut.EndAddLength = -dAddLengthToReduce
|
||||
Cutting.LeadOut.PerpDistance = 1
|
||||
end
|
||||
Cutting.LeadIn, Cutting.LeadOut = SawPlusChain.GetLeadInOut( Proc, Cutting)
|
||||
|
||||
local bOk, sErr
|
||||
|
||||
@@ -4983,6 +4999,7 @@ function SawPlusChain.Make( Proc, b3Raw)
|
||||
Cutting.RadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.StepLength * ( i - 1)
|
||||
bOk, sErr = SawPlusChain.ApplyMachining( Cutting, 'Cut_', b3Raw)
|
||||
end
|
||||
|
||||
-- parametri della lavorazione con sega a catena
|
||||
|
||||
-- lavorazione con sega a catena
|
||||
|
||||
Reference in New Issue
Block a user