BugFix/Approx3EdgesFaces:

- in freeContour aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm)
This commit is contained in:
luca.mazzoleni
2022-12-13 09:48:53 +01:00
parent 3bf3ba3b43
commit 3b46a5b285
+31 -1
View File
@@ -12,6 +12,7 @@
-- 2022/04/26 Migliorata gestione caso pocketing.
-- 2022/08/05 Aggiunta segnalazione aree vietate non gestite.
-- 2022/08/29 Corretta gestione tipo Pocket senza fondo (sono lavorabili da entrambe le parti con fresatura).
-- 2022/12/13 Aggiunta la funzione Is3EdgesApprox per riconoscere come 3 lati anche facce con lati aggiuntivi molto corti (<15 mm)
-- Tabella per definizione modulo
local WPF = {}
@@ -1233,6 +1234,33 @@ local function GetMaxDepth( vtNz, dMillDiam, dDiamTh, dMaxDepth, dFreeLen)
end
end
---------------------------------------------------------------------
-- Funzione per determinare se la faccia ha lati molto corti (trascurabili) ed è quindi approssimabile ad una 3 facce
local function Is3EdgesApprox( Proc, nFacet, nAddGrpId)
local bResult = false
local nContourId = EgtExtractSurfTmFacetLoops( Proc.Id, nFacet, nAddGrpId)
EgtMergeCurvesInCurveCompo( nContourId)
-- recupero il numero effettivo di lati
local _, nEntityCount = EgtCurveDomain( nContourId)
local nEdges = nEntityCount
if nContourId then
if nEntityCount and nEntityCount == 3 then
bResult = true
-- rimuovo i lati molto corti dal conteggio totale
elseif nEntityCount then
for i = 1, nEntityCount do
local dLength = EgtCurveCompoLength( nContourId, i - 1)
if dLength < 15 then nEdges = nEdges - 1 end
end
end
if nEdges == 3 then bResult = true end
end
if bResult == true then
EgtOutLog( 'FreeContour : Face with ' .. tointeger( nEntityCount) .. ' edges skipped (approx 3 edges)')
end
return bResult
end
---------------------------------------------------------------------
local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAddGrpId)
-- flag per fresature non passanti
@@ -1358,8 +1386,10 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
return 0, sErr
end
end
-- verifico se la faccia ha alcuni lati molto corti e può essere approssimata ad una 3 lati
local bIs3EdgesApprox = Is3EdgesApprox( Proc, vFace[i].Fac, nAddGrpId)
-- se tutta la faccia o la sua fine senza taglio, inserisco una fresatura
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and vFace[i].Edges > 3) then
if ( vFace[i].Type & 2) ~= 0 or ( vFace[i].Type == 4 and ( vFace[i].Edges > 3 and not bIs3EdgesApprox)) then
-- inserisco la lavorazione
local sName = 'Free_' .. ( EgtGetName( Proc.PartId) or tostring( Proc.PartId))
local nMchId = EgtAddMachining( sName, sMilling)