|
|
|
@@ -5662,7 +5662,7 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine, FaceToMachine, b3Raw, Proc)
|
|
|
|
|
function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine, FaceToMachine, b3Raw)
|
|
|
|
|
-- 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
|
|
|
|
@@ -5713,49 +5713,18 @@ function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine, FaceToMachin
|
|
|
|
|
LeadIn.StartAddLength = BD.CUT_EXTRA
|
|
|
|
|
LeadOut.EndAddLength = BD.CUT_EXTRA
|
|
|
|
|
end
|
|
|
|
|
local vtN = Vector3d( FaceToMachine.VtN)
|
|
|
|
|
local vtOrthO
|
|
|
|
|
if EdgeToMachine.Elevation > - 10 * GEO.EPS_SMALL then
|
|
|
|
|
vtOrthO = Vector3d( EdgeToMachine.ToolDirection)
|
|
|
|
|
else
|
|
|
|
|
vtOrthO = -Vector3d( EdgeToMachine.ToolDirection)
|
|
|
|
|
end
|
|
|
|
|
local ptP1 = Point3d( EdgeToMachine.ptStart)
|
|
|
|
|
local ptP2 = Point3d( EdgeToMachine.ptEnd)
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, FaceToMachine.Id)
|
|
|
|
|
local vtV1 = -Vector3d( Edges[EdgeToMachine.PreviousEdgeIndex].vtEdge)
|
|
|
|
|
local vtV2 = Vector3d( Edges[EdgeToMachine.NextEdgeIndex].vtEdge)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local bInvert = Machining.Invert
|
|
|
|
|
if bInvert then
|
|
|
|
|
ptP1, ptP2 = ptP2, ptP1
|
|
|
|
|
vtV1, vtV2 = vtV2, vtV1
|
|
|
|
|
end
|
|
|
|
|
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
|
|
|
|
|
|
|
|
|
-- Versore di riferimento
|
|
|
|
|
local vtRef = Vector3d( vtTg)
|
|
|
|
|
vtRef:rotate( vtN, EgtIf( bInvert, -90, 90))
|
|
|
|
|
|
|
|
|
|
local bIsRightWorkside = Machining.Workside == MCH_MILL_WS.RIGHT
|
|
|
|
|
if bIsRightWorkside ~= bInvert--[[ and EdgeToMachine.Id ~= FaceToMachine.Edges.BottomEdge.Id]] then
|
|
|
|
|
vtV1 = -vtV1
|
|
|
|
|
vtV2 = -vtV2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local b3Box = BBox3d( b3Raw)
|
|
|
|
|
b3Box:expand( BD.CUT_SIC)
|
|
|
|
|
local ptPa1 = ptP1 + LeadIn.StartAddLength * -vtTg
|
|
|
|
|
local ptPa2 = ptP2 + LeadOut.EndAddLength * vtTg
|
|
|
|
|
|
|
|
|
|
Machining.vtTg = vtTg
|
|
|
|
|
LeadIn.vtV1 = vtV1
|
|
|
|
|
LeadOut.vtV2 = vtV2
|
|
|
|
|
LeadIn.ptP1 = ptP1
|
|
|
|
|
LeadOut.ptP2 = ptP2
|
|
|
|
|
Machining.vtOffset = vtRef
|
|
|
|
|
|
|
|
|
|
LeadIn.TangentDistance, LeadIn.PerpDistance, LeadOut.TangentDistance, LeadOut.PerpDistance = Fbs.CalcLeadInOutPerpGeom( ptPa1, ptPa2, vtV1, vtV2, vtN, ( Machining.Tool.Diameter / 2), vtRef, -Machining.RadialOffset, b3Box, bIsRightWorkside)
|
|
|
|
|
Machining.vtV = vtV1
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
if Machining.IsStartClosed then
|
|
|
|
|
LeadIn.StartAddLength = -dAddLengthToReduce
|
|
|
|
@@ -5868,23 +5837,42 @@ function SawPlusChain.ApplyMachining( Machining, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SawPlusChain.Saw.GetSCC( vtMachiningDirection)
|
|
|
|
|
function SawPlusChain.Saw.GetSCC( vtMachiningDirection, vtN, vtTg)
|
|
|
|
|
-- TODO implementare SCC come per FacesBySaw
|
|
|
|
|
local nSCC = MCH_SCC.NONE
|
|
|
|
|
if AreSameVectorApprox( vtMachiningDirection, Z_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_ZP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, Z_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_ZM
|
|
|
|
|
elseif AreSameVectorApprox( vtMachiningDirection, Y_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_YP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, Y_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_YM
|
|
|
|
|
elseif AreSameVectorApprox( vtMachiningDirection, X_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_XP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, X_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_XM
|
|
|
|
|
if not BD.TURN then
|
|
|
|
|
-- per ora aggregato usato in verticale solo in split e headcut; Fast non influenzata
|
|
|
|
|
if BD.C_SIMM and bMaximizeVerticalDepth then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_ZM
|
|
|
|
|
elseif abs( vtMachiningDirection:getX()) > abs( vtMachiningDirection:getY()) - GEO.EPS_SMALL then
|
|
|
|
|
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
|
|
|
|
|
if abs( vtTg:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
|
|
|
|
nSCC = EgtIf( ( vtMachiningDirection:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP)
|
|
|
|
|
else
|
|
|
|
|
nSCC = EgtIf( ( vtMachiningDirection:getX() > -GEO.EPS_SMALL), MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- se il taglio è orizzontale, si gira aggregato lama per facilitare caduta del legno
|
|
|
|
|
if abs( vtTg:getZ()) < 10 * GEO.EPS_SMALL and not AreSameOrOppositeVectorApprox( vtN, Z_AX()) then
|
|
|
|
|
nSCC = EgtIf( ( vtMachiningDirection:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YM, MCH_SCC.ADIR_YP)
|
|
|
|
|
else
|
|
|
|
|
nSCC = EgtIf( ( vtMachiningDirection:getY() > -GEO.EPS_SMALL), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if AreSameVectorApprox( vtMachiningDirection, Z_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_ZP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, Z_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_ZM
|
|
|
|
|
elseif AreSameVectorApprox( vtMachiningDirection, Y_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_YP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, Y_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_YM
|
|
|
|
|
elseif AreSameVectorApprox( vtMachiningDirection, X_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_XP
|
|
|
|
|
elseif AreOppositeVectorApprox( vtMachiningDirection, X_AX()) then
|
|
|
|
|
nSCC = MCH_SCC.ADIR_XM
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return nSCC
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -6006,15 +5994,15 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
|
|
|
|
Cutting.Faceuse = BL.GetNearestOrthoOpposite( -EdgeToMachine.ToolDirection)
|
|
|
|
|
end
|
|
|
|
|
Cutting.nEdgeFaceUse = EdgeToMachine.Id
|
|
|
|
|
-- SCC
|
|
|
|
|
Cutting.SCC = SawPlusChain.Saw.GetSCC( EdgeToMachine.ToolDirection)
|
|
|
|
|
-- asse bloccato
|
|
|
|
|
Cutting.BlockedAxis = {}
|
|
|
|
|
Cutting.BlockedAxis.Orientation = 'perpendicular'
|
|
|
|
|
Cutting.BlockedAxis.VtN = FaceToMachine.VtN
|
|
|
|
|
Cutting.BlockedAxis.VtOut = EgtIf( FaceToMachine.VtN:getX() > 0, X_AX(), -X_AX())
|
|
|
|
|
-- approccio e retrazione
|
|
|
|
|
Cutting.LeadIn, Cutting.LeadOut = SawPlusChain.CalculateLeadInOut( Cutting, EdgeToMachine, FaceToMachine, b3Raw, Proc)
|
|
|
|
|
Cutting.LeadIn, Cutting.LeadOut = SawPlusChain.CalculateLeadInOut( Cutting, EdgeToMachine, FaceToMachine, b3Raw)
|
|
|
|
|
-- SCC
|
|
|
|
|
Cutting.SCC = SawPlusChain.Saw.GetSCC( EdgeToMachine.ToolDirection, FaceToMachine.VtN, Cutting.vtTg)
|
|
|
|
|
-- eventuale step orizzontale
|
|
|
|
|
Cutting.HorizontalSteps = {}
|
|
|
|
|
if Cutting.Tool.SideStep then
|
|
|
|
@@ -6048,38 +6036,15 @@ function SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
|
local bIsCuttingOk = false
|
|
|
|
|
local sCuttingOriginalMessage = Cutting.Message or ''
|
|
|
|
|
local sCuttingApplyMessage = ''
|
|
|
|
|
local vtTg = Cutting.vtTg
|
|
|
|
|
local bInvert = Cutting.Invert
|
|
|
|
|
local dOriginalRadialOffset = Cutting.RadialOffset
|
|
|
|
|
local dOriginalLeadInPerpDistance = Cutting.LeadIn.PerpDistance
|
|
|
|
|
local dOriginalLeadInTangDistance = Cutting.LeadIn.TangentDistance
|
|
|
|
|
local dOriginalLeadOutPerpDistance = Cutting.LeadOut.PerpDistance
|
|
|
|
|
local dOriginalLeadOutTangDistance = Cutting.LeadOut.TangentDistance
|
|
|
|
|
|
|
|
|
|
for i = Cutting.HorizontalSteps.Count, 1, -1 do
|
|
|
|
|
local dRadialStep = Cutting.HorizontalSteps.StepLength * ( i - 1)
|
|
|
|
|
local dDirectionProportion = ( Cutting.LeadIn.vtV1 * vtTg)
|
|
|
|
|
Cutting.RadialOffset = dOriginalRadialOffset + dRadialStep
|
|
|
|
|
local dStepOffset = Cutting.RadialOffset - dOriginalRadialOffset
|
|
|
|
|
local dTangOffsetStep = ( Cutting.RadialOffset * dDirectionProportion)
|
|
|
|
|
local bTiltedSlot = abs( dDirectionProportion) > 0 + 10 * GEO.EPS_SMALL
|
|
|
|
|
local bIsRightWorkside = Cutting.Workside == MCH_MILL_WS.RIGHT
|
|
|
|
|
|
|
|
|
|
Cutting.RadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.StepLength * ( i - 1)
|
|
|
|
|
-- update distanza perpendicolare attacco per contemplare l'offset applicato
|
|
|
|
|
|
|
|
|
|
local b3Box = BBox3d( b3Raw)
|
|
|
|
|
b3Box:expand( BD.CUT_SIC)
|
|
|
|
|
local ptPa1 = Cutting.LeadIn.ptP1 + ( Cutting.LeadIn.StartAddLength - dTangOffsetStep) * -vtTg + dStepOffset * Cutting.LeadIn.vtV1
|
|
|
|
|
local ptPa2 = Cutting.LeadOut.ptP2 + ( Cutting.LeadOut.EndAddLength + dTangOffsetStep) * vtTg + dStepOffset * Cutting.LeadOut.vtV2
|
|
|
|
|
|
|
|
|
|
Cutting.LeadIn.TangentDistance, Cutting.LeadIn.PerpDistance, Cutting.LeadOut.TangentDistance, Cutting.LeadOut.PerpDistance = Fbs.CalcLeadInOutPerpGeom( ptPa1, ptPa2, Cutting.LeadIn.vtV1, Cutting.LeadOut.vtV2, Cutting.BlockedAxis.VtN, ( Cutting.Tool.Diameter / 2), Cutting.vtOffset, -Cutting.RadialOffset, b3Box, bIsRightWorkside)
|
|
|
|
|
--Cutting.LeadIn.PerpDistance = dOriginalLeadInPerpDistance - dRadialStep --dOriginalLeadInPerpDistance - Cutting.RadialOffset
|
|
|
|
|
--Cutting.LeadIn.TangentDistance = dOriginalLeadInTangDistance + dTangOffsetStep --+ Cutting.LeadIn.StartAddLength
|
|
|
|
|
--Cutting.LeadOut.PerpDistance = dOriginalLeadOutPerpDistance - dRadialStep --- Cutting.RadialOffset
|
|
|
|
|
--Cutting.LeadOut.TangentDistance = dOriginalLeadOutTangDistance - dTangOffsetStep --- Cutting.LeadOut.EndAddLength
|
|
|
|
|
|
|
|
|
|
Cutting.LeadIn.StartAddLength = Cutting.LeadIn.StartAddLength + EgtIf( bTiltedSlot, - ( dTangOffsetStep + Cutting.LeadIn.StartAddLength), 0)
|
|
|
|
|
Cutting.LeadOut.EndAddLength = Cutting.LeadOut.EndAddLength + EgtIf( bTiltedSlot, ( dTangOffsetStep + Cutting.LeadOut.EndAddLength), 0)
|
|
|
|
|
Cutting.LeadIn.PerpDistance = dOriginalLeadInPerpDistance - Cutting.RadialOffset
|
|
|
|
|
Cutting.LeadOut.PerpDistance = dOriginalLeadOutPerpDistance - Cutting.RadialOffset
|
|
|
|
|
-- applicazione lavorazione
|
|
|
|
|
bIsCuttingOk, sCuttingApplyMessage = SawPlusChain.ApplyMachining( Cutting, b3Raw)
|
|
|
|
|
-- update messaggi
|
|
|
|
|