- modifiche varie

This commit is contained in:
luca.bacis
2021-12-20 17:53:53 +01:00
parent 9f320e4934
commit 77d4f23bdd
+20 -55
View File
@@ -91,7 +91,7 @@ function ProcessLapJoint.Identify( Proc)
end
---------------------------------------------------------------------
local function AssignQIdent( Proc)
local function AssignQValues( Proc)
-- reset assegnazione parametri Q
Q_FORCE_BLADE = nil
@@ -614,8 +614,8 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw)
return true
end
end
-- in base al tipo di feature attribuisco il significato dei parametri Q
AssignQIdent( Proc)
-- in base al tipo di feature leggo i valori dei parametri Q
AssignQValues( Proc)
-- se può essere fatto con utensile tipo lama
local bUseBHSideMill, bHead, bHeadDir = VerifyBHSideMill( Proc)
if bUseBHSideMill then
@@ -1086,10 +1086,6 @@ local function MakeByMill( Proc, nFacInd, rfFac, dH, dV, dElev, dCollSic, bSpeci
EgtOutLog( sErr)
return false, sErr
end
EgtOutLog( '*** ProcID=' .. tostring( Proc.Id))
EgtOutLog( '*** Name=' .. EgtGetName( Proc.Id))
EgtOutLog( '*** nFacInd=' .. tostring( nFacInd))
EgtOutLog( '*** nFacAdj=' .. tostring( nFacAdj))
-- Determino se estremi aperti o chiusi e faccia adiacente da aggiungere alla lavorazione
local bOpenStart = false
local bOpenEnd = false
@@ -1156,12 +1152,6 @@ local function MakeByMill( Proc, nFacInd, rfFac, dH, dV, dElev, dCollSic, bSpeci
local nFaceUse = BL.GetNearestParalOpposite( rfFac:getVersZ())
-- inserisco la lavorazione di fresatura
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
-- <LB> --
EgtOutLog( '*** FaceUse=' .. tostring( nFaceUse))
EgtOutLog( '*** Milling on Face=' .. tostring( nFacAdj))
-- <LB> --
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
@@ -4358,7 +4348,8 @@ local function ShowFacesNumber( SurfId)
rFrame:toGlob(EgtGetGlobFrame(SurfId))
local idGrp = EgtGroup( GDB_ID.ROOT, rFrame, GDB_RT.GLOB)
EgtFrame( GDB_ID.ROOT, rFrame, GDB_ID.GLOB)
local idTxt = EgtTextEx( idGrp, {-5, -5, 1}, 0, tostring( fcIdx), 'Arial', 'S', 10)
local idTxt = EgtTextEx( idGrp, {-4, -5, 0}, 0, tostring( fcIdx), 'Arial', 'S', 10)
EgtSetColor( idTxt, {255, 255, 255, 100}, false)
EgtSetName( idTxt, 'Txt_Surf' .. tostring( SurfId) .. '_Face' .. tostring( fcIdx))
EgtRelocateGlob( idTxt, GDB_ID.ROOT)
EgtErase( idGrp)
@@ -4464,7 +4455,6 @@ end
---------------------------------------------------------------------
local function AreFacesOrthogonal( nSurfId, nFacInd, nFacInd2, dCosSideAng)
-- recupero il numero di facce
if not dCosSideAng then
dCosSideAng = -0.09
end
@@ -4488,7 +4478,7 @@ end
local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmHead, b3Raw, nChamfer)
local nFacInd, dFacElev, nFacInd2, dFacElev2 = BL.GetFaceWithMostAdj( Proc.Id, nPartId)
-- entrambe le facce non devono essere orientate verso il basso
-- entrambe le facce non devono essere orientate verso il basso
local _, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT)
-- se orientata verso il basso, verifico l'alternativa
@@ -4524,29 +4514,23 @@ local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmH
if abs( vtN:getX()) > 0.7 or abs( vtN:getY()) > 0.7 or abs( vtN:getZ()) > 0.7 then dCollSic = 0 end
if abs( vtN2:getX()) > 0.7 or abs( vtN2:getY()) > 0.7 or abs( vtN2:getZ()) > 0.7 then dCollSic2 = 0 end
local sPocketing
-- <LB> controllo se le facce sono ortogonali o meno
local nPockFace
-- <LB> controllo se le facce sono ortogonali
local dOrtho = AreFacesOrthogonal(Proc.Id, nFacInd, nFacInd2)
local nPockFace
--if bUseNewMethod == false then
if (dOrtho == 0) then -- ortogonali
sPocketing = ML.FindPocketing( sMchFind, dDiam2, dFacElev2 + dCollSic2)
nPockFace = nFacInd2
elseif (dOrtho > 0) then -- overcut (angolo aperto)
-- <LB> prendo prima la faccia 1
-- <LB> inizio con la prima delle 2 facce
sPocketing = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic)
nPockFace = nFacInd
else
local sErr = 'Error : special LapJoint with undercut face is not managed'
EgtOutLog( sErr)
return false, sErr
end
-- se non trova una svuotatura adatta provo ad assegnarla all'altra faccia
if not sPocketing then
--if bUseNewMethod == false then
if (dOrtho == 0) then
-- <LB> se ortogonali, 'swappa' le 2 facce
-- <LB> se ortogonali, faccio uno 'swap' delle 2 facce
dDiam, dDiam2 = dDiam2, dDiam
dCollSic, dCollSic2 = dCollSic2, dCollSic
nFacInd, nFacInd2 = nFacInd2, nFacInd
@@ -4556,7 +4540,7 @@ local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmH
rfFac, rfFac2 = rfFac2, rfFac
vtN, vtN2 = vtN2, vtN
end
-- <LB> prendo a riferimento l'altra faccia
-- <LB> prendo a riferimento la seconda faccia per la svuotatura
nPockFace = nFacInd2
sPocketing = ML.FindPocketing( sMchFind, dDiam2, dFacElev2 + dCollSic2)
@@ -4567,10 +4551,6 @@ local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmH
end
end
EgtOutLog( '*** nFacInd=' .. tostring(nFacInd))
EgtOutLog( '*** nFacInd2=' .. tostring(nFacInd2))
EgtOutLog( '*** Pocketing Face=' .. tostring(nPockFace))
-- provo con contornatura
local dDiamTool = 20
if bIsL then
@@ -4628,10 +4608,6 @@ local function MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmH
if not bOk then return false, sWarn end
end
--- <LB> ---
--ShowFacesNumber( Proc.Id)
EgtOutLog( '*** -----------------------------------------------------------------')
return true, ''
end
@@ -4820,27 +4796,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- altrimenti lavoro con svuotatura
else
local bSpecial3faces = false
local bUseNewMethod = false
EgtOutLog( '*** -----------------------------------------------------------------')
EgtOutLog( '*** new method=' .. EgtIf( bUseNewMethod, 'YES', 'NO'))
-- verifico se lavorando la faccia principale rimane esclusa molta sezione trasversale complessiva della feature (da box)
local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
local bBoxF = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfFac)
if bUseNewMethod == false then
if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) then
bSpecial3faces = true
if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) then
bSpecial3faces = true
--- <LB> ---
--ShowFacesNumber( Proc.Id)
end
else
-- <LB> diminuisco la differenza per cui considero la lavorazione come "speciale" per lavorare anche con angoli prossimi all'ortogonalità
if dH * dV < 0.97 * ( bBoxF:getDimX() * bBoxF:getDimY()) then
bSpecial3faces = true
end
end
EgtOutLog( '*** bSpecial3faces=' .. EgtIf( bSpecial3faces, 'YES', 'NO'))
-- se riconosciuta gestione 3 facce
-- e limitata per ora alla feature 20
@@ -4848,7 +4813,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa
-- se smusso non è esclusivo
if nChamfer < 2 then
local bOk, sErr = MakeSpecialThreeFaces( Proc, nPhase, bIsL, nRawId, nPartId, dOvmHead, b3Raw, nChamfer)
return bOk, sErr
return bOk, sErr
end
-- altrimenti lavorazione di svuotatura o contornatura
@@ -5482,8 +5447,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead)
EgtOutLog( sErr)
return false, sErr
end
-- in base al tipo di feature attribuisco il significato dei parametri Q
AssignQIdent( Proc)
-- in base al tipo di feature leggo i valori dei parametri Q
AssignQValues( Proc)
-- se non forzate frese, uso la lama
local bUseBlade = Q_USE_ROUGH_TOOL ~= 1 and Q_USE_MILL ~= 1
local nForceUseBladeOnNotContinueFace