- in SLOTBYCHAINSAW modifiche varie
This commit is contained in:
@@ -55,29 +55,12 @@ local function GetCompletionPercentage( Proc, Result)
|
||||
end
|
||||
|
||||
|
||||
local function AddResult( Machining)
|
||||
table.insert( Result, {})
|
||||
Result[#Result].bIsApplicable = Machining.bIsApplicable
|
||||
Result[#Result].sMessage = Machining.sMessage
|
||||
Result[#Result].dDepthMachined = Machining.dDepthToMachine
|
||||
Result[#Result].bIsApplyOk = Machining.bIsApplyOk
|
||||
Result[#Result].sApplyMessage = Machining.sApplyMessage
|
||||
|
||||
return Result
|
||||
end
|
||||
|
||||
|
||||
local function CalculateLeadInOut( Machining, EdgeToMachine)
|
||||
local function CalculateLeadInOut( Machining, EdgeToMachine, sSideToMachine, dLengthToMachine)
|
||||
-- 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
|
||||
local bIsMortising = ( Machining.nType == MCH_OY.MORTISING)
|
||||
local dAddLengthToReduce = 0
|
||||
if bIsMortising then
|
||||
dAddLengthToReduce = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
else
|
||||
dAddLengthToReduce = sqrt( Machining.dDepthToMachine * TOOLS[Machining.nToolIndex].dDiameter - Machining.dDepthToMachine * Machining.dDepthToMachine)
|
||||
end
|
||||
dAddLengthToReduce = TOOLS[Machining.nToolIndex].dDiameter / 2
|
||||
|
||||
if Machining.bInvert then
|
||||
Machining.bIsStartClosed, Machining.bIsEndClosed = Machining.bIsEndClosed, Machining.bIsStartClosed
|
||||
@@ -87,63 +70,46 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
|
||||
local LeadOut = {}
|
||||
LeadIn.dStartAddLength = 0
|
||||
LeadOut.dEndAddLength = 0
|
||||
if not bIsMortising then
|
||||
LeadIn.nType = MCH_MILL_LI.LINEAR
|
||||
LeadOut.nType = MCH_MILL_LI.LINEAR
|
||||
LeadIn.dTangentDistance = 0
|
||||
LeadOut.dTangentDistance = 0
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
LeadIn.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
|
||||
LeadOut.dPerpDistance = EdgeToMachine.dElevation + BeamData.CUT_SIC
|
||||
if Machining.bIsStartClosed then
|
||||
if sSideToMachine == 'Start' then
|
||||
LeadIn.dStartAddLength = dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
else
|
||||
LeadIn.dPerpDistance = BeamData.CUT_SIC
|
||||
LeadOut.dPerpDistance = BeamData.CUT_SIC
|
||||
end
|
||||
LeadIn.dElevation = 0
|
||||
LeadOut.dElevation = 0
|
||||
LeadIn.dCompLength = 0
|
||||
LeadOut.dCompLength = 0
|
||||
if Machining.bIsStartClosed and Machining.bIsEndClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
elseif Machining.bIsStartClosed then
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadOut.dEndAddLength = max( -LeadIn.dStartAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
elseif Machining.bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
-- eventuale correzione per accorciamento maggiore di larghezza tasca
|
||||
LeadIn.dStartAddLength = max( -LeadOut.dEndAddLength - EdgeToMachine.dLength + 10 * BeamData.CUT_EXTRA, BeamData.CUT_EXTRA)
|
||||
else
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
else
|
||||
if Machining.bIsStartClosed then
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
if Machining.bIsEndClosed then
|
||||
if sSideToMachine == 'End' then
|
||||
LeadIn.dStartAddLength = dLengthToMachine + BeamData.CUT_EXTRA - EdgeToMachine.dLength
|
||||
else
|
||||
LeadIn.dStartAddLength = -dAddLengthToReduce
|
||||
else
|
||||
LeadIn.dStartAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
if Machining.bIsEndClosed then
|
||||
LeadOut.dEndAddLength = -dAddLengthToReduce
|
||||
else
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
else
|
||||
LeadOut.dEndAddLength = BeamData.CUT_EXTRA
|
||||
end
|
||||
|
||||
return LeadIn, LeadOut
|
||||
end
|
||||
|
||||
|
||||
function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
-- TODO calcolo area lavorata
|
||||
function SLOTBYCHAINSAW.Make( Proc, Part, FaceToMachine, EdgeToMachine, OptionalParameters)
|
||||
local Mortising = {}
|
||||
Mortising.bIsApplicable = true
|
||||
Mortising.dDepthToMachine = 0
|
||||
Mortising.dResidualDepth = EdgeToMachine.dElevation
|
||||
Mortising.sMessage = ''
|
||||
Mortising.idProc = Proc.id
|
||||
-- OneSide | OneSideAndExtend | BothSides | BothSidesAndExtend
|
||||
local sMortisingType
|
||||
|
||||
Mortising.sEdgeType = EdgeToMachine.sType
|
||||
|
||||
-- parametri opzionali
|
||||
local bUseZigZagMortising = OptionalParameters.bUseZigZagMortising or false
|
||||
local sSideToMachine = OptionalParameters.sSideToMachine or ''
|
||||
local dLengthToMachine = OptionalParameters.dLengthToMachine or EdgeToMachine.dLength
|
||||
local dCustomMaxElev = OptionalParameters.dMaxElev or abs( EdgeToMachine.dElevation)
|
||||
local bStopAtHalfElevation = OptionalParameters.bStopAtHalfElevation or false
|
||||
|
||||
local dPocketHeight = 0
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
|
||||
@@ -156,66 +122,52 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
end
|
||||
|
||||
-- ricerca utensile
|
||||
local bExtendWithCornerRadius = false
|
||||
if not bStopAtHalfElevation then
|
||||
if ( EdgeToMachine.sType == 'Side' and Proc.Topology.sName == 'Groove-3-Through') or
|
||||
( EdgeToMachine.sType == 'Opposite' and Proc.Topology.sFamily == 'Tunnel') then
|
||||
|
||||
bExtendWithCornerRadius = true
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
else
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
||||
end
|
||||
else
|
||||
bExtendWithCornerRadius = true
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
end
|
||||
local ToolSearchParameters = {}
|
||||
local ToolInfo = {}
|
||||
ToolSearchParameters.vtToolDirection = EdgeToMachine.vtToolDirection
|
||||
ToolSearchParameters.bAllowTopHead = true
|
||||
ToolSearchParameters.bAllowBottomHead = false
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
sMortisingType = 'OneSideAndExtend'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = true
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
if ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
sMortisingType = 'BothSidesAndExtend'
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
elseif EdgeToMachine.sType == 'Side' and #( Proc.MainFaces.SideFaces) == 0 then
|
||||
sMortisingType = 'BothSidesAndExtend'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = true
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) / 2 + BeamData.CUT_EXTRA_MIN
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
else
|
||||
sMortisingType = 'OneSide'
|
||||
ToolSearchParameters.bExtendWithCornerRadius = false
|
||||
ToolSearchParameters.dElevation = abs( EdgeToMachine.dElevation) + BeamData.CUT_EXTRA
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
if ToolSearchParameters.bExtendWithCornerRadius and ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
if sMortisingType == 'BothSidesAndExtend' then
|
||||
sMortisingType = 'BothSides'
|
||||
elseif sMortisingType == 'OneSideAndExtend' then
|
||||
sMortisingType = 'OneSide'
|
||||
end
|
||||
ToolSearchParameters.bExtendWithCornerRadius = false
|
||||
ToolSearchParameters.dElevation = nil
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
end
|
||||
ToolSearchParameters.bAllowBottomHead = true
|
||||
ToolSearchParameters.dElevation = Mortising.dDepthToMachine
|
||||
ToolSearchParameters.bExtendWithCornerRadius = bExtendWithCornerRadius
|
||||
ToolInfo = MachiningLib.FindChainSaw( Proc, ToolSearchParameters)
|
||||
Mortising.nToolIndex = ToolInfo.nToolIndex
|
||||
Mortising.nType = MCH_OY.MORTISING
|
||||
if not TOOLS[Mortising.nToolIndex].sName then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - chainsaw not found'
|
||||
Mortising.sMessage = 'Chainsaw not found'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
return Mortising
|
||||
end
|
||||
|
||||
-- verifica dimensioni tasca compatibili
|
||||
-- se tasca meno spessa della sega a catena la strategia non è applicabile
|
||||
if TOOLS[Mortising.nToolIndex].dThickness > dPocketHeight + 10 * GEO.EPS_SMALL then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw thickness'
|
||||
Mortising.sMessage = 'Pocket too narrow for chainsaw thickness'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
return Mortising
|
||||
end
|
||||
if #( Proc.MainFaces.SideFaces) > 1 then
|
||||
-- se tasca più stretta della sega a catena la strategia non è applicabile
|
||||
if TOOLS[Mortising.nToolIndex].dWidth > EdgeToMachine.dLength + 10 * GEO.EPS_SMALL then
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket too narrow for chainsaw width'
|
||||
Mortising.sMessage = 'Pocket too narrow for chainsaw width'
|
||||
Mortising.bIsApplicable = false
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
return Mortising, EdgeToMachine.dElevation
|
||||
return Mortising
|
||||
end
|
||||
end
|
||||
|
||||
@@ -235,14 +187,8 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
Mortising.bToolInvert = true
|
||||
end
|
||||
-- profondità e offset longitudinale
|
||||
if sMortisingType == 'OneSide' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation)
|
||||
elseif sMortisingType == 'OneSideAndExtend' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
|
||||
elseif sMortisingType == 'BothSides' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2
|
||||
elseif sMortisingType == 'BothSidesAndExtend' then
|
||||
Mortising.dDepthToMachine = abs( EdgeToMachine.dElevation) / 2 + TOOLS[Mortising.nToolIndex].dCornerRadius + BeamData.CUT_EXTRA_MIN
|
||||
if bExtendWithCornerRadius then
|
||||
Mortising.dDepthToMachine = Mortising.dDepthToMachine + TOOLS[Mortising.nToolIndex].dCornerRadius
|
||||
end
|
||||
if TOOLS[Mortising.nToolIndex].dMaxMaterial > Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
if EdgeToMachine.dElevation > -10 * GEO.EPS_SMALL then
|
||||
@@ -261,6 +207,10 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
Mortising.sMessage = 'Feature '.. Proc.idFeature .. ' : chainsaw elevation (' .. EgtNumToString( EdgeToMachine.dElevation, 1) .. ') bigger than max tool depth (' .. EgtNumToString( Mortising.dDepthToMachine, 1) .. ')'
|
||||
EgtOutLog( Mortising.sMessage)
|
||||
end
|
||||
-- massima elevazione
|
||||
if dCustomMaxElev < Mortising.dDepthToMachine - 10 * GEO.EPS_SMALL then
|
||||
Mortising.dMaxElev = dCustomMaxElev
|
||||
end
|
||||
-- offset radiale
|
||||
Mortising.dRadialOffset = 0
|
||||
-- distanza di sicurezza
|
||||
@@ -269,7 +219,7 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
Mortising.dOverlap = 0
|
||||
-- step
|
||||
Mortising.Steps = {}
|
||||
if Strategy.Parameters.bUseZigZagMortising then
|
||||
if bUseZigZagMortising then
|
||||
Mortising.Steps.nStepType = MCH_MILL_ST.ZIGZAG
|
||||
else
|
||||
Mortising.Steps.nStepType = MCH_MILL_ST.ONEWAY
|
||||
@@ -292,7 +242,7 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
Mortising.sSuggestedAngles = BeamLib.GetChainSawInitAngs( FaceToMachine.vtN, EdgeToMachine.vtToolDirection, 2)
|
||||
end
|
||||
-- approccio e retrazione
|
||||
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine)
|
||||
Mortising.LeadIn, Mortising.LeadOut = CalculateLeadInOut( Mortising, EdgeToMachine, sSideToMachine, dLengthToMachine)
|
||||
-- eventuale step verticale
|
||||
Mortising.VerticalSteps = MachiningLib.GetMachiningSteps( dPocketHeight, TOOLS[Mortising.nToolIndex].dThickness)
|
||||
-- geometria
|
||||
@@ -314,190 +264,9 @@ function CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine, Part)
|
||||
-- end
|
||||
|
||||
return Mortising
|
||||
end
|
||||
|
||||
|
||||
function AddMachiningAllSteps( Proc, Mortising)
|
||||
local bIsMortisingOk = false
|
||||
local sMortisingApplyMessage = ''
|
||||
|
||||
local dOriginalRadialOffsetMortising = Mortising.dRadialOffset
|
||||
for i = Mortising.VerticalSteps.nCount, 1, -1 do
|
||||
Mortising.dRadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.dStepLength * ( i - 1)
|
||||
-- applicazione lavorazione
|
||||
bIsMortisingOk, sMortisingApplyMessage = MachiningLib.AddNewMachining( Proc, Mortising)
|
||||
-- update messaggi
|
||||
if sMortisingApplyMessage and #sMortisingApplyMessage > 0 then
|
||||
Mortising.sMessage = Mortising.sMessage .. '\n' .. 'Apply : ' .. sMortisingApplyMessage .. '\n'
|
||||
end
|
||||
end
|
||||
|
||||
return bIsMortisingOk, sMortisingApplyMessage
|
||||
end
|
||||
|
||||
|
||||
function SLOTBYCHAINSAW.Make( bAddMachining, Proc, Part, Parameters)
|
||||
-- TODO da implementare gestione feature lunghe e spezzatura
|
||||
Strategy.Parameters = Parameters
|
||||
Strategy.Result = {}
|
||||
Strategy.Result.sInfo = ''
|
||||
|
||||
local Machinings = {}
|
||||
|
||||
if not IsTopologyOk( Proc) then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented'
|
||||
EgtOutLog( sErr)
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result.sInfo = 'Topology'
|
||||
return false, Strategy.Result
|
||||
end
|
||||
|
||||
-- se tasca su faccia sotto la strategia non è applicabile (la sega a catena in generale non può lavorare da sotto)
|
||||
if Proc.AffectedFaces.bBottom and ( Proc.nFct > 3 or not Proc.AffectedFaces.bTop) then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not applicable - pocket on bottom face'
|
||||
EgtOutLog( sErr)
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
Strategy.Result.sInfo = 'Direction'
|
||||
return false, Strategy.Result
|
||||
end
|
||||
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
-- Tunnel side 1
|
||||
Mortising = {}
|
||||
Mortising.bIsApplicable = false
|
||||
Mortising = CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], Part)
|
||||
Machinings.TunnelSide1 = Mortising
|
||||
-- Tunnel side 2
|
||||
Mortising = {}
|
||||
Mortising.bIsApplicable = false
|
||||
Mortising = CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], Part)
|
||||
Machinings.TunnelSide2 = Mortising
|
||||
|
||||
if Machinings.TunnelSide1.bIsApplicable and Machinings.TunnelSide1.dResidualDepth < GEO.EPS_SMALL then
|
||||
|
||||
elseif Machinings.TunnelSide2.bIsApplicable and Machinings.TunnelSide2.dResidualDepth < GEO.EPS_SMALL then
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
else
|
||||
-- Bottom
|
||||
local Mortising = {}
|
||||
Mortising.bIsApplicable = false
|
||||
Mortising = CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, Part)
|
||||
Machinings.Bottom = Mortising
|
||||
-- Side (start)
|
||||
Mortising = {}
|
||||
Mortising.bIsApplicable = false
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
Mortising = CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], Part)
|
||||
end
|
||||
Machinings.SideStart = Mortising
|
||||
-- Side (end)
|
||||
Mortising = {}
|
||||
Mortising.bIsApplicable = false
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
Mortising = CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], Part)
|
||||
end
|
||||
Machinings.SideEnd = Mortising
|
||||
|
||||
if Machinings.Bottom.bIsApplicable and Machinings.Bottom.dResidualDepth < GEO.EPS_SMALL then
|
||||
|
||||
elseif Machinings.SideStart.bIsApplicable and Machinings.SideStart.dResidualDepth < GEO.EPS_SMALL then
|
||||
|
||||
elseif Machinings.SideEnd.bIsApplicable and Machinings.SideEnd.dResidualDepth < GEO.EPS_SMALL then
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- sega a catena
|
||||
-- parametri lavorazione con sega a catena - fondo della tasca o tunnel
|
||||
local Mortising = {}
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[1], Part)
|
||||
else
|
||||
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, Part)
|
||||
-- si lavora solo quanto non lavorato dalla lama
|
||||
Mortising.MaxElev = dBottomDepthToMachine + BeamData.CUT_EXTRA
|
||||
end
|
||||
if bAddMachining and Mortising.bIsApplicable then
|
||||
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
-- lato opposto del tunnel
|
||||
if Proc.Topology.sFamily == 'Tunnel' then
|
||||
if dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], Part)
|
||||
if bAddMachining and Mortising.bIsApplicable then
|
||||
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
else
|
||||
-- se la sega a catena non è arrivata sul fondo e c'è almeno un lato aperto va lavorato
|
||||
if dResidualDepth > 10 * GEO.EPS_SMALL then
|
||||
-- eventuale lavorazione di sega a catena - lato della tasca da cui inizia la lavorazione
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
|
||||
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], Part)
|
||||
if bAddMachining and Mortising.bIsApplicable then
|
||||
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
-- eventuale lavorazione di sega a catena - lato della tasca in cui finisce la lavorazione
|
||||
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
|
||||
Mortising, dResidualDepth = Chainsaw.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], Part)
|
||||
if bAddMachining and Mortising.bIsApplicable then
|
||||
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
|
||||
end
|
||||
Chainsaw.AddResult( Mortising)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO da migliorare / refactoring in funzione
|
||||
local nCanApplyCount = 0
|
||||
local nApplyOkCount = 0
|
||||
local bAreAllApplyOk
|
||||
local dCompletionPercentage = 0
|
||||
for i = 1, #Chainsaw.Result do
|
||||
Strategy.Result.sInfo = Strategy.Result.sInfo .. '\n' .. Chainsaw.Result[i].sMessage .. '\n' .. ( Chainsaw.Result[i].sApplyMessage or '')
|
||||
if Chainsaw.Result[i].bIsApplicable then
|
||||
nCanApplyCount = nCanApplyCount + 1
|
||||
end
|
||||
if Chainsaw.Result[i].bIsApplyOk then
|
||||
nApplyOkCount = nApplyOkCount + 1
|
||||
end
|
||||
end
|
||||
if bAddMachining then
|
||||
bAreAllApplyOk = ( nApplyOkCount == #Chainsaw.Result)
|
||||
end
|
||||
if nCanApplyCount == 0 then
|
||||
Strategy.Result.sStatus = 'Not-Applicable'
|
||||
else
|
||||
dCompletionPercentage = GetCompletionPercentage( Proc, Chainsaw.Result)
|
||||
if ( nCanApplyCount == #Chainsaw.Result) and dCompletionPercentage > 99 + 10 * GEO.EPS_SMALL then
|
||||
Strategy.Result.sStatus = 'Completed'
|
||||
else
|
||||
Strategy.Result.sStatus = 'Not-Completed'
|
||||
end
|
||||
end
|
||||
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dCompletionPercentage)
|
||||
Strategy.Result.nQuality = FeatureData.GetFeatureQuality( 'Chainsaw')
|
||||
local MRRParameters = { dStep = TOOLS[Cutting.nToolIndex].dThickness,
|
||||
dSideStep = min( TOOLS[Cutting.nToolIndex].dSideStep, Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1].dLength),
|
||||
dFeed = TOOLS[Cutting.nToolIndex].Feeds.dFeed}
|
||||
Strategy.Result.dMRR = MachiningLib.GetToolMRR( MRRParameters)
|
||||
|
||||
return bAreAllApplyOk, Strategy.Result
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return STR0003
|
||||
return SLOTBYCHAINSAW
|
||||
@@ -572,8 +572,6 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
Strategy.Result = {}
|
||||
Strategy.Result.sInfo = ''
|
||||
|
||||
local dResidualDepth = 0
|
||||
|
||||
if not IsTopologyOk( Proc) then
|
||||
local sErr = 'Feature '.. Proc.idFeature .. ' : strategy ' .. Strategy.sName .. ' not implemented'
|
||||
EgtOutLog( sErr)
|
||||
@@ -824,7 +822,10 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO da migliorare / refactoring in funzione
|
||||
-- TODO aggiunta delle lavorazioni a MACHININGS. Gli step sono da ciclare qui.
|
||||
-- TODO gestione e output dei risultati
|
||||
|
||||
-- TODO da rifare
|
||||
local nCanApplyCount = 0
|
||||
local nApplyOkCount = 0
|
||||
local bAreAllApplyOk
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
local STR0003Data = {
|
||||
sStrategyId = 'STR0003',
|
||||
Parameters = {
|
||||
{ sName = 'bFinishWithChainSaw', sValue = 'true', sDescriptionShort = 'Blade only', sDescriptionLong = 'Machining with blade only and avoid chainsaw', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'bFinishWithChainSaw', sValue = 'true', sDescriptionShort = 'Finish with chainsaw if needed', sDescriptionLong = 'Finish with chainsaw if needed', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'bForceLongcutBlade', sValue = 'false', sDescriptionShort = 'Force ripping blade', sDescriptionLong = 'Force the use of ripping blade, designed for cuts parallel to the grain', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'bContinueOnFailedApply', sValue = 'true', sDescriptionShort = 'Continue to next machining on failed apply', sDescriptionLong = 'If one machining of the strategy fails to apply continue with the others', sType = 'b', sMessageId = '', sMinUserLevel = '9'},
|
||||
{ sName = 'bNotCompleteWithBladeRadius', sValue = 'true', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'},
|
||||
{ sName = 'bUseZigZagMortising', sValue = 'false', sDescriptionShort = '', sDescriptionLong = '', sType = 'b', sMessageId = '', sMinUserLevel = '1'}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user