DataBeam :

- migliorie a gestione fessure con tre facce da lavorare con sega a catena.
This commit is contained in:
DarioS
2022-03-23 08:55:36 +01:00
parent cf78978476
commit 482cd50e0b
+37 -56
View File
@@ -380,14 +380,18 @@ local function VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill)
bIsU = ( bIsU or ( Proc.Fct == 3 and not TestElleShape3( Proc)))
bIsL = ( bIsL or ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2))
-- la lavorazione BH non va bene se le facce di chiusura non sono perpendicolari a X
if bIsU or bIsL then
for i = 1, Proc.Fct do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
return false
end
-- le facce devono contenere X e quelle di chiusura devono essere perpendicolari a X
local bStopY, bStopZ
for i = 1, Proc.Fct do
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, i-1, GDB_ID.ROOT)
if abs( vtN:getX()) > 0.001 and abs( vtN:getX()) < 0.999962 then
return false
end
if abs( vtN:getY()) > 0.866 then bStopY = true end
if abs( vtN:getZ()) > 0.866 then bStopZ = true end
end
if bStopY and bStopZ then
return false
end
-- se non U o L o singola faccia di multipla, non accettata
@@ -615,7 +619,7 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
local bUseBHSideMill, bHead, bHeadDir = VerifyBHSideMill( Proc)
if bUseBHSideMill then
Proc.HeadDir = bHeadDir
return not bHead
--return not bHead
end
-- recupero box del pezzo
local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL)
@@ -3074,6 +3078,10 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- verifico se posso farlo con la sega-catena
local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( Proc, dDimMin, dDimMax)
if bMakeChainSaw then
-- Calcolo uso faccia
local vtRef = Vector3d( vtOrtho)
if vtRef:getY() > 0.5 or vtRef:getZ() < -0.1 then vtRef = -vtRef end
local nFaceUse = BL.GetNearestParalOpposite( vtRef, vtN)
-- Verifico se necessarie più passate
local nStep = ceil( ( dDimMin - 10 * GEO.EPS_SMALL) / dSawThick2)
local dStep = 0
@@ -3092,18 +3100,6 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, nLundIdFace}})
-- imposto uso del lato faccia
local nFaceUse
-- se non è un tunnel a 4 facce
if Proc.Fct < 4 then
nFaceUse = BL.GetNearestParalOpposite( rfFac:getVersZ(), vtN)
-- altrimenti vero tunnel (solo sopra-sotto o davanti-dietro)
else
if abs( vtOrtho:getZ()) >= 0.707 then
nFaceUse = MCH_MILL_FU.PARAL_DOWN
else
nFaceUse = MCH_MILL_FU.PARAL_BACK
end
end
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto angolo 3° asse rot
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 1))
@@ -3111,40 +3107,19 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd,
-- imposto offset radiale
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- se non è un tunnel a 4 facce
if Proc.Fct < 4 then
-- imposto sempre massimo affondamento
local dBoxDepth
if nFaceUse == MCH_MILL_FU.PARAL_LEFT or nFaceUse == MCH_MILL_FU.PARAL_RIGHT then
dBoxDepth = Proc.Box:getDimX()
elseif nFaceUse == MCH_MILL_FU.PARAL_FRONT or nFaceUse == MCH_MILL_FU.PARAL_BACK then
dBoxDepth = Proc.Box:getDimY()
else
dBoxDepth = Proc.Box:getDimZ()
end
EgtSetMachiningParam( MCH_MP.DEPTH, dBoxDepth)
if dBoxDepth > dMaxMat2 then
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- sistemo inizio e fine
if bOpenStart then EgtSetMachiningParam( MCH_MP.STARTADDLEN, 0) end
if bOpenEnd then EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) end
-- altrimenti vero tunnel (solo sopra-sotto o davanti-dietro)
else
-- se possibile aumento l'affondamento pari al raggio corner + 1
if dMaxMat2 > (dDepth + dSawCornerRad2 + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1))
-- se massimo affondamento supera altezza fessura, uso massimo affondamento
elseif dMaxMat2 > (dDepth + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1))
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat2 < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- se possibile aumento l'affondamento pari al raggio corner + 1
if dMaxMat2 > ( dDepth + dSawCornerRad2 + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1))
-- se massimo affondamento supera altezza fessura, uso massimo affondamento
elseif dMaxMat2 > (dDepth + 1) then
EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1))
-- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning
elseif dMaxMat2 < dDepth then
EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2)
sWarn = 'Warning : elevation bigger than max tool depth'
EgtOutLog( sWarn)
end
-- considero estremi inizio/fine chiusi
-- recupero massima elevazione da utente
if dMaxElev and dMaxElev > 10 then
local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';'
@@ -4519,7 +4494,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- larghezza della faccia
local dV = 0
local dH = 0
-- se due o più (recupero la larghezza della faccia perpendicolarmente alle altre)
-- se due o più facce (recupero la larghezza della faccia perpendicolarmente alle altre)
if Proc.Fct >= 2 then
local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, EgtIf( nFacInd == 0, 1, 0), GDB_ID.ROOT)
local vtX = vtN2 ^ vtN
@@ -4529,9 +4504,14 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
dH = b3Ref:getDimX()
dV = b3Ref:getDimY()
end
-- altrimenti una sola
-- altrimenti una sola faccia
else
_, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
_, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
if Proc.Box:getDimX() > Proc.Box:getDimY() then
if dH > dV then dH, dV = dV, dH end
else
if dH < dV then dH, dV = dV, dH end
end
end
-- verifico se U
local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc))
@@ -4562,6 +4542,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bHeadDir, MCH_MILL_FU.PARAL_LEFT, MCH_MILL_FU.PARAL_RIGHT))
-- calcolo step effettivo ed elevazione
local dVcalc = dV - dMaxMat
if abs( dVcalc) < 0.1 then dVcalc = 0 end
local dStep = min( EgtMdbGetCurrMachiningParam( MCH_MP.STEP), dMaxMat)
local nStep = ceil( dVcalc / dStep)
if nStep > 0 then