DataWall :
- gestione modalità Cloud (rototraslazione del grezzo per centrare il contorno della nuvola di punti ottenuta per scansione in macchina).
This commit is contained in:
+62
-5
@@ -1,4 +1,4 @@
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2020/07/07
|
||||
-- BatchProcess.lua by Egaltech s.r.l. 2020/07/21
|
||||
-- Gestione calcolo batch disposizione e lavorazioni per Pareti
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ elseif WALL.FLAG == 3 then
|
||||
sFlag = 'CHECK'
|
||||
elseif WALL.FLAG == 4 then
|
||||
sFlag = 'CHECK+GENERATE'
|
||||
elseif WALL.FLAG == 5 then
|
||||
sFlag = 'CLOUD'
|
||||
elseif WALL.FLAG == 11 then
|
||||
sFlag = 'TOOLS'
|
||||
elseif WALL.FLAG == 12 then
|
||||
@@ -57,7 +59,7 @@ end
|
||||
|
||||
-- Funzione per gestire visualizzazione dopo errore
|
||||
local function PostErrView( nErr, sMsg)
|
||||
if nErr ~= 0 and ( WALL.FLAG == 1 or WALL.FLAG == 2) then
|
||||
if nErr ~= 0 and ( WALL.FLAG == 1 or WALL.FLAG == 2 or WALL.FLAG == 5) then
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
EgtZoom( SCE_ZM.ALL)
|
||||
EgtOutBox( sMsg, 'BatchProcess (err=' .. tostring( nErr) .. ')', 'ERRORS')
|
||||
@@ -66,7 +68,7 @@ end
|
||||
|
||||
-- Funzione per gestire visualizzazione dopo warning
|
||||
local function PostWarnView( nWarn, sMsg)
|
||||
if nWarn ~= 0 and ( WALL.FLAG == 1 or WALL.FLAG == 2) then
|
||||
if nWarn ~= 0 and ( WALL.FLAG == 1 or WALL.FLAG == 2 or WALL.FLAG == 5) then
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
EgtZoom( SCE_ZM.ALL)
|
||||
EgtOutBox( sMsg, 'BatchProcess (wrn=' .. tostring( nWarn) .. ')', 'WARNINGS')
|
||||
@@ -134,6 +136,7 @@ local sDir, sTitle, sExt = EgtSplitPath( WALL.FILE)
|
||||
local bBtl = ( string.upper( sExt or '') ~= '.NGE')
|
||||
local sNgeFile = sDir..sTitle..'.nge'
|
||||
local sBtmFile = sDir..sTitle..'.btm'
|
||||
local sPntFile = sDir..sTitle..'.pnt'
|
||||
|
||||
-- In generale va completamente riprocessato
|
||||
local bToProcess = true
|
||||
@@ -488,7 +491,6 @@ end
|
||||
-- *** Eseguo stima tempi ***
|
||||
EgtOutLog( ' +++ Estimating T&L >>>')
|
||||
if not EgtEstimate( '', 'EgtCAM5 - ' .. sNgeFile) then
|
||||
|
||||
WALL.ERR = 21
|
||||
local _, sName, _ = EgtSplitPath( WALL.FILE)
|
||||
WALL.MSG = 'Error estimating production time : ' .. sName
|
||||
@@ -500,9 +502,64 @@ local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot')
|
||||
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
|
||||
EgtOutLog( sTime)
|
||||
|
||||
-- Imposto la vista ISO 3d, se richiesto
|
||||
-- Se modalità Cloud, importo la nuvola di punti
|
||||
if WALL.FLAG == 5 then
|
||||
EgtOutLog( ' +++ Importing Point Cloud >>>')
|
||||
-- Creo gruppo Cloud nel gruppo di lavorazione
|
||||
local nMGrpId = EgtGetCurrMachGroup()
|
||||
local nCloudId = EgtGetFirstNameInGroup( nMGrpId or GDB_ID.NULL, 'Cloud')
|
||||
if nCloudId then
|
||||
EgtEmptyGroup( nCloudId)
|
||||
else
|
||||
nCloudId = EgtGroup( nMGrpId)
|
||||
EgtSetName( nCloudId, 'Cloud')
|
||||
end
|
||||
-- Recupero BBox della tavola
|
||||
local b3Tab = EgtGetTableArea()
|
||||
if not b3Tab or b3Tab:isEmpty() then
|
||||
WALL.ERR = 22
|
||||
WALL.MSG = 'Machine table not found'
|
||||
return
|
||||
end
|
||||
-- Recupero i punti della nuvola
|
||||
local hFile = io.open( sPntFile, 'r')
|
||||
if not hFile then
|
||||
WALL.ERR = 23
|
||||
WALL.MSG = 'Missing point cloud file'
|
||||
return
|
||||
end
|
||||
local vPoints = {}
|
||||
local sLine = hFile:read( '*l')
|
||||
while sLine do
|
||||
local vCoord = EgtSplitString( sLine, ' ')
|
||||
if vCoord and #vCoord >= 2 then
|
||||
local dX = tonumber( vCoord[1]) + b3Tab:getMax():getX()
|
||||
local dY = tonumber( vCoord[2]) + b3Tab:getMin():getY()
|
||||
local dZ = b3Tab:getMax():getZ()
|
||||
EgtOutLog( ' X='..EgtNumToString( dX, 3)..' Y='..EgtNumToString( dY, 3), 3)
|
||||
table.insert( vPoints, { dX, dY, dZ})
|
||||
end
|
||||
sLine = hFile:read( '*l')
|
||||
end
|
||||
hFile:close()
|
||||
-- Inserisco la curva di contorno della nuvola
|
||||
local nClCrvId = EgtCurveCompoFromPoints( nCloudId, vPoints, GDB_RT.GLOB)
|
||||
if not nClCrvId then
|
||||
WALL.ERR = 24
|
||||
WALL.MSG = 'Failed to create Point cloud Contour'
|
||||
return
|
||||
end
|
||||
EgtCloseCurveCompo( nClCrvId)
|
||||
EgtApproxCurve( nClCrvId, GDB_CA.LINES, 1.0)
|
||||
EgtSetColor( nClCrvId, 'RED')
|
||||
end
|
||||
|
||||
-- Se modifica o simula, imposto la vista ISO 3d
|
||||
if WALL.FLAG == 1 or WALL.FLAG == 2 then
|
||||
EgtSetView( SCE_VD.ISO_SW, false)
|
||||
-- se cloud, imposto la vista TOP
|
||||
elseif WALL.FLAG == 5 then
|
||||
EgtSetView( SCE_VD.TOP, false)
|
||||
end
|
||||
|
||||
-- Completamento senza errori e avvisi
|
||||
|
||||
Reference in New Issue
Block a user