- varie modifiche ai tagli di lama per DownUp, caso solo 2d

- in FaceData.GetEdgesInfo si scrivono anche i ptStart e ptEnd; IsFaceRhomboid diventa IsFaceParallelogram
- in BeamLib aggiunta IsEdgeOnBox
This commit is contained in:
luca.mazzoleni
2025-11-03 16:29:12 +01:00
parent 2d1abbb3cc
commit 7b4673acef
5 changed files with 102 additions and 46 deletions
+28 -14
View File
@@ -284,13 +284,20 @@ local function IsFaceZOutOfRange ( vtNFace, Tool)
end
-------------------------------------------------------------------------------------------------------------
local function IsBladeOrientationOkForDownUp( Face, Edge, b3Raw)
local function IsBladeOrientationOkForDownUp( Face, Edge, b3Part)
-- se l'utensile lavora perpendicolarmente, l'orientamento è sempre valido per DownUp
if AreSameVectorApprox( Face.vtN, Edge.vtN) then
return true
end
-- componente Z negativa di vtTool, ossia testa sotto alla trave e rischio collisione carro Z: non lavorabile in Downup
-- TODO con lama da sopra il test è per Z > 0!!!
if Edge.vtN:getZ() < - 10 * GEO.EPS_SMALL then
return false
end
-- orientamento 3d della faccia: non lavorabile in DownUp
-- TODO implementare gestione DownUp in 3d
@@ -327,14 +334,14 @@ local function IsBladeOrientationOkForDownUp( Face, Edge, b3Raw)
local dFaceComponent = Face.vtN["get" .. sAxis](Face.vtN)
local dEdgeComponent = Edge.vtN["get" .. sAxis](Edge.vtN)
local dPtonboxComponent = ptOnBox["get" .. sAxis](ptOnBox)
local dMaxb3rawComponent = b3Raw:getMax()["get" .. sAxis](b3Raw:getMax())
local dMinb3rawComponent = b3Raw:getMin()["get" .. sAxis](b3Raw:getMin())
local dMaxb3PartComponent = b3Part:getMax()["get" .. sAxis](b3Part:getMax())
local dMinb3PartComponent = b3Part:getMin()["get" .. sAxis](b3Part:getMin())
if dFaceComponent * dEdgeComponent < 10 * GEO.EPS_SMALL then
if dEdgeComponent > GEO.EPS_SMALL then
return dPtonboxComponent > dMaxb3rawComponent - 500 * GEO.EPS_SMALL
return dPtonboxComponent > dMaxb3PartComponent - 500 * GEO.EPS_SMALL
else
return dPtonboxComponent < dMinb3rawComponent + 500 * GEO.EPS_SMALL
return dPtonboxComponent < dMinb3PartComponent + 500 * GEO.EPS_SMALL
end
end
return false
@@ -365,7 +372,7 @@ end
-------------------------------------------------------------------------------------------------------------
-- ritorna se la faccia e il lato sono lavorabili e, se sì, il modo di lavorare (standard/DownUp) e l'elevazione corretta (in DownUp può cambiare)
function MachiningLib.GetBladeEngagement( Face, Edge, b3Raw, Tool)
function MachiningLib.GetBladeEngagement( Face, Edge, b3Part, Tool, bAllowEntryFromInternalEdge)
local sBladeEngagement = 'Standard'
local dDownUpElevation = Edge.dElevation
@@ -384,17 +391,24 @@ function MachiningLib.GetBladeEngagement( Face, Edge, b3Raw, Tool)
return false
end
-- faccia non rettangolare: non lavorabile in DownUp
if not FaceData.IsFaceRectangular( Face) then
-- faccia non parallelogramma: non lavorabile in DownUp
if not FaceData.IsFaceParallelogram( Face) then
return false
end
-- se il lato di approccio non è sul box e non è espressamente consentito (es: cubetti), non lavorabile in DownUp
local EdgeOpposite = BeamLib.FindEdgeBestOrientedAsDirection( Face.Edges, -Edge.vtN)
if not bAllowEntryFromInternalEdge and not BeamLib.IsEdgeOnBox( Face, EdgeOpposite, b3Part) then
return false
end
-- orientamento faccia / utensile compatibili con DownUp: lavorabile, si calcola l'elevazione reale per DownUp e si ritorna
if IsBladeOrientationOkForDownUp( Face, Edge, b3Raw) then
if IsBladeOrientationOkForDownUp( Face, Edge, b3Part) then
sBladeEngagement = 'DownUp'
dDownUpElevation = FaceData.GetEdgeElevationInBBox( Face, Edge, b3Raw )
dDownUpElevation = FaceData.GetEdgeElevationInBBox( Face, Edge, b3Part)
return true, sBladeEngagement, dDownUpElevation
end
@@ -544,7 +558,7 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
local dElevation = ToolSearchParameters.dElevation or 0
local bForceLongcutBlade = ToolSearchParameters.bForceLongcutBlade or false
local EdgeToMachine = ToolSearchParameters.EdgeToMachine
local b3Raw = ToolSearchParameters.b3Raw
local b3Part = ToolSearchParameters.b3Part
local nBestToolIndex
local dBestToolResidualDepth = 0
@@ -563,12 +577,12 @@ function MachiningLib.FindBlade( Proc, ToolSearchParameters)
-- se dati sufficienti, si determina se con questo utensile il taglio è fattibile e il modo di lavorare della lama
if bIsToolCompatible then
if FaceToMachine and EdgeToMachine and dElevation then
local bIsBladeOk, sBladeEngagement, dDownUpElevation = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, b3Raw, TOOLS[i])
if FaceToMachine and EdgeToMachine and dElevation and b3Part then
local bIsBladeOk, sBladeEngagement, dDownUpElevation = MachiningLib.GetBladeEngagement( FaceToMachine, EdgeToMachine, b3Part, TOOLS[i])
-- orientamento non raggiungibile o elevazione eccessiva per DownUp: non compatibile
if not bIsBladeOk
or ( sBladeEngagement == 'DownUp'
and ( dDownUpElevation - ( EdgeToMachine.dElevation - dElevation)) > TOOLS[i].dMaxMaterial - 10 * GEO.EPS_SMALL) then
and ( dDownUpElevation - ( EdgeToMachine.dElevation - dElevation)) > TOOLS[i].dMaxMaterial - 10 * GEO.EPS_SMALL) then
bIsToolCompatible = false
end