- in BLADETOWASTE.CompareEdgesTopHead si scelgono di preferenza i lati più verticali

- in tutte le strategie che contemplano la lama gestita bReduceBladePath come parametro strategia
This commit is contained in:
luca.mazzoleni
2025-07-08 12:29:03 +02:00
parent 6adb856b7a
commit 1e4388c091
14 changed files with 148 additions and 30 deletions
+1
View File
@@ -26,6 +26,7 @@ function FeatureLib.GetProcFromTrimesh( idTrimesh, Part, ProcToCopyFrom)
-- dati specifici della Proc
Proc.id = idTrimesh
Proc.idPart = Part.id
Proc.nFct = EgtSurfTmFacetCount( Proc.id) or 0
Proc.b3Box = EgtGetBBoxGlob( idTrimesh or GDB_ID.NULL, GDB_BB.STANDARD)
Proc.AffectedFaces = BeamLib.GetAffectedFaces( Proc, Part)
+10
View File
@@ -62,6 +62,16 @@
"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"
},
{
"sName": "sCuttingStrategy",
"sNameNge": "EXEC_TENON_SURF",
+4 -2
View File
@@ -31,7 +31,8 @@ local function GetTenonStrategy( Proc, Part)
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
-- creo piano di taglio sulla testa del tenone
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
@@ -45,7 +46,8 @@ local function GetTenonStrategy( Proc, Part)
-- lavorazione forzata con utensile lama
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
+10
View File
@@ -52,6 +52,16 @@
"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"
},
{
"sName": "sCuttingStrategy",
"sNameNge": "EXEC_TENON_SURF",
+4 -2
View File
@@ -29,7 +29,8 @@ local function GetTenonStrategy( Proc, Part)
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
-- creo piano di taglio sulla testa del tenone
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
@@ -43,7 +44,8 @@ local function GetTenonStrategy( Proc, Part)
-- lavorazione forzata con utensile lama
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idTenonCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
+10
View File
@@ -72,6 +72,16 @@
"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"
},
{
"sName": "sCuttingStrategy",
"sNameNge": "EXEC_MORTISE_SURF",
+4 -2
View File
@@ -33,7 +33,8 @@ function GetMortiseStrategy( Proc, Part)
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
-- creo piano di taglio sulla testa del tenone
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
@@ -47,7 +48,8 @@ function GetMortiseStrategy( Proc, Part)
-- lavorazione forzata con utensile lama
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
+10
View File
@@ -42,6 +42,16 @@
"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"
},
{
"sName": "sCuttingStrategy",
"sNameNge": "EXEC_TENON_SURF",
+4 -2
View File
@@ -44,7 +44,8 @@ local function GetBestPocketingStrategy( Proc, Part)
if Strategy.Parameters.sCuttingStrategy == 'AUTO' then
-- creo piano di taglio sulla testa del tenone
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
@@ -58,7 +59,8 @@ local function GetBestPocketingStrategy( Proc, Part)
-- lavorazione forzata con utensile lama
elseif Strategy.Parameters.sCuttingStrategy == 'BLADE_FORCED' then
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
Machining.Cutting, Result.Cutting = BladeToWaste.Make( Strategy.idMortiseCutPlane, Part, OptionalParameters)
-- se presente almeno una lavorazione e completo, il taglio è applicabile
+30
View File
@@ -41,6 +41,36 @@
}
]
},
{
"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"
},
{
"sName": "sRidgelapStrategy",
"sNameNge": "RIDGELAP_STRATEGY",
+8 -6
View File
@@ -98,11 +98,12 @@ function STR0012.Make( bAddMachining, Proc, Part, CustomParameters)
dMaxNyTopBlade = sin( Strategy.Parameters.dMaxYAngleTopBlade)
end
local OptionalParameters = { dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume,
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
dMinNzTopBlade = dMinZTopBlade,
dMaxNyTopBlade = dMaxNyTopBlade,
bSaveAddedGeometries = bAddMachining,
dExtendAfterTail = dExtendAfterTail
dMaxWasteLength = Strategy.Parameters.dMaxWasteLength,
dMinNzTopBlade = dMinZTopBlade,
dMaxNyTopBlade = dMaxNyTopBlade,
bSaveAddedGeometries = bAddMachining,
dExtendAfterTail = dExtendAfterTail,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
TwoFaces.Result, BladeToWasteResult = BladeToWaste.Make( Proc, Part, OptionalParameters)
dTimeToMachine = BladeToWasteResult.dTimeToMachine
@@ -128,7 +129,8 @@ function STR0012.Make( bAddMachining, Proc, Part, CustomParameters)
dMinNzTopBlade = dMinZTopBlade,
dMaxNyTopBlade = dMaxNyTopBlade,
bSaveAddedGeometries = bAddMachining,
dExtendAfterTail = dExtendAfterTail
dExtendAfterTail = dExtendAfterTail,
bReduceBladePath = Strategy.Parameters.bReduceBladePath
}
AddedFace.Result, BladeToWasteResult = BladeToWaste.Make( idAddedTmFace, Part, OptionalParameters)
+11 -1
View File
@@ -41,12 +41,22 @@
"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"
},
{
"sName": "bExecutePreCut",
"sNameNge": "EXEC_PRECUT",
"sValue": "true",
"sDescriptionShort": "Force to add PreCuts",
"sDescriptionLong": "Autocam will apply a machining on the theoric zero, to avoid collision if the theoric piece length doesn't correspond to the real length",
"sDescriptionLong": "Autocam will apply a machining on the theoretical zero, to avoid collision if the theoretical piece length doesn't correspond to the real length",
"sType": "b",
"sMessageId": " ",
"sMinUserLevel": "1"
+1
View File
@@ -97,6 +97,7 @@ function TAILCUT.Make( bAddMachining, Proc, Part, CustomParameters)
OptionalParameters.dMaxWasteVolume = Strategy.Parameters.dMaxWasteVolume
OptionalParameters.dMaxWasteLength = Strategy.Parameters.dMaxWasteLength
OptionalParameters.bReduceBladePath = Strategy.Parameters.bReduceBladePath
Strategy.Machining, _ = BladeToWaste.Make( Proc, Part, OptionalParameters)
if Strategy.Machining and #Strategy.Machining > 0 then
+41 -15
View File
@@ -22,25 +22,50 @@ local FeatureInfo = {}
-------------------------------------------------------------------------------------------------------------
local function CompareEdgesTopHead( EdgeA, EdgeB)
-- prima i lati a minore elevazione (se entro 5 mm si considerano uguali)
if EdgeA.dElevation < EdgeB.dElevation - 5 then
-- prima i lati vicini all'orizzontale (30deg)
if ( abs( EdgeA.vtN:getZ()) < 0.5 + 10 * GEO.EPS_SMALL) and ( abs( EdgeB.vtN:getZ()) > 0.5 + 10 * GEO.EPS_SMALL) then
return true
elseif EdgeA.dElevation > EdgeB.dElevation + 5 then
elseif ( abs( EdgeA.vtN:getZ()) > 0.5 + 10 * GEO.EPS_SMALL) and ( abs( EdgeB.vtN:getZ()) < 0.5 + 10 * GEO.EPS_SMALL) then
return false
-- se stessa elevazione si preferiscono i lati più in basso (testa sopra)
else
if EdgeA.vtN:getZ() > EdgeB.vtN:getZ() + 10 * GEO.EPS_SMALL then
return true
elseif EdgeA.vtN:getZ() < EdgeB.vtN:getZ() - 10 * GEO.EPS_SMALL then
return false
-- se stessa Z si preferiscono i lati verso il fronte della trave
else
if EdgeA.vtN:getY() > EdgeB.vtN:getY() + 10 * GEO.EPS_SMALL then
-- se entrambi entro i 30deg si preferiscono i lati a minore elevazione
if ( abs( EdgeA.vtN:getZ()) < 0.5 + 10 * GEO.EPS_SMALL) and ( abs( EdgeB.vtN:getZ()) < 0.5 + 10 * GEO.EPS_SMALL) then
if EdgeA.dElevation < EdgeB.dElevation - 5 then
return true
elseif EdgeA.vtN:getY() < EdgeB.vtN:getY() - 10 * GEO.EPS_SMALL then
elseif EdgeA.dElevation > EdgeB.dElevation + 5 then
return false
-- se stessa elevazione si preferiscono i lati più lunghi
else
if EdgeA.dLength > EdgeB.dLength + 10 * GEO.EPS_SMALL then
return true
elseif EdgeA.dLength < EdgeB.dLength - 10 * GEO.EPS_SMALL then
return false
else
return false
end
end
-- se entrambi oltre i 30deg si preferiscono i lati più vicini all'orizzontale
elseif ( abs( EdgeA.vtN:getZ()) > 0.5 + 10 * GEO.EPS_SMALL) and ( abs( EdgeB.vtN:getZ()) > 0.5 + 10 * GEO.EPS_SMALL) then
if abs( EdgeA.vtN:getZ()) < abs( EdgeB.vtN:getZ()) - 100 * GEO.EPS_SMALL then
return true
elseif abs( EdgeA.vtN:getZ()) > abs( EdgeB.vtN:getZ()) + 100 * GEO.EPS_SMALL then
return false
-- se stessa Z si preferiscono i lati a minore elevazione
else
if EdgeA.dElevation < EdgeB.dElevation - 5 then
return true
elseif EdgeA.dElevation > EdgeB.dElevation + 5 then
return false
-- se stessa elevazione si preferiscono i lati più lunghi
else
if EdgeA.dLength > EdgeB.dLength + 10 * GEO.EPS_SMALL then
return true
elseif EdgeA.dLength < EdgeB.dLength - 10 * GEO.EPS_SMALL then
return false
else
return false
end
end
end
end
end
@@ -281,6 +306,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
end
local nToolIndex = OptionalParameters.nToolIndex
local dExtendAfterTail = OptionalParameters.dExtendAfterTail or 10000
local bReduceBladePath = OptionalParameters.bReduceBladePath or false
-- lato da lavorare in base al tipo di lama
local EdgeToMachineTopBlade = GetEdgeToMachine( Proc.Faces[1].Edges, Proc.Faces[1].vtN, 'Top')
@@ -301,7 +327,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
-- se possibile taglio a ghigliottina, si sceglie il lato adeguato
if sChosenBladeType == 'Top'
and OptionalParameters.bReduceBladePath
and bReduceBladePath
and FaceData.IsFaceRectangular( Proc, Proc.Faces[1].id) then
-- ricerca lama migliore testa sopra
@@ -348,7 +374,7 @@ local function CutWholeWaste( Proc, Part, OptionalParameters)
local OptionalParametersFaceByBlade = { dDepthToMachine = dDepthToMachine,
nToolIndex = nToolIndex,
dExtendAfterTail = dExtendAfterTail,
bReduceBladePath = OptionalParameters.bReduceBladePath
bReduceBladePath = bReduceBladePath
}
Cutting = FaceByBlade.Make( Proc, Part, Proc.Faces[1], EdgeToMachine, OptionalParametersFaceByBlade)
@@ -720,7 +746,7 @@ function BLADETOWASTE.Make( ProcOrId, Part, OptionalParameters)
-- tutte le lavorazioni raggruppatee e calcolo area lavorata
local dAreaToMachineTotal = 0
-- TODO SISTEMARE!! A volte la lavorazione risulta completa, ma l'area lavorata è inferipre all'area totale e ritorna lavorazione incompleta (vedi i due casi sotto)
-- TODO SISTEMARE!! A volte la lavorazione risulta completa, ma l'area lavorata è inferiore all'area totale e ritorna lavorazione incompleta (vedi i due casi sotto)
for i = 1, #Machinings1 do
if Machinings1[i].bIsApplicable then
table.insert( Machinings, Machinings1[i])