- BottomFace diventa BottomFaces e comprende tutte le possibili facce di fondo. La [1] è sempre quella a minore elevazione (sono ordinate).

- modifiche a AddNewMachining e di conseguenza alle strategie
This commit is contained in:
luca.mazzoleni
2024-06-07 12:57:36 +02:00
parent c21de95a47
commit 5dec2dc821
4 changed files with 114 additions and 170 deletions
+78 -65
View File
@@ -194,8 +194,8 @@ local function GetTunnelFaces( Proc, Part)
end
-------------------------------------------------------------------------------------------------------------
local function GetBottomFace( Proc)
local BottomFace = {}
local function GetBottomFaces( Proc)
local BottomFaces = {}
if Proc.Topology.sFamily == 'Tunnel' then
return nil
@@ -203,78 +203,81 @@ local function GetBottomFace( Proc)
error( 'GetBottomFace : Topology not implemented')
end
-- la faccia di fondo ha sempre Fct - 1 adiacenze. Se si trovano più facce di fondo si sceglie quella con minor elevazione
-- la faccia di fondo ha sempre Fct - 1 adiacenze
local FacesByAdjacencyNumber = FaceData.GetFacesByAdjacencyNumber( Proc)
if FacesByAdjacencyNumber then
local BottomFaces = FacesByAdjacencyNumber[ Proc.nFct - 1]
if #BottomFaces > 1 then
local dMinElevation = GEO.INFINITO
for i = 1, #BottomFaces do
if Proc.Faces[BottomFaces[i].id + 1].dElevation < dMinElevation then
dMinElevation = Proc.Faces[BottomFaces[i].id + 1].dElevation
BottomFace = Proc.Faces[BottomFaces[i].id + 1]
end
BottomFaces = FacesByAdjacencyNumber[ Proc.nFct - 1]
-- si rimuovono le facce non adatte ad essere lavorate
local nBottomFaces = #BottomFaces
local nCurrentFace = 1
while nCurrentFace <= nBottomFaces do
if not BottomFaces[nCurrentFace].bIsOkForMachining then
table.remove( BottomFaces, nCurrentFace)
nBottomFaces = nBottomFaces - 1
end
else
BottomFace = BottomFaces[1]
nCurrentFace = nCurrentFace + 1
end
-- la BottomFace 1 è sempre quella con minor elevazione
table.sort( BottomFaces, function (a, b) return a.dElevation < b.dElevation end)
end
if not BottomFace.bIsOkForMachining then
if #BottomFaces == 0 then
return nil
end
BottomFace.Type = 'Bottom'
BottomFace.MainEdges = {}
BottomFace.MainEdges.LongEdges = {}
BottomFace.MainEdges.SideEdges = {}
local ClosedEdgesSortedByGreatestLength = {}
for i = 1, #BottomFace.Edges do
if not BottomFace.Edges[i].Open then
table.insert( ClosedEdgesSortedByGreatestLength, {})
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].nIndex = i
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFace.Edges[i].Len
for i = 1, #BottomFaces do
BottomFaces[i].Type = 'Bottom'
BottomFaces[i].MainEdges = {}
BottomFaces[i].MainEdges.LongEdges = {}
BottomFaces[i].MainEdges.SideEdges = {}
local ClosedEdgesSortedByGreatestLength = {}
for j = 1, #BottomFaces[i].Edges do
if not BottomFaces[i].Edges[j].Open then
table.insert( ClosedEdgesSortedByGreatestLength, {})
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].nIndex = j
ClosedEdgesSortedByGreatestLength[#ClosedEdgesSortedByGreatestLength].dLength = BottomFaces[i].Edges[j].Len
end
end
end
table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end)
local nFirstLongEdgeIndex = ClosedEdgesSortedByGreatestLength[1].nIndex
table.sort( ClosedEdgesSortedByGreatestLength, function (a, b) return a.dLength > b.dLength end)
local nFirstLongEdgeIndex = ClosedEdgesSortedByGreatestLength[1].nIndex
for i = 1, #BottomFace.Edges do
local nPreviousEdgeIndex = i - 1
if i == 1 then
nPreviousEdgeIndex = #BottomFace.Edges
end
local nNextEdgeIndex = i + 1
if i == #BottomFace.Edges then
nNextEdgeIndex = 1
end
for j = 1, #BottomFaces[i].Edges do
local nPreviousEdgeIndex = j - 1
if j == 1 then
nPreviousEdgeIndex = #BottomFaces[i].Edges
end
local nNextEdgeIndex = j + 1
if j == #BottomFaces[i].Edges then
nNextEdgeIndex = 1
end
local CurrentEdge = {}
CurrentEdge.idAdjacentFace = BottomFace.Edges[i].Adj
CurrentEdge.vtToolDirection = Vector3d( BottomFace.Edges[i].Norm)
CurrentEdge.dLength = BottomFace.Edges[i].Len
CurrentEdge.dElevation = BottomFace.Edges[i].Elev
CurrentEdge.bIsOpen = BottomFace.Edges[i].Open
CurrentEdge.bIsStartOpen = BottomFace.Edges[nPreviousEdgeIndex].Open
CurrentEdge.bIsEndOpen = BottomFace.Edges[nNextEdgeIndex].Open
local CurrentEdge = {}
CurrentEdge.idAdjacentFace = BottomFaces[i].Edges[j].Adj
CurrentEdge.vtToolDirection = Vector3d( BottomFaces[i].Edges[j].Norm)
CurrentEdge.dLength = BottomFaces[i].Edges[j].Len
CurrentEdge.dElevation = BottomFaces[i].Edges[j].Elev
CurrentEdge.bIsOpen = BottomFaces[i].Edges[j].Open
CurrentEdge.bIsStartOpen = BottomFaces[i].Edges[nPreviousEdgeIndex].Open
CurrentEdge.bIsEndOpen = BottomFaces[i].Edges[nNextEdgeIndex].Open
if i == nFirstLongEdgeIndex then
BottomFace.MainEdges.LongEdges[1] = CurrentEdge
BottomFace.MainEdges.LongEdges[1].Type = 'Long'
elseif nNextEdgeIndex == nFirstLongEdgeIndex then
BottomFace.MainEdges.SideEdges[1] = CurrentEdge
BottomFace.MainEdges.SideEdges[1].Type = 'Side'
elseif nPreviousEdgeIndex == nFirstLongEdgeIndex then
BottomFace.MainEdges.SideEdges[2] = CurrentEdge
BottomFace.MainEdges.SideEdges[2].Type = 'Side'
else
BottomFace.MainEdges.LongEdges[2] = CurrentEdge
BottomFace.MainEdges.LongEdges[2].Type = 'Long'
if j == nFirstLongEdgeIndex then
BottomFaces[i].MainEdges.LongEdges[1] = CurrentEdge
BottomFaces[i].MainEdges.LongEdges[1].Type = 'Long'
elseif nNextEdgeIndex == nFirstLongEdgeIndex then
BottomFaces[i].MainEdges.SideEdges[1] = CurrentEdge
BottomFaces[i].MainEdges.SideEdges[1].Type = 'Side'
elseif nPreviousEdgeIndex == nFirstLongEdgeIndex then
BottomFaces[i].MainEdges.SideEdges[2] = CurrentEdge
BottomFaces[i].MainEdges.SideEdges[2].Type = 'Side'
else
BottomFaces[i].MainEdges.LongEdges[2] = CurrentEdge
BottomFaces[i].MainEdges.LongEdges[2].Type = 'Long'
end
end
end
return BottomFace
return BottomFaces
end
-------------------------------------------------------------------------------------------------------------
@@ -285,7 +288,11 @@ local function GetLongFaces( Proc, MainFaces)
error( 'GetLongFaces : Topology not implemented')
end
local BottomFace = MainFaces.BottomFace or GetBottomFace( Proc)
local BottomFace
local BottomFaces = MainFaces.BottomFaces or GetBottomFaces( Proc)
if BottomFaces and #BottomFaces > 0 then
BottomFace = BottomFaces[1]
end
local idFirstLongFace = GDB_ID.NULL
local idSecondLongFace = GDB_ID.NULL
@@ -375,7 +382,11 @@ local function GetSideFaces( Proc, MainFaces)
error( 'GetSideFaces : Topology not implemented')
end
local BottomFace = MainFaces.BottomFace or GetBottomFace( Proc)
local BottomFace
local BottomFaces = MainFaces.BottomFaces or GetBottomFaces( Proc)
if BottomFaces and #BottomFaces > 0 then
BottomFace = BottomFaces[1]
end
local LongFaces = MainFaces.LongFaces or GetLongFaces( Proc, MainFaces)
local idFirstSideFace = GDB_ID.NULL
@@ -461,15 +472,17 @@ function FaceData.GetMainFaces( Proc, Part)
MainFaces.TunnelAddedFaces = GetTunnelFaces( Proc, Part)
end
MainFaces.BottomFace = GetBottomFace( Proc)
MainFaces.BottomFaces = GetBottomFaces( Proc)
MainFaces.LongFaces = GetLongFaces( Proc, MainFaces)
MainFaces.SideFaces = GetSideFaces( Proc, MainFaces)
-- TODO funzione apposita per informazioni log?
if EgtGetDebugLevel() >= 3 then
if MainFaces.BottomFace then
-- colore differente per la faccia di fondo
EgtSurfTmSetFaceColor( Proc.id, MainFaces.BottomFace.id, 1)
EgtOutLog( 'Bottom Face : ' .. MainFaces.BottomFace.id)
if MainFaces.BottomFaces then
for i = 1, #MainFaces.BottomFaces do
EgtOutLog( 'Bottom Face : ' .. MainFaces.BottomFaces[i].id)
end
-- colore differente per la faccia di fondo principale
EgtSurfTmSetFaceColor( Proc.id, MainFaces.BottomFaces[1].id, 1)
end
if MainFaces.LongFaces then
for i = 1, #MainFaces.LongFaces do
+4 -5
View File
@@ -293,12 +293,12 @@ end
-------------------------------------------------------------------------------------------------------------
-- funzione per aggiungere una nuova lavorazione
-- TODO da fare
function MachiningLib.AddNewMachining( Machining)
function MachiningLib.AddNewMachining( Proc, Machining)
local nErr
local sErr = ''
-- Controllo parametri obbligatori
if not Machining.nType or not Machining.nToolIndex or not Machining.idProc or not Machining.idFaceToMachine then
if not Machining.nType or not Machining.nToolIndex or not Machining.Geometry or not Proc.id then
return false, sErr
end
@@ -323,7 +323,7 @@ function MachiningLib.AddNewMachining( Machining)
-- se nome non definito, assegno alla lavorazioen un nome standard
if not Machining.sOperationName then
Machining.sOperationName = Machining.sTypeName .. ( EgtGetName( Machining.idProc) or tostring( Machining.idProc)) .. '_' .. tostring( Machining.idFaceToMachine)
Machining.sOperationName = Machining.sTypeName .. ( EgtGetName( Proc.id) or tostring( Proc.id)) .. '_' .. tostring( Machining.idFaceToMachine)
end
if not Machining.sToolName then
Machining.sToolName = TOOLS[Machining.nToolIndex].sName
@@ -334,8 +334,7 @@ function MachiningLib.AddNewMachining( Machining)
if nOperationId then
-- impostazione geometria
-- TODO qui passare direttamente la tabella con la geometria (potrebbero arrivare anche più facce o geometrie che non sono facce)
EgtSetMachiningGeometry( {{ Machining.idProc, Machining.idFaceToMachine}})
EgtSetMachiningGeometry( Machining.Geometry)
-- impostazione parametri lavorazione
if Machining.sDepth then
+15 -17
View File
@@ -85,17 +85,17 @@ local function GetBestPocketingStrategy( Proc)
ToolSearchParameters.dMaxToolDiameter = min( Strategy.Parameters.dMaxCornerRadius * 2, dFaceHeight, dFaceWidth)
-- imposto dati per cercare la fresa migliore
elseif Proc.Topology.sName == 'Pocket-5-Blind' then
local dFaceWidth = Proc.MainFaces.BottomFace.MainEdges.LongEdges[1].dLength
local dFaceHeight = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
local dFaceWidth = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
local dFaceHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
ToolSearchParameters.sType = 'MILL_STD'
ToolSearchParameters.dMaxToolDiameter = min( Strategy.Parameters.dMaxCornerRadius * 2, dFaceHeight, dFaceWidth)
-- cerco fresa che può anche non lavorare di testa
elseif Proc.Topology.sName == 'Groove-4-Blind' then
local dFaceWidth = Proc.MainFaces.BottomFace.MainEdges.LongEdges[1].dLength
local dFaceWidth = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
ToolSearchParameters.sType = 'MILL_NOTIP'
ToolSearchParameters.dMaxToolDiameter = min( Strategy.Parameters.dMaxCornerRadius * 2, dFaceWidth)
elseif Proc.Topology.sName == 'Groove-3-Through' then
local dFaceWidth = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
local dFaceWidth = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
ToolSearchParameters.sType = 'MILL_NOTIP'
ToolSearchParameters.dMaxToolDiameter = dFaceWidth
elseif Proc.Topology.sName == 'Groove-3-Blind' then
@@ -112,12 +112,12 @@ local function GetBestPocketingStrategy( Proc)
-- cerco utensile per lavorare faccia Bottom
Milling.bIsApplicable = false
if Proc.Topology.sName ~= 'Tunnel-4-Through' then
ToolSearchParameters.dElevation = Proc.MainFaces.BottomFace.dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFace.vtN
Milling.idFaceToMachine = Proc.MainFaces.BottomFace.id
ToolSearchParameters.dElevation = Proc.MainFaces.BottomFaces[1].dElevation
ToolSearchParameters.vtToolDirection = Proc.MainFaces.BottomFaces[1].vtN
Milling.idFaceToMachine = Proc.MainFaces.BottomFaces[1].id
Milling.idProc = Proc.id
Milling.vtFaceNormal = Proc.MainFaces.BottomFace.vtN
Milling.dElevation = Proc.MainFaces.BottomFace.dElevation
Milling.vtFaceNormal = Proc.MainFaces.BottomFaces[1].vtN
Milling.dElevation = Proc.MainFaces.BottomFaces[1].dElevation
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Milling.ToolInfo.nToolIndex then
@@ -304,7 +304,7 @@ local function GetBestPocketingStrategy( Proc)
local dMachinedPrercentage = CalcMachinedPercentage( Proc, Machining)
Strategy.Result.nCompletionIndex = FeatureData.GetFeatureCompletionIndex( dMachinedPrercentage)
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100-dMachinedPrercentage) .. '%'
Strategy.Result.sInfo = 'Machining not complete, left ' .. tostring( 100 - dMachinedPrercentage) .. '%'
-- se non ho trovato neanche una lavorazione
if Machining.sTypeMachining == 'None' then
@@ -437,10 +437,9 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
for k=1, Proc.nFct do
local vtNSplitFace
_, vtNSplitFace = EgtSurfTmFacetCenter( vAddId[i], k - 1, GDB_ID.ROOT)
if vtNSplitFace and AreSameVectorExact( vtNSplitFace, Strategy.Machining[j].vtFaceNormal) then
Pocketing.idFaceToMachine = k - 1
Pocketing.idProc = vAddId[i]
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
if vtNSplitFace and AreSameVectorApprox( vtNSplitFace, Strategy.Machining[j].vtFaceNormal) then
Pocketing.Geometry = {{ vAddId[i], k - 1}}
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Proc, Pocketing)
break
end
end
@@ -462,9 +461,8 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
if i == 4 and Strategy.Machining[i].bInvertTool then
Pocketing.bToolInvert = true
end
Pocketing.idProc = Strategy.Machining[i].idProc
Pocketing.idFaceToMachine = Strategy.Machining[i].idFaceToMachine
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Pocketing)
Pocketing.Geometry = {{ Strategy.Machining[i].idProc, Strategy.Machining[i].idFaceToMachine}}
bApplyMachiningOK, Strategy.Result.sInfo = MachiningLib.AddNewMachining( Proc, Pocketing)
end
end
end
+17 -83
View File
@@ -137,66 +137,6 @@ local function CalculateLeadInOut( Machining, EdgeToMachine)
end
--TODO da rimuovere
local function AddNewMachining( Machining)
local sErr = ''
local nOperationId = EgtCreateMachining( Machining.sOperationName, Machining.nType, TOOLS[Machining.nToolIndex].sName)
-- impostazione parametri lavorazione
local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES)
EgtSetMachiningGeometry( Machining.Geometry)
EgtSetMachiningParam( MCH_MP.DEPTH_STR, Machining.sDepth)
EgtSetMachiningParam( MCH_MP.FACEUSE, Machining.nFaceuse)
EgtSetMachiningParam( MCH_MP.SCC, Machining.nSCC or MCH_SCC.STD)
EgtSetMachiningParam( MCH_MP.INVERT, Machining.bInvert)
EgtSetMachiningParam( MCH_MP.WORKSIDE, Machining.nWorkside)
EgtSetMachiningParam( MCH_MP.TOOLINVERT, Machining.bToolInvert)
EgtSetMachiningParam( MCH_MP.OFFSR, Machining.dRadialOffset)
EgtSetMachiningParam( MCH_MP.OFFSL, Machining.dLongitudinalOffset)
if Machining.nType ~= MCH_OY.MORTISING then
EgtSetMachiningParam( MCH_MP.LEADINTYPE, Machining.LeadIn.nType)
EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, Machining.LeadOut.nType)
EgtSetMachiningParam( MCH_MP.LITANG, Machining.LeadIn.dTangentDistance)
EgtSetMachiningParam( MCH_MP.LOTANG, Machining.LeadOut.dTangentDistance)
EgtSetMachiningParam( MCH_MP.LIPERP, Machining.LeadIn.dPerpDistance)
EgtSetMachiningParam( MCH_MP.LOPERP, Machining.LeadOut.dPerpDistance)
EgtSetMachiningParam( MCH_MP.LIELEV, Machining.LeadIn.dElevation)
EgtSetMachiningParam( MCH_MP.LOELEV, Machining.LeadOut.dElevation)
EgtSetMachiningParam( MCH_MP.LICOMPLEN, Machining.LeadIn.dCompLength)
EgtSetMachiningParam( MCH_MP.LOCOMPLEN, Machining.LeadOut.dCompLength)
end
EgtSetMachiningParam( MCH_MP.STARTADDLEN, Machining.LeadIn.dStartAddLength)
EgtSetMachiningParam( MCH_MP.ENDADDLEN, Machining.LeadOut.dEndAddLength)
if Machining.Steps then
if Machining.Steps.nStepType then
EgtSetMachiningParam( MCH_MP.STEPTYPE, Machining.Steps.nStepType)
end
if Machining.Steps.dStepLength then
EgtSetMachiningParam( MCH_MP.STEP, Machining.Steps.dStepLength)
end
end
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, Machining.sBlockedAxis)
if Machining.nType == MCH_OY.MORTISING then
EgtSetMachiningParam( MCH_MP.INITANGS, Machining.sSuggestedAngles)
end
EgtSetMachiningParam( MCH_MP.OVERL, Machining.dOverlap)
EgtSetMachiningParam( MCH_MP.STARTPOS, max( Machining.dStartSafetyLength, EgtGetMachiningParam( MCH_MP.STARTPOS)))
if Machining.dMaxElev then
sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', Machining.dMaxElev)
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
local bIsApplyOk = MachiningLib.ApplyMachining( true, false)
if not bIsApplyOk then
_, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nOperationId, false)
return false, sErr
end
return true, sErr
end
function Blade.GetSCC( vtMachiningDirection)
-- TODO implementare SCC come per FacesBySaw
local nSCC = MCH_SCC.NONE
@@ -231,9 +171,9 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine,
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else
if FaceToMachine.Type == 'Long' then
dPocketHeight = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
elseif FaceToMachine.Type == 'Side' then
dPocketHeight = Proc.MainFaces.BottomFace.MainEdges.LongEdges[1].dLength
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
end
end
@@ -355,9 +295,6 @@ function Blade.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachine,
Cutting.Geometry = {{Proc.id, FaceToMachine.id}}
-- nome operazione
Cutting.sOperationName = 'Cut_' .. ( EgtGetName( Cutting.idProc) or tostring( Cutting.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
-- TODO da rimuovere quando cambia AddMachining
Cutting.idProc = Proc.id
Cutting.idFaceToMachine = FaceToMachine.id
-- eventuale avviso di danneggiamento pezzo successivo
-- TODO da sostituire con check se si riesce a separare e il grezzo dietro è lungo a sufficienza
@@ -381,7 +318,7 @@ function Blade.AddResult( Cutting)
end
function Blade.AddMachiningAllSteps( Cutting)
function Blade.AddMachiningAllSteps( Proc, Cutting)
local bIsCuttingOk = false
local sCuttingApplyMessage = ''
@@ -394,7 +331,7 @@ function Blade.AddMachiningAllSteps( Cutting)
Cutting.LeadIn.dPerpDistance = dOriginalLeadInPerpDistance - Cutting.dRadialOffset
Cutting.LeadOut.dPerpDistance = dOriginalLeadOutPerpDistance - Cutting.dRadialOffset
-- applicazione lavorazione
bIsCuttingOk, sCuttingApplyMessage = MachiningLib.AddNewMachining( Cutting)
bIsCuttingOk, sCuttingApplyMessage = MachiningLib.AddNewMachining( Proc, Cutting)
-- update messaggi
if sCuttingApplyMessage and #sCuttingApplyMessage > 0 then
sCuttingApplyMessage = sCuttingApplyMessage .. 'Apply : ' .. sCuttingApplyMessage .. '\n'
@@ -420,9 +357,9 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
dPocketHeight = Proc.MainFaces.SideFaces[1].MainEdges.OppositeEdges[1].dLength
else
if FaceToMachine.Type == 'Long' then
dPocketHeight = Proc.MainFaces.BottomFace.MainEdges.SideEdges[1].dLength
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.SideEdges[1].dLength
elseif FaceToMachine.Type == 'Side' then
dPocketHeight = Proc.MainFaces.BottomFace.MainEdges.LongEdges[1].dLength
dPocketHeight = Proc.MainFaces.BottomFaces[1].MainEdges.LongEdges[1].dLength
end
end
@@ -570,9 +507,6 @@ function Chainsaw.CalculateMachiningParameters( Proc, FaceToMachine, EdgeToMachi
Mortising.Geometry = {{Proc.id, FaceToMachine.id}}
-- nome operazione
Mortising.sOperationName = 'Chainsaw_' .. ( EgtGetName( Mortising.idProc) or tostring( Mortising.idProc)) .. '_' .. tostring( FaceToMachine.id + 1)
-- TODO da rimuovere quando cambia AddMachining
Mortising.idProc = Proc.id
Mortising.idFaceToMachine = FaceToMachine.id
-- eventuale avviso di danneggiamento pezzo successivo
-- TODO da sostituire con check se si riesce a separare e il grezzo dietro è lungo a sufficienza
@@ -596,7 +530,7 @@ function Chainsaw.AddResult( Mortising)
end
function Chainsaw.AddMachiningAllSteps( Mortising)
function Chainsaw.AddMachiningAllSteps( Proc, Mortising)
local bIsMortisingOk = false
local sMortisingApplyMessage = ''
@@ -604,10 +538,10 @@ function Chainsaw.AddMachiningAllSteps( Mortising)
for i = Mortising.VerticalSteps.nCount, 1, -1 do
Mortising.dRadialOffset = dOriginalRadialOffsetMortising + Mortising.VerticalSteps.dStepLength * ( i - 1)
-- applicazione lavorazione
bIsMortisingOk, sMortisingApplyMessage = MachiningLib.AddNewMachining( Mortising)
bIsMortisingOk, sMortisingApplyMessage = MachiningLib.AddNewMachining( Proc, Mortising)
-- update messaggi
if sMortisingApplyMessage and #sMortisingApplyMessage > 0 then
Mortising.sMessage = Mortising.sMessage .. '\n' .. 'Apply : ' .. sMortisingApplyMessage
Mortising.sMessage = Mortising.sMessage .. '\n' .. 'Apply : ' .. sMortisingApplyMessage .. '\n'
end
end
@@ -655,7 +589,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge, Part)
end
if bAddMachining and Cutting.bCanApply then
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting)
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Proc, Cutting)
end
Blade.AddResult( Cutting)
local dBottomDepthToMachine = dResidualDepth
@@ -663,7 +597,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.Topology.sFamily == 'Tunnel' then
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.OppositeEdges[2], Part)
if bAddMachining and Cutting.bCanApply then
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting)
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Proc, Cutting)
end
Blade.AddResult( Cutting)
else
@@ -673,7 +607,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsStartOpen then
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[1], Part)
if bAddMachining and Cutting.bCanApply then
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting)
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Proc, Cutting)
end
Blade.AddResult( Cutting)
end
@@ -681,7 +615,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.MainFaces.LongFaces[1].MainEdges.BottomEdge.bIsEndOpen then
Cutting, dResidualDepth = Blade.CalculateMachiningParameters( Proc, Proc.MainFaces.LongFaces[1], Proc.MainFaces.LongFaces[1].MainEdges.SideEdges[2], Part)
if bAddMachining and Cutting.bCanApply then
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Cutting)
Cutting.bIsApplyOk, Cutting.sApplyMessage = Blade.AddMachiningAllSteps( Proc, Cutting)
end
Blade.AddResult( Cutting)
end
@@ -741,7 +675,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
Mortising.MaxElev = dBottomDepthToMachine + BeamData.CUT_EXTRA
end
if bAddMachining and Mortising.bCanApply then
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising)
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
end
Chainsaw.AddResult( Mortising)
-- lato opposto del tunnel
@@ -749,7 +683,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
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.bCanApply then
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising)
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
end
Chainsaw.AddResult( Mortising)
end
@@ -760,7 +694,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
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.bCanApply then
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising)
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
end
Chainsaw.AddResult( Mortising)
end
@@ -768,7 +702,7 @@ function STR0003.Make( bAddMachining, Proc, Part, CustomParameters)
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.bCanApply then
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Mortising)
Mortising.bIsApplyOk, Mortising.sApplyMessage = Chainsaw.AddMachiningAllSteps( Proc, Mortising)
end
Chainsaw.AddResult( Mortising)
end