DataWall :

- modifiche, migliorie e correzioni varie.
This commit is contained in:
Dario Sassi
2020-07-20 07:40:07 +00:00
parent 17dd2b85b8
commit c646e7cbf9
6 changed files with 318 additions and 34 deletions
+65 -21
View File
@@ -1,4 +1,4 @@
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/07/13
-- ProcessFreeContour.lua by Egaltech s.r.l. 2020/07/15
-- Gestione calcolo profilo libero per Pareti
-- Tabella per definizione modulo
@@ -15,7 +15,7 @@ local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
local WHISK_OFFS = 0.1
local WHISK_SAFE = 5
local MIN_LEN_CUT = 5
local MIN_LEN_CUT = 30
---------------------------------------------------------------------
-- Riconoscimento della feature
@@ -23,7 +23,6 @@ function WPF.Identify( Proc)
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and ( Proc.Prc == 250 or Proc.Prc == 251 or Proc.Prc == 252))
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPF.Classify( Proc, b3Raw)
@@ -74,18 +73,24 @@ end
---------------------------------------------------------------------
local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw)
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
end
end
-- ciclo di inserimento delle fresate sulle facce del contorno in esame, partendo da prima faccia non di tipo 4
-- ciclo di inserimento delle fresate sulle facce del contorno in esame
local i = 1
while i <= #vFace and vFace[i].Type == 4 do
i = i + 1
-- se faccia finale con fine non lavorato, forzo partenza da prima faccia non tutta saltata (tipo 4)
if vFace[#vFace].Type == 4 or ( vFace[#vFace].Type & 2) ~= 0 then
while i <= #vFace and vFace[i].Type == 4 do
i = i + 1
end
end
-- se facce tutte da saltare, parto dall'inizio
local bAllType4 = ( i > #vFace)
if bAllType4 then i = 1 end
while i <= #vFace do
@@ -104,9 +109,14 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw)
return false, sErr
end
-- calcolo l'affondamento
local dDepth = min( vFace[i].Width + WD.CUT_EXTRA, dMaxDepth)
local dDepth = vFace[i].Width + WD.CUT_EXTRA
local vtNz = vFace[i].Norm:getZ()
if vtNz < 0 then
dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz)
end
dDepth = min( dDepth, dMaxDepth)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, i - 1}})
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i].Fac}})
local dSal = 0
local dEal = vFace[i].Whisk - vFace[i].Len
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
@@ -143,15 +153,20 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw)
return false, sErr
end
-- calcolo l'affondamento
local dDepth = min( vFace[i].Width + WD.CUT_EXTRA, dMaxDepth)
local dDepth = vFace[i].Width + WD.CUT_EXTRA
local vtNz = vFace[i].Norm:getZ()
if vtNz < 0 then
dDepth = dDepth - dMillDiam * abs( vtNz) / sqrt( 1 - vtNz * vtNz)
end
dDepth = min( dDepth, dMaxDepth)
-- aggiungo geometria
local vGeom = {{ Proc.Id, i - 1}}
local vGeom = {{ Proc.Id, vFace[i].Fac}}
local dSal = EgtIf( ( vFace[i].Type & 2) ~= 0, vFace[i].Whisk - vFace[i].Len, 0)
local dEal = 0
i = i + 1
local j = EgtIf( i <= #vFace, i, EgtIf( bAllType4, nil, 1))
while j and ( ( vFace[j].Type & 1) ~= 0 or vFace[j].Type == 4) do
table.insert( vGeom, { Proc.Id, j - 1})
table.insert( vGeom, { Proc.Id, vFace[j].Fac})
dEal = EgtIf( ( vFace[j].Type & 1) ~= 0, vFace[j].Whisk - vFace[j].Len, 0)
if ( vFace[j].Type & 1) ~= 0 then
break
@@ -212,7 +227,7 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
-- calcolo l'affondamento
local dDepth = min( vFace[i].Width + WD.CUT_EXTRA, dMaxDepth)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, i - 1}})
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i].Fac}})
local dSal = - dSawDiam / 2
local dEal = vFace[i].Whisk - vFace[i].Len - dSawDiam / 2
EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal)
@@ -247,7 +262,7 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
-- calcolo l'affondamento
local dDepth = min( vFace[i].Width + WD.CUT_EXTRA, dMaxDepth)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, i - 1}})
EgtSetMachiningGeometry( {{ Proc.Id, vFace[i].Fac}})
local dSal = - dSawDiam / 2
local dEal = - dSawDiam / 2
if ( vFace[i].Type & 2) ~= 0 then
@@ -277,7 +292,7 @@ local function AddSawings( sSawing, vFace, Proc, nRawId, b3Raw)
end
---------------------------------------------------------------------
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw)
local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
-- ciclo di inserimento dei tagli sulle facce del contorno in esame
for i = 1, #vFace do
-- se non è faccia da saltare, inserisco il taglio di lama
@@ -293,9 +308,14 @@ local function AddCuts( sCutting, vFace, Proc, nRawId, b3Raw)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( { { Proc.Id, i - 1}})
EgtSetMachiningGeometry( { { Proc.Id, vFace[i].Fac}})
-- assegno affondamento
EgtSetMachiningParam( MCH_MP.DEPTH, vFace[i].Depth)
local dDepth = vFace[i].Depth
local vtNz = vFace[i].Norm:getZ()
if vtNz < 0 then
dDepth = dDepth - dSawThick * abs( vtNz)
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- verifico se va invertita la direzione di lavorazione perchè faccia verso l'alto (angolo maggiore di 0.01 deg)
local bInvert = ( vFace[i].Norm:getZ() > 0.0001745)
-- imposto inversione
@@ -345,6 +365,14 @@ local function MakeByCut( Proc, nRawId, b3Raw)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la curva associata
local bOpposite = false
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then
AuxId = AuxId + Proc.Id
local vtExtr= EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
bOpposite = ( vtExtr and vtExtr:getZ() < 0)
end
-- recupero la lavorazione di taglio con lama e i suoi parametri
local sCutting, dSawDiam, dSawThick, dSawMaxDepth = WM.FindCutting( 'Standard')
if not sCutting then
@@ -355,14 +383,22 @@ local function MakeByCut( Proc, nRawId, b3Raw)
-- recupero i dati di tutte le facce
local vFace = {}
for i = 1, Proc.Fct do
-- indice faccia corrente e precedente
local nFac = EgtIf( bOpposite, Proc.Fct - i, i - 1)
local nPrecFac
if bOpposite then
nPrecFac = EgtIf( i == 1, 0, nFac + 1)
else
nPrecFac = EgtIf( i == 1, Proc.Fct - 1, i - 2)
end
-- recupero centro e normale della faccia
local ptCen, vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT)
local ptCen, vtN = EgtSurfTmFacetCenter( Proc.Id, nFac, GDB_ID.ROOT)
-- recupero le dimensioni della faccia
local _, dLen, dWidth = WL.GetFaceHvRefDim( Proc.Id, i - 1)
local _, dLen, dWidth = WL.GetFaceHvRefDim( Proc.Id, nFac)
-- recupero l'angolo con la faccia precedente
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, EgtIf( i == 1, Proc.Fct - 1, i - 2), i -1, GDB_ID.ROOT)
local bAdj, _, _, dAng = EgtSurfTmFacetsContact( Proc.Id, nPrecFac, nFac, GDB_ID.ROOT)
-- salvo i dati
vFace[i] = { Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, AngPrev = EgtIf( bAdj, dAng, 0)}
end
-- analizzo le facce
local dMaxWidth = 0
@@ -460,8 +496,16 @@ local function MakeByCut( Proc, nRawId, b3Raw)
EgtErase( WhId)
end
end
-- eventuali stampe
for i = 1, #vFace do
local Face = vFace[i]
local sOut = 'Face '..tostring( Face.Fac)..' C'..tostring( Face.Cen)..' N'..tostring( Face.Norm)..
' L='..EgtNumToString( Face.Len, 1)..' W='..EgtNumToString( Face.Width, 1)..' Ap='..EgtNumToString( Face.AngPrev, 1)..
' D='..EgtNumToString( Face.Depth, 1)..' B='..EgtNumToString( Face.Whisk, 1)..' T='..tostring( Face.Type)
EgtOutLog( sOut)
end
-- inserimento dei tagli di lama
local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw)
local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick)
if not bCtOk then return bCtOk, sCtErr end
-- recupero la lavorazione con sega a catena
local sSawing = WM.FindSawing( 'Sawing')