Merge remote-tracking branch 'origin/develop' into NewHeadTailCut

This commit is contained in:
andrea.villa
2025-10-20 08:26:27 +02:00
8 changed files with 65 additions and 39 deletions
+1 -1
View File
@@ -239,7 +239,7 @@ elseif BEAM.FLAG == 9 then
Proc.nPrc = EgtGetInfo( Proc.id, 'PRC', 'i')
Proc.Topology = {}
if FeatureLib.NeedTopologyFeature( Proc) then
if FeatureLib.NeedTopologyFeature( Proc, Part) then
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
else
Proc = FeatureLib.GetAdditionalInfo( Proc, Part)
+1 -1
View File
@@ -647,7 +647,7 @@ local function CollectFeatures( Part, dRotIndex)
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
-- calcolo topologia solo se necessario, altrimenti si sfruttano le informazioni della feature BTL
local bIsFeatureReadyForProcessing = false
if FeatureLib.NeedTopologyFeature( Proc) then
if FeatureLib.NeedTopologyFeature( Proc, Part) then
Proc.AdjacencyMatrix = FaceData.GetAdjacencyMatrix( Proc)
Proc.Faces = FaceData.GetFacesInfo( Proc, Part)
Proc.Topology = FeatureLib.ClassifyTopology( Proc, Part)
+27 -16
View File
@@ -37,9 +37,22 @@ function FeatureLib.GetProcFromTrimesh( idTrimesh, Part, ProcToCopyFrom)
return Proc
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra
local function IsFeatureCuttingEntireSection( b3Proc, Part)
return ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL))
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera lunghezza della barra
local function IsFeatureCuttingEntireLength( b3Proc, Part)
return ( ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL)) or
( b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL)))
end
---------------------------------------------------------------------
-- recupero topologia della feature
function FeatureLib.NeedTopologyFeature( Proc)
function FeatureLib.NeedTopologyFeature( Proc, Part)
-- feature Egalware con calcolo topologia SEMPRE da geometria
if ID.IsHeadCut( Proc) then -- (1-340)
return true
@@ -54,8 +67,6 @@ function FeatureLib.NeedTopologyFeature( Proc)
return true
elseif ID.IsDoubleLongitudinalCut( Proc) then -- (0-12)
return true
elseif ID.IsSawCut( Proc) then -- (0-13)
return true
elseif ID.IsSlot( Proc) then -- (1-16)
return true
elseif ID.IsFrontSlot( Proc) then -- (1-17)
@@ -79,6 +90,10 @@ function FeatureLib.NeedTopologyFeature( Proc)
elseif ID.IsStepJointNotch( Proc) then -- (0-80)
return true
-- feature con calcolo topologia da geometria SOLO se rispettano certe condizioni, altrimenti riconoscimento specifico
elseif ID.IsSawCut( Proc) and Proc.nFct == 1
and ( IsFeatureCuttingEntireSection( Proc.b3Box, Part)
or IsFeatureCuttingEntireLength( Proc.b3Box, Part)) then -- (0-13)
return true
elseif ID.IsHipValleyRafterNotch( Proc) and Proc.nFct < 4 then -- (0-25)
return true
elseif ID.IsRidgeLap( Proc) and Proc.nFct ~= 3 then -- (1-30)
@@ -139,19 +154,6 @@ local function IsAnyDimensionLongAsPart( Proc, Part)
return bResult
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera sezione della barra
local function IsFeatureCuttingEntireSection( b3Proc, Part)
return ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL))
end
-------------------------------------------------------------------------------------------------------------
-- restituisce vero se la feature con box b3Proc taglia l'intera lunghezza della barra
local function IsFeatureCuttingEntireLength( b3Proc, Part)
return ( ( b3Proc:getDimY() > ( Part.b3Part:getDimY() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL)) or
( b3Proc:getDimZ() > ( Part.b3Part:getDimZ() - 500 * GEO.EPS_SMALL) and b3Proc:getDimX() > ( Part.b3Part:getDimX() - 500 * GEO.EPS_SMALL)))
end
---------------------------------------------------------------------
-- restituisce una stringa con il nome esteso della topologia della feature
-- *famiglia - numero di facce - passante*
@@ -856,6 +858,15 @@ function FeatureLib.GetFeatureSplittingPoints( Proc, Part, OptionalParameters)
table.insert( FeatureSplittingPoints, ptSplitXLeft)
end
-- TODO RIMUOVERE E SISTEMARE LA FUNZIONE!!
-- se il punto finisce fuori si mette in mezzeria
if #FeatureSplittingPoints == 1
and ( ( FeatureSplittingPoints[1]:getX() < Part.b3Part:getMin():getX() + 10 * GEO.EPS_SMALL)
or ( FeatureSplittingPoints[1]:getX() > Part.b3Part:getMax():getX() - 10 * GEO.EPS_SMALL)) then
FeatureSplittingPoints[1] = Point3d( Part.b3Part:getMin():getX() + ( Part.b3Part:getMax():getX() - Part.b3Part:getMin():getX()) / 2, 0, 0)
end
return FeatureSplittingPoints
end
+8 -8
View File
@@ -79,8 +79,8 @@ function Logs.WriteFeaturesLog( ProcessingsOnPart, PartInfo)
end
-- se c'è una chosen strategy, si aggiunge prefisso '*' per indicare nel log qual è la strategia che è stata scelta
local nIndexBestStrategy = ProcessingsOnPart.Rotation[nRotLog][ProcLog].nIndexBestStrategy or 0
local sLogLineProc = EgtIf( nIndexBestStrategy == nCountStrategies, '*', '') ..
tostring( ProcessingsOnPart.Rotation[nRotLog][ProcLog].AvailableStrategies[nCountStrategies].Result.dCompositeRating) ..' (' ..
local dRating = EgtNumToString( ProcessingsOnPart.Rotation[nRotLog][ProcLog].AvailableStrategies[nCountStrategies].Result.dCompositeRating, -1)
local sLogLineProc = EgtIf( nIndexBestStrategy == nCountStrategies, '*', '') .. dRating ..' (' ..
tostring( ProcessingsOnPart.Rotation[nRotLog][ProcLog].AvailableStrategies[nCountStrategies].sStrategyId) .. ')' ..
sStatusStrategy .. ' |'
while string.len( sLogLineProc) <= 20 do
@@ -138,8 +138,8 @@ function Logs.WriteMatrixLog( ProcessingsOnPart, PartInfo)
if PartInfo.CombinationList.Rotations[nRotLog] == 1 then
if ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy then
local sStatusStrategy = EgtIf( ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy.Result.sStatus == 'Completed', 'C', 'P')
local sLogLineProc = tostring( ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy.Result.dCompositeRating) ..
' (' .. tostring( ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy.sStrategyId) .. ')' .. sStatusStrategy .. ' |'
local dRating = EgtNumToString( ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy.Result.dCompositeRating, -1)
local sLogLineProc = dRating .. ' (' .. tostring( ProcessingsOnPart.Rotation[nRotLog][ProcLog].ChosenStrategy.sStrategyId) .. ')' .. sStatusStrategy .. ' |'
while string.len( sLogLineProc) <= 20 do
sLogLineProc = ' ' .. sLogLineProc
end
@@ -159,15 +159,15 @@ end
-------------------------------------------------------------------------------------------------------------
function Logs.WriteCombinationLog( CombinationsList, BestCombination)
EgtOutLog( ' === === === === === === === === === === COMBINATIONS === === === === === === ')
EgtOutLog( ' COMBI (UNL) | RATING | COMPLETE | NO COMPL | NO EXEC | ROTATE |')
EgtOutLog( ' COMBI (UNL) POS | RATING | COMPLETE | NO COMPL | NO EXEC | ROTATE |')
EgtOutLog( '------------------------------------------------------------------------------')
for CombiLog = 1, #CombinationsList do
local sPartPosition = EgtIf( CombinationsList[CombiLog].bPartInCombiIsInverted, 'INV', 'ORI')
local sLogLine = ' ' .. CombinationsList[CombiLog].sBitIndexCombination .. ' (' .. CombinationsList[CombiLog].nUnloadPos .. ') ' .. sPartPosition .. ' |'
local sLogLine = ' ' .. CombinationsList[CombiLog].sBitIndexCombination .. ' (' .. CombinationsList[CombiLog].nUnloadPos .. ') ' .. sPartPosition .. ' |'
-- rating
local sOtherField = tostring( CombinationsList[CombiLog].dTotalRating) .. ' |'
while string.len( sOtherField) <= 11 do
local sOtherField = EgtNumToString( CombinationsList[CombiLog].dTotalRating, - 3) .. ' |'
while string.len( sOtherField) <= 15 do
sOtherField = ' ' .. sOtherField
end
sLogLine = sLogLine .. sOtherField
+1 -1
View File
@@ -52,7 +52,7 @@
"nGrp": 0,
"TopologyList" : [
{ "sName": "Feature",
"StrategyList" : [ ]
"StrategyList" : [ { "sStrategyId": "STR0002" }, { "sStrategyId": "STR0005" }, { "sStrategyId": "STR0010" } ]
}
]
},
+2 -4
View File
@@ -554,10 +554,8 @@ function STR0002.Make( bAddMachining, Proc, Part, CustomParameters)
-- se ho una sola trimesh, sto lavorando la Proc direttamente e non ho spezzato. Applico direttamente alla geometria calcolata prima
if #vAddId == 1 then
Pocketing.Geometry = {{ Strategy.Machining[j].idProc, Strategy.Machining[j].idFaceToMachine}}
Pocketing.vtToolDirection = Proc.Faces[ Strategy.Machining[j].idFaceToMachine + 1].vtN
if Pocketing.bToolInvert then
Pocketing.vtToolDirection = -Pocketing.vtToolDirection
end
Pocketing.vtToolDirection = Strategy.Machining[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
if Proc.AffectedFaces.bLeft then
+2 -2
View File
@@ -113,7 +113,7 @@
{
"sName": "bAllowFastCuts",
"sNameNge": "ALLOW_FAST_CUTS",
"sValue": "false",
"sValue": "true",
"sDescriptionShort": "Prioritize machining speed over quality",
"sDescriptionLong": "",
"sType": "b",
@@ -123,7 +123,7 @@
{
"sName": "bReduceBladePath",
"sNameNge": "REDUCE_BLADE_PATH",
"sValue": "false",
"sValue": "true",
"sDescriptionShort": "Use entire blade diameter to shorten path",
"sDescriptionLong": "",
"sType": "b",
+23 -6
View File
@@ -396,21 +396,38 @@ local function GetSingleCutStrategy( Proc, Part, OptionalParameters)
}
nToolIndex, sChosenBladeType = GetBestBlade( Proc, Part, FaceToMachine, OptionalParametersGetBestBlade)
-- se possibile, upgrade del taglio tipo 'Top' a taglio a ghigliottina
-- se possibile, upgrade del taglio tipo 'Top' a taglio a ghigliottina. Si tenta anche se il taglio singolo non è riuscito.
if ( sChosenBladeType == 'Top' or not nToolIndex) and bReduceBladePath and FaceData.IsFaceRectangular( Proc, FaceToMachine.id) then
local nToolIndexGuillotine
-- ricerca lama migliore testa sopra
local ToolInfo = MachiningLib.FindBlade( Proc, {
vtN = FaceToMachine.vtN,
bAllowTopHead = true,
bAllowBottomHead = false
})
nToolIndexGuillotine = ToolInfo.nToolIndex
-- se non trovato utensile, si prova in DownUp
if not nToolIndexGuillotine then
ToolInfo = MachiningLib.FindBlade( Proc, {
vtN = -FaceToMachine.vtN,
bAllowTopHead = true,
bAllowBottomHead = false})
if ToolInfo.nToolIndex then
local dMinNzDownUp = TOOLS[ToolInfo.nToolIndex].SetupInfo.GetMinNzDownUp( Part.b3Raw, FaceToMachine.vtN, EdgeToMachineList.TopGuillotine.vtN, TOOLS[ToolInfo.nToolIndex])
if FaceToMachine.vtN:getZ() < dMinNzDownUp then
nToolIndexGuillotine = ToolInfo.nToolIndex
end
end
end
-- test fattibilità taglio a ghigliottina
if ToolInfo.nToolIndex then
local dRadialOffset = FaceByBlade.GetRadialOffsetForGuillotine( ToolInfo.nToolIndex, EdgeToMachineList.TopGuillotine.dLength)
if nToolIndexGuillotine then
local dRadialOffset = FaceByBlade.GetRadialOffsetForGuillotine( nToolIndexGuillotine, EdgeToMachineList.TopGuillotine.dLength)
if ( TOOLS[ToolInfo.nToolIndex].dMaxMaterial - EdgeToMachineList.TopGuillotine.dElevation - BeamData.CUT_SIC) > dRadialOffset + 10 * GEO.EPS_SMALL then
nToolIndex = ToolInfo.nToolIndex
if ( TOOLS[nToolIndexGuillotine].dMaxMaterial - EdgeToMachineList.TopGuillotine.dElevation - BeamData.CUT_SIC) > dRadialOffset + 10 * GEO.EPS_SMALL then
nToolIndex = nToolIndexGuillotine
sChosenBladeType = 'TopGuillotine'
end
end
@@ -890,7 +907,7 @@ local function CutWithDicing( Proc, Part, OptionalParameters)
Result.dCompletionPercentage = 100
Result.dQuality = FeatureLib.GetStrategyQuality( TOOLS[nToolIndex].sFamily)
Result.dTimeToMachineOriginal = FeatureLib.GetStrategyTimeToMachine( Machinings)
Result.dTimeToMachine = Result.dTimeToMachineOriginal * 1.3
Result.dTimeToMachine = Result.dTimeToMachineOriginal * 2
Result.dMRR = ( FeatureInfo.dFeatureVolume / Result.dTimeToMachine) / pow( 10, 6)
else
Result = FeatureLib.GetStrategyResultNotApplicable()