- Aggiunto taglio sgrossatura

- Aggiunta passata di sgrossatura con fresa
- Nuovi parametri per completare la gestione
This commit is contained in:
andrea.villa
2025-09-12 17:51:49 +02:00
parent cb81dc1d15
commit d7c3bd83de
2 changed files with 244 additions and 102 deletions
+90 -2
View File
@@ -12,6 +12,16 @@
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "bOnlyChamfer",
"sNameNge": "ONLY_CHAMFER",
"sValue": "false",
"sDescriptionShort": "Only Chamfer",
"sDescriptionLong": "Execute the chamfer only, no other machining",
"sType": "b",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "dOverMaterial",
"sNameNge": "OVERMAT",
@@ -22,6 +32,26 @@
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "dMaxCornerRadius",
"sNameNge": "MAX_CORNER_RADIUS",
"sValue": "15",
"sDescriptionShort": "Max radius left on corners",
"sDescriptionLong": "Radius-limit left by the tool at each corner of the feature",
"sType": "d",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "bExecRough",
"sNameNge": "EXEC_ROUGH",
"sValue": "0",
"sDescriptionShort": "Execute cut to remove material",
"sDescriptionLong": "",
"sType": "b",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "bForceStrip",
"sNameNge": "FORCE_STRIP",
@@ -42,14 +72,72 @@
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "sConcaveFaceStrategy",
"sNameNge": "CONCAVE_FACE",
"sValue": "AUTO",
"sDescriptionShort": "Cutting Strategy",
"sDescriptionLong": "",
"sType": "combo",
"sMinUserLevel": "1",
"Choices": [
{
"sValue": "AUTO",
"sDescriptionShort": "Automatic",
"sDescriptionLong": "",
"sMessageId": ""
},
{
"sValue": "BLADE_FORCED",
"sDescriptionShort": "Blade forced",
"sDescriptionLong": "",
"sMessageId": ""
},
{
"sValue": "MILL_FORCED",
"sDescriptionShort": "Mill forced",
"sDescriptionLong": "",
"sMessageId": ""
}
]
},
{
"sName": "sMillingList",
"sNameNge": "PROFILE_TOOL_LIST",
"sValue": "",
"sDescriptionShort": "Available mill to machine the profile",
"sDescriptionLong": "",
"sType": "tool",
"sSubType": "Mill",
"sType": "d",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "dMaxWasteLength",
"sNameNge": "MAX_WASTE_LENGTH",
"sValue": "300",
"sDescriptionShort": "Maximum Waste Length",
"sDescriptionLong": "",
"sType": "d",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "dMaxWasteVolume",
"sNameNge": "MAX_WASTE_VOLUME",
"sValue": "6000000",
"sDescriptionShort": "Maximum Waste Volume",
"sDescriptionLong": "",
"sType": "d",
"sMessageId": " ",
"sMinUserLevel": "1"
},
{
"sName": "bReduceBladePath",
"sNameNge": "REDUCE_BLADE_PATH",
"sValue": "true",
"sDescriptionShort": "Use entire blade diameter to shorten path",
"sDescriptionLong": "",
"sType": "b",
"sMessageId": " ",
"sMinUserLevel": "1"
}
+154 -100
View File
@@ -92,10 +92,13 @@ end
-------------------------------------------------------------------------------------------------------------
local function GetEdgeWithCornerStrategy( Proc, Part)
if Strategy.Parameters.sConcaveFaceStrategy == 'AUTO' or Strategy.Parameters.sConcaveFaceStrategy == 'BLADE_FORCED' then
local Machining = {}
local Result = {}
if Strategy.Parameters.sConcaveFaceStrategy == 'AUTO' or Strategy.Parameters.sConcaveFaceStrategy == 'BLADE_FORCED' then
end
return Machining, Result
end
-------------------------------------------------------------------------------------------------------------
@@ -103,6 +106,9 @@ local function GetChamferStrategy( Proc, Part)
local Machining = {}
local Result = {}
if Strategy.Parameters.dDepthChamfer > 100 * GEO.EPS_SMALL then
end
return Machining, Result
end
@@ -137,98 +143,129 @@ local function GetArcStrategy( Proc, Part)
dDimStrip = 0
end
-- se lavorazione orizzontale
if bIsHorizontal then
local bDouble
local Milling = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
Milling.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = EgtIf( bExecStrip, ( dDepth - dDimStrip) / 2, dDepth + BeamData.MILL_OVERLAP)
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'Milling')
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
-- se posso lavorare in una passata, ma utensile trovato non completa la lavorazione,
-- allora provo a cercare utensile con massimo materiale sufficiente per fare le due passate, magari trova un utensile più prestante
if Milling.ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL and not bExecStrip then
bDouble = true
ToolSearchParameters.dElevation = ( dDepth + BeamData.MILL_OVERLAP) / 2
-- la passata di finitura c'è sempre
local nPassages = 1
-- si verifica se fare passaggio di sgrossatura con fresa
if not bExecStrip and Strategy.Parameters.dOverMaterial > 100 * GEO.EPS_SMALL then
nPassages = 2
end
-- ciclo su numero passate (2 in caso di sgrossatura + finitura)
for nCycle = nPassages, 1, -1 do
local nMaxDiamMill = EgtIf( nCycle == 1, Strategy.Parameters.dMaxCornerRadius * 2, nil)
local sTypeTool = EgtIf( nCycle == 1 and nPassages == 2, 'MillingFinish', 'Milling')
-- se lavorazione orizzontale
if bIsHorizontal then
local bDouble
local Milling = MachiningLib.InitMachiningParameters( MCH_MY.MILLING)
Milling.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = EgtIf( bExecStrip, ( dDepth - dDimStrip) / 2, dDepth + BeamData.MILL_OVERLAP)
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
end
Milling.bToolInvert = bToolInvert
Milling.vtToolDirection = vtExtr
if bDouble or bExecStrip then
if bDouble then
Milling.sDepth = ( dDepth + BeamData.MILL_OVERLAP) / 2
else
Milling.sDepth = ( dDepth - dDimStrip) / 2
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
-- se posso lavorare in una passata, ma utensile trovato non completa la lavorazione,
-- allora provo a cercare utensile con massimo materiale sufficiente per fare le due passate, magari trova un utensile più prestante
if Milling.ToolInfo.dResidualDepth > 10 * GEO.EPS_SMALL and not bExecStrip then
bDouble = true
ToolSearchParameters.dElevation = ( dDepth + BeamData.MILL_OVERLAP) / 2
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
end
table.insert( Machining, Milling)
local Milling2 = BeamLib.TableCopyDeep( Milling)
table.insert( Machining, Milling2)
else
Milling.sDepth = dDepth + BeamData.MILL_OVERLAP
table.insert( Machining, Milling)
end
-- se lavorazione verticale
else
-- si cerca utensile 1
local Milling = {}
Milling.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'Milling')
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
-- si cerca utensile 2
local Milling2 = {}
Milling2.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, vtExtr, -vtExtr)
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, 'Milling')
Milling2.ToolInfo = {}
Milling2.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
Milling.vtToolDirection = ToolSearchParameters.vtToolDirection
-- se serve codolo
if bExecStrip then
-- se a disposizione entrambi gli utensili
if Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
table.insert( Machining, Milling2)
-- se disponibile solo primo utensile
elseif Milling.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
-- se disponibile solo secondo utensile
elseif Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling2)
-- nessun utensile disponibile
else
-- non si fa nulla
if nCycle == 2 then
Milling.dRadialOffset = Strategy.Parameters.dOverMaterial
end
-- altrimenti senza codolo
if bDouble or bExecStrip then
if bDouble then
Milling.sDepth = ( dDepth + BeamData.MILL_OVERLAP) / 2
else
Milling.sDepth = ( dDepth - dDimStrip) / 2
end
table.insert( Machining, Milling)
local Milling2 = BeamLib.TableCopyDeep( Milling)
Milling2.bOtherDirection = true
table.insert( Machining, Milling2)
else
Milling.sDepth = dDepth + BeamData.MILL_OVERLAP
table.insert( Machining, Milling)
end
-- se lavorazione verticale
else
-- se utensile 1 esegue completamente
if Milling.ToolInfo.nToolIndex and Milling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
table.insert( Machining, Milling)
-- se utensile 2 esegue completamente
elseif Milling2.ToolInfo.nToolIndex and Milling2.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
table.insert( Machining, Milling2)
-- se possono lavorare entrambi
elseif Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
table.insert( Machining, Milling2)
-- se utensile 1 non completo
elseif Milling.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
-- se utensile 2 non completo
elseif Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling2)
-- si cerca utensile 1
local Milling = {}
Milling.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, -vtExtr, vtExtr)
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
Milling.ToolInfo = {}
Milling.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
if nCycle == 2 then
Milling.dRadialOffset = Strategy.Parameters.dOverMaterial
end
Milling.vtToolDirection = ToolSearchParameters.vtToolDirection
-- si cerca utensile 2
local Milling2 = {}
Milling2.bIsApplicable = false
ToolSearchParameters = {}
ToolSearchParameters.sMillShape = 'STANDARD'
ToolSearchParameters.dElevation = dDepth + BeamData.MILL_OVERLAP
ToolSearchParameters.vtToolDirection = EgtIf( bToolInvert, vtExtr, -vtExtr)
ToolSearchParameters.AvailableToolList = MachiningLib.GetAvailableToolList( Proc, Strategy.Parameters.sMillingList, sTypeTool)
ToolSearchParameters.dMaxToolDiameter = nMaxDiamMill
Milling2.ToolInfo = {}
Milling2.ToolInfo = MachiningLib.FindMill( Proc, ToolSearchParameters)
Milling2.bOtherDirection = true
if nCycle == 2 then
Milling2.dRadialOffset = Strategy.Parameters.dOverMaterial
end
Milling2.vtToolDirection = ToolSearchParameters.vtToolDirection
-- se serve codolo
if bExecStrip then
-- se a disposizione entrambi gli utensili
if Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
table.insert( Machining, Milling2)
-- se disponibile solo primo utensile
elseif Milling.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
-- se disponibile solo secondo utensile
elseif Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling2)
-- nessun utensile disponibile
else
-- non si fa nulla
end
-- altrimenti senza codolo
else
-- se utensile 1 esegue completamente
if Milling.ToolInfo.nToolIndex and Milling.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
table.insert( Machining, Milling)
-- se utensile 2 esegue completamente
elseif Milling2.ToolInfo.nToolIndex and Milling2.ToolInfo.dResidualDepth < 10 * GEO.EPS_SMALL then
table.insert( Machining, Milling2)
-- se possono lavorare entrambi
elseif Milling.ToolInfo.nToolIndex and Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
table.insert( Machining, Milling2)
-- se utensile 1 non completo
elseif Milling.ToolInfo.nToolIndex then
table.insert( Machining, Milling)
-- se utensile 2 non completo
elseif Milling2.ToolInfo.nToolIndex then
table.insert( Machining, Milling2)
end
end
end
end
@@ -236,7 +273,7 @@ local function GetArcStrategy( Proc, Part)
-- TODO VOTO DA FARE!!!!
Result.sStatus = 'Completed'
Result.nCompletionIndex = 5
Result.dMRR = MachiningLib.GetToolMRR( Machining[1].ToolInfo or Machining[2].ToolInfo)
Result.dMRR = 1
Result.nQuality = FeatureLib.GetFeatureQuality( 'Mill')
Result.sInfo = ''
@@ -266,13 +303,14 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
Strategy.Chamfer = {}
Strategy.Chamfer.Machinings = {}
Strategy.Chamfer.Result = {}
Strategy.Profile = {}
Strategy.Profile.Machinings = {}
Strategy.Profile.Result = {}
Strategy.Result = {}
local bAreAllMachiningsAdded = true
-- calcolo se la lavorazione del tenone può essere spostata dopo taglio di coda
local dLengthOnX = Proc.b3Box:getDimX()
Strategy.bCanMoveAfterSplit = MachiningLib.CanMoveAfterSplitcut( dLengthOnX, Part)
-- recupero e verifico l'entità curva
local idAux = EgtGetInfo( Proc.id, 'AUXID', 'i')
if idAux then idAux = idAux + Proc.id end
@@ -303,9 +341,10 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
end
-- lavorazione profilo (a meno che non si facciano solo smussi)
if not Strategy.Parameters.bOnlyChamfer then
Strategy.Profile.Machinings, Strategy.Profile.Result = GetArcStrategy( Proc, Part)
end
Strategy.Profile = {}
Strategy.Profile.Machinings = {}
Strategy.Profile.Result = {}
Strategy.Profile.Machinings, Strategy.Profile.Result = GetArcStrategy( Proc, Part)
end
Strategy.Result = GetFeatureResult()
@@ -320,6 +359,21 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
-- lavorazione di sgrezzatura di lama
if Strategy.RoughCut.Machinings then
-- se cutting da fare come svuotatura
if Strategy.RoughCut.Machinings.bCuttingWithMill then
-- TODO
-- taglio di lama
else
for i = 1, #Strategy.RoughCut.Machinings do
if Proc.AffectedFaces.bLeft and Strategy.bCanMoveAfterSplit then
Strategy.RoughCut.Machinings[i].sStage = 'AfterTail'
end
local bIsMachiningAdded = MachiningLib.AddMachinings( Proc, Strategy.RoughCut.Machinings[i])
if not bIsMachiningAdded then
bAreAllMachiningsAdded = false
end
end
end
end
-- lavorazione degli angoli interni
@@ -367,13 +421,13 @@ function STR0015.Make( bAddMachining, Proc, Part, CustomParameters)
Strategy.Profile.Machinings[i].LeadOutForSplit.dPerpDistance = TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].dDiameter / 2 + BeamData.COLL_SIC
-- sistemo il lato e la direzione di lavoro
if i == 1 then
Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, false, true)
Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
else
if Strategy.Profile.Machinings[i].bOtherDirection then
Strategy.Profile.Machinings[i].bToolInvert = true
Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, true, false)
Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
else
Strategy.Profile.Machinings[i].bInvert = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, false, true)
Strategy.Profile.Machinings[i].nWorkside = EgtIf( TOOLS[Strategy.Profile.Machinings[i].ToolInfo.nToolIndex].bIsCCW, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)
end
Strategy.Profile.Machinings[i].ptEdge1 = EgtSP( Proc.idAddAuxGeom, GDB_ID.ROOT)
Strategy.Profile.Machinings[i].ptEdge2 = EgtEP( Proc.idAddAuxGeom, GDB_ID.ROOT)