|
|
|
@@ -1792,7 +1792,9 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
dDepth, bOneShot)
|
|
|
|
|
|
|
|
|
|
-- recupero la lavorazione senza considerare l'elevazione perché viene calcolata l'elevazione utile
|
|
|
|
|
local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, not( bMillDown and not bDoubleSide), bMillDown and not bDoubleSide)
|
|
|
|
|
local bTopHead = not( bMillDown and not bDoubleSide)
|
|
|
|
|
local bDownHead = bMillDown and not bDoubleSide
|
|
|
|
|
local sMilling = ML.FindMilling( 'SmallToolContour', nil, nil, nil, nil, bTopHead, bDownHead)
|
|
|
|
|
if not sMilling then
|
|
|
|
|
local sMyWarn = 'Warning : SmallToolContour not found in library'
|
|
|
|
|
EgtOutLog( sMyWarn)
|
|
|
|
@@ -1954,17 +1956,31 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
-- inversione direzione utensile
|
|
|
|
|
local bInvertMach = false
|
|
|
|
|
local bInvertTool = false
|
|
|
|
|
if nPathInt then
|
|
|
|
|
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
|
|
|
|
|
if vtN1:getZ() < BD.NZ_MINA and abs(vtN1:getZ()) >= 0.707 then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
|
|
|
|
elseif not bDoubleSide and vtN1:getY() > GEO.EPS_SMALL then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
if bDownHead then
|
|
|
|
|
if vtN1:getZ() > 10 * GEO.EPS_SMALL then
|
|
|
|
|
bInvertTool = true
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
end
|
|
|
|
|
elseif bMillDown and bDoubleSide then
|
|
|
|
|
if vtN1:getZ() > 10 * GEO.EPS_SMALL and bDownHead then
|
|
|
|
|
bInvertTool = true
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- verifico se devo invertire direzione utensile (in caso di direzione verso la verticale)
|
|
|
|
|
if vtN1:getZ() < BD.NZ_MINA and abs( vtN1:getZ()) >= 0.707 then
|
|
|
|
|
bInvertTool = true
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
-- altrimenti se da fare in una sola volta e direzionato verso Y+ lo inverto per lavorarlo davanti
|
|
|
|
|
elseif not bDoubleSide and vtN1:getY() > 10 * GEO.EPS_SMALL then
|
|
|
|
|
bInvertTool = true
|
|
|
|
|
bInvertMach = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bInvertMach)
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
local nSCC = MCH_SCC.NONE
|
|
|
|
|
if not BD.C_SIMM then
|
|
|
|
@@ -2039,7 +2055,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
-- imposto lato di lavoro sinistro
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT)
|
|
|
|
|
-- imposto direzione utensile opposta
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.TOOLINVERT, not bInvertTool)
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
|
local nSCC = MCH_SCC.NONE
|
|
|
|
|
if not BD.C_SIMM then
|
|
|
|
@@ -2068,7 +2084,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth)
|
|
|
|
|
-- setto se devo invertire il percorso
|
|
|
|
|
local bInvert = CheckToInvert( nIdPath, true)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, not bInvert)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.INVERT, not EgtIf( bInvertMach, not bInvert, bInvert))
|
|
|
|
|
-- Note utente con dichiarazione nessuna generazione sfridi per Vmill e massima elevazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'VMRS', 0)
|
|
|
|
@@ -4583,9 +4599,11 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
|
|
|
|
else
|
|
|
|
|
dMachDepth = dMaxDepthDn - ( dDepth / 2) - dCollSic
|
|
|
|
|
dElev = dMaxDepthDn
|
|
|
|
|
bComplete = false
|
|
|
|
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
if dMaxDepthDn < ( dDepth / 2) + dCollSic + 100 * GEO.EPS_SMALL then
|
|
|
|
|
bComplete = false
|
|
|
|
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
-- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura
|
|
|
|
@@ -4593,9 +4611,11 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
|
|
|
|
if dMaxDepth < ( dDepth / 2) + BD.CUT_EXTRA + dCollSic then
|
|
|
|
|
dMachDepth = dMaxDepth - (dDepth / 2) - dCollSic
|
|
|
|
|
dElev = dMaxDepth
|
|
|
|
|
bComplete = false
|
|
|
|
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
if dMaxDepth < ( dDepth / 2) + dCollSic + 100 * GEO.EPS_SMALL then
|
|
|
|
|
bComplete = false
|
|
|
|
|
sWarn = 'Warning : elevation bigger than max tool depth'
|
|
|
|
|
EgtOutLog( sWarn)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if bMakeContour then
|
|
|
|
@@ -5713,17 +5733,8 @@ 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( FaceToMachine.Edges.BottomEdge.ptStart)
|
|
|
|
|
local ptP2 = Point3d( FaceToMachine.Edges.BottomEdge.ptEnd)
|
|
|
|
|
local vtV1 = -Vector3d( FaceToMachine.Edges.SideEdges.StartEdge.vtEdge)
|
|
|
|
|
local vtV2 = Vector3d( FaceToMachine.Edges.SideEdges.EndEdge.vtEdge)
|
|
|
|
|
local ptP1 = Point3d( EdgeToMachine.ptStart)
|
|
|
|
|
local ptP2 = Point3d( EdgeToMachine.ptEnd)
|
|
|
|
|
|
|
|
|
|
local bInvert = Machining.Invert
|
|
|
|
|
if bInvert then
|
|
|
|
@@ -5734,16 +5745,6 @@ function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine, FaceToMachin
|
|
|
|
|
Machining.vtTg = vtTg
|
|
|
|
|
Machining.vtV = vtV1
|
|
|
|
|
|
|
|
|
|
-- Versore di riferimento
|
|
|
|
|
local vtRef = Vector3d( vtTg)
|
|
|
|
|
vtRef:rotate( vtN, EgtIf( bInvert, -90, 90))
|
|
|
|
|
|
|
|
|
|
local b3Box = BBox3d( b3Raw)
|
|
|
|
|
b3Box:expand( BD.CUT_SIC)
|
|
|
|
|
local ptPa1 = ptP1 + LeadIn.StartAddLength * -vtTg
|
|
|
|
|
local ptPa2 = ptP2 + LeadOut.EndAddLength * vtTg
|
|
|
|
|
|
|
|
|
|
LeadIn.TangentDistance, LeadIn.PerpDistance, LeadOut.TangentDistance, LeadOut.PerpDistance = Fbs.CalcLeadInOutPerpGeom( ptPa1, ptPa2, vtV1, vtV2, vtN, ( Machining.Tool.Diameter / 2), vtRef, -Machining.RadialOffset, b3Box)
|
|
|
|
|
else
|
|
|
|
|
if Machining.IsStartClosed then
|
|
|
|
|
LeadIn.StartAddLength = -dAddLengthToReduce
|
|
|
|
@@ -5856,23 +5857,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
|
|
|
|
|
|
|
|
|
@@ -5994,8 +6014,6 @@ 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'
|
|
|
|
@@ -6003,6 +6021,8 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
|
|
|
|
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)
|
|
|
|
|
-- SCC
|
|
|
|
|
Cutting.SCC = SawPlusChain.Saw.GetSCC( EdgeToMachine.ToolDirection, FaceToMachine.VtN, Cutting.vtTg)
|
|
|
|
|
-- eventuale step orizzontale
|
|
|
|
|
Cutting.HorizontalSteps = {}
|
|
|
|
|
if Cutting.Tool.SideStep then
|
|
|
|
@@ -6036,25 +6056,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
|
|
|
|
|
Cutting.RadialOffset = dOriginalRadialOffset + Cutting.HorizontalSteps.StepLength * ( i - 1)
|
|
|
|
|
local dOrthoOffsetStep = ( Cutting.RadialOffset * ( Cutting.vtV * vtTg))
|
|
|
|
|
-- update distanza perpendicolare attacco per contemplare l'offset applicato
|
|
|
|
|
Cutting.LeadIn.PerpDistance = dOriginalLeadInPerpDistance - Cutting.RadialOffset
|
|
|
|
|
Cutting.LeadIn.TangentDistance = dOriginalLeadInTangDistance + dOrthoOffsetStep + Cutting.LeadIn.StartAddLength
|
|
|
|
|
Cutting.LeadOut.PerpDistance = dOriginalLeadOutPerpDistance - Cutting.RadialOffset
|
|
|
|
|
Cutting.LeadOut.TangentDistance = dOriginalLeadOutTangDistance - dOrthoOffsetStep - Cutting.LeadOut.EndAddLength
|
|
|
|
|
|
|
|
|
|
Cutting.LeadIn.StartAddLength = Cutting.LeadIn.StartAddLength - dOrthoOffsetStep - Cutting.LeadIn.StartAddLength
|
|
|
|
|
Cutting.LeadOut.EndAddLength = Cutting.LeadOut.EndAddLength + dOrthoOffsetStep + Cutting.LeadOut.EndAddLength
|
|
|
|
|
-- applicazione lavorazione
|
|
|
|
|
bIsCuttingOk, sCuttingApplyMessage = SawPlusChain.ApplyMachining( Cutting, b3Raw)
|
|
|
|
|
-- update messaggi
|
|
|
|
@@ -8184,7 +8194,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
|
|
|
|
|
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
|
|
|
|
|
dDepth, bOneShotm)
|
|
|
|
|
dDepth, bOneShot)
|
|
|
|
|
if not bOk then return false, sWarn2 end
|
|
|
|
|
if sWarn2 then
|
|
|
|
|
if not sWarn then sWarn = '' end
|
|
|
|
@@ -8276,7 +8286,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
|
|
|
|
|
bDoubleSide, vtOrtho, nPathInt, nSurfInt, b3Solid,
|
|
|
|
|
dDepth, bOneShotm)
|
|
|
|
|
dDepth, bOneShot)
|
|
|
|
|
if not bOk then return false, sWarn2 end
|
|
|
|
|
if sWarn2 then
|
|
|
|
|
if not sWarn then sWarn = '' end
|
|
|
|
|