Prima bozza gestione feature frontale

This commit is contained in:
andrea.villa
2025-03-25 11:20:19 +01:00
parent 7a2d6696b8
commit 13c227ee0b
5 changed files with 155 additions and 30 deletions
+10 -4
View File
@@ -629,17 +629,23 @@ local function CollectFeatures( Part)
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
-- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL
Proc.Topology = {}
local bIsFeatureReadyForProcessing = false
if FeatureLib.NeedTopologyFeature( Proc) then
Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc)
Proc.Faces = FaceData.GetFacesInfo( Proc, Part)
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
-- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa
if Proc.Topology.sName ~= 'NOT_IMPLEMENTED' then
Proc.MainFaces = FaceData.GetMainFaces( Proc, Part)
bIsFeatureReadyForProcessing = true
end
else
Proc = FeatureLib.GetAdditionalInfo( Proc, Part)
Proc.Topology = FeatureLib.ClassifyFeature( Proc, Part)
Proc.Topology = FeatureLib.GetTopologyFromFeature( Proc, Part)
bIsFeatureReadyForProcessing = true
end
-- se topologia feature riconosciuta, oppure da non calcolare perchè il riconoscimento topologico è basato sulla feature stessa
if Proc.Topology.sName ~= 'NOT_IMPLEMENTED' then
Proc.MainFaces = FaceData.GetMainFaces( Proc, Part)
-- se la feature è stata compresa
if bIsFeatureReadyForProcessing then
-- se la processing ha una strategia forzata, riporto tutto nella proc
local vForcedStrategy = GetFeatureForcedStrategy( Proc)
if vForcedStrategy then
+1 -1
View File
@@ -232,7 +232,7 @@ end
---------------------------------------------------------------------
-- recupera classificazione feature (da info BTL, non geometrica)
function FeatureLib.ClassifyFeature( Proc, Part)
function FeatureLib.GetTopologyFromFeature( Proc, Part)
local Topology = {}
Topology.sFamily = 'FEATURE'
+4 -4
View File
@@ -68,7 +68,7 @@ function GetMortiseStrategy( Proc, Part)
if Machining.bCuttingWithMill and ( not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit) then
ToolSearchParameters = {}
ToolSearchParameters.dElevation = 0
ToolSearchParameters.vtToolDirection = Proc.vtTenonN
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtMortiseN
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Machining.Cutting.ToolInfo.nToolIndex then
Machining.Cutting.bIsApplicable = true
@@ -281,7 +281,7 @@ function ApplyMortiseAntiSplint( Proc, Part)
Machining.Geometry = {{ nId1, -1}}
Machining.bInvert = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
Machining.nWorkside = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)
Machining.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dMortiseDepth, 1)) .. '; VMRS=0;'
Machining.dMaxElev = Proc.FeatureInfo.dMortiseDepth
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
Machining.sStage = 'AfterTail'
@@ -327,7 +327,7 @@ function STR0007.Make( bAddMachining, Proc, Part, CustomParameters)
if Proc.FeatureInfo.bIsFrontMortise then
-- verifico esista la faccia di taglio
local ptCutC, vtCutN = EgtSurfTmFacetCenter( Proc.id, 1, GDB_ID.ROOT)
if ptCutC and vtCutN and AreSameVectorApprox( Strategy.FeatureInfo.vtMortiseN, vtCutN) then
if ptCutC and vtCutN and AreSameVectorApprox( Proc.FeatureInfo.vtMortiseN, vtCutN) then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
Strategy.idMortiseCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, Part.b3Part, GDB_RT.GLOB)
@@ -419,7 +419,7 @@ function STR0007.Make( bAddMachining, Proc, Part, CustomParameters)
Strategy.Machining.Milling.bInvert = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, false, true)
Strategy.Machining.Milling.nWorkside = EgtIf( TOOLS[Strategy.Machining.Milling.ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)
Strategy.Machining.Milling.sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( Proc.FeatureInfo.dMortiseDepth, 1)) .. ';'
Strategy.Machining.Milling.dMaxElev = Proc.FeatureInfo.dMortiseDepth
-- TODO calcolare SCC
+133 -21
View File
@@ -9,6 +9,8 @@ local BeamLib = require( 'BeamLib')
local BeamData = require( 'BeamData')
local MachiningLib = require( 'MachiningLib')
local FeatureLib = require( 'FeatureLib')
-- strategie di base
local BladeToWaste = require('BLADETOWASTE')
-- Tabella per definizione modulo
local STR0008 = {}
@@ -27,20 +29,76 @@ local function IsTopologyOk( Proc)
end
-------------------------------------------------------------------------------------------------------------
local function GetBestPocketingStrategy( Proc)
-- imposto parametri di ricerca utensile in base a topologia
local Machining = {}
local Milling = {}
local function GetBestPocketingStrategy( Proc, Part)
local Machining = { Cutting = {}, Pocketing = {}}
local Result = { Cutting = {}, Pocketing = {}}
local ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dMaxToolDiameter = Proc.FeatureInfo.dMortiseMinRadius * 2
Machining.sTypeMachining = 'None' -- Bottom\ Side1\ Side2\ Side1-Side2\ None
Strategy.Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
-- in caso sia una mortasa frontale, bisogna lavorare il taglio
if Proc.FeatureInfo.bIsFrontMortise then
-- scelta automatica lavorazione. Non viene mai scelta la motosega
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
-- creo piano di taglio sulla testa del tenone
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
if #Machining.Cutting > 0 and Result.Cutting and Result.Cutting.sStatus == 'Completed' then
Machining.Cutting.bIsApplicable = true
end
-- se non possibile di lama si prova con fresa
if not Machining.Cutting or #Machining.Cutting == 0 then
Machining.bCuttingWithMill = true
end
-- lavorazione forzata con utensile lama
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
if #Machining.Cutting > 0 and Result.Cutting.sStatus == 'Completed' then
Machining.Cutting.bIsApplicable = true
else
Machining.Cutting.bIsApplicable = false
end
-- lavorazione forzata con utensile fresa
elseif Strategy.Parameters.sCuttingStrategy == 'MILL_FORCED' then
Machining.bCuttingWithMill = true
-- lavorazione forzata con utensile motosega
elseif Strategy.Parameters.sCuttingStrategy == 'CHAINSAW_FORCED' then
-- DA FARE!!
end
-- === ricerca utensile per svuotare taglio iniziale, se taglio non possibile ===
if Machining.bCuttingWithMill and ( not( Proc.AffectedFaces.bLeft) or Strategy.bCanMoveAfterSplit) then
ToolSearchParameters = {}
ToolSearchParameters.dElevation = 0
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtMortiseN
ToolSearchParameters.sMillShape = 'STANDARD'
Machining.Cutting.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if Machining.Cutting.ToolInfo.nToolIndex then
Machining.Cutting.bIsApplicable = true
local ParametersMRR = {}
ParametersMRR.nToolIndex = Machining.Cutting.ToolInfo.nToolIndex
Result.Cutting.dMRR = MachiningLib.GetToolMRR( ParametersMRR)
Result.Cutting.sStatus = 'Completed'
end
end
end
-- ===== RICERCA UTENSILE =====
-- cerco utensile per lavorare faccia Bottom
Milling.bIsApplicable = false
Machining.Pocketing.bIsApplicable = false
if Proc.Topology.sName == 'Pocket-Round' or Proc.Topology.sName == 'Pocket-Round-Front' then
local Milling = {}
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dMaxToolDiameter = Proc.FeatureInfo.dMortiseMinRadius * 2
ToolSearchParameters.dElevation = Proc.FeatureInfo.dMortiseDepth
ToolSearchParameters.vtToolDirection = Proc.FeatureInfo.vtMortiseN
Milling.idFaceToMachine = 0 -- ATTENZIONE: Per convenzione, la faccia di fondo della mortasa ha sempre indice 0
@@ -64,11 +122,11 @@ local function GetBestPocketingStrategy( Proc)
Strategy.Result.dCompletionPercentage = 100
else
Strategy.Result.sStatus = 'Not-Completed'
Strategy.Result.sInfo = 'Mortise not complete, left ' .. ceil( Machining.Pocketing.ToolInfo.dResidualDepth) .. 'mm'
Strategy.Result.sInfo = 'Mortise not complete, left ' .. ceil( Milling.ToolInfo.dResidualDepth) .. 'mm'
Strategy.Result.dCompletionPercentage = ( Milling.ToolInfo.dResidualDepth * 100) / Proc.FeatureInfo.dMortiseDepth
end
Strategy.Result.nCompletionIndex = FeatureLib.GetFeatureCompletionIndex( Strategy.Result.dCompletionPercentage)
table.insert( Machining, Milling)
table.insert( Machining.Pocketing, Milling)
end
-- si lavora faccia di mezzo
elseif 'Pocket-Round-Through' then
@@ -111,27 +169,81 @@ function STR0008.Make( bAddMachining, Proc, Part, CustomParameters)
local bAreAllMachiningsAdded = true
local Pocketing = {}
Strategy.Machining = GetBestPocketingStrategy( Proc)
-- se mortasa frontale, verifico che esista faccia di taglio
if Proc.FeatureInfo.bIsFrontMortise then
-- verifico esista la faccia di taglio
local ptCutC, vtCutN = EgtSurfTmFacetCenter( Proc.id, 1, GDB_ID.ROOT)
if ptCutC and vtCutN and AreSameVectorApprox( Proc.FeatureInfo.vtMortiseN, vtCutN) then
-- recupero gruppo per geometria addizionale
local nAddGrpId = BeamLib.GetAddGroup( Part.id)
Strategy.idMortiseCutPlane = EgtSurfTmPlaneInBBox( nAddGrpId, ptCutC, vtCutN, Part.b3Part, GDB_RT.GLOB)
end
end
Strategy.Machining = GetBestPocketingStrategy( Proc, Part)
if bAddMachining and Strategy.Result.sStatus ~= 'Not-Applicable' then
-- si applicano le lavorazioni
for j = 1, #Strategy.Machining do
if Strategy.Machining[j].bIsApplicable then
-- se mortasa frontale si fa taglio di lama
if Proc.FeatureInfo.bIsFrontMortise then
-- taglio in lunghezza sulla faccia frontale
if Strategy.Machining.Cutting.bIsApplicable then
OptionalParameters = {}
-- se cutting da fare come svuotatura
if Strategy.Machining.bCuttingWithMill then
Strategy.Machining.Cutting.Steps = {}
Strategy.Machining.Cutting.LeadIn = {}
Strategy.Machining.Cutting.nType = MCH_OY.POCKETING
Strategy.Machining.Cutting.nSubType = MCH_POCK_SUB.SPIRALIN
Strategy.Machining.Cutting.LeadIn.nType = MCH_POCK_LI.ZIGZAG
Strategy.Machining.Cutting.Steps.dStep = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dStep
Strategy.Machining.Cutting.Steps.dSideStep = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dSideStep
Strategy.Machining.Cutting.nToolIndex = Strategy.Machining.Cutting.ToolInfo.nToolIndex
Strategy.Machining.Cutting.LeadIn.dTangentDistance = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
Strategy.Machining.Cutting.LeadIn.dElevation = TOOLS[Strategy.Machining.Cutting.ToolInfo.nToolIndex].dDiameter/2
Strategy.Machining.Cutting.sDepth = 0
Strategy.Machining.Cutting.Geometry = {{ Strategy.idMortiseCutPlane, 0}}
Strategy.Machining.Cutting.vtToolDirection = Proc.FeatureInfo.vtMortiseN
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
Strategy.Machining.Cutting.sStage = 'AfterTail'
end
bAreAllMachiningsAdded = MachiningLib.AddMachinings( Proc, Strategy.Machining.Cutting)
-- taglio di lama
else
for i = 1, #Strategy.Machining.Cutting do
if Strategy.Machining.Cutting.bIsApplicable then
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
Strategy.Machining.Cutting[i].sStage = 'AfterTail'
end
local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Strategy.Machining.Cutting[i])
if not bIsMachiningAdded then
bAreAllMachiningsAdded = false
end
end
end
end
end
end
-- si applicano le lavorazioni di svuotatura
for j = 1, #Strategy.Machining.Pocketing do
if Strategy.Machining.Pocketing[j].bIsApplicable then
Pocketing = {}
Pocketing.Steps = {}
Pocketing.LeadIn = {}
Pocketing.nType = MCH_OY.POCKETING
Pocketing.nSubType = MCH_POCK_SUB.SPIRALOUT
Pocketing.LeadIn.nType = MCH_POCK_LI.ZIGZAG
Pocketing.Steps.dStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dStep
Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dSideStep
Pocketing.nToolIndex = Strategy.Machining[j].ToolInfo.nToolIndex
Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.sDepth = min( 0, -Strategy.Machining[j].ToolInfo.dResidualDepth)
Pocketing.Steps.dStep = TOOLS[Strategy.Machining.Pocketing[j].ToolInfo.nToolIndex].dStep
Pocketing.Steps.dSideStep = TOOLS[Strategy.Machining.Pocketing[j].ToolInfo.nToolIndex].dSideStep
Pocketing.nToolIndex = Strategy.Machining.Pocketing[j].ToolInfo.nToolIndex
Pocketing.LeadIn.dTangentDistance = TOOLS[Strategy.Machining.Pocketing[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.LeadIn.dElevation = TOOLS[Strategy.Machining.Pocketing[j].ToolInfo.nToolIndex].dDiameter/2
Pocketing.sDepth = min( 0, -Strategy.Machining.Pocketing[j].ToolInfo.dResidualDepth)
Pocketing.dMaxElev = Proc.FeatureInfo.dMortiseDepth
Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}}
Pocketing.vtToolDirection = Strategy.Machining[j].vtFaceNormal
Pocketing.Geometry = {{ Strategy.Machining.Pocketing[j].idProc, Strategy.Machining.Pocketing[j].idFaceToMachine}}
Pocketing.vtToolDirection = Strategy.Machining.Pocketing[j].vtFaceNormal
-- TODO controllare parametro danneggiamento ammesso per decidere se spostare dopo taglio seprazione
-- se è aperta sulla coda, dico che deve essere fatta dopo la separazione
@@ -3,6 +3,13 @@
local STR0008Data = {
sStrategyId = 'STR0008',
Parameters = {
{ sName = 'dOverMatOnLength', sNameNge = 'OVM_LENGTH', sValue = '0', sDescription = 'Sovramateriale lunghezza mortasa', sType = 'd'},
{ sName = 'dOverMatOnRadius', sNameNge = 'OVM_RADIUS', sValue = '0', sDescription = 'Sovramateriale larghezza mortasa', sType = 'd'},
{ sName = 'sCuttingStrategy', sNameNge = 'EXEC_CUT_SURF', sValue = 'AUTO', sType = 'combo', sMinUserLevel = '1',
Choices = { { sValue = 'AUTO', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'BLADE_FORCED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'MILL_FORCED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''},
{ sValue = 'CHAINSAW_FORCED', sDescriptionShort = '', sDescriptionLong = '', sMessageId = ''}}}
}
}