- aggiunta libreria WFeatureTopology per il riconoscimento topologico delle feature (da completare)
- spostate alcune funzioni da FreeContour a WallLib
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
-- 2023/04/17 Lavorazione CleanCorner sempre forzata con lato di lavoro in centro.
|
||||
-- 2023/05/25 Funzioni EgtAddMachining sostituite da WM.AddMachining in modo da trascrivere le priorità da btl alle lavorazioni.
|
||||
-- 2023/06/06 Aggiunta gestione lavorazione per lamatura speciale affondata con Tool_ID specifico.
|
||||
-- 2023/06/26 Funzione Is3EdgesApprox spostata in WallLib.
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local WPF = {}
|
||||
@@ -148,64 +149,6 @@ function WPF.FlipClassify( Proc, b3Raw)
|
||||
return nFlip0, nFlip1
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function TestElleShape3( nIdGeom, nNumFacet)
|
||||
-- valida solo nel caso di tre facce
|
||||
if nNumFacet ~= 3 then return false end
|
||||
-- determino se L con una faccia terminale o U con tre facce
|
||||
local bIsL = true
|
||||
for i = 1, 3 do
|
||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
||||
-- le conto
|
||||
local nCount = 0
|
||||
for j = 1, #vFacAdj do
|
||||
if vFacAdj[j] >= 0 then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
if nCount == 1 then
|
||||
bIsL = false
|
||||
break
|
||||
end
|
||||
end
|
||||
return bIsL
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function TestElleShape4( nIdGeom, nNumFacet)
|
||||
-- valida solo nel caso di quattro facce
|
||||
if nNumFacet ~= 4 then return false end
|
||||
-- determino se L con due facce terminali o O
|
||||
local nFac3Adj = 0
|
||||
local dMinArea3 = GEO.INFINITO * GEO.INFINITO
|
||||
local dMaxArea2 = 0
|
||||
for i = 1, 4 do
|
||||
local vFacAdj = EgtSurfTmFacetAdjacencies( nIdGeom, i - 1)[1]
|
||||
-- le conto
|
||||
local nCount = 0
|
||||
for j = 1, #vFacAdj do
|
||||
if vFacAdj[j] >= 0 then
|
||||
nCount = nCount + 1
|
||||
end
|
||||
end
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( nIdGeom, i - 1, GDB_ID.ROOT)
|
||||
local dArea = dH * dV
|
||||
if nCount == 2 then
|
||||
dMaxArea2 = max( dMaxArea2, dArea)
|
||||
elseif nCount == 3 then
|
||||
dMinArea3 = min( dMinArea3, dArea)
|
||||
nFac3Adj = nFac3Adj + 1
|
||||
end
|
||||
end
|
||||
if nFac3Adj ~= 2 then return false end
|
||||
-- verifico se L profonda oppure lunga
|
||||
if dMinArea3 < dMaxArea2 then
|
||||
return 1
|
||||
else
|
||||
return 2
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function VerifyCornerType( Proc)
|
||||
-- Verifico il tipo di lavorazione su angolo :
|
||||
@@ -1243,33 +1186,6 @@ 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
|
||||
@@ -1292,7 +1208,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd
|
||||
end
|
||||
-- verifico se la facce hanno alcuni lati molto corti e possono quindi essere approssimate a 3 lati
|
||||
for currentFace = 1, #vFace do
|
||||
if Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
|
||||
if WL.Is3EdgesApprox( Proc, vFace[currentFace].Fac, nAddGrpId) then
|
||||
vFace[currentFace].Is3EdgesApprox = true
|
||||
end
|
||||
end
|
||||
@@ -2460,9 +2376,9 @@ local function MakeByPocket( Proc, nRawId, b3Raw)
|
||||
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
|
||||
local nNewProc, nNumFacet = RemoveBottomFaceAndReorder( Proc, nAddGrpId, nFacet)
|
||||
-- se ho forma a L
|
||||
local bIsL = ( nNumFacet == 2 or TestElleShape3( nNewProc, nNumFacet) or TestElleShape4( nNewProc, nNumFacet) == 2)
|
||||
local bIsL = ( nNumFacet == 2 or WL.TestElleShape3( nNewProc, nNumFacet) or WL.TestElleShape4( nNewProc, nNumFacet) == 2)
|
||||
-- verifico se U
|
||||
local bIsU = ( nNumFacet == 3 and not TestElleShape3( nNewProc, nNumFacet))
|
||||
local bIsU = ( nNumFacet == 3 and not WL.TestElleShape3( nNewProc, nNumFacet))
|
||||
local dMiddleFacetLength = 0
|
||||
if bIsU then
|
||||
local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( nNewProc, 1, GDB_ID.ROOT)
|
||||
|
||||
Reference in New Issue
Block a user