DataWall :
- modifiche, migliorie e correzioni varie.
This commit is contained in:
+3
-3
@@ -340,14 +340,14 @@ if bToProcess then
|
||||
|
||||
-- Abilito Vmill
|
||||
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
|
||||
|
||||
|
||||
-- Lavoro le features
|
||||
local bPfOk, Stats = WE.ProcessFeatures()
|
||||
local sOutput = ''
|
||||
for i = 1, #Stats do
|
||||
local sMsg = Stats[i].Msg
|
||||
sMsg = string.gsub( sMsg, '\n', ' ', 10)
|
||||
sMsg = string.gsub( sMsg, '\r', ' ', 10)
|
||||
sMsg = string.gsub( sMsg or '', '\n', ' ', 10)
|
||||
sMsg = string.gsub( sMsg or '', '\r', ' ', 10)
|
||||
if Stats[i].Err == 0 then
|
||||
WALL.ERR = 0
|
||||
WALL.MSG = '---'
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
-- ProcessCut.lua by Egaltech s.r.l. 2020/07/15
|
||||
-- Gestione calcolo taglio di testa o longitudinale per Pareti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
local WPC = {}
|
||||
|
||||
-- Include
|
||||
require( 'EgtBase')
|
||||
local WL = require( 'WallLib')
|
||||
local FreeContour = require( 'WProcessFreeContour')
|
||||
|
||||
EgtOutLog( ' WProcessCut started', 1)
|
||||
|
||||
-- Dati
|
||||
local WD = require( 'WallData')
|
||||
local WM = require( 'WMachiningLib')
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Riconoscimento della feature
|
||||
function WPC.Identify( Proc)
|
||||
return ( (( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 10) or
|
||||
(( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 10))
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Classificazione della feature
|
||||
function WPC.Classify( Proc, b3Raw)
|
||||
-- verifico abbia una sola faccia
|
||||
if Proc.Fct ~= 1 then return false end
|
||||
-- controllo la normale
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
|
||||
if abs( vtN:getZ()) < 0.5 then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Applicazione della lavorazione
|
||||
function WPC.Make( Proc, nRawId, b3Raw)
|
||||
return FreeContour.Make( Proc, nRawId, b3Raw)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
return WPC
|
||||
@@ -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')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- WProcessLapJoint.lua by Egaltech s.r.l. 2020/07/10
|
||||
-- WProcessLapJoint.lua by Egaltech s.r.l. 2020/07/16
|
||||
-- Gestione calcolo mezzo-legno per Pareti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -49,18 +49,137 @@ function WPL.Classify( Proc, b3Raw)
|
||||
if nFacInd < 0 then return false end
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- verifico se è lavorabile da sopra
|
||||
return vtN:getZ() >= WD.NZ_MINA
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- verifico se è lavorabile da sopra o di fianco se con sega a catena
|
||||
return ( vtN:getZ() >= WD.NZ_MINA or ( dV < 19 and Proc.Fct > 4 and vtN:getZ() > - 0.01))
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByChainSaw( Proc, nFacet, nRawId, b3Raw, dElev, dH, dV)
|
||||
local sWarn
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||
-- Recupero le facce adiacenti alla principale
|
||||
local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacet)[1]
|
||||
if not vAdj or #vAdj == 0 then
|
||||
local sErr = 'Error : main face without adjacencies'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
EgtOutLog( 'Adjac=' .. table.concat( vAdj, ','), 3)
|
||||
-- Cerco una faccia adiacente alla principale sul lato più lungo
|
||||
local nFacAdj
|
||||
local dMaxLen = 0
|
||||
for i = 1, #vAdj do
|
||||
if vAdj[i] >= 0 then
|
||||
local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacet, vAdj[i], GDB_ID.ROOT)
|
||||
local dLen = dist( ptP1, ptP2)
|
||||
local vtAdjN = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], GDB_ID.ROOT)
|
||||
if dLen > dMaxLen - 1 and vtAdjN:getZ() > -0.1 then
|
||||
nFacAdj = vAdj[i]
|
||||
dMaxLen = dLen
|
||||
EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, dH, dV), 3)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not nFacAdj then
|
||||
local sErr = 'Error : long adjacent face not found'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Recupero la lavorazione
|
||||
local sSawing = WM.FindSawing( 'Sawing')
|
||||
if not sSawing then
|
||||
local sErr = 'Error : chainsawing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr, 'MNF'
|
||||
end
|
||||
-- Recupero i dati dell'utensile
|
||||
local dSawWidth = 75
|
||||
local dSawThick = 8
|
||||
local dMaxDepth = 200
|
||||
if EgtMdbSetCurrMachining( sSawing) then
|
||||
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
|
||||
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
|
||||
dSawWidth = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawWidth
|
||||
dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick
|
||||
dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth
|
||||
end
|
||||
end
|
||||
if dSawThick > dV + 10 * GEO.EPS_SMALL then
|
||||
local sErr = 'Error : chainsaw too thick'
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- Calcolo uso faccia
|
||||
local nFaceUse = WL.GetNearestParalOpposite( vtN)
|
||||
-- Calcolo angolo 3° asse rot (da direz. utensile)
|
||||
local d3RotAng = 180
|
||||
-- Lati chiusi
|
||||
local bOpenStart = false
|
||||
local bOpenEnd = false
|
||||
-- Verifico se necessarie più passate
|
||||
local nStep = ceil( ( dV - 10 * GEO.EPS_SMALL) / dSawThick)
|
||||
local dStep = 0
|
||||
if nStep > 1 then
|
||||
dStep = ( dV - dSawThick) / ( nStep - 1)
|
||||
end
|
||||
for i = 1, nStep do
|
||||
-- Applico la lavorazione con sega a catena a questa faccia
|
||||
local sName = 'Csaw_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( i)
|
||||
local nMchFId = EgtAddMachining( sName, sSawing)
|
||||
if not nMchFId then
|
||||
local sErr = 'Error adding machining ' .. sName .. '-' .. sSawing
|
||||
EgtOutLog( sErr)
|
||||
return false, sErr
|
||||
end
|
||||
-- aggiungo geometria
|
||||
EgtSetMachiningGeometry( {{ Proc.Id, nFacAdj}})
|
||||
-- imposto uso faccia
|
||||
EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse)
|
||||
-- imposto accorciamento iniziale/finale per estremi aperti/chiusi
|
||||
EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( bOpenStart, 0, - dSawWidth / 2))
|
||||
EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( bOpenEnd, 0, - dSawWidth / 2))
|
||||
-- imposto angolo 3° asse rot
|
||||
EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, 'A1=' .. EgtNumToString( d3RotAng))
|
||||
-- imposto offset radiale
|
||||
local dOffs = ( i - 1) * dStep
|
||||
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
|
||||
-- se necessario, limito l'affondamento
|
||||
if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then
|
||||
sWarn = 'Warning in LapJoint : elevation (' .. EgtNumToString( dElev, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
|
||||
dDepth = dMaxDepth - dElev
|
||||
EgtOutLog( sWarn)
|
||||
EgtSetMachiningParam( MCH_MP.DEPTH_STR, 'TH '..EgtNumToString( dDepth, 1))
|
||||
end
|
||||
-- imposto elevazione
|
||||
local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 2) .. ';'
|
||||
EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes)
|
||||
-- eseguo
|
||||
if not EgtApplyMachining( true, false) then
|
||||
local _, sErr = EgtGetLastMachMgrError()
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sErr
|
||||
elseif EgtIsMachiningEmpty() then
|
||||
_, sWarn = EgtGetMachMgrWarning( 0)
|
||||
EgtSetOperationMode( nMchFId, false)
|
||||
return false, sWarn
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
|
||||
-- dati della faccia
|
||||
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, nPartId)
|
||||
local dElev = WL.GetFaceElevation( Proc.Id, nFacet, Proc.PartId)
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT)
|
||||
local dDiam = min( dH, dV)
|
||||
if Proc.Fct < 5 then dDiam = dDiam * 2 end
|
||||
-- recupero la lavorazione
|
||||
local sPocketing = WM.FindPocketing( 'Pocket', nil, dElev)
|
||||
local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev)
|
||||
if not sPocketing then
|
||||
local sErr = 'Error : pocketing not found in library'
|
||||
EgtOutLog( sErr)
|
||||
@@ -229,8 +348,13 @@ end
|
||||
---------------------------------------------------------------------
|
||||
local function MakeMoreFaces( Proc, nRawId, b3Raw)
|
||||
-- cerco la faccia con il maggior numero di adiacenze
|
||||
local nFacInd, _, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
local nFacInd, dElev, nFacInd2 = WL.GetFaceWithMostAdj( Proc.Id, Proc.PartId)
|
||||
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT)
|
||||
-- se necessaria sega a catena
|
||||
if dV < 19 and Proc.Fct > 4 and vtN:getZ() > - 0.01 then
|
||||
return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV)
|
||||
end
|
||||
local nFacet = EgtIf( vtN:getZ() >= WD.NZ_MINA, nFacInd, nFacInd2)
|
||||
-- eseguo la svuotatura
|
||||
return MakeByPocketing( Proc, nFacet, nRawId, b3Raw)
|
||||
|
||||
+44
-3
@@ -1,4 +1,4 @@
|
||||
-- WallExec.lua by Egaltech s.r.l. 2020/06/24
|
||||
-- WallExec.lua by Egaltech s.r.l. 2020/07/15
|
||||
-- Libreria esecuzione lavorazioni per Pareti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -16,6 +16,8 @@ _G.package.loaded.WMachiningLib = nil
|
||||
local WM = require( 'WMachiningLib')
|
||||
_G.package.loaded.WallLib = nil
|
||||
local WL = require( 'WallLib')
|
||||
_G.package.loaded.WProcessCut = nil
|
||||
local Cut = require( 'WProcessCut')
|
||||
_G.package.loaded.WProcessLapJoint = nil
|
||||
local LapJoint = require( 'WProcessLapJoint')
|
||||
_G.package.loaded.WProcessDrill = nil
|
||||
@@ -124,8 +126,12 @@ end
|
||||
local function ClassifyFeatures( vProc, b3Raw)
|
||||
for i = 1, #vProc do
|
||||
local Proc = vProc[i]
|
||||
-- se taglio
|
||||
if Cut.Identify( Proc) then
|
||||
local bOk = Cut.Classify( Proc, b3Raw)
|
||||
if not bOk then Proc.Flg = 0 end
|
||||
-- se tasca
|
||||
if LapJoint.Identify( Proc) then
|
||||
elseif LapJoint.Identify( Proc) then
|
||||
local bOk = LapJoint.Classify( Proc, b3Raw)
|
||||
if not bOk then Proc.Flg = 0 end
|
||||
-- se foratura
|
||||
@@ -156,8 +162,12 @@ end
|
||||
local function AddFeatureMachining( Proc, nRawId, b3Raw)
|
||||
local bOk = true
|
||||
local sErr = ''
|
||||
-- se taglio (1/2-010-X) o taglio longitudinale (0/3/4-010-X)
|
||||
if Cut.Identify( Proc) then
|
||||
-- esecuzione taglio
|
||||
bOk, sErr = Cut.Make( Proc, nRawId, b3Raw)
|
||||
-- se tasca (3/4-030-X)
|
||||
if LapJoint.Identify( Proc) then
|
||||
elseif LapJoint.Identify( Proc) then
|
||||
-- esecuzione tasca
|
||||
bOk, sErr = LapJoint.Make( Proc, nRawId, b3Raw)
|
||||
-- se foratura ( 3/4-040-X)
|
||||
@@ -176,6 +186,35 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw)
|
||||
return bOk, sErr
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function MoveMachiningsAtEnd( nPhase, nType, sStartName)
|
||||
local nOperId = EgtGetPhaseDisposition( nPhase)
|
||||
local nLastId = EgtGetLastOperation()
|
||||
local nInsertId = nLastId
|
||||
while nOperId do
|
||||
local nNextOperId = EgtGetNextOperation( nOperId)
|
||||
if EgtGetOperationPhase( nOperId) == nPhase and EgtGetOperationType( nOperId) == nType and
|
||||
( not sStartName or string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName) then
|
||||
EgtRelocateGlob( nOperId, nInsertId, GDB_IN.AFTER)
|
||||
nInsertId = nOperId
|
||||
end
|
||||
if nOperId == nLastId then
|
||||
break
|
||||
end
|
||||
nOperId = nNextOperId
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
local function SortMachinings()
|
||||
local nPhase = 1
|
||||
-- Sposto i tagli di lama alla fine
|
||||
MoveMachiningsAtEnd( nPhase, MCH_OY.SAWING)
|
||||
-- Sposto i tagli con sega a catena dopo i tagli di lama
|
||||
MoveMachiningsAtEnd( nPhase, MCH_OY.MORTISING, 'Csaw_')
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
function WallExec.ProcessFeatures()
|
||||
-- errori e stato
|
||||
@@ -220,6 +259,8 @@ function WallExec.ProcessFeatures()
|
||||
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
|
||||
end
|
||||
end
|
||||
-- riordino le lavorazioni
|
||||
SortMachinings()
|
||||
-- restituzione risultati
|
||||
return ( nTotErr == 0), Stats
|
||||
end
|
||||
|
||||
+32
-1
@@ -1,4 +1,4 @@
|
||||
-- WallLib.lua by Egaltech s.r.l. 2020/06/24
|
||||
-- WallLib.lua by Egaltech s.r.l. 2020/07/15
|
||||
-- Libreria globale per Pareti
|
||||
|
||||
-- Tabella per definizione modulo
|
||||
@@ -222,5 +222,36 @@ function WallLib.GetFaceHvRefDim( nSurfId, nFacet)
|
||||
return frHV, b3HV:getDimX(), b3HV:getDimY()
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function WallLib.GetNearestParalOpposite( vtRef)
|
||||
-- devo confrontare la componente orizzontale con quella verticale
|
||||
local dHorSq = vtRef:getX() * vtRef:getX() + vtRef:getY() * vtRef:getY()
|
||||
local dVertSq =vtRef:getZ() * vtRef:getZ()
|
||||
-- se prevalente la componente orizzontale
|
||||
if dHorSq >= dVertSq then
|
||||
if abs( vtRef:getX()) > abs( vtRef:getY()) then
|
||||
if vtRef:getX() > 0 then
|
||||
return MCH_MILL_FU.PARAL_LEFT
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_RIGHT
|
||||
end
|
||||
else
|
||||
if vtRef:getY() > 0 then
|
||||
return MCH_MILL_FU.PARAL_FRONT
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_BACK
|
||||
end
|
||||
end
|
||||
-- altrimenti prevale la verticale
|
||||
else
|
||||
if vtRef:getZ() > 0 then
|
||||
return MCH_MILL_FU.PARAL_DOWN
|
||||
else
|
||||
return MCH_MILL_FU.PARAL_TOP
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
return WallLib
|
||||
|
||||
Reference in New Issue
Block a user