feature/MirroredMachinings:
- implementato riconoscimento tasche sul fianco (e relativa specchiata) da fare in doppio; funzionanti, da testare - piccoli ritocchi a AffectedFaces e Topology
This commit is contained in:
@@ -34,7 +34,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- restituisce gli id delle facce di Proc che hanno il numero di adiacenze nAdj
|
||||
local function GetFacesWithGivenAdjacencyNumber( Proc, nAdj)
|
||||
function WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, nAdj)
|
||||
local vAdj = GetAdjacencyMatrix( Proc)
|
||||
local vFacesWithGivenAdj = {}
|
||||
for i = 1, Proc.Fct do
|
||||
@@ -172,9 +172,9 @@ function WFeatureTopology.Classify( Proc)
|
||||
bAllAnglesConcave, bAllRightAngles = AreAllAnglesConcaveOrRight( Proc)
|
||||
local vTriangularFaces = GetTriangularFaces( Proc)
|
||||
local bIsAnyDimensionLongAsPart = IsAnyDimensionLongAsPart( Proc)
|
||||
local vFacesWithTwoAdj = GetFacesWithGivenAdjacencyNumber( Proc, 2)
|
||||
local vFacesWithThreeAdj = GetFacesWithGivenAdjacencyNumber( Proc, 3)
|
||||
local vFacesWithFourAdj = GetFacesWithGivenAdjacencyNumber( Proc, 4)
|
||||
local vFacesWithTwoAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 2)
|
||||
local vFacesWithThreeAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 3)
|
||||
local vFacesWithFourAdj = WFeatureTopology.GetFacesWithGivenAdjacencyNumber( Proc, 4)
|
||||
|
||||
if Proc.IsOutline then
|
||||
sFamily = 'OUTLINE'
|
||||
@@ -186,7 +186,7 @@ function WFeatureTopology.Classify( Proc)
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave and #vTriangularFaces == 1 then
|
||||
sFamily = 'Bevel'
|
||||
bIsThrough = false
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave and bIsAnyDimensionLongAsPart then
|
||||
elseif Proc.Fct == 2 and bAllAnglesConcave then
|
||||
sFamily = 'Rabbet'
|
||||
bIsThrough = true
|
||||
elseif Proc.Fct == 2 and not bAllAnglesConcave and bIsAnyDimensionLongAsPart then
|
||||
|
||||
+83
-43
@@ -640,52 +640,92 @@ function InsertScrapRemoval( nPhase)
|
||||
EgtSetCurrMachining( nActiveMachiningId)
|
||||
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)
|
||||
-- Cerca in vProc la presenza di feature da lavorare in doppio e, se trovate, ne setta i parametri
|
||||
local function SetMirroredFeatures( vProc, 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)
|
||||
-- AGGIUNGERE DIPENDENZA DA COSTANTE WALLDATA!!
|
||||
|
||||
-- tasca sul fianco (non groove)
|
||||
if Proc.TopologyLongName == 'Rabbet-Through-RightAngles-Parallel-2'or
|
||||
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3' or
|
||||
Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4' or
|
||||
Proc.TopologyLongName == 'Tunnel-Blind-RightAngles-Parallel-5' then
|
||||
-- feature rivolta verso Y- e parallela a X
|
||||
local bIsFeatureFacingFrontSide = Proc.AffectedFaces.Front
|
||||
-- feature vicino al bordo Y- del grezzo
|
||||
local bIsFeatureOnEdge = false
|
||||
local nFaceLookingFrontSide
|
||||
for j = 1, Proc.Fct do
|
||||
if AreOppositeVectorApprox( Proc.Face[j].VtN, Y_AX()) then
|
||||
nFaceLookingFrontSide = j - 1
|
||||
end
|
||||
end
|
||||
local dMaxDist = 300
|
||||
if nFaceLookingFrontSide then
|
||||
local ptFaceCenter = EgtSurfTmFacetCenter( Proc.Id, nFaceLookingFrontSide, GDB_ID.ROOT)
|
||||
local dSideDist = abs( ptFaceCenter:getY() - b3Raw:getMin():getY())
|
||||
bIsFeatureOnEdge = bIsFeatureFacingFrontSide and ( dSideDist < dMaxDist)
|
||||
end
|
||||
-- mirror XY sul lato opposto
|
||||
local nMirrorId
|
||||
local dYMirrorAx
|
||||
local dDeltaZ
|
||||
for j = 1, #vProc do
|
||||
local ProcMirror = vProc[j]
|
||||
if ProcMirror.TopologyLongName == Proc.TopologyLongName and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then
|
||||
-- feature specchiata rivolta verso Y+ e parallela a X
|
||||
local bIsMirrorFeatureFacingBackSide = ProcMirror.AffectedFaces.Back
|
||||
-- feature specchiata vicino al bordo Y+ del grezzo
|
||||
local bIsMirrorFeatureOnEdge = false
|
||||
local nMirrorFaceLookingBackSide
|
||||
for k = 1, ProcMirror.Fct do
|
||||
if AreSameVectorApprox( ProcMirror.Face[k].VtN, Y_AX()) then
|
||||
nMirrorFaceLookingBackSide = k - 1
|
||||
end
|
||||
end
|
||||
if nMirrorFaceLookingBackSide then
|
||||
local ptMirrorFaceCenter = EgtSurfTmFacetCenter( ProcMirror.Id, nMirrorFaceLookingBackSide, GDB_ID.ROOT)
|
||||
local dMirrorSideDist = abs( ptMirrorFaceCenter:getY() - b3Raw:getMax():getY())
|
||||
bIsMirrorFeatureOnEdge = bIsMirrorFeatureFacingBackSide and ( dMirrorSideDist < dMaxDist)
|
||||
end
|
||||
-- box delle stesse dimensioni
|
||||
local bIsMirrorFeatureSameDimension = false
|
||||
local b3Proc = EgtGetBBoxGlob( Proc.Id, GDB_BB.STANDARD)
|
||||
local b3ProcMirror = EgtGetBBoxGlob( ProcMirror.Id, GDB_BB.STANDARD)
|
||||
bIsMirrorFeatureSameDimension = abs( b3Proc:getDimX() - b3ProcMirror:getDimX()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3Proc:getDimY() - b3ProcMirror:getDimY()) < 500 * GEO.EPS_SMALL and
|
||||
abs( b3Proc:getDimZ() - b3ProcMirror:getDimZ()) < 500 * GEO.EPS_SMALL
|
||||
-- box allineati in X
|
||||
local bIsMirrorBoxXAligned = abs( Proc.Box:getCenter():getX() - ProcMirror.Box:getCenter():getX()) < 500 * GEO.EPS_SMALL
|
||||
-- box che non si intersecano
|
||||
local bIsNotMirrorBoxOverlapping = not OverlapsXY( b3Proc, b3ProcMirror)
|
||||
-- se tutte vere le condizioni, calcolo i parametri da passare alle lavorazioni
|
||||
if bIsMirrorFeatureFacingBackSide and bIsMirrorFeatureOnEdge and bIsMirrorFeatureSameDimension and bIsMirrorBoxXAligned and bIsNotMirrorBoxOverlapping then
|
||||
nMirrorId = ProcMirror.Id
|
||||
local b3Tab = EgtGetTableArea()
|
||||
local ptOnMirrorAx = ( Proc.Box:getCenter() + ProcMirror.Box:getCenter()) / 2
|
||||
dYMirrorAx = ptOnMirrorAx:getY() - b3Tab:getMin():getY()
|
||||
dDeltaZ = ProcMirror.Box:getMax():getZ() - Proc.Box:getMax():getZ()
|
||||
end
|
||||
end
|
||||
end
|
||||
-- se le condizioni precedenti sono soddisfatte, posso scrivere i parametri nella lavorazione
|
||||
if nMirrorId and bIsFeatureFacingFrontSide and bIsFeatureOnEdge then
|
||||
-- 2: specchiatura in Y
|
||||
Proc.Double = 2
|
||||
Proc.MirrorId = nMirrorId
|
||||
-- posizione Y dell'asse di specchiatura
|
||||
Proc.MirrorAx = dYMirrorAx
|
||||
-- Offset Z tra le feature
|
||||
Proc.MirrorDeltaZ = dDeltaZ
|
||||
end
|
||||
|
||||
-- groove passante
|
||||
elseif Proc.TopologyLongName == 'Groove-Through-RightAngles-Parallel-3' then
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -725,7 +765,7 @@ function WallExec.ProcessFeatures()
|
||||
WD.FindFeaturesInDouble( vProc, b3Raw)
|
||||
end
|
||||
|
||||
SetMirroredFeatures( vProc, nPartId, b3Raw)
|
||||
SetMirroredFeatures( vProc, b3Raw)
|
||||
|
||||
-- debug
|
||||
if EgtGetDebugLevel() >= 1 then
|
||||
|
||||
+7
-7
@@ -405,20 +405,20 @@ end
|
||||
function WallLib.GetProcessAffectedFaces( Proc)
|
||||
local nBoxSolidId = EgtGetFirstNameInGroup( Proc.PartId or GDB_ID.NULL, 'Box')
|
||||
local b3Part = EgtGetBBoxGlob( nBoxSolidId, GDB_BB.STANDARD)
|
||||
local vtFacesAffected = { Bottom = false, Back = false, Top = false, Front = false, Left = false, Right = false}
|
||||
local vtFacesAffected = { Top = false, Bottom = false, Front = false, Back = false, Left = false, Right = false}
|
||||
if Proc.Box and not Proc.Box:isEmpty() then
|
||||
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():getZ() < b3Part:getMin():getZ() + 10 * GEO.EPS_SMALL then
|
||||
vtFacesAffected.Bottom = true
|
||||
end
|
||||
if Proc.Box:getMin():getY() < b3Part:getMin():getY() + 10 * GEO.EPS_SMALL then
|
||||
vtFacesAffected.Front = true
|
||||
end
|
||||
if Proc.Box:getMax():getY() > b3Part:getMax():getY() - 10 * GEO.EPS_SMALL then
|
||||
vtFacesAffected.Back = true
|
||||
end
|
||||
if Proc.Box:getMin():getX() < b3Part:getMin():getX() + 10 * GEO.EPS_SMALL then
|
||||
vtFacesAffected.Left = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user