DataWall :

- correzioni per fresatura fessure di lato.
This commit is contained in:
Dario Sassi
2020-11-18 14:49:37 +00:00
parent 7383e914cc
commit 86a4374767
+52 -10
View File
@@ -42,8 +42,8 @@ function WPL.Classify( Proc, b3Raw)
local vtN = {}
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
-- verifico se è lavorabile da sopra
return vtN[1]:getZ() >= WD.NZ_MINA or vtN[2]:getZ() >= WD.NZ_MINA
-- verifico se è lavorabile da sopra o di fianco
return ( vtN[1]:getZ() >= - 0.01 or vtN[2]:getZ() >= - 0.01)
-- se più di 2 facce
else
local nFacInd, dElev, nFacInd2, dElev2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
@@ -231,17 +231,31 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw)
if not sMilling then return false end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMillLen = 10
local dMillTotLen = 30
local dMaxDepth = 0
local dThDiam = 100
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen
dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
dThDiam = EgtTdbGetCurrToolThDiam() or dThDiam
end
end
if dMillDiam < dDiam or dMaxDepth < dElev then return false end
if dMillDiam < dDiam or dMaxDepth < dElev then
local sErr = 'Error : Side Elevation too big'
EgtOutLog( sErr)
return false, sErr
end
local dMillExtra = dMillTotLen - dMillLen
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
local sErr = 'Error : Tool collide with table'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di contornatura
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
@@ -272,7 +286,7 @@ end
---------------------------------------------------------------------
local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw)
-- dati della faccia e dell'altra
-- dati della faccia
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nRawId)
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
@@ -286,11 +300,15 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw)
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMillLen = 10
local dMillTotLen = 30
local dMaxMat = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen
dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
end
end
@@ -299,6 +317,12 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw)
EgtOutLog( sErr)
return false, sErr
end
local dMillExtra = dMillTotLen - dMillLen
if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then
local sErr = 'Error : Tool collide with table'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di contornatura
local sName = 'Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
@@ -318,8 +342,13 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw)
-- imposto modo di lavorare la faccia
local nFaceUse = WL.GetNearestParalOpposite( Z_AX(), vtN)
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
-- imposto elevazione
local dMaxElev = 2 * ( dThick - dMaxMat)
-- imposto elevazione e step
local dStep = EgtGetMachiningParam( MCH_MP.STEP)
if dStep < GEO.EPS_SMALL then dStep = dMaxMat end
local nStep = ceil( ( dThick - dMaxMat) / dStep)
dStep = ( dThick - dMaxMat) / nStep
local dMaxElev = ( nStep + 1) * dStep
EgtSetMachiningParam( MCH_MP.STEP, dStep)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
@@ -464,8 +493,18 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
end
-- recupero la lavorazione di taglio con lama e i suoi parametri
local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard')
-- se non inclinate o capacità di taglio non sufficiente, provo con contornatura o svuotatura
if not sCutting or vtN[1]:getZ() > 0.95 or vtN[2]:getZ() > 0.95 or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC then
-- se di fianco in basso
if vtN[1]:getZ() < -0.95 or vtN[2]:getZ() < -0.95 then
-- cerco la faccia orizzontale
local nFacet = EgtIf( abs( vtN[1]:getZ()) < 0.1, 0, 1)
-- se vicino al bordo del grezzo e non troppo larga, provo con fresatura di fianco
local ptMid = ( ptP1 + ptP2) / 2
if abs( ptMid:getX() - b3Raw:getMin():getX()) < 300 or abs( ptMid:getX() - b3Raw:getMax():getX()) < 300 or
abs( ptMid:getY() - b3Raw:getMin():getY()) < 300 or abs( ptMid:getY() - b3Raw:getMax():getY()) < 300 then
return MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw)
end
-- se altrimenti di fianco in alto
elseif vtN[1]:getZ() > 0.95 or vtN[2]:getZ() > 0.95 then
-- cerco la faccia con il maggior numero di adiacenze (e minor elevazione)
local nFacInd, _, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
@@ -478,8 +517,11 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw)
return true
end
end
-- eseguo la svuotatura
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
-- se non inclinate o capacità di taglio non sufficiente, provo con contornatura o svuotatura
if not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC then
-- eseguo la svuotatura
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
end
end
-- ordino i tagli per fare prima quello meno inclinato
local nOrd = { 0, 1}