|
|
|
@@ -1004,7 +1004,7 @@ end
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
-- Lavorazione con fresa
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
|
|
|
|
local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId, nForcedFacInd, nSideInd)
|
|
|
|
|
-- recupero l'ingombro del grezzo di appartenenza
|
|
|
|
|
local b3Raw = EgtGetRawPartBBox( nRawId)
|
|
|
|
|
-- recupero l'ingombro della trave
|
|
|
|
@@ -1015,13 +1015,16 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- verifico il numero di facce della tacca
|
|
|
|
|
assert( ( Proc.Fct == 1), 'Error : MakeOneFaceByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
|
|
|
|
if not nForcedFacInd then
|
|
|
|
|
assert( ( Proc.Fct == 1), 'Error : MakeOneFaceByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces')
|
|
|
|
|
nForcedFacInd = 0
|
|
|
|
|
end
|
|
|
|
|
-- dati della faccia
|
|
|
|
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
|
|
|
|
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nForcedFacInd, GDB_ID.ROOT)
|
|
|
|
|
-- verifico se orientata verso l'alto
|
|
|
|
|
local bUp = ( vtN:getZ() >= BD.NZ_MINA)
|
|
|
|
|
-- scelta faccia da lavorare
|
|
|
|
|
local nFacInd = 0
|
|
|
|
|
local nFacInd = nForcedFacInd
|
|
|
|
|
-- recupero la lavorazione
|
|
|
|
|
local sMilling = ML.FindMilling( 'BirdsMouth')
|
|
|
|
|
if not sMilling then
|
|
|
|
@@ -1029,6 +1032,16 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
local dTDiam = 50
|
|
|
|
|
local dMaxMat = 0
|
|
|
|
|
if EgtMdbSetCurrMachining( sMilling) then
|
|
|
|
|
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
|
|
|
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
|
|
|
|
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
|
|
|
|
|
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam
|
|
|
|
|
-- inserisco la lavorazione di fresatura
|
|
|
|
|
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
|
|
|
local nMchFId = EgtAddMachining( sName, sMilling)
|
|
|
|
@@ -1039,8 +1052,17 @@ local function MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId)
|
|
|
|
|
end
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd}})
|
|
|
|
|
-- imposto uso faccia e lato correzione
|
|
|
|
|
if vtN:getX() > 0 then
|
|
|
|
|
-- imposto uso faccia e lato correzione se forzate da fuori forzo lavorazione della faccia
|
|
|
|
|
if nSideInd and nForcedFacInd then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.NONE)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dTDiam / 2)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dTDiam / 2)
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'EdgesFaceUse', EgtNumToString( nSideInd))
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LIPERP, dTDiam / 2)
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.LOPERP, dTDiam / 2)
|
|
|
|
|
elseif vtN:getX() > 0 then
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bUp, MCH_MILL_FU.ORTHO_LEFT, MCH_MILL_FU.PARAL_LEFT))
|
|
|
|
|
else
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bUp, MCH_MILL_FU.ORTHO_RIGHT, MCH_MILL_FU.PARAL_RIGHT))
|
|
|
|
@@ -3548,7 +3570,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
|
|
|
|
-- se necessario, avverto limitazione dell'affondamento
|
|
|
|
|
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
|
|
|
|
if Proc.Fct == 3 and Proc.Topology == 'Groove' and Proc.IsThrough and (Proc.AffectedFaces.Left or Proc.AffectedFaces.Right) and not Proc.IsParallel then
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nFacAdj+1])
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nFacAdj+1].Id)
|
|
|
|
|
local dWorkEdgeWidth
|
|
|
|
|
for i = 1, #Edges do
|
|
|
|
|
if Edges[i].AdjacentFaceId == nFacInd then
|
|
|
|
@@ -3679,7 +3701,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth)
|
|
|
|
|
-- si decidono lato di lavoro, inversione e estensione in base al lato aperto
|
|
|
|
|
local nEdgeIndex = BL.GetEdgeToMachineFromVector( Proc.Id, nFacAdj, vtRef)
|
|
|
|
|
local EdgesEgt = BL.GetEdgesInfo( Proc, Proc.Face[nFacAdj+1])
|
|
|
|
|
local EdgesEgt = BL.GetEdgesInfo( Proc, Proc.Face[nFacAdj+1].Id)
|
|
|
|
|
local CurrentEdge = EdgesEgt[nEdgeIndex+1]
|
|
|
|
|
local dStartAddLen = 0
|
|
|
|
|
local dEndAddLen = 0
|
|
|
|
@@ -4030,7 +4052,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas
|
|
|
|
|
-- faccia principale e quindi la componente X del versore della faccia potrebbe dare un valore non coerente
|
|
|
|
|
local dDiffFromSqAng = dAng + 90
|
|
|
|
|
-- informazioni sul lato da lavorare
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nSideFace + 1])
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nSideFace + 1].Id)
|
|
|
|
|
local EdgeToMachine = {}
|
|
|
|
|
for i = 1, #Edges do
|
|
|
|
|
local CurrentEdge = Edges[i]
|
|
|
|
@@ -4767,7 +4789,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId
|
|
|
|
|
return 1, sWarn, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, nil, sPocketing
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@@ -4801,7 +4823,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, b3Solid, bIsU, vtN, nFacInd,
|
|
|
|
|
local dMaxDepth = 200
|
|
|
|
|
local bAdj, dAng, dExtraOffs, sWarn2, nIdMach
|
|
|
|
|
-- Se faccia sulla quale cerca di applicare l'antisplint è chiusa e limitata da altre facce non lo applica
|
|
|
|
|
local FacetEdge = BL.GetEdgesInfo( Proc, Proc.Face[nFacet+1])
|
|
|
|
|
local FacetEdge = BL.GetEdgesInfo( Proc, Proc.Face[nFacet+1].Id)
|
|
|
|
|
for nEdge = 1, #FacetEdge do
|
|
|
|
|
if AreSameVectorApprox( FacetEdge[nEdge].ToolDirection, vtN) and ( not FacetEdge[nEdge].IsStartOpen or not FacetEdge[nEdge].IsEndOpen) and not FacetEdge[nEdge].IsOpen then
|
|
|
|
|
sWarn2 = 'Warning : antisplint not applicable on closed face'
|
|
|
|
@@ -5533,25 +5555,31 @@ function SawPlusChain.GetBottomFaceEdges( Proc, Face)
|
|
|
|
|
|
|
|
|
|
local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.Id, Face.Id, GDB_ID.ROOT)
|
|
|
|
|
if nFaceType < 1 then
|
|
|
|
|
for j = 1, #vEdges do
|
|
|
|
|
local nPreviousEdgeIndex = j - 1
|
|
|
|
|
if j == 1 then
|
|
|
|
|
for i = 1, #vEdges do
|
|
|
|
|
local nPreviousEdgeIndex = i - 1
|
|
|
|
|
if i == 1 then
|
|
|
|
|
nPreviousEdgeIndex = #vEdges
|
|
|
|
|
end
|
|
|
|
|
local nNextEdgeIndex = j + 1
|
|
|
|
|
if j == #vEdges then
|
|
|
|
|
local nNextEdgeIndex = i + 1
|
|
|
|
|
if i == #vEdges then
|
|
|
|
|
nNextEdgeIndex = 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local CurrentEdge = {}
|
|
|
|
|
CurrentEdge.AdjacentFaceId = vEdges[j].Adj
|
|
|
|
|
CurrentEdge.ToolDirection = Vector3d( vEdges[j].Norm)
|
|
|
|
|
CurrentEdge.Length = vEdges[j].Len
|
|
|
|
|
CurrentEdge.Elevation = vEdges[j].Elev
|
|
|
|
|
CurrentEdge.IsOpen = vEdges[j].Open
|
|
|
|
|
CurrentEdge.AdjacentFaceId = vEdges[i].Adj
|
|
|
|
|
CurrentEdge.ToolDirection = Vector3d( vEdges[i].Norm)
|
|
|
|
|
CurrentEdge.Length = vEdges[i].Len
|
|
|
|
|
CurrentEdge.Elevation = vEdges[i].Elev
|
|
|
|
|
CurrentEdge.IsOpen = vEdges[i].Open
|
|
|
|
|
CurrentEdge.IsStartOpen = ( vEdges[nPreviousEdgeIndex].Open)
|
|
|
|
|
CurrentEdge.IsEndOpen = ( vEdges[nNextEdgeIndex].Open)
|
|
|
|
|
CurrentEdge.Id = j - 1
|
|
|
|
|
CurrentEdge.Id = i - 1
|
|
|
|
|
CurrentEdge.ptStart = Point3d( vEdges[i].Start)
|
|
|
|
|
CurrentEdge.ptEnd = Point3d( vEdges[nNextEdgeIndex].Start)
|
|
|
|
|
CurrentEdge.vtEdge = CurrentEdge.ptEnd - CurrentEdge.ptStart ; CurrentEdge.vtEdge:normalize()
|
|
|
|
|
CurrentEdge.Id = i - 1
|
|
|
|
|
CurrentEdge.PreviousEdgeIndex = nPreviousEdgeIndex
|
|
|
|
|
CurrentEdge.NextEdgeIndex = nNextEdgeIndex
|
|
|
|
|
|
|
|
|
|
if CurrentEdge.AdjacentFaceId == Proc.MainFaces.LongFace.Id then
|
|
|
|
|
table.insert( Edges.LongEdges, CurrentEdge)
|
|
|
|
@@ -5579,25 +5607,30 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face)
|
|
|
|
|
|
|
|
|
|
local nFaceType, vEdges = EgtSurfTmGetFacetOutlineInfo( Proc.Id, Face.Id, GDB_ID.ROOT)
|
|
|
|
|
if nFaceType < 1 then
|
|
|
|
|
for j = 1, #vEdges do
|
|
|
|
|
local nPreviousEdgeIndex = j - 1
|
|
|
|
|
if j == 1 then
|
|
|
|
|
for i = 1, #vEdges do
|
|
|
|
|
local nPreviousEdgeIndex = i - 1
|
|
|
|
|
if i == 1 then
|
|
|
|
|
nPreviousEdgeIndex = #vEdges
|
|
|
|
|
end
|
|
|
|
|
local nNextEdgeIndex = j + 1
|
|
|
|
|
if j == #vEdges then
|
|
|
|
|
local nNextEdgeIndex = i + 1
|
|
|
|
|
if i == #vEdges then
|
|
|
|
|
nNextEdgeIndex = 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local CurrentEdge = {}
|
|
|
|
|
CurrentEdge.AdjacentFaceId = vEdges[j].Adj
|
|
|
|
|
CurrentEdge.ToolDirection = Vector3d( vEdges[j].Norm)
|
|
|
|
|
CurrentEdge.Length = vEdges[j].Len
|
|
|
|
|
CurrentEdge.Elevation = vEdges[j].Elev
|
|
|
|
|
CurrentEdge.IsOpen = vEdges[j].Open
|
|
|
|
|
CurrentEdge.AdjacentFaceId = vEdges[i].Adj
|
|
|
|
|
CurrentEdge.ToolDirection = Vector3d( vEdges[i].Norm)
|
|
|
|
|
CurrentEdge.Length = vEdges[i].Len
|
|
|
|
|
CurrentEdge.Elevation = vEdges[i].Elev
|
|
|
|
|
CurrentEdge.IsOpen = vEdges[i].Open
|
|
|
|
|
CurrentEdge.IsStartOpen = ( vEdges[nPreviousEdgeIndex].Open)
|
|
|
|
|
CurrentEdge.IsEndOpen = ( vEdges[nNextEdgeIndex].Open)
|
|
|
|
|
CurrentEdge.Id = j - 1
|
|
|
|
|
CurrentEdge.ptStart = Point3d( vEdges[i].Start)
|
|
|
|
|
CurrentEdge.ptEnd = Point3d( vEdges[nNextEdgeIndex].Start)
|
|
|
|
|
CurrentEdge.vtEdge = CurrentEdge.ptEnd - CurrentEdge.ptStart ; CurrentEdge.vtEdge:normalize()
|
|
|
|
|
CurrentEdge.Id = i - 1
|
|
|
|
|
CurrentEdge.PreviousEdgeIndex = nPreviousEdgeIndex
|
|
|
|
|
CurrentEdge.NextEdgeIndex = nNextEdgeIndex
|
|
|
|
|
|
|
|
|
|
if Proc.Topology == 'Tunnel' then
|
|
|
|
|
if CurrentEdge.AdjacentFaceId > -1 then
|
|
|
|
@@ -5629,7 +5662,7 @@ function SawPlusChain.GetLongFaceEdges( Proc, Face)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine)
|
|
|
|
|
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
|
|
|
|
@@ -5680,6 +5713,37 @@ function SawPlusChain.CalculateLeadInOut( Machining, EdgeToMachine)
|
|
|
|
|
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 bInvert = Machining.Invert
|
|
|
|
|
if bInvert then
|
|
|
|
|
ptP1, ptP2 = ptP2, ptP1
|
|
|
|
|
vtV1, vtV2 = vtV2, vtV1
|
|
|
|
|
end
|
|
|
|
|
local vtTg = ptP2 - ptP1 ; vtTg:normalize()
|
|
|
|
|
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
|
|
|
|
@@ -5813,11 +5877,12 @@ function SawPlusChain.Saw.GetSCC( vtMachiningDirection)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine)
|
|
|
|
|
function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, b3Raw)
|
|
|
|
|
local Cutting = {}
|
|
|
|
|
Cutting.CanApply = true
|
|
|
|
|
Cutting.Message = ''
|
|
|
|
|
Cutting.ProcId = Proc.Id
|
|
|
|
|
EdgeToMachine.FaceId = FaceToMachine.Id
|
|
|
|
|
|
|
|
|
|
local dPocketHeight = 0
|
|
|
|
|
if Proc.Topology == 'Tunnel' then
|
|
|
|
@@ -5937,7 +6002,7 @@ function SawPlusChain.Saw.CalculateMachiningParameters( Proc, FaceToMachine, Edg
|
|
|
|
|
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)
|
|
|
|
|
Cutting.LeadIn, Cutting.LeadOut = SawPlusChain.CalculateLeadInOut( Cutting, EdgeToMachine, FaceToMachine, b3Raw)
|
|
|
|
|
-- eventuale step orizzontale
|
|
|
|
|
Cutting.HorizontalSteps = {}
|
|
|
|
|
if Cutting.Tool.SideStep then
|
|
|
|
@@ -5971,15 +6036,25 @@ 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
|
|
|
|
@@ -6221,9 +6296,9 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
-- lavorazione di lama - fondo della tasca o fino a massimo materiale se tunnel
|
|
|
|
|
local Cutting = {}
|
|
|
|
|
if Proc.Topology == 'Tunnel' then
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1])
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[1], b3Raw)
|
|
|
|
|
else
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge)
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.BottomEdge, b3Raw)
|
|
|
|
|
end
|
|
|
|
|
local bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
@@ -6235,7 +6310,7 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
local dBottomDepthToMachine = Cutting.RadialOffset
|
|
|
|
|
-- lato opposto del tunnel
|
|
|
|
|
if Proc.Topology == 'Tunnel' then
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2])
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.OppositeEdges[2], b3Raw)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
@@ -6248,7 +6323,7 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
if Cutting.CanApply and Cutting.RadialOffset > 10 * GEO.EPS_SMALL then
|
|
|
|
|
-- eventuale lavorazione di lama - lato della tasca da cui inizia la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsStartOpen then
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.StartEdge)
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.StartEdge, b3Raw)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
@@ -6259,7 +6334,7 @@ function SawPlusChain.Make( bOnlySaw, Proc, nRawId)
|
|
|
|
|
end
|
|
|
|
|
-- eventuale lavorazione di lama - lato della tasca in cui finisce la lavorazione
|
|
|
|
|
if Proc.MainFaces.LongFace.Edges.BottomEdge.IsEndOpen then
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.EndEdge)
|
|
|
|
|
Cutting = SawPlusChain.Saw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFace, Proc.MainFaces.LongFace.Edges.SideEdges.EndEdge, b3Raw)
|
|
|
|
|
bIsCuttingOk = false
|
|
|
|
|
if Cutting.CanApply then
|
|
|
|
|
bIsCuttingOk, Cutting.Message = SawPlusChain.Saw.ApplyAllSteps( Cutting, b3Raw)
|
|
|
|
@@ -6688,60 +6763,74 @@ local function AddMillCorner( vFace, Proc, dToolDiam, nAddGrpId, nMasterNewProc,
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
local j = EgtIf( i < #vFace, i + 1, EgtIf( bClosed, 1, nil))
|
|
|
|
|
if not j then return true end
|
|
|
|
|
local nFace2 = vFace[j].Fac
|
|
|
|
|
-- punto in comune tra le due facce (punto precedente della faccia [j])
|
|
|
|
|
ptLoc1 = vFace[j].PPrev
|
|
|
|
|
-- punto precedente (punto precedente della faccia [i])
|
|
|
|
|
if vFace[i].PPrev then
|
|
|
|
|
ptLoc3 = vFace[i].PPrev
|
|
|
|
|
else
|
|
|
|
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
|
|
|
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), vFace[i].Cen:getY(), ptLoc1:getZ())
|
|
|
|
|
if vFace[j].PPrev then
|
|
|
|
|
local nFace2 = vFace[j].Fac
|
|
|
|
|
-- punto in comune tra le due facce (punto precedente della faccia [j])
|
|
|
|
|
ptLoc1 = vFace[j].PPrev
|
|
|
|
|
-- punto precedente (punto precedente della faccia [i])
|
|
|
|
|
if vFace[i].PPrev then
|
|
|
|
|
ptLoc3 = vFace[i].PPrev
|
|
|
|
|
elseif vFace[i].PNoPrev then
|
|
|
|
|
ptLoc3 = vFace[i].PNoPrev
|
|
|
|
|
else
|
|
|
|
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), ptLoc1:getY(), vFace[i].Cen:getZ())
|
|
|
|
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
|
|
|
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), vFace[i].Cen:getY(), ptLoc1:getZ())
|
|
|
|
|
else
|
|
|
|
|
ptLoc3 = Point3d( vFace[i].Cen:getX(), ptLoc1:getY(), vFace[i].Cen:getZ())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- punto successivo ( precedente della faccia successiva)
|
|
|
|
|
local k = EgtIf( j < #vFace, j + 1, EgtIf( bClosed, 1, nil))
|
|
|
|
|
-- se è un percorso aperto prendo il punto medio della seconda faccia come punto locale 2
|
|
|
|
|
if not k then
|
|
|
|
|
if abs( vtN:getZ()) > abs( vtN:getY()) then
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
|
|
|
|
|
-- punto successivo ( precedente della faccia successiva)
|
|
|
|
|
local k = EgtIf( j < #vFace, j + 1, EgtIf( bClosed, 1, nil))
|
|
|
|
|
-- se è un percorso aperto prendo il punto medio della seconda faccia come punto locale 2
|
|
|
|
|
if not k then
|
|
|
|
|
if vFace[j].PNoSucc then
|
|
|
|
|
ptLoc2 = vFace[j].PNoSucc
|
|
|
|
|
elseif abs( vtN:getZ()) > abs( vtN:getY()) then
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
|
|
|
|
|
else
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), ptLoc1:getY(), vFace[j].Cen:getZ())
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), ptLoc1:getY(), vFace[j].Cen:getZ())
|
|
|
|
|
if vFace[j].PNoSucc then
|
|
|
|
|
ptLoc2 = vFace[j].PNoSucc
|
|
|
|
|
elseif vFace[k].PPrev then
|
|
|
|
|
ptLoc2 = vFace[k].PPrev
|
|
|
|
|
elseif abs( vtN:getZ()) > abs( vtN:getY()) then
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), vFace[j].Cen:getY(), ptLoc1:getZ())
|
|
|
|
|
else
|
|
|
|
|
ptLoc2 = Point3d( vFace[j].Cen:getX(), ptLoc1:getY(), vFace[j].Cen:getZ())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
ptLoc2 = vFace[k].PPrev
|
|
|
|
|
end
|
|
|
|
|
-- ricavo i punti e l'angolo interno
|
|
|
|
|
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
|
|
|
|
|
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
|
|
|
|
local tFacAdj = {}
|
|
|
|
|
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > -( 90 + 10 * GEO.EPS_SMALL) then
|
|
|
|
|
local dLen = dist( ptP1, ptP2)
|
|
|
|
|
tFacAdj = { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}
|
|
|
|
|
end
|
|
|
|
|
-- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90°
|
|
|
|
|
-- con una tolleranza di 2 gradi
|
|
|
|
|
if #tFacAdj > 0 then
|
|
|
|
|
if (dAng + 90) > 2 then
|
|
|
|
|
local dAngOffs = (dAng + 90) / 2
|
|
|
|
|
-- primo taglio
|
|
|
|
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, -dAngOffs,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- secondo taglio
|
|
|
|
|
bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, dAngOffs,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- altrimenti ho un solo percorso
|
|
|
|
|
else
|
|
|
|
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, 0,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- ricavo i punti e l'angolo interno
|
|
|
|
|
local _, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( nNewProc.Id, nFace1, nFace2, GDB_ID.ROOT)
|
|
|
|
|
-- se punti validi e angolo è interno e non è quasi piatto e >= 90 creo istanza
|
|
|
|
|
local tFacAdj = {}
|
|
|
|
|
if ptP1 and ptP2 and dAng < 0 and dAng < -6 and dAng > -( 90 + 10 * GEO.EPS_SMALL) then
|
|
|
|
|
local dLen = dist( ptP1, ptP2)
|
|
|
|
|
tFacAdj = { nFace1, nFace2, dLen, ptP1, ptP2, dAng, ptLoc1, ptLoc2, ptLoc3}
|
|
|
|
|
end
|
|
|
|
|
-- se ho un elemento creo percorso o percorsi in base al tipo di cono e all'apertura dall'angolo rispetto ai 90°
|
|
|
|
|
-- con una tolleranza di 2 gradi
|
|
|
|
|
if #tFacAdj > 0 then
|
|
|
|
|
if (dAng + 90) > 2 then
|
|
|
|
|
local dAngOffs = (dAng + 90) / 2
|
|
|
|
|
-- primo taglio
|
|
|
|
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, -dAngOffs,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- secondo taglio
|
|
|
|
|
bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, dAngOffs,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
-- altrimenti ho un solo percorso
|
|
|
|
|
else
|
|
|
|
|
local bOk, sErr = AddMillCornerMachining( Proc.PartId, nNewProc, nFacInd, tFacAdj, nAddGrpId,
|
|
|
|
|
dToolDiam, sMilling, 0,
|
|
|
|
|
ToolData, bMakeLocSurf, vFace, vtN)
|
|
|
|
|
if not bOk then return bOk, sErr end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@@ -6777,7 +6866,60 @@ local function GetOtherRegions( nPartId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
local function GetFacesData( nNewProc, dToolDiam, dToolMaxDepth, dToolThick, nAddGrpId, nPartId, vtNBottom)
|
|
|
|
|
local function GetCleanCornerFacesData( nNewProc, dToolDiam, dToolMaxDepth, dToolThick, nAddGrpId, nPartId, vtNBottom, Proc)
|
|
|
|
|
|
|
|
|
|
local function GetCleanCornerPointIfNoAdj( nNewProc, Proc, nFac, vFace, ptAdjP1, ptAdjP2)
|
|
|
|
|
local ptPNoPrev
|
|
|
|
|
local bAdj, ptLocP1, ptLocP2, dAng
|
|
|
|
|
if not ptAdjP1 and not ptAdjP2 then
|
|
|
|
|
bAdj, ptLocP1, ptLocP2, dAng = EgtSurfTmFacetsContact( nNewProc, nFac+1, nFac, GDB_ID.ROOT)
|
|
|
|
|
else
|
|
|
|
|
bAdj = true
|
|
|
|
|
ptLocP1 = ptAdjP1
|
|
|
|
|
ptLocP2 = ptAdjP2
|
|
|
|
|
end
|
|
|
|
|
if bAdj then
|
|
|
|
|
local vEdges = BL.GetEdgesInfo( nNewProc, nFac)
|
|
|
|
|
for j = 1, #vEdges do
|
|
|
|
|
if #vEdges == 4 and ( not AreSamePointApprox( vEdges[j].ptStart, ptLocP1) and not AreSamePointApprox( vEdges[j].ptStart, ptLocP2)) and
|
|
|
|
|
( not AreSamePointApprox( vEdges[j].ptEnd, ptLocP1) and not AreSamePointApprox( vEdges[j].ptEnd, ptLocP2)) then
|
|
|
|
|
-- se rivolto verso Z
|
|
|
|
|
if abs( vtNBottom:getZ()) > abs( vtNBottom:getY()) then
|
|
|
|
|
if vEdges[j].ptStart:getZ() < vEdges[j].ptEnd:getZ() then
|
|
|
|
|
ptPNoPrev = vEdges[j].ptStart
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
ptPNoPrev = vEdges[j].ptEnd
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if vtNBottom:getY() > 0 then
|
|
|
|
|
ptPNoPrev = EgtIf( vEdges[j].ptStart:getY() < vEdges[j].ptEnd:getY(), vEdges[j].ptStart, vEdges[j].ptEnd)
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
ptPNoPrev = EgtIf( vEdges[j].ptStart:getY() > vEdges[j].ptEnd:getY(), vEdges[j].ptStart, vEdges[j].ptEnd)
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif #vEdges == 3 then
|
|
|
|
|
if not AreSamePointApprox( vEdges[j].ptStart, ptLocP1) then
|
|
|
|
|
ptPNoPrev = vEdges[j].ptStart
|
|
|
|
|
break
|
|
|
|
|
elseif not AreSamePointApprox( vEdges[j].ptStart, ptLocP2) then
|
|
|
|
|
ptPNoPrev = vEdges[j].ptStart
|
|
|
|
|
break
|
|
|
|
|
elseif not AreSamePointApprox( vEdges[j].ptEnd, ptLocP1) then
|
|
|
|
|
ptPNoPrev = vEdges[j].ptEnd
|
|
|
|
|
break
|
|
|
|
|
elseif not AreSamePointApprox( vEdges[j].ptEnd, ptLocP2) then
|
|
|
|
|
ptPNoPrev = vEdges[j].ptEnd
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return ptPNoPrev
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
|
|
|
|
local vFace = {}
|
|
|
|
@@ -6794,14 +6936,17 @@ local function GetFacesData( nNewProc, dToolDiam, dToolMaxDepth, dToolThick, nAd
|
|
|
|
|
local _, dLen, dWidth = BL.GetFaceHvRefDim( nNewProc, nFac)
|
|
|
|
|
-- recupero l'angolo con la faccia precedente
|
|
|
|
|
local bAdj, ptLocP1, ptLocP2, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT)
|
|
|
|
|
-- salvo i dati
|
|
|
|
|
vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
|
|
|
|
|
if not bAdj and Proc.Fct > 3 then
|
|
|
|
|
vFace[i].PNoPrev = GetCleanCornerPointIfNoAdj( nNewProc, Proc, nFac, vFace[i], nil, nil)
|
|
|
|
|
end
|
|
|
|
|
-- verifico che l'adiacenza sia veramente con il precedente (percorro con normale a destra)
|
|
|
|
|
if bAdj then
|
|
|
|
|
if ( vtN ^ ( ptLocP1 - ptCen)) * vtNBottom > 0 then
|
|
|
|
|
bAdj = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- salvo i dati
|
|
|
|
|
vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
|
|
|
|
|
if bAdj then
|
|
|
|
|
-- se rivolto verso Z
|
|
|
|
|
if abs( vtNBottom:getZ()) > abs( vtNBottom:getY()) then
|
|
|
|
@@ -6817,6 +6962,10 @@ local function GetFacesData( nNewProc, dToolDiam, dToolMaxDepth, dToolThick, nAd
|
|
|
|
|
vFace[i].PPrev = EgtIf( ptLocP1:getY() > ptLocP2:getY(), ptLocP1, ptLocP2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local bAdj_2, ptLocP1_2, ptLocP2_2, dAng_2 = EgtSurfTmFacetsContact( nNewProc, nFac, nFac+1, GDB_ID.ROOT)
|
|
|
|
|
if not bAdj_2 and Proc.Fct > 3 then
|
|
|
|
|
vFace[i].PNoSucc = GetCleanCornerPointIfNoAdj( nNewProc, Proc, nFac, vFace[i], ptLocP1, ptLocP2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- analizzo le facce
|
|
|
|
@@ -7511,14 +7660,34 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
end
|
|
|
|
|
-- provo con contornatura
|
|
|
|
|
local dDiamTool = 20
|
|
|
|
|
local nChoosenFacInd = nFacInd2
|
|
|
|
|
local dChoosenFacElev = dFacElev2
|
|
|
|
|
if bIsL then
|
|
|
|
|
local bOk, sErr
|
|
|
|
|
bOk, sWarn, dDiamTool = MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dFacElev, dCollSic, true, sMilling, nFacInd2, dFacElev2)
|
|
|
|
|
if not bOk then return bOk, sWarn end
|
|
|
|
|
else
|
|
|
|
|
local sErr = 'Error : Impossible mill special LapJoint'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
-- provo ancora con la pocketing dell'altra faccia
|
|
|
|
|
local sPocketing = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
|
|
|
|
|
if sPocketing then
|
|
|
|
|
nChoosenFacInd = nFacInd
|
|
|
|
|
dChoosenFacElev = dFacElev
|
|
|
|
|
local Edges = BL.GetEdgesInfo( Proc, Proc.Face[nFacInd+1].Id)
|
|
|
|
|
local nSideInd
|
|
|
|
|
for i = 1, #Edges do
|
|
|
|
|
if Edges[i].AdjacentFaceId == nFacInd2 then
|
|
|
|
|
nSideInd = i - 1
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se pocketing ok forza facet e spigolo di lavoro
|
|
|
|
|
bOk, sWarn = MakeOneFaceByMill( Proc, nPhase, nRawId, nPartId, nFacInd2, nSideInd)
|
|
|
|
|
if not bOk then return bOk, sWarn end
|
|
|
|
|
else
|
|
|
|
|
local sErr = 'Error : Impossible mill special LapJoint'
|
|
|
|
|
EgtOutLog( sErr)
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- inserisco la lavorazione di svuotatura
|
|
|
|
|
local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
|
|
|
|
@@ -7529,7 +7698,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
return false, sErr
|
|
|
|
|
end
|
|
|
|
|
-- aggiungo geometria
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nFacInd2}})
|
|
|
|
|
EgtSetMachiningGeometry( {{ Proc.Id, nChoosenFacInd}})
|
|
|
|
|
-- imposto uso faccia
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT)
|
|
|
|
|
-- imposto posizione braccio porta testa
|
|
|
|
@@ -7544,7 +7713,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
end
|
|
|
|
|
-- imposto elevazione
|
|
|
|
|
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or ''
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dFacElev2, 1))
|
|
|
|
|
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dChoosenFacElev, 1))
|
|
|
|
|
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
|
|
|
|
|
-- eseguo
|
|
|
|
|
if not ML.ApplyMachining( true, false) then
|
|
|
|
@@ -8068,7 +8237,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
bSetOpenBorders = true
|
|
|
|
|
end
|
|
|
|
|
nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId,
|
|
|
|
|
bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
|
|
|
|
|
bOrthoFaces, sPocketing = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders, bIsU, bIsL)
|
|
|
|
|
if nOk == -3 then
|
|
|
|
|
bTryWithBlades = true
|
|
|
|
|
elseif nOk == -2 then
|
|
|
|
@@ -8102,6 +8271,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
end
|
|
|
|
|
-- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola
|
|
|
|
|
local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0
|
|
|
|
|
local nCleanCorner = EgtGetInfo( Proc.Id, Q_CLEAN_CORNER, 'i') or 0
|
|
|
|
|
if nContourSmallTool > 0 then
|
|
|
|
|
local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw,
|
|
|
|
|
nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown,
|
|
|
|
@@ -8113,6 +8283,43 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sWarn2, sWarn2)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- se richiesta pulizia spigoli con fresa a V
|
|
|
|
|
if nCleanCorner > 0 then
|
|
|
|
|
local dMaxToolMaterial = 0
|
|
|
|
|
if EgtMdbSetCurrMachining( sPocketing) then
|
|
|
|
|
local sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
|
|
|
|
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then
|
|
|
|
|
dMaxToolMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxToolMaterial
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local nNewProc
|
|
|
|
|
local vtSpec = vtN
|
|
|
|
|
if not ( Proc.Fct == 3 and bIsU) then
|
|
|
|
|
nNewProc = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacInd, vtN)
|
|
|
|
|
-- se U passante ricavo vettore da "sopra" con componente Z forzata in positivo
|
|
|
|
|
else
|
|
|
|
|
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
|
|
|
|
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
|
|
|
|
-- vettore normale ad una delle facce adiacenti
|
|
|
|
|
local vtOther = EgtSurfTmFacetNormVersor( Proc.Id, Proc.Face[nFacInd+1].Adjacencies[1], GDB_ID.ROOT)
|
|
|
|
|
-- ricavo vettore verso l'alto (simulo faccia di fondo)
|
|
|
|
|
vtSpec = vtN ^ vtOther
|
|
|
|
|
-- se negativo in Z forzo positivo
|
|
|
|
|
if vtSpec:getZ() < 0 then
|
|
|
|
|
vtSpec:mirror(vtSpec)
|
|
|
|
|
end
|
|
|
|
|
ReorderFaces( nNewProc, nNumFacet, vtSpec)
|
|
|
|
|
-- normale della lavorazione clean corner
|
|
|
|
|
vtN = vtSpec
|
|
|
|
|
end
|
|
|
|
|
local vFace, dDepth = GetCleanCornerFacesData( nNewProc, dDiamTool, dMaxToolMaterial, ( dDiamTool/2), nAddGrpId, Proc.PartId, vtN, Proc)
|
|
|
|
|
local bCleanCornerOk, sCleanCornerWarn = AddMillCorner( vFace, Proc, dDiamTool, nAddGrpId, nNewProc, vtN)
|
|
|
|
|
if not bCleanCornerOk then return false, sCleanCornerWarn end
|
|
|
|
|
if sCleanCornerWarn then
|
|
|
|
|
if not sWarn then sWarn = '' end
|
|
|
|
|
sWarn = EgtIf( #sWarn > 0, sWarn .. '\n' .. sCleanCornerWarn, sCleanCornerWarn)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
bOk = true
|
|
|
|
@@ -8328,8 +8535,27 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
|
|
|
|
|
-- se richiesta pulizia spigoli con fresa a V
|
|
|
|
|
if nCleanCorner > 0 then
|
|
|
|
|
local dThElev = dToolThDiameter / 2 * sqrt( vtN:getX() * vtN:getX() + vtN:getY() * vtN:getY())
|
|
|
|
|
local nNewProc = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacInd, vtN)
|
|
|
|
|
local vFace, dDepth = GetFacesData( nNewProc, dToolDiameter, dMaxToolMaterial, ( dToolDiameter/2), nAddGrpId, Proc.PartId, vtN)
|
|
|
|
|
local nNewProc
|
|
|
|
|
local vtSpec = vtN
|
|
|
|
|
if not ( Proc.Fct == 3 and bIsU) then
|
|
|
|
|
nNewProc = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacInd, vtN)
|
|
|
|
|
-- se U passante ricavo vettore da "sopra" con componente Z forzata in positivo
|
|
|
|
|
else
|
|
|
|
|
nNewProc = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL
|
|
|
|
|
local nNumFacet = EgtSurfTmFacetCount( nNewProc)
|
|
|
|
|
-- vettore normale ad una delle facce adiacenti
|
|
|
|
|
local vtOther = EgtSurfTmFacetNormVersor( Proc.Id, Proc.Face[nFacInd+1].Adjacencies[1], GDB_ID.ROOT)
|
|
|
|
|
-- ricavo vettore verso l'alto (simulo faccia di fondo)
|
|
|
|
|
vtSpec = vtN ^ vtOther
|
|
|
|
|
-- se negativo in Z forzo positivo
|
|
|
|
|
if vtSpec:getZ() < 0 then
|
|
|
|
|
vtSpec:mirror(vtSpec)
|
|
|
|
|
end
|
|
|
|
|
ReorderFaces( nNewProc, nNumFacet, vtSpec)
|
|
|
|
|
-- normale della lavorazione clean corner
|
|
|
|
|
vtN = vtSpec
|
|
|
|
|
end
|
|
|
|
|
local vFace, dDepth = GetCleanCornerFacesData( nNewProc, dToolDiameter, dMaxToolMaterial, ( dToolDiameter/2), nAddGrpId, Proc.PartId, vtN, Proc)
|
|
|
|
|
local bCleanCornerOk, sCleanCornerWarn = AddMillCorner( vFace, Proc, dToolDiameter, nAddGrpId, nNewProc, vtN)
|
|
|
|
|
if not bCleanCornerOk then return false, sCleanCornerWarn end
|
|
|
|
|
if sCleanCornerWarn then
|
|
|
|
|