- TestElleShape 3 e 4 spostati in WallLib

- a DoubleCut aggiunto riconoscimento della sola L011
- in WallLib aggiunta funzione GetProcessAffectedFaces che restituisce le facce del grezzo interessate dalla feature
- in WallExec aggiunte alle Proc informazioni sulle facce della feature
- alcune modifiche iniziali per Mirror
This commit is contained in:
luca.mazzoleni
2023-06-20 09:35:25 +02:00
parent ac853fc74c
commit 1236d196ba
5 changed files with 158 additions and 61 deletions
+1
View File
@@ -19,3 +19,4 @@
/bin/*.ini
/bin/LuaLibs/*.lua
/bin/Images/*.png
.vscode/settings.json
+6
View File
@@ -24,6 +24,12 @@ function WPDC.Identify( Proc)
( Proc.Grp == 0 and Proc.Prc == 12))
end
---------------------------------------------------------------------
-- Riconoscimento della sola feature L011
function WPDC.IdentifyStrict( Proc)
return ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 11
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPDC.Classify( Proc, b3Raw)
+2 -60
View File
@@ -348,64 +348,6 @@ function WPL.FlipClassify( Proc)
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 GetOtherRegions( nPartId)
local vOthers = {}
@@ -2104,12 +2046,12 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar)
dDiam = 2 * dDiam
end
-- se forma ad L
local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc.Id, Proc.Fct) or TestElleShape4( Proc.Id, Proc.Fct) == 2)
local bIsL = ( Proc.Fct == 2 or WL.TestElleShape3( Proc.Id, Proc.Fct) or WL.TestElleShape4( Proc.Id, Proc.Fct) == 2)
if bIsL then
dDiam = 2 * dDiam
end
-- se forma ad U
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc.Id, Proc.Fct))
local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct))
if bIsU then
local _, dH2, dV2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
-- prendo la linea di base
+65 -1
View File
@@ -179,7 +179,17 @@ function WallExec.CollectFeatures( PartId, b3Raw)
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
-- recupero l'elenco delle facce della parte interessate dalla feature
Proc.AffectedFaces = WL.GetProcessAffectedFaces( Proc, PartId)
-- recupero informazioni sulle facce della feature
Proc.Face = {}
for i = 1, Proc.Fct do
Proc.Face[i] = { Id = i - 1, VtN = EgtSurfTmFacetNormVersor( Proc.Id, i - 1, GDB_ID.ROOT ), Elevation = WL.GetFaceElevation( Proc.Id, i - 1, PartId)}
end
if Proc.Box and not Proc.Box:isEmpty() then
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
@@ -580,6 +590,57 @@ local function SortMachinings( nPhase, PrevMch, nPartId)
return PrevMch
end
function VerifyLapJointMirrored( Proc, vProc, nPartId, b3Raw)
-- verifico se la geometria master è lavorabile in doppio (se la feature attuale è dal lato master)
local bIsThroughL = ( Proc.Fct == 2 and ( Proc.AffectedFaces == { true, true, false, false, true, true} or Proc.AffectedFaces == { true, false, false, true, true, true}))
local bIsU = ( Proc.Fct == 3 and not WL.TestElleShape3( Proc.Id, Proc.Fct))
local bAllowDifferentZ = false
-- 2 lati a L, passante
if bIsThroughL then
bAllowDifferentZ = true
-- 3 lati a U, passante
elseif bIsU then
-- sul fianco, parallela a X
if Proc.AffectedFaces == { false, true, false, false, true, true} or Proc.AffectedFaces == { false, false, false, true, true, true} then
bAllowDifferentZ = true
-- sopra
elseif Proc.AffectedFaces == { true, false, false, false, true, true} then
-- sul fianco, parallela a Z
elseif Proc.AffectedFaces == { true, true, true, false, false, false} then
end
-- 3 lati a L, non passante
elseif Proc.Fct == 3 then
-- 4 lati
elseif Proc.Fct == 4 then
-- 5 lati, tasca standard
elseif Proc.Fct == 5 then
end
-- se la condizione sopra è vera, verifico se esistono una o più altre features specchiate
-- se le condizioni sopra sono vere, lo segno nelle proprietà delle feature
end
-------------------------------------------------------------------------------------------------------------
-- Cerca in vProc la presenza di feature da lavorare in doppio.
local function SetMirroredFeatures( vProc, nPartId, b3Raw)
for i = 1, #vProc do
local Proc = vProc[i]
if Proc.Flg ~= 0 then
-- Proc.Double -> 2: specchiatura in Y
-- Proc.MirrorId -> Id della feature mirrorata
if ( ( LapJoint.Identify and Proc.Prc ~= 20) or DoubleCut.IdentifyStrict( Proc)) and true then -- aggiungere dipendenza da costante WallData!!
VerifyLapJointMirrored( Proc, vProc, nPartId, b3Raw)
end
end
end
end
-------------------------------------------------------------------------------------------------------------
function WallExec.ProcessFeatures()
-- errori e stato
@@ -611,6 +672,9 @@ function WallExec.ProcessFeatures()
if WD.FindFeaturesInDouble then
WD.FindFeaturesInDouble( vProc, b3Raw)
end
SetMirroredFeatures( vProc, nPartId, b3Raw)
-- debug
if EgtGetDebugLevel() >= 1 then
PrintFeatures( vProc)
+84
View File
@@ -316,5 +316,89 @@ function WallLib.GetNearestOrthoOpposite( vtRef, vtNorm)
return nil
end
---------------------------------------------------------------------
function WallLib.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
---------------------------------------------------------------------
function WallLib.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
-------------------------------------------------------------------------------------------------------------
-- restituisce le facce del grezzo interessate dalla feature Proc
function WallLib.GetProcessAffectedFaces( Proc, nPartId)
local b3Part = EgtGetBBoxGlob( nPartId, GDB_BB.STANDARD)
local vtFacesAffected = { Bottom = false, Back = false, Top = false, Front = false, Left = false, Right = false}
if Proc.Box:getMin():getZ() < b3Part:getMin():getZ() + 10 * GEO.EPS_SMALL then
vtFacesAffected.Bottom = true
end
if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 10 * GEO.EPS_SMALL then
vtFacesAffected.Back = true
end
if Proc.Box:getMax():getZ() > b3Part:getMax():getZ() - 10 * GEO.EPS_SMALL then
vtFacesAffected.Top = true
end
if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 10 * GEO.EPS_SMALL then
vtFacesAffected.Front = true
end
if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 10 * GEO.EPS_SMALL then
vtFacesAffected.Left = true
end
if Proc.Box:getMax():getX() > b3Part:getMax():getX() - 10 * GEO.EPS_SMALL then
vtFacesAffected.Right = true
end
return vtFacesAffected
end
-------------------------------------------------------------------------------------------------------------
return WallLib